mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
* Source/NSXMLDocument.m:
* Source/NSXMLDTD.m: * Source/NSXMLNode.m: * Source/NSXMLDTDNode.m: * Source/NSXMLElement.m: Remove compiler warnings for clang reported by David Chisnall. * Tests/base/NSAutoreleasePool/basic.m: Get to compile again without -C99. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35043 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ea0346b5c6
commit
4b86775102
7 changed files with 320 additions and 299 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2012-04-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSXMLDocument.m:
|
||||
* Source/NSXMLDTD.m:
|
||||
* Source/NSXMLNode.m:
|
||||
* Source/NSXMLDTDNode.m:
|
||||
* Source/NSXMLElement.m: Remove compiler warnings for clang
|
||||
reported by David Chisnall.
|
||||
* Tests/base/NSAutoreleasePool/basic.m: Get to compile again
|
||||
without -C99.
|
||||
|
||||
2012-04-06 12:37 theraven
|
||||
|
||||
* libs/base/trunk/Source/NSConnection.m,
|
||||
|
@ -15,7 +26,7 @@
|
|||
libs/base/trunk/Tests/base/NSArray/basic.m,
|
||||
libs/base/trunk/Tests/base/NSDictionary/basic.m: Support for
|
||||
collection subscripting (NSArray and NSDictionary).
|
||||
|
||||
|
||||
Yes, the syntax is ugly, but no doubt people will start using it
|
||||
in June...
|
||||
|
||||
|
|
|
@ -57,18 +57,18 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
- (NSXMLDTDNode*) attributeDeclarationForName: (NSString*)name
|
||||
elementName: (NSString*)elementName
|
||||
{
|
||||
xmlDtdPtr node = internal->node;
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
const xmlChar *xmlElementName = XMLSTRING(elementName);
|
||||
|
||||
if ((node == NULL) ||
|
||||
(node->children == NULL))
|
||||
if ((theNode == NULL) ||
|
||||
(theNode->children == NULL))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
for (children = node->children; children; children = children->next)
|
||||
for (children = theNode->children; children; children = children->next)
|
||||
{
|
||||
if (children->type == XML_ATTRIBUTE_DECL)
|
||||
{
|
||||
|
@ -87,17 +87,17 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (NSXMLDTDNode*) elementDeclarationForName: (NSString*)name
|
||||
{
|
||||
xmlDtdPtr node = internal->node;
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
if ((node == NULL) ||
|
||||
(node->children == NULL))
|
||||
if ((theNode == NULL) ||
|
||||
(theNode->children == NULL))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
for (children = node->children; children; children = children->next)
|
||||
for (children = theNode->children; children; children = children->next)
|
||||
{
|
||||
if (children->type == XML_ELEMENT_DECL)
|
||||
{
|
||||
|
@ -116,17 +116,17 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
- (NSXMLDTDNode*) entityDeclarationForName: (NSString*)name
|
||||
{
|
||||
//xmlGetEntityFromDtd
|
||||
xmlDtdPtr node = internal->node;
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
if ((node == NULL) ||
|
||||
(node->children == NULL))
|
||||
if ((theNode == NULL) ||
|
||||
(theNode->children == NULL))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
for (children = node->children; children; children = children->next)
|
||||
for (children = theNode->children; children; children = children->next)
|
||||
{
|
||||
if (children->type == XML_ENTITY_DECL)
|
||||
{
|
||||
|
@ -192,36 +192,38 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)theOptions
|
||||
- (id) initWithKind: (NSXMLNodeKind)theKind options: (NSUInteger)theOptions
|
||||
{
|
||||
if (NSXMLDTDKind == kind)
|
||||
if (NSXMLDTDKind == theKind)
|
||||
{
|
||||
return [super initWithKind: kind options: theOptions];
|
||||
return [super initWithKind: theKind options: theOptions];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self release];
|
||||
return [[NSXMLNode alloc] initWithKind: kind
|
||||
options: theOptions];
|
||||
// This cast is here to keep clang quite that expects an init* method to
|
||||
// return an object of the same class, which is not true here.
|
||||
return (NSXMLDTD*)[[NSXMLNode alloc] initWithKind: theKind
|
||||
options: theOptions];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
|
||||
{
|
||||
NSXMLNodeKind kind = [child kind];
|
||||
NSXMLNodeKind theKind = [child kind];
|
||||
NSUInteger childCount = [self childCount];
|
||||
|
||||
// Check to make sure this is a valid addition...
|
||||
NSAssert(nil != child, NSInvalidArgumentException);
|
||||
NSAssert(index <= childCount, NSInvalidArgumentException);
|
||||
NSAssert(nil == [child parent], NSInvalidArgumentException);
|
||||
NSAssert(NSXMLAttributeKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDTDKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDocumentKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLElementKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLInvalidKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNamespaceKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLTextKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLAttributeKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDTDKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDocumentKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLElementKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLInvalidKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNamespaceKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLTextKind != theKind, NSInvalidArgumentException);
|
||||
|
||||
[self _insertChild: child atIndex: index];
|
||||
}
|
||||
|
@ -239,17 +241,17 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (NSXMLDTDNode*) notationDeclarationForName: (NSString*)name
|
||||
{
|
||||
xmlDtdPtr node = internal->node;
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
if ((node == NULL) ||
|
||||
(node->children == NULL))
|
||||
if ((theNode == NULL) ||
|
||||
(theNode->children == NULL))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
for (children = node->children; children; children = children->next)
|
||||
for (children = theNode->children; children; children = children->next)
|
||||
{
|
||||
if (children->type == XML_NOTATION_NODE)
|
||||
{
|
||||
|
@ -265,9 +267,9 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (NSString*) publicID
|
||||
{
|
||||
xmlDtd *node = internal->node;
|
||||
xmlDtd *theNode = internal->node;
|
||||
|
||||
return StringFromXMLStringPtr(node->ExternalID);
|
||||
return StringFromXMLStringPtr(theNode->ExternalID);
|
||||
}
|
||||
|
||||
- (void) removeChildAtIndex: (NSUInteger)index
|
||||
|
@ -284,9 +286,9 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
[child detach];
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)theNode
|
||||
{
|
||||
[self insertChild: node atIndex: index];
|
||||
[self insertChild: theNode atIndex: index];
|
||||
[self removeChildAtIndex: index + 1];
|
||||
}
|
||||
|
||||
|
@ -304,23 +306,23 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (void) setPublicID: (NSString*)publicID
|
||||
{
|
||||
xmlDtd *node = internal->node;
|
||||
xmlDtd *theNode = internal->node;
|
||||
|
||||
node->ExternalID = XMLStringCopy(publicID);
|
||||
theNode->ExternalID = XMLStringCopy(publicID);
|
||||
}
|
||||
|
||||
- (void) setSystemID: (NSString*)systemID
|
||||
{
|
||||
xmlDtd *node = internal->node;
|
||||
xmlDtd *theNode = internal->node;
|
||||
|
||||
node->SystemID = XMLStringCopy(systemID);
|
||||
theNode->SystemID = XMLStringCopy(systemID);
|
||||
}
|
||||
|
||||
- (NSString*) systemID
|
||||
{
|
||||
xmlDtd *node = internal->node;
|
||||
xmlDtd *theNode = internal->node;
|
||||
|
||||
return StringFromXMLStringPtr(node->SystemID);
|
||||
return StringFromXMLStringPtr(theNode->SystemID);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -53,19 +53,21 @@ GS_PRIVATE_INTERNAL(NSXMLDTDNode)
|
|||
GS_CREATE_INTERNAL(NSXMLDTDNode);
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)theOptions
|
||||
- (id) initWithKind: (NSXMLNodeKind)theKind options: (NSUInteger)theOptions
|
||||
{
|
||||
if (NSXMLEntityDeclarationKind == kind
|
||||
|| NSXMLElementDeclarationKind == kind
|
||||
|| NSXMLNotationDeclarationKind == kind)
|
||||
if (NSXMLEntityDeclarationKind == theKind
|
||||
|| NSXMLElementDeclarationKind == theKind
|
||||
|| NSXMLNotationDeclarationKind == theKind)
|
||||
{
|
||||
return [super initWithKind: kind options: theOptions];
|
||||
return [super initWithKind: theKind options: theOptions];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self release];
|
||||
return [[NSXMLNode alloc] initWithKind: kind
|
||||
options: theOptions];
|
||||
// This cast is here to keep clang quite that expects an init* method to
|
||||
// return an object of the same class, which is not true here.
|
||||
return (NSXMLDTDNode*)[[NSXMLNode alloc] initWithKind: theKind
|
||||
options: theOptions];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +81,7 @@ GS_PRIVATE_INTERNAL(NSXMLDTDNode)
|
|||
error: &error];
|
||||
if (tempDoc != nil)
|
||||
{
|
||||
result = RETAIN([tempDoc childAtIndex: 0]);
|
||||
result = (NSXMLDTDNode*)RETAIN([tempDoc childAtIndex: 0]);
|
||||
[result detach]; // detach from document.
|
||||
}
|
||||
[tempDoc release];
|
||||
|
|
|
@ -120,16 +120,16 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
{
|
||||
char *url = NULL;
|
||||
char *encoding = NULL; // "UTF8";
|
||||
int options = XML_PARSE_NOERROR;
|
||||
int xmlOptions = XML_PARSE_NOERROR;
|
||||
xmlDocPtr doc = NULL;
|
||||
|
||||
if (!(mask & NSXMLNodePreserveWhitespace))
|
||||
{
|
||||
options |= XML_PARSE_NOBLANKS;
|
||||
xmlOptions |= XML_PARSE_NOBLANKS;
|
||||
//xmlKeepBlanksDefault(0);
|
||||
}
|
||||
doc = xmlReadMemory([data bytes], [data length],
|
||||
url, encoding, options);
|
||||
url, encoding, xmlOptions);
|
||||
if (doc == NULL)
|
||||
{
|
||||
DESTROY(self);
|
||||
|
@ -155,17 +155,19 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)theOptions
|
||||
- (id) initWithKind: (NSXMLNodeKind)theKind options: (NSUInteger)theOptions
|
||||
{
|
||||
if (NSXMLDocumentKind == kind)
|
||||
if (NSXMLDocumentKind == theKind)
|
||||
{
|
||||
return [super initWithKind: kind options: theOptions];
|
||||
return [super initWithKind: theKind options: theOptions];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self release];
|
||||
return [[NSXMLNode alloc] initWithKind: kind
|
||||
options: theOptions];
|
||||
// This cast is here to keep clang quite that expects an init* method to
|
||||
// return an object of the same class, which is not true here.
|
||||
return (NSXMLDocument*)[[NSXMLNode alloc] initWithKind: theKind
|
||||
options: theOptions];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,9 +229,9 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
internal->node->encoding = XMLStringCopy(encoding);
|
||||
}
|
||||
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)kind
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)theContentKind
|
||||
{
|
||||
internal->contentKind = kind;
|
||||
internal->contentKind = theContentKind;
|
||||
}
|
||||
|
||||
- (void) setDTD: (NSXMLDTD*)documentTypeDeclaration
|
||||
|
@ -246,9 +248,9 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
[self addChild: documentTypeDeclaration];
|
||||
}
|
||||
|
||||
- (void) setMIMEType: (NSString*)MIMEType
|
||||
- (void) setMIMEType: (NSString*)theMIMEType
|
||||
{
|
||||
ASSIGNCOPY(internal->MIMEType, MIMEType);
|
||||
ASSIGNCOPY(internal->MIMEType, theMIMEType);
|
||||
}
|
||||
|
||||
- (void) setRootElement: (NSXMLNode*)root
|
||||
|
@ -282,22 +284,22 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (void) setURI: (NSString*)URI
|
||||
{
|
||||
xmlDocPtr node = internal->node;
|
||||
xmlDocPtr theNode = internal->node;
|
||||
|
||||
if (node->URL != NULL)
|
||||
if (theNode->URL != NULL)
|
||||
{
|
||||
xmlFree((xmlChar *)node->URL);
|
||||
xmlFree((xmlChar *)theNode->URL);
|
||||
}
|
||||
node->URL = XMLStringCopy(URI);
|
||||
theNode->URL = XMLStringCopy(URI);
|
||||
}
|
||||
|
||||
- (NSString*) URI
|
||||
{
|
||||
xmlDocPtr node = internal->node;
|
||||
xmlDocPtr theNode = internal->node;
|
||||
|
||||
if (node->URL)
|
||||
if (theNode->URL)
|
||||
{
|
||||
return StringFromXMLStringPtr(node->URL);
|
||||
return StringFromXMLStringPtr(theNode->URL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -309,13 +311,13 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
{
|
||||
if ([version isEqualToString: @"1.0"] || [version isEqualToString: @"1.1"])
|
||||
{
|
||||
xmlDocPtr node = internal->node;
|
||||
xmlDocPtr theNode = internal->node;
|
||||
|
||||
if (node->version != NULL)
|
||||
if (theNode->version != NULL)
|
||||
{
|
||||
xmlFree((xmlChar *)node->version);
|
||||
xmlFree((xmlChar *)theNode->version);
|
||||
}
|
||||
node->version = XMLStringCopy(version);
|
||||
theNode->version = XMLStringCopy(version);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -326,32 +328,31 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) version
|
||||
{
|
||||
xmlDocPtr node = internal->node;
|
||||
xmlDocPtr theNode = internal->node;
|
||||
|
||||
if (node->version)
|
||||
return StringFromXMLStringPtr(node->version);
|
||||
if (theNode->version)
|
||||
return StringFromXMLStringPtr(theNode->version);
|
||||
else
|
||||
return @"1.0";
|
||||
}
|
||||
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
|
||||
{
|
||||
NSXMLNodeKind kind = [child kind];
|
||||
NSXMLNodeKind theKind = [child kind];
|
||||
NSUInteger childCount = [self childCount];
|
||||
|
||||
// Check to make sure this is a valid addition...
|
||||
NSAssert(nil != child, NSInvalidArgumentException);
|
||||
NSAssert(index <= childCount, NSInvalidArgumentException);
|
||||
NSAssert(nil == [child parent], NSInvalidArgumentException);
|
||||
kind = [child kind];
|
||||
NSAssert(NSXMLAttributeKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDTDKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDocumentKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLElementDeclarationKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLEntityDeclarationKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLInvalidKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNamespaceKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNotationDeclarationKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLAttributeKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDTDKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDocumentKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLElementDeclarationKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLEntityDeclarationKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLInvalidKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNamespaceKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNotationDeclarationKind != theKind, NSInvalidArgumentException);
|
||||
|
||||
[self _insertChild: child atIndex: index];
|
||||
}
|
||||
|
@ -398,9 +399,9 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
[self insertChild: child atIndex: [self childCount]];
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)theNode
|
||||
{
|
||||
[self insertChild: node atIndex: index];
|
||||
[self insertChild: theNode atIndex: index];
|
||||
[self removeChildAtIndex: index + 1];
|
||||
}
|
||||
|
||||
|
@ -409,9 +410,9 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
return [self XMLDataWithOptions: NSXMLNodeOptionsNone];
|
||||
}
|
||||
|
||||
- (NSData *) XMLDataWithOptions: (NSUInteger)options
|
||||
- (NSData *) XMLDataWithOptions: (NSUInteger)theOptions
|
||||
{
|
||||
NSString *xmlString = [self XMLStringWithOptions: options];
|
||||
NSString *xmlString = [self XMLStringWithOptions: theOptions];
|
||||
|
||||
return [xmlString dataUsingEncoding: NSUTF8StringEncoding
|
||||
allowLossyConversion: NO];
|
||||
|
|
|
@ -70,17 +70,19 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
return [self initWithKind: NSXMLElementKind options: 0];
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)theOptions
|
||||
- (id) initWithKind: (NSXMLNodeKind)theKind options: (NSUInteger)theOptions
|
||||
{
|
||||
if (NSXMLElementKind == kind)
|
||||
if (NSXMLElementKind == theKind)
|
||||
{
|
||||
return [super initWithKind: kind options: theOptions];
|
||||
return [super initWithKind: theKind options: theOptions];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self release];
|
||||
return [[NSXMLNode alloc] initWithKind: kind
|
||||
options: theOptions];
|
||||
// This cast is here to keep clang quite that expects an init* method to
|
||||
// return an object of the same class, which is not true here.
|
||||
return (NSXMLElement*)[[NSXMLNode alloc] initWithKind: theKind
|
||||
options: theOptions];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,8 +178,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
((cur->ns == NULL) || (cur->ns->prefix == NULL) ||
|
||||
(xmlStrcmp(cur->ns->prefix, (const xmlChar*)"") == 0)))
|
||||
{
|
||||
NSXMLNode *node = [NSXMLNode _objectForNode: cur];
|
||||
[results addObject: node];
|
||||
NSXMLNode *theNode = [NSXMLNode _objectForNode: cur];
|
||||
[results addObject: theNode];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,8 +216,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
(xmlStrcmp(childNS->prefix, (const xmlChar*)"") == 0)))) ||
|
||||
((cur->ns != NULL) && (xmlStrcmp(cur->ns->href, href) == 0)))
|
||||
{
|
||||
NSXMLNode *node = [NSXMLNode _objectForNode: cur];
|
||||
[results addObject: node];
|
||||
NSXMLNode *theNode = [NSXMLNode _objectForNode: cur];
|
||||
[results addObject: theNode];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +228,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
- (void) addAttribute: (NSXMLNode*)attribute
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlAttrPtr attr = (xmlAttrPtr)[attribute _node];
|
||||
xmlAttrPtr oldAttr;
|
||||
|
||||
|
@ -244,7 +246,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
if (ns->href == NULL)
|
||||
{
|
||||
xmlNsPtr newNs = xmlSearchNs(node->doc, node, ns->prefix);
|
||||
xmlNsPtr newNs = xmlSearchNs(theNode->doc, theNode, ns->prefix);
|
||||
|
||||
if (newNs != NULL)
|
||||
{
|
||||
|
@ -255,7 +257,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
}
|
||||
else //if (ns->prefix == NULL)
|
||||
{
|
||||
xmlNsPtr newNs = xmlSearchNsByHref(node->doc, node, ns->href);
|
||||
xmlNsPtr newNs = xmlSearchNsByHref(theNode->doc, theNode, ns->href);
|
||||
|
||||
if (newNs != NULL)
|
||||
{
|
||||
|
@ -292,8 +294,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
}
|
||||
|
||||
// Insert in new
|
||||
ensure_oldNs(node);
|
||||
oldNs1 = node->doc->oldNs;
|
||||
ensure_oldNs(theNode);
|
||||
oldNs1 = theNode->doc->oldNs;
|
||||
while (oldNs1)
|
||||
{
|
||||
if (oldNs1->next == NULL)
|
||||
|
@ -307,17 +309,17 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
#if LIBXML_VERSION >= 20620
|
||||
xmlDOMWrapAdoptNode(NULL, attr->doc, (xmlNodePtr)attr,
|
||||
node->doc, node, 0);
|
||||
theNode->doc, theNode, 0);
|
||||
#else
|
||||
xmlSetTreeDoc((xmlNodePtr)attr, node->doc);
|
||||
xmlSetTreeDoc((xmlNodePtr)attr, theNode->doc);
|
||||
#endif
|
||||
xmlFreeDoc(tmp);
|
||||
|
||||
oldAttr = xmlHasNsProp(node, attr->name, ns->href);
|
||||
oldAttr = xmlHasNsProp(theNode, attr->name, ns->href);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldAttr = xmlHasProp(node, attr->name);
|
||||
oldAttr = xmlHasProp(theNode, attr->name);
|
||||
}
|
||||
|
||||
if (NULL != oldAttr)
|
||||
|
@ -344,7 +346,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
}
|
||||
}
|
||||
}
|
||||
xmlAddChild(node, (xmlNodePtr)attr);
|
||||
xmlAddChild(theNode, (xmlNodePtr)attr);
|
||||
[self _addSubNode: attribute];
|
||||
}
|
||||
|
||||
|
@ -390,8 +392,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
- (NSArray*) attributes
|
||||
{
|
||||
NSMutableArray *attributes = [NSMutableArray array];
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlAttrPtr attributeNode = node->properties;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlAttrPtr attributeNode = theNode->properties;
|
||||
|
||||
while (attributeNode)
|
||||
{
|
||||
|
@ -423,8 +425,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
{
|
||||
NSXMLNode *result = nil;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlAttrPtr attributeNode = xmlHasProp(node, XMLSTRING(name));
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlAttrPtr attributeNode = xmlHasProp(theNode, XMLSTRING(name));
|
||||
|
||||
if (NULL != attributeNode)
|
||||
{
|
||||
|
@ -439,8 +441,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
URI: (NSString*)URI
|
||||
{
|
||||
NSXMLNode *result = nil;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlAttrPtr attributeNode = xmlHasNsProp(node, XMLSTRING(localName),
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlAttrPtr attributeNode = xmlHasNsProp(theNode, XMLSTRING(localName),
|
||||
XMLSTRING(URI));
|
||||
|
||||
if (NULL != attributeNode)
|
||||
|
@ -454,16 +456,16 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
- (void) addNamespace: (NSXMLNode*)aNamespace
|
||||
{
|
||||
xmlNsPtr ns = xmlCopyNamespace((xmlNsPtr)[aNamespace _node]);
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
const xmlChar *prefix = ns->prefix;
|
||||
|
||||
if (node->nsDef == NULL)
|
||||
if (theNode->nsDef == NULL)
|
||||
{
|
||||
node->nsDef = ns;
|
||||
theNode->nsDef = ns;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNsPtr cur = node->nsDef;
|
||||
xmlNsPtr cur = theNode->nsDef;
|
||||
xmlNsPtr last = NULL;
|
||||
|
||||
while (cur != NULL)
|
||||
|
@ -487,13 +489,13 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
if (cur->href == NULL)
|
||||
{
|
||||
// This was a fake namespace we added
|
||||
if (node->ns == cur)
|
||||
if (theNode->ns == cur)
|
||||
{
|
||||
node->ns = ns;
|
||||
theNode->ns = ns;
|
||||
}
|
||||
if (last == NULL)
|
||||
{
|
||||
node->nsDef = ns;
|
||||
theNode->nsDef = ns;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -505,22 +507,22 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
}
|
||||
|
||||
// Are we setting a default namespace?
|
||||
if ((node->ns == NULL) && (xmlStrcmp(prefix, (const xmlChar*)"") == 0))
|
||||
if ((theNode->ns == NULL) && (xmlStrcmp(prefix, (const xmlChar*)"") == 0))
|
||||
{
|
||||
node->ns = ns;
|
||||
theNode->ns = ns;
|
||||
}
|
||||
|
||||
// Need to replace fake namespaces in subnodes
|
||||
cleanup_namespaces(node, ns);
|
||||
cleanup_namespaces(theNode, ns);
|
||||
}
|
||||
|
||||
- (void) removeNamespaceForPrefix: (NSString*)name
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (node->nsDef != NULL)
|
||||
if (theNode->nsDef != NULL)
|
||||
{
|
||||
xmlNsPtr cur = node->nsDef;
|
||||
xmlNsPtr cur = theNode->nsDef;
|
||||
xmlNsPtr last = NULL;
|
||||
const xmlChar *prefix = XMLSTRING(name);
|
||||
|
||||
|
@ -538,9 +540,9 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
last->next = cur->next;
|
||||
}
|
||||
cur->next = NULL;
|
||||
if (node->ns == cur)
|
||||
if (theNode->ns == cur)
|
||||
{
|
||||
node->ns = NULL;
|
||||
theNode->ns = NULL;
|
||||
}
|
||||
xmlFreeNs(cur);
|
||||
return;
|
||||
|
@ -593,14 +595,14 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
if (name != nil)
|
||||
{
|
||||
const xmlChar *prefix = XMLSTRING(name);
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNsPtr ns;
|
||||
|
||||
ns = xmlSearchNs(node->doc, node, prefix);
|
||||
ns = xmlSearchNs(theNode->doc, theNode, prefix);
|
||||
if ((ns == NULL) && ([name length] == 0))
|
||||
{
|
||||
prefix = NULL;
|
||||
ns = xmlSearchNs(node->doc, node, prefix);
|
||||
ns = xmlSearchNs(theNode->doc, theNode, prefix);
|
||||
}
|
||||
|
||||
if (ns != NULL)
|
||||
|
@ -640,21 +642,21 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
|
||||
{
|
||||
NSXMLNodeKind kind = [child kind];
|
||||
NSXMLNodeKind theKind = [child kind];
|
||||
NSUInteger childCount = [self childCount];
|
||||
|
||||
// Check to make sure this is a valid addition...
|
||||
NSAssert(nil != child, NSInvalidArgumentException);
|
||||
NSAssert(index <= childCount, NSInvalidArgumentException);
|
||||
NSAssert(nil == [child parent], NSInvalidArgumentException);
|
||||
NSAssert(NSXMLAttributeKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDTDKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDocumentKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLElementDeclarationKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLEntityDeclarationKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLInvalidKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNamespaceKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNotationDeclarationKind != kind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLAttributeKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDTDKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLDocumentKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLElementDeclarationKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLEntityDeclarationKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLInvalidKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNamespaceKind != theKind, NSInvalidArgumentException);
|
||||
NSAssert(NSXMLNotationDeclarationKind != theKind, NSInvalidArgumentException);
|
||||
|
||||
[self _insertChild: child atIndex: index];
|
||||
}
|
||||
|
@ -701,9 +703,9 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
[self insertChild: child atIndex: [self childCount]];
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)theNode
|
||||
{
|
||||
[self insertChild: node atIndex: index];
|
||||
[self insertChild: theNode atIndex: index];
|
||||
[self removeChildAtIndex: index + 1];
|
||||
}
|
||||
|
||||
|
@ -740,23 +742,23 @@ joinTextNodes(xmlNodePtr nodeA, xmlNodePtr nodeB, NSMutableArray *nodesToDelete)
|
|||
|
||||
while ((subNode = [subEnum nextObject]))
|
||||
{
|
||||
xmlNodePtr node = [subNode _node];
|
||||
xmlNodePtr prev = node->prev;
|
||||
xmlNodePtr next = node->next;
|
||||
xmlNodePtr theNode = [subNode _node];
|
||||
xmlNodePtr prev = theNode->prev;
|
||||
xmlNodePtr next = theNode->next;
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE)
|
||||
if (theNode->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
[(NSXMLElement *)subNode
|
||||
normalizeAdjacentTextNodesPreservingCDATA:preserve];
|
||||
}
|
||||
else if (node->type == XML_TEXT_NODE
|
||||
|| (node->type == XML_CDATA_SECTION_NODE && !preserve))
|
||||
else if (theNode->type == XML_TEXT_NODE
|
||||
|| (theNode->type == XML_CDATA_SECTION_NODE && !preserve))
|
||||
{
|
||||
if (next && (next->type == XML_TEXT_NODE
|
||||
|| (next->type == XML_CDATA_SECTION_NODE && !preserve)))
|
||||
{
|
||||
//combine node & node->next
|
||||
joinTextNodes(node, node->next, nodesToDelete);
|
||||
joinTextNodes(theNode, theNode->next, nodesToDelete);
|
||||
}
|
||||
if (prev && (prev->type == XML_TEXT_NODE
|
||||
|| (prev->type == XML_CDATA_SECTION_NODE && !preserve)))
|
||||
|
@ -772,7 +774,7 @@ joinTextNodes(xmlNodePtr nodeA, xmlNodePtr nodeB, NSMutableArray *nodesToDelete)
|
|||
* from our subNodes when we're done iterating it)
|
||||
* (or maybe we need to turn it into an NSInvalidNode too??)
|
||||
*/
|
||||
joinTextNodes(node->prev, node, nodesToDelete);
|
||||
joinTextNodes(theNode->prev, theNode, nodesToDelete);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -470,13 +470,13 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
|||
GS_CREATE_INTERNAL(NSXMLNode);
|
||||
}
|
||||
|
||||
- (id) _initWithNode: (xmlNodePtr)node kind: (NSXMLNodeKind)kind
|
||||
- (id) _initWithNode: (xmlNodePtr)theNode kind: (NSXMLNodeKind)theKind
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
[self _createInternal];
|
||||
[self _setNode: node];
|
||||
internal->kind = kind;
|
||||
[self _setNode: theNode];
|
||||
internal->kind = theKind;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -484,16 +484,16 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
|||
- (xmlNodePtr) _childNodeAtIndex: (NSUInteger)index
|
||||
{
|
||||
NSUInteger count = 0;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr children;
|
||||
|
||||
if ((node->type == XML_NAMESPACE_DECL) ||
|
||||
(node->type == XML_ATTRIBUTE_NODE))
|
||||
if ((theNode->type == XML_NAMESPACE_DECL) ||
|
||||
(theNode->type == XML_ATTRIBUTE_NODE))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
children = node->children;
|
||||
children = theNode->children;
|
||||
if (!children)
|
||||
return NULL; // the Cocoa docs say it returns nil if there are no children
|
||||
|
||||
|
@ -1096,20 +1096,20 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
{
|
||||
NSUInteger count = 0;
|
||||
xmlNodePtr children = NULL;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (!node)
|
||||
if (!theNode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((node->type == XML_NAMESPACE_DECL) ||
|
||||
(node->type == XML_ATTRIBUTE_NODE))
|
||||
if ((theNode->type == XML_NAMESPACE_DECL) ||
|
||||
(theNode->type == XML_ATTRIBUTE_NODE))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (children = node->children; children; children = children->next)
|
||||
for (children = theNode->children; children; children = children->next)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
@ -1128,18 +1128,18 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
else
|
||||
{
|
||||
xmlNodePtr children = NULL;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if ((node == NULL) ||
|
||||
(node->type == XML_NAMESPACE_DECL) ||
|
||||
(node->type == XML_ATTRIBUTE_NODE) ||
|
||||
(node->children == NULL))
|
||||
if ((theNode == NULL) ||
|
||||
(theNode->type == XML_NAMESPACE_DECL) ||
|
||||
(theNode->type == XML_ATTRIBUTE_NODE) ||
|
||||
(theNode->children == NULL))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
childrenArray = [NSMutableArray array];
|
||||
for (children = node->children; children; children = children->next)
|
||||
for (children = theNode->children; children; children = children->next)
|
||||
{
|
||||
NSXMLNode *n = [NSXMLNode _objectForNode: children];
|
||||
[childrenArray addObject: n];
|
||||
|
@ -1186,49 +1186,49 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
{
|
||||
if (GS_EXISTS_INTERNAL)
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
NSArray *subNodes = [internal->subNodes copy];
|
||||
NSEnumerator *enumerator = [subNodes objectEnumerator];
|
||||
xmlNodePtr theNode = internal->node;
|
||||
NSArray *theSubNodes = [internal->subNodes copy];
|
||||
NSEnumerator *enumerator = [theSubNodes objectEnumerator];
|
||||
NSXMLNode *subNode;
|
||||
|
||||
while ((subNode = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[subNode detach];
|
||||
}
|
||||
[subNodes release];
|
||||
[theSubNodes release];
|
||||
|
||||
[internal->objectValue release];
|
||||
[internal->subNodes release];
|
||||
if (node)
|
||||
if (theNode)
|
||||
{
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
((xmlNsPtr)node)->_private = NULL;
|
||||
((xmlNsPtr)theNode)->_private = NULL;
|
||||
// FIXME: Not sure when to free the node here,
|
||||
// the same namespace node might be referenced
|
||||
// from other places.
|
||||
xmlFreeNode(node);
|
||||
xmlFreeNode(theNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->_private = NULL;
|
||||
if (node->parent == NULL)
|
||||
theNode->_private = NULL;
|
||||
if (theNode->parent == NULL)
|
||||
{
|
||||
// the top level node frees the entire tree
|
||||
if (node->type == XML_DOCUMENT_NODE)
|
||||
if (theNode->type == XML_DOCUMENT_NODE)
|
||||
{
|
||||
xmlFreeDoc((xmlDocPtr)node);
|
||||
xmlFreeDoc((xmlDocPtr)theNode);
|
||||
}
|
||||
else if (node->type == XML_ENTITY_DECL &&
|
||||
((xmlEntityPtr)node)->etype == XML_INTERNAL_PREDEFINED_ENTITY)
|
||||
else if (theNode->type == XML_ENTITY_DECL &&
|
||||
((xmlEntityPtr)theNode)->etype == XML_INTERNAL_PREDEFINED_ENTITY)
|
||||
{
|
||||
// Don't free internal entity nodes
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlDocPtr tmp = node->doc;
|
||||
xmlDocPtr tmp = theNode->doc;
|
||||
|
||||
xmlFreeNode(node);
|
||||
xmlFreeNode(theNode);
|
||||
// Free the private document we allocated in detach
|
||||
if (tmp)
|
||||
{
|
||||
|
@ -1245,19 +1245,19 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) detach
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (node)
|
||||
if (theNode)
|
||||
{
|
||||
NSXMLNode *parent = [self parent];
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node->doc)
|
||||
if (theNode->doc)
|
||||
{
|
||||
/* Create a private document and move the node over.
|
||||
* This is needed so that the strings of the nodes subtree
|
||||
|
@ -1268,15 +1268,15 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
xmlDocPtr tmp = xmlNewDoc((xmlChar *)"1.0");
|
||||
|
||||
#if LIBXML_VERSION >= 20620
|
||||
xmlDOMWrapAdoptNode(NULL, node->doc, node, tmp, NULL, 0);
|
||||
xmlDOMWrapAdoptNode(NULL, theNode->doc, theNode, tmp, NULL, 0);
|
||||
#else
|
||||
xmlSetTreeDoc(node, tmp);
|
||||
xmlSetTreeDoc(theNode, tmp);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// separate our node from its parent and siblings
|
||||
xmlUnlinkNode(node);
|
||||
xmlUnlinkNode(theNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1294,15 +1294,15 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSUInteger) index
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
int count = 0;
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((node = node->prev))
|
||||
while ((theNode = theNode->prev))
|
||||
{
|
||||
count++; // count our earlier sibling nodes
|
||||
}
|
||||
|
@ -1315,20 +1315,20 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
return [self initWithKind: NSXMLInvalidKind];
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind) kind
|
||||
- (id) initWithKind: (NSXMLNodeKind)theKind
|
||||
{
|
||||
return [self initWithKind: kind options: 0];
|
||||
return [self initWithKind: theKind options: 0];
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)theOptions
|
||||
- (id) initWithKind: (NSXMLNodeKind)theKind options: (NSUInteger)theOptions
|
||||
{
|
||||
Class theSubclass = [NSXMLNode class];
|
||||
void *node = NULL;
|
||||
void *theNode = NULL;
|
||||
|
||||
/*
|
||||
* We find the correct subclass for specific node kinds:
|
||||
*/
|
||||
switch (kind)
|
||||
switch (theKind)
|
||||
{
|
||||
case NSXMLDocumentKind:
|
||||
theSubclass = [NSXMLDocument class];
|
||||
|
@ -1367,7 +1367,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
return nil;
|
||||
|
||||
default:
|
||||
kind = NSXMLInvalidKind;
|
||||
theKind = NSXMLInvalidKind;
|
||||
theSubclass = [NSXMLNode class];
|
||||
break;
|
||||
}
|
||||
|
@ -1380,26 +1380,26 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
if (NO == [self isKindOfClass: theSubclass])
|
||||
{
|
||||
[self release];
|
||||
return [[theSubclass alloc] initWithKind: kind
|
||||
return [[theSubclass alloc] initWithKind: theKind
|
||||
options: theOptions];
|
||||
}
|
||||
|
||||
/* If we are initializing for the correct class, we can actually perform
|
||||
* initializations:
|
||||
*/
|
||||
switch (kind)
|
||||
switch (theKind)
|
||||
{
|
||||
case NSXMLDocumentKind:
|
||||
node = xmlNewDoc((xmlChar *)"1.0");
|
||||
theNode = xmlNewDoc((xmlChar *)"1.0");
|
||||
break;
|
||||
|
||||
case NSXMLInvalidKind:
|
||||
case NSXMLElementKind:
|
||||
node = xmlNewNode(NULL,(xmlChar *)"");
|
||||
theNode = xmlNewNode(NULL,(xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLDTDKind:
|
||||
node = xmlNewDtd(NULL, (xmlChar *)"", (xmlChar *)"",(xmlChar *)"");
|
||||
theNode = xmlNewDtd(NULL, (xmlChar *)"", (xmlChar *)"",(xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLElementDeclarationKind:
|
||||
|
@ -1409,14 +1409,14 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
memset(ret, 0, sizeof(xmlElement));
|
||||
ret->type = XML_ELEMENT_DECL;
|
||||
ret->name = xmlStrdup((xmlChar *)"");
|
||||
node = ret;
|
||||
theNode = ret;
|
||||
break;
|
||||
}
|
||||
|
||||
case NSXMLEntityDeclarationKind:
|
||||
#if LIBXML_VERSION >= 20700
|
||||
node = xmlNewEntity(NULL, (xmlChar *)"", 0, (xmlChar *)"",
|
||||
(xmlChar *)"", (xmlChar *)"");
|
||||
theNode = xmlNewEntity(NULL, (xmlChar *)"", 0, (xmlChar *)"",
|
||||
(xmlChar *)"", (xmlChar *)"");
|
||||
#else
|
||||
{
|
||||
xmlEntityPtr ret;
|
||||
|
@ -1427,41 +1427,41 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
ret->ExternalID = xmlStrdup((xmlChar *)"");
|
||||
ret->SystemID = xmlStrdup((xmlChar *)"");
|
||||
ret->content = xmlStrdup((xmlChar *)"");
|
||||
node = ret;
|
||||
theNode = ret;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case NSXMLNotationDeclarationKind:
|
||||
// FIXME
|
||||
node = xmlNewNode(NULL, (xmlChar *)"");
|
||||
theNode = xmlNewNode(NULL, (xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLProcessingInstructionKind:
|
||||
node = xmlNewPI((xmlChar *)"", (xmlChar *)"");
|
||||
theNode = xmlNewPI((xmlChar *)"", (xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLCommentKind:
|
||||
node = xmlNewComment((xmlChar *)"");
|
||||
theNode = xmlNewComment((xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLTextKind:
|
||||
node = xmlNewText((xmlChar *)"");
|
||||
theNode = xmlNewText((xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLNamespaceKind:
|
||||
node = xmlNewNs(NULL,(xmlChar *)"",(xmlChar *)"");
|
||||
theNode = xmlNewNs(NULL,(xmlChar *)"",(xmlChar *)"");
|
||||
break;
|
||||
|
||||
case NSXMLAttributeKind:
|
||||
node = xmlNewProp(NULL,(xmlChar *)"",(xmlChar *)"");
|
||||
theNode = xmlNewProp(NULL,(xmlChar *)"",(xmlChar *)"");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (nil == (self = [self _initWithNode: node kind: kind]))
|
||||
if (nil == (self = [self _initWithNode: theNode kind: theKind]))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
@ -1505,20 +1505,20 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) localName
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
return StringFromXMLStringPtr(((xmlNs *)node)->prefix);
|
||||
return StringFromXMLStringPtr(((xmlNs *)theNode)->prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
return StringFromXMLStringPtr(node->name);
|
||||
return StringFromXMLStringPtr(theNode->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1543,7 +1543,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
{
|
||||
NSXMLNode *ancestor = self;
|
||||
NSXMLNode *candidate = nil;
|
||||
NSXMLNodeKind kind;
|
||||
NSXMLNodeKind theKind;
|
||||
|
||||
if (forward)
|
||||
{
|
||||
|
@ -1588,8 +1588,8 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
}
|
||||
|
||||
/* Sanity check: Namespace and attribute nodes are skipped: */
|
||||
kind = [candidate kind];
|
||||
if ((NSXMLAttributeKind == kind) || (NSXMLNamespaceKind == kind))
|
||||
theKind = [candidate kind];
|
||||
if ((NSXMLAttributeKind == theKind) || (NSXMLNamespaceKind == theKind))
|
||||
{
|
||||
return [candidate _nodeFollowingInNaturalDirection: forward];
|
||||
}
|
||||
|
@ -1603,17 +1603,17 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSXMLNode*) nextSibling
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NULL == node)
|
||||
if (NULL == theNode)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (XML_NAMESPACE_DECL == node->type)
|
||||
if (XML_NAMESPACE_DECL == theNode->type)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return [NSXMLNode _objectForNode: node->next];
|
||||
return [NSXMLNode _objectForNode: theNode->next];
|
||||
}
|
||||
|
||||
- (id) objectValue
|
||||
|
@ -1624,43 +1624,43 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
- (NSXMLNode*) parent
|
||||
{
|
||||
xmlNodePtr parent = NULL;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NULL == node)
|
||||
if (NULL == theNode)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (XML_NAMESPACE_DECL == node->type)
|
||||
if (XML_NAMESPACE_DECL == theNode->type)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
parent = node->parent;
|
||||
parent = theNode->parent;
|
||||
return [NSXMLNode _objectForNode: parent];
|
||||
}
|
||||
|
||||
- (NSString*) prefix
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NULL == node)
|
||||
if (NULL == theNode)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (XML_NAMESPACE_DECL == node->type)
|
||||
if (XML_NAMESPACE_DECL == theNode->type)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
if (XML_ELEMENT_NODE != node->type)
|
||||
if (XML_ELEMENT_NODE != theNode->type)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
if (node->ns == NULL)
|
||||
if (theNode->ns == NULL)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
return StringFromXMLStringPtr(node->ns->prefix);
|
||||
return StringFromXMLStringPtr(theNode->ns->prefix);
|
||||
}
|
||||
|
||||
- (NSXMLNode*) previousNode
|
||||
|
@ -1670,32 +1670,32 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSXMLNode*) previousSibling
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NULL == node)
|
||||
if (NULL == theNode)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (XML_NAMESPACE_DECL == node->type)
|
||||
if (XML_NAMESPACE_DECL == theNode->type)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return [NSXMLNode _objectForNode: node->prev];
|
||||
return [NSXMLNode _objectForNode: theNode->prev];
|
||||
}
|
||||
|
||||
- (NSXMLDocument*) rootDocument
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NULL == node)
|
||||
if (NULL == theNode)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (XML_NAMESPACE_DECL == node->type)
|
||||
if (XML_NAMESPACE_DECL == theNode->type)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if ((NULL == node->doc) || (NULL == node->doc->children))
|
||||
if ((NULL == theNode->doc) || (NULL == theNode->doc->children))
|
||||
{
|
||||
// This is a standalone node, we still may have a private document,
|
||||
// but we don't want to return this.
|
||||
|
@ -1703,13 +1703,13 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
}
|
||||
|
||||
return
|
||||
(NSXMLDocument *)[NSXMLNode _objectForNode: (xmlNodePtr)(node->doc)];
|
||||
(NSXMLDocument *)[NSXMLNode _objectForNode: (xmlNodePtr)(theNode->doc)];
|
||||
}
|
||||
|
||||
- (NSString*) stringValue
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlChar *content = xmlNodeGetContent(node);
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlChar *content = xmlNodeGetContent(theNode);
|
||||
NSString *result = nil;
|
||||
|
||||
if (NULL != content)
|
||||
|
@ -1738,16 +1738,16 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) setName: (NSString *)name
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
xmlNsPtr ns = (xmlNsPtr)node;
|
||||
xmlNsPtr ns = (xmlNsPtr)theNode;
|
||||
|
||||
if (ns->prefix != NULL)
|
||||
{
|
||||
|
@ -1763,40 +1763,40 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
if (NULL == xmlName)
|
||||
{
|
||||
xmlNodeSetName(node, (const xmlChar *)"");
|
||||
xmlNodeSetName(theNode, (const xmlChar *)"");
|
||||
return;
|
||||
}
|
||||
|
||||
localName = xmlSplitQName2(xmlName, &prefix);
|
||||
if (prefix != NULL)
|
||||
{
|
||||
if ((node->type == XML_ATTRIBUTE_NODE) ||
|
||||
(node->type == XML_ELEMENT_NODE))
|
||||
if ((theNode->type == XML_ATTRIBUTE_NODE) ||
|
||||
(theNode->type == XML_ELEMENT_NODE))
|
||||
{
|
||||
if ((node->ns != NULL && node->ns->prefix == NULL))
|
||||
if ((theNode->ns != NULL && theNode->ns->prefix == NULL))
|
||||
{
|
||||
node->ns->prefix = xmlStrdup(prefix);
|
||||
theNode->ns->prefix = xmlStrdup(prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNsPtr ns;
|
||||
|
||||
// Set namespace
|
||||
ns = xmlSearchNs(node->doc, node, prefix);
|
||||
ns = xmlSearchNs(theNode->doc, theNode, prefix);
|
||||
if (ns)
|
||||
{
|
||||
xmlSetNs(node, ns);
|
||||
xmlSetNs(theNode, ns);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNsPtr oldNs;
|
||||
|
||||
ensure_oldNs(node);
|
||||
ensure_oldNs(theNode);
|
||||
|
||||
// Fake the name space and fix it later
|
||||
// This function is private, so re reimplemt it.
|
||||
//ns = xmlDOMWrapStoreNs(node->doc, NULL, prefix);
|
||||
oldNs = node->doc->oldNs;
|
||||
oldNs = theNode->doc->oldNs;
|
||||
while (oldNs)
|
||||
{
|
||||
if (oldNs->prefix != NULL && xmlStrEqual(oldNs->prefix, prefix))
|
||||
|
@ -1812,18 +1812,18 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
}
|
||||
oldNs = oldNs->next;
|
||||
}
|
||||
xmlSetNs(node, ns);
|
||||
xmlSetNs(theNode, ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlNodeSetName(node, localName);
|
||||
xmlNodeSetName(theNode, localName);
|
||||
xmlFree(localName);
|
||||
xmlFree(prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNodeSetName(node, xmlName);
|
||||
xmlNodeSetName(theNode, xmlName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1835,11 +1835,11 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) setStringValue: (NSString*)string resolvingEntities: (BOOL)resolve
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
xmlNsPtr ns = (xmlNsPtr)node;
|
||||
xmlNsPtr ns = (xmlNsPtr)theNode;
|
||||
if (ns->href != NULL)
|
||||
{
|
||||
xmlFree((xmlChar *)ns->href);
|
||||
|
@ -1851,8 +1851,8 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
// Remove all child nodes except attributes
|
||||
if (internal->subNodes)
|
||||
{
|
||||
NSArray *subNodes = [internal->subNodes copy];
|
||||
NSEnumerator *enumerator = [subNodes objectEnumerator];
|
||||
NSArray *theSubNodes = [internal->subNodes copy];
|
||||
NSEnumerator *enumerator = [theSubNodes objectEnumerator];
|
||||
NSXMLNode *subNode;
|
||||
|
||||
while ((subNode = [enumerator nextObject]) != nil)
|
||||
|
@ -1862,18 +1862,19 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
[subNode detach];
|
||||
}
|
||||
}
|
||||
[theSubNodes release];
|
||||
}
|
||||
|
||||
if (resolve == NO)
|
||||
{
|
||||
xmlNodeSetContent(node, XMLSTRING(string));
|
||||
xmlNodeSetContent(theNode, XMLSTRING(string));
|
||||
}
|
||||
else
|
||||
{
|
||||
// need to actually resolve entities...
|
||||
// is this the right functionality?? xmlEncodeSpecialChars()
|
||||
xmlChar *newstr = xmlEncodeEntitiesReentrant(node->doc, XMLSTRING(string));
|
||||
xmlNodeSetContent(node, newstr);
|
||||
xmlChar *newstr = xmlEncodeEntitiesReentrant(theNode->doc, XMLSTRING(string));
|
||||
xmlNodeSetContent(theNode, newstr);
|
||||
xmlMemFree(newstr);
|
||||
}
|
||||
}
|
||||
|
@ -1882,49 +1883,49 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) setURI: (NSString*)URI
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((node->type == XML_ATTRIBUTE_NODE) ||
|
||||
(node->type == XML_ELEMENT_NODE))
|
||||
if ((theNode->type == XML_ATTRIBUTE_NODE) ||
|
||||
(theNode->type == XML_ELEMENT_NODE))
|
||||
{
|
||||
const xmlChar *uri = XMLSTRING(URI);
|
||||
xmlNsPtr ns;
|
||||
|
||||
if (uri == NULL)
|
||||
{
|
||||
node->ns = NULL;
|
||||
theNode->ns = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
ns = xmlSearchNsByHref(node->doc, node, uri);
|
||||
ns = xmlSearchNsByHref(theNode->doc, theNode, uri);
|
||||
if (ns == NULL)
|
||||
{
|
||||
if ((node->ns != NULL && node->ns->href == NULL))
|
||||
if ((theNode->ns != NULL && theNode->ns->href == NULL))
|
||||
{
|
||||
node->ns->href = xmlStrdup(uri);
|
||||
theNode->ns->href = xmlStrdup(uri);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
if (node->type == XML_ELEMENT_NODE)
|
||||
if (theNode->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
//ns = xmlNewNs(node, uri, (const xmlChar *)"");
|
||||
ns = xmlNewNs(node, uri, NULL);
|
||||
//ns = xmlNewNs(theNode, uri, (const xmlChar *)"");
|
||||
ns = xmlNewNs(theNode, uri, NULL);
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
xmlNsPtr oldNs;
|
||||
|
||||
ensure_oldNs(node);
|
||||
ensure_oldNs(theNode);
|
||||
|
||||
// Fake the name space and fix it later
|
||||
// This function is private, so re reimplemt it.
|
||||
//ns = xmlDOMWrapStoreNs(node->doc, NULL, prefix);
|
||||
oldNs = node->doc->oldNs;
|
||||
oldNs = theNode->doc->oldNs;
|
||||
while (oldNs)
|
||||
{
|
||||
if (oldNs->href != NULL && xmlStrEqual(oldNs->href, uri))
|
||||
|
@ -1943,22 +1944,22 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
}
|
||||
}
|
||||
|
||||
xmlSetNs(node, ns);
|
||||
xmlSetNs(theNode, ns);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*) URI
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if ((node->type == XML_ATTRIBUTE_NODE) ||
|
||||
(node->type == XML_ELEMENT_NODE))
|
||||
if ((theNode->type == XML_ATTRIBUTE_NODE) ||
|
||||
(theNode->type == XML_ELEMENT_NODE))
|
||||
{
|
||||
xmlNsPtr ns = internal->node->ns;
|
||||
xmlNsPtr ns = theNode->ns;
|
||||
|
||||
if ((ns != NULL) && (ns->href != NULL))
|
||||
{
|
||||
|
@ -1974,7 +1975,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
return [self XMLStringWithOptions: NSXMLNodeOptionsNone];
|
||||
}
|
||||
|
||||
- (NSString*) XMLStringWithOptions: (NSUInteger)options
|
||||
- (NSString*) XMLStringWithOptions: (NSUInteger)theOptions
|
||||
{
|
||||
NSString *string = nil;
|
||||
xmlChar *buf = NULL;
|
||||
|
@ -1990,20 +1991,20 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
xmlOptions |= XML_SAVE_AS_XML;
|
||||
#endif
|
||||
#if LIBXML_VERSION >= 20708
|
||||
if (options & NSXMLNodePreserveWhitespace)
|
||||
if (theOptions & NSXMLNodePreserveWhitespace)
|
||||
{
|
||||
xmlOptions |= XML_SAVE_WSNONSIG;
|
||||
}
|
||||
#endif
|
||||
#if LIBXML_VERSION >= 20622
|
||||
//NSXMLNodeExpandEmptyElement is the default
|
||||
if ((options & NSXMLNodeCompactEmptyElement) == 0)
|
||||
if ((theOptions & NSXMLNodeCompactEmptyElement) == 0)
|
||||
{
|
||||
xmlOptions |= XML_SAVE_NO_EMPTY;
|
||||
}
|
||||
#endif
|
||||
#if LIBXML_VERSION >= 20617
|
||||
if (options & NSXMLNodePrettyPrint)
|
||||
if (theOptions & NSXMLNodePrettyPrint)
|
||||
{
|
||||
xmlOptions |= XML_SAVE_FORMAT;
|
||||
}
|
||||
|
@ -2051,24 +2052,24 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) XPath
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
return StringFromXMLStringPtr(xmlGetNodePath(node));
|
||||
xmlNodePtr theNode = internal->node;
|
||||
return StringFromXMLStringPtr(xmlGetNodePath(theNode));
|
||||
}
|
||||
|
||||
- (NSArray*) nodesForXPath: (NSString*)anxpath error: (NSError**)error
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
return execute_xpath(node, anxpath, nil, YES, error);
|
||||
return execute_xpath(theNode, anxpath, nil, YES, error);
|
||||
}
|
||||
|
||||
- (NSArray*) objectsForXQuery: (NSString*)xquery
|
||||
|
|
|
@ -16,9 +16,11 @@ int main()
|
|||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSObject *o = [NSObject new];
|
||||
for (unsigned i=0 ; i<1000 ; i++)
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
[[o retain] autorelease];
|
||||
[[o retain] autorelease];
|
||||
}
|
||||
NSUInteger totalCount = [arp autoreleaseCount];
|
||||
PASS(totalCount == 1000, "Autorelease count is correct");
|
||||
|
|
Loading…
Reference in a new issue