Code Robo
Formatter
Comparator
Tester
Merger
Converter
Utility
Java Code Complience
Validator
EncoderDecoder
Virtual Service
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  


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;
	}


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