Code Robo
Virtual Service
Comparator
Tester
Converter
Utility
Java Code Complience
Validator
Formatter
EncoderDecoder



XPath Generator
       Talk to EasyAssistant

XPath is used to refer any element or attribute in a XML document.XPath is used in source code to retrieve value from XML document.XPath generation and testing is very important. XPath is used to retrieve value from XMLEvaluting a XPath or konwing the XPath is very common requirement. This utility has been built up to generate all XPaths of a XML document. Just need to provide the XML content, it will generate the XPath list of all the elements and attributes present in the document. It can test a XPath also.
The XPath tester supports XML namespaces fully. The declarations of XML namespace does not need to be explicit or on the root XML element. It support xml name space defined anywhere in the document. It supports default namespace also.

Click Here To Watch A Demo On It(https://youtu.be/mCDftFTfvKc).

XML:(* Required): It is required.   XPath:(* Required only for 'Test XPath'): It is required.
 
Sort Result Alphabetically  
XPath Examples:

All of the following examples use this sample XML code..
1. Select the document node
/
2. Select the 'root' element
/Author
3. Select 'Book' element.
/Author/Books/Book
4. Select all 'Extn' elements regardless of their positions in the document.
//Extn
5. Select the 'PublisherCode' attributes of the 'Book' elements .
/Author/Books/Book/@PublisherCode
6. Select the textual value of first 'Price' element.
//Price[1]/text()


How It Works:

Question: 1.1 How to select a particular element based upon its position , I have multiple arrays in my xml having same element name so i have to select the element from first array only, along with other elements using Union (|) operator. How can i perform this ?
Answers: I am not sure whether I understood your question fully or not. But I trying to answer based on my understanding. I am assuming you have an XML where element with same name appears multiple places in the document(One example given below). Here Addresses element appear under Auther and Publisher. In that case how to select (reach) an element at particlar level. Specifically how get access of the Addresses element under Author.
Sample XML:
<Author>
	<Addresses>
		<Address Type="COMMINCATION"/>
		<Address Type="PERMANENT"/>
	</Addresses>
	<Books>
		<Publisher>
			<Addresses>
				<Address Type="HOME"/>
				<Address Type="Office"/>
			</Addresses>
		</Publisher>
	</Books>
</Author>
To get the Addresses element under Author you can have following type of code:
Sample Code:
	public static Element getAddressesElmOfAuthor(Document doc) throws Exception {
		Element authorElm = doc.getDocumentElement();
		NodeList nodeList = authorElm.getElementsByTagName("Addresses");
		Element addressesElmOfAuthor = null;
		for (int i = 0; i < nodeList.getLength(); i++) {
			Node node = nodeList.item(0);
			if ("Author".equals(node.getParentNode().getNodeName())) {
				addressesElmOfAuthor = (Element) node;
			}
		}
		return addressesElmOfAuthor;
	}

User Comments:
Swapna Singh:
Most simple and intuitive tool I have seen so far! Thanks!
    Reply;
easycodeforall:
Thank you so much!
    Reply

anonymous:
can you tell me which package you have used to build this?
    Reply;
easycodeforall:
we have implemented using JAXB. But algorithim is custom.
    Reply

Annonymous:
How to select a particular element based upon its position , I have multiple arrays in my xml having same element name so i have to select the element from first array only, along with other elements using Union (|) operator. How can i perform this ?
    Reply;
easycodeforall:
I have answered it above section Qauestion.1.1 . Hope it will address your need. Plese let us know if you have anyother question.
    Reply
anonymous:
Thank you so much! Here tools are sooooooooo useful!!!!!!
    Reply


Post Your Comment:
Name :
Email ( Optional*) :
Comments / Suggestion (* Required) It is required: :
: