Re: [xml] xmlNodePtr properties missing xmlns:xxxx
- From: "Eric S. Eberhard" <flash vicsmba com>
- To: Andrew Hartley <andrew hartley bcs org uk>,xml gnome org
- Subject: Re: [xml] xmlNodePtr properties missing xmlns:xxxx
- Date: Thu, 23 Jun 2011 10:26:06 -0700
That is because namespace is "special" and located in a linked list
off other pointers. Here is a snippet of code I use to free them
(get rid of them) which is the opposite of what you want, but should
give you a starting point ...
xmlNodePtr node;
for (;node;node=node->next) { /* looping through
all nodes */
xmlNsPtr next;
xmlNsPtr cur;
cur = node->ns; /* looping
through all namespaces for this node */
while (cur) {
next = cur->next;
if (cur->href) xmlFree((char *) cur->href);
if (cur->prefix) xmlFree((char *) cur->prefix);
cur->href = NULL;
cur->prefix = NULL;
xmlFree((char *)cur);
cur = next;
}
node->ns = NULL;
if (node->type == XML_ELEMENT_NODE ||
node->type == XML_XINCLUDE_START ||
node->type == XML_XINCLUDE_END) {
cur = node->nsDef;
while (cur) {
next = cur->next;
if (cur->href) xmlFree((char *) cur->href);
if (cur->prefix) xmlFree((char *) cur->prefix);
cur->href = NULL;
cur->prefix = NULL;
xmlFree((char *)cur);
cur = next;
}
node->nsDef = NULL;
}
Note -- I ripped out stuff special to me and may have been a bit
sloppy, but this should give you an idea.
Eric
At 08:28 AM 6/23/2011, Andrew Hartley wrote:
I have an iXBRL document that I am parsing with LibXml2. The problem I have
is that I register all the namespaces which are mostly held in the <html>
root node, no problem. But, there are some namespace declarations in some
of the document nodes as attrbutes of that particular node. When I get the
attributes of a particular node that has a namespace declaration and I read
the attributes thus:
xmlAttrPtr pAttr = pCurNode->properties;
I then iterate through all the attributes, and they are all there apart from
the one named 'xmlns:xxxx="blahblahblah" . Is there anyway I can locate
these namespace declarations, so that I can register them?
Any advice on this problem will be much appreciated.
--
View this message in context:
http://old.nabble.com/xmlNodePtr-properties-missing-xmlns%3Axxxx-tp31911110p31911110.html
Sent from the Gnome - Lib - Xml - General mailing list archive at Nabble.com.
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
Eric S. Eberhard
(928) 567-3727 Voice
(928) 567-6122 Fax
(928) 301-7537 Cell
Vertical Integrated Computer Systems, LLC
Metropolis Support, LLC
For Metropolis support and VICS MBA Support!!!! http://www.vicsmba.com
Pictures of Snake in Spring
http://www.facebook.com/album.php?aid=115547&id=1409661701&l=1c375e1f49
Pictures of Camp Verde
http://www.facebook.com/album.php?aid=12771&id=1409661701&l=fc0e0a2bcf
Pictures of Land Cruiser in Sedona
http://www.facebook.com/album.php?aid=50953&id=1409661701
Pictures of Flagstaff area near our cabin
http://www.facebook.com/album.php?aid=12750&id=1409661701
Pictures of Cheryl in a Horse Show
http://www.facebook.com/album.php?aid=32484&id=1409661701
Pictures of the AZ Desert
http://www.facebook.com/album.php?aid=58827&id=1409661701
(You can see why we love this state :-) )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]