support creating PI and Comment nodes; implemented attributes method in NSXMLElement

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34520 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2012-01-14 05:59:45 +00:00
parent e395d2f42a
commit d43aa730a1
2 changed files with 21 additions and 7 deletions

View file

@ -57,7 +57,8 @@ void clearPrivatePointers(xmlNodePtr aNode)
- (void) _setNode: (void *)_anode
{
((xmlNodePtr)_anode)->_private = self;
if (_anode)
((xmlNodePtr)_anode)->_private = self;
internal->node = _anode;
}
@ -68,7 +69,6 @@ void clearPrivatePointers(xmlNodePtr aNode)
if (node)
{
xmlElementType type = node->type;
xmlChar *name = NULL;
// NSXMLNodeKind kind = 0;
result = node->_private;
@ -78,15 +78,18 @@ void clearPrivatePointers(xmlNodePtr aNode)
switch(type)
{
case(XML_DOCUMENT_NODE):
name = (xmlChar *)node->name;
result = [[self alloc] initWithKind: NSXMLDocumentKind];
break;
case(XML_ELEMENT_NODE):
name = (xmlChar *)node->name;
result = [[self alloc] initWithKind: NSXMLElementKind];
break;
case(XML_PI_NODE):
result = [[self alloc] initWithKind: NSXMLProcessingInstructionKind];
break;
case(XML_COMMENT_NODE):
result = [[self alloc] initWithKind: NSXMLCommentKind];
break;
case(XML_ATTRIBUTE_NODE):
name = (xmlChar *)node->name;
result = [[self alloc] initWithKind: NSXMLAttributeKind];
[result setStringValue: StringFromXMLStringPtr(node->content)];
break;