XML NODE
<!-- url path="/jsp/Admin_BetaSignup.jsp" roles="ZohoCampaignAdmin" authentication="optional" description="Page used to add the Beta users">
<param name="zuid" xss="throwerror" max-len="300"/>
</url -->
I Want to select this node via xpath . I use below code in java .
Document document = DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
.parse("/home/local/ZOHOCORP/bharathi-1397/build/AdventNet/Sas/webapps/zcadmin/WEB-INF/security.xml");
XPath xpath = XPathFactory.newInstance().newXPath();
System.out.println(
xpath.evaluate("//comment()[@path='/jsp/Admin_BetaSignup.jsp']",
document,XPathConstants.NODE)
);
Output : null .
Why?
Use:
XSLT – based verification:
when this transformation is applied on the XML document below:
the wanted comment node is selected and copied to the output: