.net - Can XPath compare hexadecimal attribute values? -
simple task. here's xpath expression:
/methods/method[@token = '06000009']/sequencepoints/entry[string(@iloffset) <= string('00000e')][last()]
and here's part of xml document query:
<methods> <method token="06000009"> <sequencepoints> <entry iloffset="000000" startline="178" startcolumn="3" /> <entry iloffset="000001" startline="179" startcolumn="4" /> <entry iloffset="000008" startline="180" startcolumn="4" /> <entry iloffset="000009" startline="181" startcolumn="5" /> <entry iloffset="00000f" startline="182" startcolumn="4" /> <entry iloffset="000010" hidden="true" /> <entry iloffset="000022" hidden="true" /> <entry iloffset="000023" startline="183" startcolumn="3" /> </sequencepoints> </method> </methods>
finds nothing. should find element:
<entry iloffset="000009" ...>
why doesn't work?
i'm not sure whether need string()
conversion. without it doesn't work either. don't want xpath compare numbers because can go wrong hex values.
xpath 2.0:
yes. in scenario comparing 2 strings. legal , should work fine. if not working using xpath 1.0.
xpath 1.0:
not really. can compare strings =
, !=
operators.
Comments
Post a Comment