mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
- HTMLparser.c: fixed loop on invalid char in scripts
- parser.c: update to description of xmlIOParseDTD() - libxml.m4 xmlversion.h.in: changes contributed by Michael Schmeing <m.schmeing@internet-factory.de> - configure.in: preparing for 2.2.7 - Makefile.am: trying to avoid config.h and acconfig.h being included in the distrib - rebuilt the docs - configure.in: released 2.2.7 Daniel
This commit is contained in:
@ -3403,3 +3403,107 @@ handle_as_char:
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlNewGlobalNs:
|
||||
* @doc: the document carrying the namespace
|
||||
* @href: the URI associated
|
||||
* @prefix: the prefix for the namespace
|
||||
*
|
||||
* Creation of a Namespace, the old way using PI and without scoping
|
||||
* DEPRECATED !!!
|
||||
* It now create a namespace on the root element of the document if found.
|
||||
* Returns NULL this functionnality had been removed
|
||||
*/
|
||||
xmlNsPtr
|
||||
xmlNewGlobalNs(xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix) {
|
||||
static int deprecated = 0;
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewGlobalNs() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
return(NULL);
|
||||
#if 0
|
||||
xmlNodePtr root;
|
||||
|
||||
xmlNsPtr cur;
|
||||
|
||||
root = xmlDocGetRootElement(doc);
|
||||
if (root != NULL)
|
||||
return(xmlNewNs(root, href, prefix));
|
||||
|
||||
/*
|
||||
* if there is no root element yet, create an old Namespace type
|
||||
* and it will be moved to the root at save time.
|
||||
*/
|
||||
cur = (xmlNsPtr) xmlMalloc(sizeof(xmlNs));
|
||||
if (cur == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewGlobalNs : malloc failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
memset(cur, 0, sizeof(xmlNs));
|
||||
cur->type = XML_GLOBAL_NAMESPACE;
|
||||
|
||||
if (href != NULL)
|
||||
cur->href = xmlStrdup(href);
|
||||
if (prefix != NULL)
|
||||
cur->prefix = xmlStrdup(prefix);
|
||||
|
||||
/*
|
||||
* Add it at the end to preserve parsing order ...
|
||||
*/
|
||||
if (doc != NULL) {
|
||||
if (doc->oldNs == NULL) {
|
||||
doc->oldNs = cur;
|
||||
} else {
|
||||
xmlNsPtr prev = doc->oldNs;
|
||||
|
||||
while (prev->next != NULL) prev = prev->next;
|
||||
prev->next = cur;
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlUpgradeOldNs:
|
||||
* @doc: a document pointer
|
||||
*
|
||||
* Upgrade old style Namespaces (PI) and move them to the root of the document.
|
||||
* DEPRECATED
|
||||
*/
|
||||
void
|
||||
xmlUpgradeOldNs(xmlDocPtr doc) {
|
||||
static int deprecated = 0;
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlNewGlobalNs() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
#if 0
|
||||
xmlNsPtr cur;
|
||||
|
||||
if ((doc == NULL) || (doc->oldNs == NULL)) return;
|
||||
if (doc->children == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlUpgradeOldNs: failed no root !\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
cur = doc->oldNs;
|
||||
while (cur->next != NULL) {
|
||||
cur->type = XML_LOCAL_NAMESPACE;
|
||||
cur = cur->next;
|
||||
}
|
||||
cur->type = XML_LOCAL_NAMESPACE;
|
||||
cur->next = doc->children->nsDef;
|
||||
doc->children->nsDef = doc->oldNs;
|
||||
doc->oldNs = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user