Re: [xml] How do you detect if a xml file has a root node??



On Fri, Mar 23, 2007 at 10:55:59AM -0400, Kali, Jayashree wrote:
How do I detect if the file has a root node or not? 

  An XML file has one and only one root node, by definition, 
    http://www.w3.org/TR/REC-xml/#NT-document

I mean how do I make the difference between the below xml file and the
above xml file.

<!-some comment generated.."  -->

<RootNode>

<Node1>data</Node1>

</RootNode>

  There is still only one root node here, 

I need to know it before parsing the whole file, 

  I don't think you can, and I feel some confusion

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]