List Info

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




Re: How do you detect if a xml file has a root node??
country flaguser name
United States
2007-03-23 16:25:47
Thanks for your instant reply. But my requirement is if the
first node
is the main node containing other nodes I need to ignore it.
But if it
contains that data then I need to include it.

Can anyone suggest me a method to do it.

regards,
Jayashree

-----Original Message-----
From: Andreas Tscharner [mailto:andreas.tscharnermetromec.ch] 
Sent: Friday, March 23, 2007 11:41 AM
To: Kali, Jayashree; xmlgnome.org
Subject: RE: [xml] How do you detect if a xml file has a
root node??

> Hi,
> 
>  
> 
> I have an xml file of the below format.
> 
>  
> 
> <!-some comment generated.."  -->
> 
> <Node1>data</Node1>
> 
>  
> 
> How do I detect if the file has a root node or not? 

This file HAS a root node, it's called "Node1"
> 
> 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>

The root node have different names. On your first example,
it was
"Node1", and now it is "RootNode"


> as I need to avoid the root node when I load the xml
file.

Why? You can just ignore (or not) the first node after you
have parsed
the file...

Best regards
	Andreas
-- 
Andreas Tscharner                         
andreas.tscharnermetromec.ch
------------------------------------------------------------
------------
And the beast shall come forth surrounded by a roiling cloud
of
vengeance. The house of the unbelievers shall be razed and
they shall be
scorched to the earth. Their tags shall blink until the end
of days.
                                            -- The Book of
Mozilla 12:10

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )