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



I have an xml file of the below format.


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



How do I detect if the file has a root node or not?

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


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





I need to know it before parsing the whole file,

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

So if the file is in the first format then I get wrong results..




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