I am trying to parse xml document with a certain format. The issue rises when I have values of the tags embedded b/w comments, e.g.
<document>
<field loc="field1">field name 1</field>
<field loc="field2"><!--this is a comment-->field name 2<!--also a comment--></field>
</document>
I can get the value for field1 but when I try to get the value for field2, it fails:
/document/field[@loc='field2']
any help will be appreciated.
thanks
Well
/document/field[@loc = 'field2']should suffice to find the string value of that field, independent of the presence of any comments inside the element. Or do you want to select the comments as well?