crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Different syntax for XPath Query
Question Posted on 17 Oct 2011Home >> 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




.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




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?






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap