
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem with XPath query (pick value based on attribute in multi element)
Hi All;
I'm facing problem with XPath query in tFileInputXML, when I'm using query with element number defined:
/Tracks/SegmentTrack[1]/Value
It is working but when I use conditional:
/Tracks/SegmentTrack[Value/@type='magnetic']/Value
It returns null, I've tried with \" instead of ', but still same result. I've tested query online and it is working correctly, site used:
https://www.freeformatter.com/xpath-tester.html#ad-output
Am I doing something wrong or this kind of queries are not supported?
If not supported, do you have any suggestion without heavy string parsing?
All suggestions really appreciated.
Thank you very much
BR/Artur
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@GnuS,check the txmlinput settings,since i was able to get wth below.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@GnuS,check the txmlinput settings,since i was able to get wth below.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi;
I have to dig a bit more but you are correct it is working (real XML is bigger and cannot share it).
Thank you very much for your time and help.
BR/Artur

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All;
I hope it will be helpful for somebody, I've found the reason of my problem, XML which I'm parsing is actually double loop (example was a cut), my loop is on LEVEL_A because I want to have records per it, and searching on SegmentTrack will not work, it will simply pickup first one, that's it and will not iterate through others to find needed record. What is confusing is that online parsers does work on second loop searches. Below XML with representation of my XML.
<LEVEL_As>
<LEVEL_A seq=1>
<Tracks>
<SegmentTrack>
<Value type="true" unit="deg">341</Value>
</SegmentTrack>
<SegmentTrack>
<Value type="magnetic" unit="deg">338</Value>
</SegmentTrack>
</Tracks>
</LEVEL_A>
<Tracks>
<SegmentTrack>
<Value type="true" unit="deg">341</Value>
</SegmentTrack>
<SegmentTrack>
<Value type="magnetic" unit="deg">338</Value>
</SegmentTrack>
</Tracks>
<LEVEL_A seq=2>
</LEVEL_A>
...
<LEVEL_A seq=N>
<Tracks>
<SegmentTrack>
<Value type="true" unit="deg">341</Value>
</SegmentTrack>
<SegmentTrack>
<Value type="magnetic" unit="deg">338</Value>
</SegmentTrack>
</Tracks>
</LEVEL_A>
</LEVEL_As>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Sir,
I am new to XML and I can't actually, I also got the same error(Xpath query lost).
I am attaching the XML file in this message.
