Is there a way in PERL to parse an XML file and creates XPath expressions for each element encountered.
My goal is to achieve following from this ex xml file :
<root> <elemA>one</elemA> <elemA attribute1='first' attribute2='second'>two</elemA> <elemB>three</elemB> <elemC> <elemB>five</elemB> </elemC> </root> to produce the following output : //root[1]/elemA[1]='one' //root[1]/elemA[2]='two' //root[1]/elemA[2][@attribute1='first'] //root[1]/elemA[2][@attribute2='second'] //root[1]/elemB[1]='three' //root[1]/elemC[1]/elemB[1]='five'
In reply to XML to XPath: Get xpath from xml by AjayPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |