mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
get the xml code to build on RedHat/CentOS
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34928 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
18c64eae4f
commit
043b774291
4 changed files with 43 additions and 23 deletions
|
@ -1,3 +1,10 @@
|
|||
2012-03-14 Richard Frith-Macdonald & Fred Kiefer
|
||||
|
||||
* Source/NSXMLPrivate.h:
|
||||
* Source/NSXMLNode.m:
|
||||
* Source/NSXMLElement.m:
|
||||
Fixups to get the code to build on CentOS/RedHat linux.
|
||||
|
||||
2012-03-12 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSXMLNode.m (-detach): Don't handle the namespace case.
|
||||
|
|
|
@ -324,7 +324,7 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
}
|
||||
else
|
||||
{
|
||||
xmlFreeNode(cur);
|
||||
xmlFreeNs(cur);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -338,7 +338,6 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
{
|
||||
NSEnumerator *en = [namespaces objectEnumerator];
|
||||
NSXMLNode *namespace = nil;
|
||||
xmlNsPtr cur = NULL;
|
||||
|
||||
// FIXME: Remove old namespaces
|
||||
// xmlFreeNsList(internal->node->nsDef);
|
||||
|
@ -409,7 +408,8 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
if (ns)
|
||||
{
|
||||
const xmlChar *uri = XMLSTRING(namespaceURI);
|
||||
xmlNsPtr cur = NULL;
|
||||
xmlNsPtr cur;
|
||||
|
||||
for (cur = ns; cur != NULL; cur = cur->next)
|
||||
{
|
||||
if (xmlStrcmp(uri, cur->href) == 0)
|
||||
|
|
|
@ -344,7 +344,7 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
|
|||
}
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
docNode = ((xmlNsPtr)node)->context;
|
||||
docNode = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1016,7 +1016,6 @@ execute_xpath(NSXMLNode *xmlNode, NSString *xpath_exp, NSString *nmspaces)
|
|||
}
|
||||
[subNodes release];
|
||||
|
||||
[internal->URI release];
|
||||
[internal->objectValue release];
|
||||
[internal->subNodes release];
|
||||
if (node)
|
||||
|
@ -1355,15 +1354,12 @@ execute_xpath(NSXMLNode *xmlNode, NSString *xpath_exp, NSString *nmspaces)
|
|||
{
|
||||
return nil;
|
||||
}
|
||||
if (XML_NAMESPACE_DECL == node->type)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
parent = (xmlNodePtr)(((xmlNs *)node)->context);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = node->parent;
|
||||
}
|
||||
parent = node->parent;
|
||||
return [NSXMLNode _objectForNode: parent];
|
||||
}
|
||||
|
||||
|
@ -1507,22 +1503,21 @@ execute_xpath(NSXMLNode *xmlNode, NSString *xpath_exp, NSString *nmspaces)
|
|||
- (NSString*) XMLStringWithOptions: (NSUInteger)options
|
||||
{
|
||||
NSString *string = nil;
|
||||
xmlNodePtr node = (xmlNodePtr)[self _node];
|
||||
xmlChar *buf = NULL;
|
||||
xmlDocPtr doc;
|
||||
xmlBufferPtr buffer = xmlBufferCreate();
|
||||
xmlBufferPtr buffer;
|
||||
int error = 0;
|
||||
int len = 0;
|
||||
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
if (internal->node->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
doc = ((xmlNs *)node)->context;
|
||||
xmlNsPtr ns = (xmlNsPtr)internal->node;
|
||||
|
||||
return StringFromXMLStringPtr(ns->href);
|
||||
}
|
||||
else
|
||||
{
|
||||
doc = node->doc;
|
||||
}
|
||||
error = xmlNodeDump(buffer, doc, node, 1, 1);
|
||||
buffer = xmlBufferCreate();
|
||||
doc = internal->node->doc;
|
||||
error = xmlNodeDump(buffer, doc, internal->node, 1, 1);
|
||||
if (-1 == error)
|
||||
{
|
||||
xmlBufferFree(buffer);
|
||||
|
@ -1530,7 +1525,7 @@ execute_xpath(NSXMLNode *xmlNode, NSString *xpath_exp, NSString *nmspaces)
|
|||
}
|
||||
buf = buffer->content;
|
||||
len = buffer->use;
|
||||
string = StringFromXMLString(buf,len);
|
||||
string = StringFromXMLString(buf, len);
|
||||
xmlBufferFree(buffer);
|
||||
|
||||
return string;
|
||||
|
|
|
@ -83,10 +83,28 @@ StringFromXMLString(const unsigned char *bytes, unsigned length)
|
|||
|
||||
/* Instance variables for NSXMLNode. This macro needs to be defined before
|
||||
* the NSXMLNode.h header is imported and before GSInternal.h is imported.
|
||||
*
|
||||
* The 'kind' tells us what sort of node this is.
|
||||
* The 'node' points to the underlying libxml2 node structure.
|
||||
* The 'nsParent' points to the parent node of a namspace structure, needed
|
||||
* because older (but still used on at least one major linux distribution)
|
||||
* versions of libxml2 don't have a link to the parent of a namespace.
|
||||
* The 'options' field is a bitmask of options for this node.
|
||||
* The 'objectValue' is the object value set for the node.
|
||||
*
|
||||
* The 'subNodes' array is confusing ... what *is* the ownership policy for
|
||||
* NSXMLNode with respect to the libxml2 tree? The simple/obvious one would
|
||||
* be that each NSXMLNode owns any NSXMLNode pointed to by children of the
|
||||
* corresponding libxml2 structure ... in which case there would be no need
|
||||
* for this array because the references to the owned NSXMLNode instances
|
||||
* would be the'_private' fields of the libxml2 structures.
|
||||
*
|
||||
* URI is probably not needed at all ... I'm not sure
|
||||
*/
|
||||
#define GS_NSXMLNode_IVARS \
|
||||
NSUInteger kind; \
|
||||
GS_XMLNODETYPE *node; \
|
||||
xmlNodePtr nsParent; \
|
||||
NSUInteger options; \
|
||||
id objectValue; \
|
||||
NSString *URI; \
|
||||
|
|
Loading…
Reference in a new issue