Re: [xml] Why <!DOCTYPE> considered as the root element



On Tue, Oct 30, 2001 at 01:31:58AM +0300, k_f_d mail ru wrote:
Hello!

Can anyone explain me why I have the folllowing problem. Say, 
I'm trying to parse with libxml the XML file like this:

<?xml version="1.0"?>
<!DOCTYPE testfile SYSTEM "blah-blah">
<root>
  <child>
    <elem attr="val"/>
  </child>
</root>

libxml counts `testfile' as the root element -- the only element 
in the document! If I removing the second line (<DOCTYPE...>), 
the problem disappearing. What am I doing wrong?

  You're assuming doc->children is the root element, this is wrong !

  http://xmlsoft.org/html/libxml-tree.html#XMLDOCGETROOTELEMENT

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]