* Source/NSXMLDocument.m

* Source/NSXMLNode.m: Add / to xpath if it is not there.
	Thes matches behavior observed on Mac OS X/Cocoa.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34562 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2012-01-17 08:51:23 +00:00
parent c28fe9a54b
commit 96e464fc49
3 changed files with 17 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2012-01-17 03:48-EST Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSXMLDocument.m
* Source/NSXMLNode.m: Add / to xpath if it is not there.
Thes matches behavior observed on Mac OS X/Cocoa.
2012-01-17 03:06-EST Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSXMLDocument.m: Correct issues with unit tests.

View file

@ -218,8 +218,9 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
- (void) setRootElement: (NSXMLNode*)root
{
#warning properly dispose of old root element.
// #warning properly dispose of old root element.
xmlNodePtr newrootnode;
id oldElement = [self rootElement];
if(root == nil)
{
@ -229,6 +230,10 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
xmlDocSetRootElement(MY_DOC,[root _node]);
newrootnode = MY_DOC->children;
newrootnode->_private = root; // hmmm, this probably isn't where this belongs, but try it...
// Get rid of old element...
// xmlFree([oldElement _node]);
oldElement = nil; // is this correct??
}
- (void) setStandalone: (BOOL)standalone

View file

@ -931,6 +931,11 @@ NSArray *execute_xpath(NSXMLNode *node,
- (NSArray*) nodesForXPath: (NSString*)anxpath error: (NSError**)error
{
if([[anxpath substringWithRange: NSMakeRange(0,1)] isEqual: @"/"] == NO)
{
anxpath = [@"/" stringByAppendingString: anxpath];
}
*error = NULL;
return execute_xpath(self, anxpath, NULL);
}