How to get the XML Node via XPath -



How to get the XML Node via XPath -

i have xml :

<?xml version="1.0" encoding="utf-8" ?> <root> <class> <room> 1 </room> <subject> english language </subject> </class> <class> <room> 2 </room> <subject> maths </subject> </class> </root>

i using datasource grid , have used xmldatasource , xpath .

primarydatasource = new xmldatasource(); primarydatasource.enablecaching = false; primarydatasource.data = classxml; homecoming primarydatasource;

and accessing nodes in client side as: xpath("room") & xpath("subject")

which gives me values of particular attributes.

now want whole xml root form client side, 1 class root only.

<class> <room> 1 </room> <subject> english language </subject> </class>

can tell me how can thru xpath or other methods.

if want first "class" use:

(//class)[1]

xml xpath linq-to-xml

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -