fix rootElement

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34522 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2012-01-14 06:51:13 +00:00
parent 70b79c28fc
commit 25ffa3ff82
2 changed files with 7 additions and 4 deletions

View file

@ -38,6 +38,9 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
@interface NSXMLNode (Private) @interface NSXMLNode (Private)
- (void *) _node; - (void *) _node;
- (void) _setNode: (void *)_anode; - (void) _setNode: (void *)_anode;
+ (NSXMLNode *) _objectForNode: (xmlNodePtr)node;
- (void) _addSubNode:(NSXMLNode *)subNode;
- (void) _removeSubNode:(NSXMLNode *)subNode;
@end @end
@implementation NSXMLDocument @implementation NSXMLDocument
@ -180,8 +183,8 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
- (NSXMLElement*) rootElement - (NSXMLElement*) rootElement
{ {
xmlNodePtr node = xmlDocGetRootElement(MY_DOC); xmlNodePtr rootElem = xmlDocGetRootElement(MY_DOC);
return (NSXMLElement *)(node->_private); return (NSXMLElement *)[NSXMLNode _objectForNode:rootElem];
} }
- (void) setCharacterEncoding: (NSString*)encoding - (void) setCharacterEncoding: (NSString*)encoding

View file

@ -78,10 +78,10 @@ void clearPrivatePointers(xmlNodePtr aNode)
switch(type) switch(type)
{ {
case(XML_DOCUMENT_NODE): case(XML_DOCUMENT_NODE):
result = [[self alloc] initWithKind: NSXMLDocumentKind]; result = [[NSXMLDocument alloc] initWithKind: NSXMLDocumentKind];
break; break;
case(XML_ELEMENT_NODE): case(XML_ELEMENT_NODE):
result = [[self alloc] initWithKind: NSXMLElementKind]; result = [[NSXMLElement alloc] initWithKind: NSXMLElementKind];
break; break;
case(XML_TEXT_NODE): case(XML_TEXT_NODE):
result = [[self alloc] initWithKind: NSXMLTextKind]; result = [[self alloc] initWithKind: NSXMLTextKind];