Posted on 2007-04-18 13:49:06-07 by ehasas
Searching same Xpath with different values.
Hi, I am using ActivePerl v5.8.8. My aim is to search a XPath in a XML file and match the respective value present. I am using "xml_is" function of "Test::XML::Simple" package. It takes i) XML file, ii) XPath and iii) Value as input and returns status accordingly. Now the problem is if same XPaht is present for two times with different values, it returns value mismatch for both the Xpath. For example- XPath 1) /Library/Book/Perl/Name and value = "Perl In NutShell" Xpath 2) /Library/Book/Perl/Name and value = "ActivePerl Handbook" and XML file is like0- - - - Perl In NutShell Text Book - ActivePerl Handbook 150.00 Now in above XML file XPath "/Library/Book/Perl/Name" is present twice but with different values. Now if I call "xml_is" function passing this XPath and one of the value, it will return as value mismatch. Is there any way to distinguish between the two cases one of repetive XPath and second actual value mismatch for unique Xpath? Thanks in anticipation, -Ehasas
Direct Responses: 7199 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.