Multiple Expression Execution on XPath
How to specify Multiple XPath Expression at a time Sometimes we need to specify multiple XPath e xpressions to evaluate XML file. For instance let's consider the following XML File. <FieldCollection> <VarificationField> <CreditCardNumber>378291726006009</CreditCardNumber> <CreditCardCVV>1234</CreditCardCVV> <fieldName>CreditCard</fieldName> </VarificationField> </FieldCollection> Say we need to select two different nodes say CreditCardNumber and CreditCardCVV out of a xml file and mask them. We can use "|" separator for specifying more then one path, like as follows. //*/CreditCardNumber/text() | //*/CreditCardCVV/text() As shown above we piped two different XPath to build a single XPathExpression which would be used to evaluate the XML documents. String path = "//*/CreditCardNumber/text() | //*/CreditCardCVV/text() "; XPathFactory factory = XPathFactory.newInstance...