mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-14 19:24:06 +03:00
applied the same fix for the XML-1.0 namespace to xmlSearchNsByHref() as
* tree.c: applied the same fix for the XML-1.0 namespace to xmlSearchNsByHref() as was done for xmlSearchNs() Daniel
This commit is contained in:
parent
ad11b301ab
commit
c1a0da3c24
@ -1,3 +1,8 @@
|
||||
Wed Aug 14 10:29:02 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: applied the same fix for the XML-1.0 namespace to
|
||||
xmlSearchNsByHref() as was done for xmlSearchNs()
|
||||
|
||||
Mon Aug 12 16:52:08 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* libxml.3: small cleanup of the man page
|
||||
|
22
tree.c
22
tree.c
@ -4519,8 +4519,26 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar *href) {
|
||||
/*
|
||||
* Only the document can hold the XML spec namespace.
|
||||
*/
|
||||
if (doc == NULL)
|
||||
return(NULL);
|
||||
if ((doc == NULL) && (node->type == XML_ELEMENT_NODE)) {
|
||||
/*
|
||||
* The XML-1.0 namespace is normally held on the root
|
||||
* element. In this case exceptionally create it on the
|
||||
* node element.
|
||||
*/
|
||||
cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
|
||||
if (cur == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlSearchNs : malloc failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
memset(cur, 0, sizeof(xmlNs));
|
||||
cur->type = XML_LOCAL_NAMESPACE;
|
||||
cur->href = xmlStrdup(XML_XML_NAMESPACE);
|
||||
cur->prefix = xmlStrdup((const xmlChar *)"xml");
|
||||
cur->next = node->nsDef;
|
||||
node->nsDef = cur;
|
||||
return(cur);
|
||||
}
|
||||
if (doc->oldNs == NULL) {
|
||||
/*
|
||||
* Allocate a new Namespace and fill the fields.
|
||||
|
Loading…
x
Reference in New Issue
Block a user