AjayPerl has asked for the wisdom of the Perl Monks concerning the following question:
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'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML to XPath: Get xpath from xml
by space_monk (Chaplain) on Jun 14, 2013 at 04:15 UTC | |
|
Re: XML to XPath: Get xpath from xml
by Anonymous Monk on Jun 14, 2013 at 07:16 UTC | |
by AjayPerl (Initiate) on Jun 15, 2013 at 13:21 UTC | |
|
Re: XML to XPath: Get xpath from xml
by nysus (Parson) on Apr 05, 2019 at 05:40 UTC |