mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Make the NSXMLNode ivar a union.
Having the same ivar exposed as different types in different compilation units is probably a bad idea in general and will break with the new ObjC ABI, where we have link-time checks for this. It would also confuse reflection and any languages that use reflection for bridging in exciting ways.
This commit is contained in:
parent
146d823689
commit
9b7e3a8fff
6 changed files with 97 additions and 85 deletions
|
@ -26,7 +26,6 @@
|
|||
|
||||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GS_XMLNODETYPE xmlDtd
|
||||
#define GSInternal NSXMLDTDInternal
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
@ -57,7 +56,7 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
- (NSXMLDTDNode*) attributeDeclarationForName: (NSString*)name
|
||||
elementName: (NSString*)elementName
|
||||
{
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlDtdPtr theNode = internal->node.dtd;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
const xmlChar *xmlElementName = XMLSTRING(elementName);
|
||||
|
@ -87,7 +86,7 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (NSXMLDTDNode*) elementDeclarationForName: (NSString*)name
|
||||
{
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlDtdPtr theNode = internal->node.dtd;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
|
@ -116,7 +115,7 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
- (NSXMLDTDNode*) entityDeclarationForName: (NSString*)name
|
||||
{
|
||||
//xmlGetEntityFromDtd
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlDtdPtr theNode = internal->node.dtd;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
|
@ -241,7 +240,7 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (NSXMLDTDNode*) notationDeclarationForName: (NSString*)name
|
||||
{
|
||||
xmlDtdPtr theNode = internal->node;
|
||||
xmlDtdPtr theNode = internal->node.dtd;
|
||||
xmlNodePtr children = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
|
@ -267,7 +266,7 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (NSString*) publicID
|
||||
{
|
||||
xmlDtd *theNode = internal->node;
|
||||
xmlDtd *theNode = internal->node.dtd;
|
||||
|
||||
return StringFromXMLStringPtr(theNode->ExternalID);
|
||||
}
|
||||
|
@ -306,21 +305,21 @@ GS_PRIVATE_INTERNAL(NSXMLDTD)
|
|||
|
||||
- (void) setPublicID: (NSString*)publicID
|
||||
{
|
||||
xmlDtd *theNode = internal->node;
|
||||
xmlDtd *theNode = internal->node.dtd;
|
||||
|
||||
theNode->ExternalID = XMLStringCopy(publicID);
|
||||
}
|
||||
|
||||
- (void) setSystemID: (NSString*)systemID
|
||||
{
|
||||
xmlDtd *theNode = internal->node;
|
||||
xmlDtd *theNode = internal->node.dtd;
|
||||
|
||||
theNode->SystemID = XMLStringCopy(systemID);
|
||||
}
|
||||
|
||||
- (NSString*) systemID
|
||||
{
|
||||
xmlDtd *theNode = internal->node;
|
||||
xmlDtd *theNode = internal->node.dtd;
|
||||
|
||||
return StringFromXMLStringPtr(theNode->SystemID);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GS_XMLNODETYPE xmlEntity
|
||||
#define GSInternal NSXMLDTDNodeInternal
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
@ -101,12 +100,12 @@ GS_PRIVATE_INTERNAL(NSXMLDTDNode)
|
|||
|
||||
- (NSString*) notationName
|
||||
{
|
||||
return StringFromXMLStringPtr(internal->node->name);
|
||||
return StringFromXMLStringPtr(internal->node.entity->name);
|
||||
}
|
||||
|
||||
- (NSString*) publicID
|
||||
{
|
||||
return StringFromXMLStringPtr(internal->node->ExternalID);
|
||||
return StringFromXMLStringPtr(internal->node.entity->ExternalID);
|
||||
}
|
||||
|
||||
- (void) setDTDKind: (NSXMLDTDNodeKind)nodeKind
|
||||
|
@ -116,22 +115,22 @@ GS_PRIVATE_INTERNAL(NSXMLDTDNode)
|
|||
|
||||
- (void) setNotationName: (NSString*)notationName
|
||||
{
|
||||
internal->node->name = XMLSTRING(notationName);
|
||||
internal->node.entity->name = XMLSTRING(notationName);
|
||||
}
|
||||
|
||||
- (void) setPublicID: (NSString*)publicID
|
||||
{
|
||||
internal->node->ExternalID = XMLSTRING(publicID);
|
||||
internal->node.entity->ExternalID = XMLSTRING(publicID);
|
||||
}
|
||||
|
||||
- (void) setSystemID: (NSString*)systemID
|
||||
{
|
||||
internal->node->ExternalID = XMLSTRING(systemID);
|
||||
internal->node.entity->ExternalID = XMLSTRING(systemID);
|
||||
}
|
||||
|
||||
- (NSString*) systemID
|
||||
{
|
||||
return StringFromXMLStringPtr(internal->node->SystemID);
|
||||
return StringFromXMLStringPtr(internal->node.entity->SystemID);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GS_XMLNODETYPE xmlDoc
|
||||
#define GSInternal NSXMLDocumentInternal
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
@ -56,8 +55,8 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) characterEncoding
|
||||
{
|
||||
if (internal->node->encoding)
|
||||
return StringFromXMLStringPtr(internal->node->encoding);
|
||||
if (internal->node.doc->encoding)
|
||||
return StringFromXMLStringPtr(internal->node.doc->encoding);
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
@ -69,7 +68,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSXMLDTD*) DTD
|
||||
{
|
||||
xmlDtdPtr dtd = xmlGetIntSubset(internal->node);
|
||||
xmlDtdPtr dtd = xmlGetIntSubset(internal->node.doc);
|
||||
return (NSXMLDTD *)[NSXMLNode _objectForNode: (xmlNodePtr)dtd];
|
||||
}
|
||||
|
||||
|
@ -152,7 +151,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
}
|
||||
|
||||
// Free old node
|
||||
xmlFreeDoc((xmlDocPtr)internal->node);
|
||||
xmlFreeDoc((xmlDocPtr)internal->node.doc);
|
||||
[self _setNode: doc];
|
||||
|
||||
if (mask & NSXMLDocumentValidate)
|
||||
|
@ -215,7 +214,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (BOOL) isStandalone
|
||||
{
|
||||
return (internal->node->standalone == 1);
|
||||
return (internal->node.doc->standalone == 1);
|
||||
}
|
||||
|
||||
- (NSString*) MIMEType
|
||||
|
@ -225,17 +224,17 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSXMLElement*) rootElement
|
||||
{
|
||||
xmlNodePtr rootElem = xmlDocGetRootElement(internal->node);
|
||||
xmlNodePtr rootElem = xmlDocGetRootElement(internal->node.doc);
|
||||
return (NSXMLElement *)[NSXMLNode _objectForNode: rootElem];
|
||||
}
|
||||
|
||||
- (void) setCharacterEncoding: (NSString*)encoding
|
||||
{
|
||||
if (internal->node->encoding != NULL)
|
||||
if (internal->node.doc->encoding != NULL)
|
||||
{
|
||||
xmlFree((xmlChar *)internal->node->encoding);
|
||||
xmlFree((xmlChar *)internal->node.doc->encoding);
|
||||
}
|
||||
internal->node->encoding = XMLStringCopy(encoding);
|
||||
internal->node.doc->encoding = XMLStringCopy(encoding);
|
||||
}
|
||||
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)theContentKind
|
||||
|
@ -253,7 +252,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
old = [self DTD];
|
||||
[old detach];
|
||||
|
||||
internal->node->intSubset = (xmlDtdPtr)[documentTypeDeclaration _node];
|
||||
internal->node.doc->intSubset = (xmlDtdPtr)[documentTypeDeclaration _node];
|
||||
[self addChild: documentTypeDeclaration];
|
||||
}
|
||||
|
||||
|
@ -280,7 +279,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
[self setChildren: nil];
|
||||
|
||||
// FIXME: Should we use addChild: here?
|
||||
xmlDocSetRootElement(internal->node, [root _node]);
|
||||
xmlDocSetRootElement(internal->node.doc, [root _node]);
|
||||
|
||||
// Do our subNode housekeeping...
|
||||
[self _addSubNode: root];
|
||||
|
@ -288,12 +287,12 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (void) setStandalone: (BOOL)standalone
|
||||
{
|
||||
internal->node->standalone = standalone;
|
||||
internal->node.doc->standalone = standalone;
|
||||
}
|
||||
|
||||
- (void) setURI: (NSString*)URI
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->URL != NULL)
|
||||
{
|
||||
|
@ -304,7 +303,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) URI
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->URL)
|
||||
{
|
||||
|
@ -320,7 +319,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
{
|
||||
if ([version isEqualToString: @"1.0"] || [version isEqualToString: @"1.1"])
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->version != NULL)
|
||||
{
|
||||
|
@ -337,7 +336,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
- (NSString*) version
|
||||
{
|
||||
xmlDocPtr theNode = internal->node;
|
||||
xmlDocPtr theNode = internal->node.doc;
|
||||
|
||||
if (theNode->version)
|
||||
return StringFromXMLStringPtr(theNode->version);
|
||||
|
@ -459,7 +458,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
}
|
||||
|
||||
// Apply the stylesheet and get the result...
|
||||
resultDoc = xsltApplyStylesheet(stylesheet, internal->node,
|
||||
resultDoc = xsltApplyStylesheet(stylesheet, internal->node.doc,
|
||||
(const char **)params);
|
||||
|
||||
// Cleanup...
|
||||
|
@ -502,7 +501,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
xmlValidCtxtPtr ctxt = xmlNewValidCtxt();
|
||||
// FIXME: Should use xmlValidityErrorFunc and userData
|
||||
// to get the error
|
||||
BOOL result = (BOOL)(xmlValidateDocument(ctxt, internal->node));
|
||||
BOOL result = (BOOL)(xmlValidateDocument(ctxt, internal->node.doc));
|
||||
xmlFreeValidCtxt(ctxt);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GSInternal NSXMLElementInternal
|
||||
#define GS_XMLNODETYPE xmlNode
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
#import "GSInternal.h"
|
||||
|
@ -169,7 +168,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
xmlNodePtr cur = NULL;
|
||||
const xmlChar *xmlName = XMLSTRING(name);
|
||||
|
||||
for (cur = internal->node->children; cur != NULL; cur = cur->next)
|
||||
for (cur = internal->node.node->children; cur != NULL; cur = cur->next)
|
||||
{
|
||||
if (cur->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
|
@ -194,9 +193,9 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
xmlNodePtr cur = NULL;
|
||||
const xmlChar *href = XMLSTRING(URI);
|
||||
const xmlChar *xmlName = XMLSTRING(localName);
|
||||
xmlNsPtr parentNS = xmlSearchNsByHref(internal->node->doc, internal->node, href);
|
||||
xmlNsPtr parentNS = xmlSearchNsByHref(internal->node.node->doc, internal->node.node, href);
|
||||
|
||||
for (cur = internal->node->children; cur != NULL; cur = cur->next)
|
||||
for (cur = internal->node.node->children; cur != NULL; cur = cur->next)
|
||||
{
|
||||
if (cur->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
|
@ -206,7 +205,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
if (cur->nsDef != NULL)
|
||||
{
|
||||
childNS = xmlSearchNsByHref(internal->node->doc, cur, href);
|
||||
childNS = xmlSearchNsByHref(internal->node.node->doc, cur, href);
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,7 +227,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
- (void) addAttribute: (NSXMLNode*)attribute
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlAttrPtr attr = (xmlAttrPtr)[attribute _node];
|
||||
xmlAttrPtr oldAttr;
|
||||
|
||||
|
@ -393,7 +392,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
- (NSArray*) attributes
|
||||
{
|
||||
NSMutableArray *attributes = [NSMutableArray array];
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlAttrPtr attributeNode = theNode->properties;
|
||||
|
||||
while (attributeNode)
|
||||
|
@ -426,7 +425,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
{
|
||||
NSXMLNode *result = nil;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlAttrPtr attributeNode = xmlHasProp(theNode, XMLSTRING(name));
|
||||
|
||||
if (NULL != attributeNode)
|
||||
|
@ -442,7 +441,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
URI: (NSString*)URI
|
||||
{
|
||||
NSXMLNode *result = nil;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlAttrPtr attributeNode = xmlHasNsProp(theNode, XMLSTRING(localName),
|
||||
XMLSTRING(URI));
|
||||
|
||||
|
@ -457,7 +456,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
- (void) addNamespace: (NSXMLNode*)aNamespace
|
||||
{
|
||||
xmlNsPtr ns = xmlCopyNamespace((xmlNsPtr)[aNamespace _node]);
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
const xmlChar *prefix = ns->prefix;
|
||||
|
||||
if (theNode->nsDef == NULL)
|
||||
|
@ -519,7 +518,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
|
||||
- (void) removeNamespaceForPrefix: (NSString*)name
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (theNode->nsDef != NULL)
|
||||
{
|
||||
|
@ -534,7 +533,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
{
|
||||
if (last == NULL)
|
||||
{
|
||||
internal->node->nsDef = cur->next;
|
||||
internal->node.node->nsDef = cur->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -560,8 +559,8 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
NSXMLNode *namespace = nil;
|
||||
|
||||
// Remove old namespaces
|
||||
xmlFreeNsList(internal->node->nsDef);
|
||||
internal->node->nsDef = NULL;
|
||||
xmlFreeNsList(internal->node.node->nsDef);
|
||||
internal->node.node->nsDef = NULL;
|
||||
|
||||
// Add new ones
|
||||
while ((namespace = (NSXMLNode *)[en nextObject]) != nil)
|
||||
|
@ -574,7 +573,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
{
|
||||
// FIXME: Should we use xmlGetNsList()?
|
||||
NSMutableArray *result = nil;
|
||||
xmlNsPtr ns = internal->node->nsDef;
|
||||
xmlNsPtr ns = internal->node.node->nsDef;
|
||||
|
||||
if (ns)
|
||||
{
|
||||
|
@ -596,7 +595,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
if (name != nil)
|
||||
{
|
||||
const xmlChar *prefix = XMLSTRING(name);
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlNsPtr ns;
|
||||
|
||||
ns = xmlSearchNs(theNode->doc, theNode, prefix);
|
||||
|
@ -631,7 +630,7 @@ extern void ensure_oldNs(xmlNodePtr node);
|
|||
- (NSString*) resolvePrefixForNamespaceURI: (NSString*)namespaceURI
|
||||
{
|
||||
const xmlChar *uri = XMLSTRING(namespaceURI);
|
||||
xmlNsPtr ns = xmlSearchNsByHref(internal->node->doc, internal->node, uri);
|
||||
xmlNsPtr ns = xmlSearchNsByHref(internal->node.node->doc, internal->node.node, uri);
|
||||
|
||||
if (ns)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GSInternal NSXMLNodeInternal
|
||||
#define GS_XMLNODETYPE xmlNode
|
||||
|
||||
#import "Foundation/NSCharacterSet.h"
|
||||
#import "NSXMLPrivate.h"
|
||||
|
@ -325,22 +324,22 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
|||
@implementation NSXMLNode (Private)
|
||||
- (void *) _node
|
||||
{
|
||||
return internal->node;
|
||||
return internal->node.node;
|
||||
}
|
||||
|
||||
- (void) _setNode: (void *)_anode
|
||||
{
|
||||
DESTROY(internal->subNodes);
|
||||
internal->node = _anode;
|
||||
if (internal->node != NULL)
|
||||
internal->node.node = _anode;
|
||||
if (internal->node.node != NULL)
|
||||
{
|
||||
if (internal->node->type == XML_NAMESPACE_DECL)
|
||||
if (internal->node.node->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
((xmlNsPtr)(internal->node))->_private = self;
|
||||
((xmlNsPtr)(internal->node.node))->_private = self;
|
||||
}
|
||||
else
|
||||
{
|
||||
internal->node->_private = self;
|
||||
internal->node.node->_private = self;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +503,7 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
|||
- (xmlNodePtr) _childNodeAtIndex: (NSUInteger)index
|
||||
{
|
||||
NSUInteger count = 0;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlNodePtr children;
|
||||
|
||||
if ((theNode->type == XML_NAMESPACE_DECL) ||
|
||||
|
@ -535,7 +534,7 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
|||
*/
|
||||
|
||||
// Get all of the nodes...
|
||||
xmlNodePtr parentNode = internal->node; // we are the parent
|
||||
xmlNodePtr parentNode = internal->node.node; // we are the parent
|
||||
xmlNodePtr childNode = (xmlNodePtr)[child _node];
|
||||
xmlNodePtr curNode = [self _childNodeAtIndex: index];
|
||||
BOOL mergeTextNodes = NO; // is there a defined option for this?
|
||||
|
@ -1119,7 +1118,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
{
|
||||
NSUInteger count = 0;
|
||||
xmlNodePtr children = NULL;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (!theNode)
|
||||
{
|
||||
|
@ -1151,7 +1150,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
else
|
||||
{
|
||||
xmlNodePtr children = NULL;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if ((theNode == NULL) ||
|
||||
(theNode->type == XML_NAMESPACE_DECL) ||
|
||||
|
@ -1212,7 +1211,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
{
|
||||
if (GS_EXISTS_INTERNAL)
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
NSArray *theSubNodes = [internal->subNodes copy];
|
||||
NSEnumerator *enumerator = [theSubNodes objectEnumerator];
|
||||
NSXMLNode *subNode;
|
||||
|
@ -1271,7 +1270,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) detach
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (theNode)
|
||||
{
|
||||
|
@ -1320,7 +1319,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSUInteger) index
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
int count = 0;
|
||||
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
|
@ -1507,7 +1506,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
NSLog(@"s sV '%@' oV '%@', other sV '%@' oV '%@'", [self stringValue], [self objectValue],
|
||||
[other stringValue], [other objectValue]);
|
||||
*/
|
||||
return isEqualTree(internal->node, (xmlNodePtr)[other _node]);
|
||||
return isEqualTree(internal->node.node, (xmlNodePtr)[other _node]);
|
||||
}
|
||||
|
||||
- (NSXMLNodeKind) kind
|
||||
|
@ -1531,7 +1530,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) localName
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
|
@ -1629,7 +1628,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSXMLNode*) nextSibling
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NULL == theNode)
|
||||
{
|
||||
|
@ -1650,7 +1649,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
- (NSXMLNode*) parent
|
||||
{
|
||||
xmlNodePtr parent = NULL;
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NULL == theNode)
|
||||
{
|
||||
|
@ -1667,7 +1666,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) prefix
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NULL == theNode)
|
||||
{
|
||||
|
@ -1696,7 +1695,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSXMLNode*) previousSibling
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NULL == theNode)
|
||||
{
|
||||
|
@ -1711,7 +1710,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSXMLDocument*) rootDocument
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NULL == theNode)
|
||||
{
|
||||
|
@ -1734,7 +1733,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) stringValue
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
xmlChar *content = xmlNodeGetContent(theNode);
|
||||
NSString *result = nil;
|
||||
|
||||
|
@ -1764,7 +1763,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) setName: (NSString *)name
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
|
@ -1861,7 +1860,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) setStringValue: (NSString*)string resolvingEntities: (BOOL)resolve
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (theNode->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
|
@ -1909,7 +1908,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (void) setURI: (NSString*)URI
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
|
@ -1976,7 +1975,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) URI
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
|
@ -2044,18 +2043,18 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
xmlSaveCtxtPtr ctxt;
|
||||
|
||||
ctxt = xmlSaveToBuffer(buffer, "utf-8", xmlOptions);
|
||||
xmlSaveTree(ctxt, internal->node);
|
||||
xmlSaveTree(ctxt, internal->node.node);
|
||||
error = xmlSaveClose(ctxt);
|
||||
}
|
||||
#else
|
||||
{
|
||||
xmlDocPtr doc = NULL;
|
||||
|
||||
if (internal->node->type != XML_NAMESPACE_DECL)
|
||||
if (internal->node.node->type != XML_NAMESPACE_DECL)
|
||||
{
|
||||
doc = internal->node->doc;
|
||||
doc = internal->node.node->doc;
|
||||
}
|
||||
error = xmlNodeDump(buffer, doc, internal->node, 1, 1);
|
||||
error = xmlNodeDump(buffer, doc, internal->node.node, 1, 1);
|
||||
}
|
||||
#endif
|
||||
if (-1 == error)
|
||||
|
@ -2080,13 +2079,13 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
|
|||
|
||||
- (NSString*) XPath
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
return StringFromXMLStringPtr(xmlGetNodePath(theNode));
|
||||
}
|
||||
|
||||
- (NSArray*) nodesForXPath: (NSString*)anxpath error: (NSError**)error
|
||||
{
|
||||
xmlNodePtr theNode = internal->node;
|
||||
xmlNodePtr theNode = internal->node.node;
|
||||
|
||||
if (NSXMLInvalidKind == internal->kind)
|
||||
{
|
||||
|
|
|
@ -109,6 +109,23 @@ StringFromXMLString(const unsigned char *bytes, unsigned length)
|
|||
return AUTORELEASE(str);
|
||||
}
|
||||
|
||||
#if defined(HAVE_LIBXML)
|
||||
|
||||
#define GS_XMLNODETYPE \
|
||||
union\
|
||||
{\
|
||||
xmlDoc *doc;\
|
||||
xmlDtd *dtd;\
|
||||
xmlEntity *entity;\
|
||||
xmlNode *node;\
|
||||
}
|
||||
|
||||
#else
|
||||
#define GS_XMLNODETYPE void*
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Instance variables for NSXMLNode. This macro needs to be defined before
|
||||
* the NSXMLNode.h header is imported and before GSInternal.h is imported.
|
||||
*
|
||||
|
@ -139,7 +156,7 @@ StringFromXMLString(const unsigned char *bytes, unsigned length)
|
|||
*/
|
||||
#define GS_NSXMLNode_IVARS \
|
||||
NSUInteger kind; \
|
||||
GS_XMLNODETYPE *node; \
|
||||
GS_XMLNODETYPE node; \
|
||||
NSUInteger options; \
|
||||
id objectValue; \
|
||||
NSMutableArray *subNodes;
|
||||
|
|
Loading…
Reference in a new issue