Re: [xml] A little confued, please have a look

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@imag.fr)
Date: Sat Feb 10 2001 - 04:42:20 EST


On Fri, Feb 09, 2001 at 01:06:05PM -0800, Ming Lu wrote:
>
> For a XML file as below:
>
> <?xml version="1.0"?>
> <PLAN xmlns="http://www.argus.ca/autotest/1.0/">
> <NODE CommFlag="0"/>
> <NODE CommFlag="1"/>
> </PLAN>
>
> after parse it with the function pxmlDoc=xmlParseFile(LPCTSTR(strFileName));
> I want to the get the content of the first node (node with the CommFlag="0")
> so I did it as following;
> xmlNodePtr pode;
> pnode=pxmlDoc->children->children;
> but it doesnt work. If I change pnode=pxmlDoc->children->children to
> pnode=pxmlDoc->children->children->next; then it works. But from the
> document, I think it should be
> pnode=pxmlDoc->children->children. Can someone explain it to me. TIA. By the

  Seems I really need to add this to the FAQ ... done

  No, in XML all characters in the content of the document are
signifficant *including blanks and formatting line breaks* .
  The extra nodes you are wondering about are just that, text nodes
with the formatting spaces wich are part of the document but that
people tend to forget.
  There is a function xmlKeepBlanksDefault () to remove those at parse
time, but that's an heuristic, and its use should be limited to case
where you are sure there is no mixed-content in the document.

  http://xmlsoft.org/html/libxml-parser.html#XMLKEEPBLANKSDEFAULT

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Feb 10 2001 - 04:43:31 EST