mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
OSX compatibility tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35325 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e357aab701
commit
87db54ef18
3 changed files with 50 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2012-07-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSXMLNode.m: Just report string value as description ...
|
||||||
|
which appears to be what OSX does.
|
||||||
|
* Tests/base/KVC/mutable.m: Add tests based on code by Riccardo.
|
||||||
|
|
||||||
2012-07-27 Richard Frith-Macdonald <rfm@gnu.org>
|
2012-07-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSKeyValueObserving.m:
|
* Source/NSKeyValueObserving.m:
|
||||||
|
|
|
@ -1177,9 +1177,12 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
||||||
|
|
||||||
- (NSString*) description
|
- (NSString*) description
|
||||||
{
|
{
|
||||||
|
/* OSX simply uses the XML string value of a node as its description.
|
||||||
return [NSString stringWithFormat:@"<%@ %@ %d>%@",
|
return [NSString stringWithFormat:@"<%@ %@ %d>%@",
|
||||||
NSStringFromClass([self class]),
|
NSStringFromClass([self class]),
|
||||||
[self name], [self kind], [self XMLString]];
|
[self name], [self kind], [self XMLString]];
|
||||||
|
*/
|
||||||
|
return [self XMLString];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
|
41
Tests/base/NSXMLNode/description.m
Normal file
41
Tests/base/NSXMLNode/description.m
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#import "Testing.h"
|
||||||
|
/*
|
||||||
|
* Author: Riccardo Mottola
|
||||||
|
* Created: 2012-07-27 14:37:14 +0000 by multix
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
NSString *filePath;
|
||||||
|
NSString *xmlDocStr;
|
||||||
|
NSXMLDocument *xmlDoc;
|
||||||
|
NSXMLElement *rootElement;
|
||||||
|
NSError *error;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
|
||||||
|
START_SET("NSXMLNode - descriptions")
|
||||||
|
|
||||||
|
xmlDocStr = @"<?xml version=\"1.0\" encoding=\"utf-8\"?><env:Envelope xmlns:env=\"http://myurl/mypath/envelope\"><InvokeStampatore xmlns=\"http://tempuri.org/\"> <Flusso><IdFlusso>DF247309-57F8-4CDB-8711-6E9DB69BCE74</IdFlusso><Sorgente>FOX/EDI</Sorgente><DataRichiesta>2012-06-26T17:00:00.717</DataRichiesta><OraRichiesta>17:00</OraRichiesta> <NumeroDocumenti>10</NumeroDocumenti><Lettera><IdCrm>FakeField</IdCrm><TipoDocumento>1001</TipoDocumento><DataDocumento>2012-06-26T14:45:08.673Z</DataDocumento><Utente>FakeUser</Utente><Priorita>Normale</Priorita><PraticaName>FakeName</PraticaName><ContentHeader> <fieldList> <Field><name>Campaign.Name</name> <value>Campagna ENP</value></Field><Field><name>Cliente.Cap</name><value>37053</value></Field></fieldList></ContentHeader></Lettera></Flusso></InvokeStampatore></env:Envelope>";
|
||||||
|
xmlDoc = [[NSXMLDocument alloc] initWithXMLString:xmlDocStr options:0 error:error];
|
||||||
|
|
||||||
|
//NSLog(@"%@", xmlDoc);
|
||||||
|
rootElement = [xmlDoc rootElement];
|
||||||
|
PASS(0 == [[rootElement attributes] count], "root has no attributes");
|
||||||
|
PASS_EQUAL(
|
||||||
|
[[[rootElement namespaces] objectAtIndex: 0] description],
|
||||||
|
@"xmlns:env=\"http://myurl/mypath/envelope\"",
|
||||||
|
"namespace description");
|
||||||
|
PASS_EQUAL(
|
||||||
|
[[[rootElement children] objectAtIndex: 0] description],
|
||||||
|
@"<InvokeStampatore xmlns=\"http://tempuri.org/\"><Flusso><IdFlusso>DF247309-57F8-4CDB-8711-6E9DB69BCE74</IdFlusso><Sorgente>FOX/EDI</Sorgente><DataRichiesta>2012-06-26T17:00:00.717</DataRichiesta><OraRichiesta>17:00</OraRichiesta><NumeroDocumenti>10</NumeroDocumenti><Lettera><IdCrm>FakeField</IdCrm><TipoDocumento>1001</TipoDocumento><DataDocumento>2012-06-26T14:45:08.673Z</DataDocumento><Utente>FakeUser</Utente><Priorita>Normale</Priorita><PraticaName>FakeName</PraticaName><ContentHeader><fieldList><Field><name>Campaign.Name</name><value>Campagna ENP</value></Field><Field><name>Cliente.Cap</name><value>37053</value></Field></fieldList></ContentHeader></Lettera></Flusso></InvokeStampatore>",
|
||||||
|
"child description");
|
||||||
|
|
||||||
|
END_SET("NSXMLNode - descriptions")
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue