Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


Different syntax for XPath Query
Question Posted on 17 Oct 2011

Home >> XML >> Xml Questions >> Different syntax for XPath Query




Below are some usefull and more useable syntax in xpath all of these syntax are usefull when we are doing in xml
/catalog selects the root element
/catalog/cdselects all the cd elements of the catalog element
/catalog/cd/price selects all the price elements ofall the cd elements of the catalog element
/catalog/cd[price>10.0]selects all the cd elements with price greater than 10.0
startswith a slash(/)representsan absolute path to an element
startswith two slashes(//)selectsall elements that satisfy the criteria
//cdselects all cd elements in the document
/catalog/cd/title| /catalog/cd/artist selects all the title and artist elements of the cd elements of catalog
//title| //artistselects all the title and artist elements in the document
/catalog/cd/*selects all the child elements of all cd elements of the catalog element
/catalog/*/priceselectsall the price elements that are grandchildren of catalog
/*/*/priceselects all price elements which have two ancestors
//* selectsall elements in the document
/catalog/cd[1]selectsthe first cd child of catalog
/catalog/cd[last()] selectsthe last cd child of catalog
/catalog/cd[price]selects all the cd elements that have price
/catalog/cd[price=10.90]selects cd elements with the price of 10.90
/catalog/cd[price=10.90]/priceselects all price elements with the price of 10.90
//@country selects all countryattributes
//cd[@country]selects cd elements which have a " country " attribute
//cd[@*]selects cdelements which have any attribute
//cd[@country='UK']selects cd elements with " country " attribute equal to 'UK'
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Difference between XML and HTML
Web architecture of XML Database
Select XML Nodes by Name in c# code
Is it possible to execute XML?
Can we use graphics in XML if yes then how?






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |