I am creating Private Data from XML Log [Metadata.Text:Dataset="Log",Model="XML",Path="/root/textFields/textField[26]/fieldContent"]
Today the field changed from textField[26] to textField[25]. This is coming from a edocumentation.pdf from our postal software. When I put in root/textFields/textField[tag='psTotalPieces_7DM0L0Z6Y']/fieldContent I get an invalid path. I am missing anything?
Thanks
Joe
Create Private Data from XML Log
-
jchristofi
- Newbie
- Posts: 1
- Joined: Mon Jul 11, 2022 5:43 pm
Re: Create Private Data from XML Log
We found the answer, but for anyone else looking, here is is the solution.
[Metadata.Text:Dataset="Log",Model="XML",Path="/root/textFields/textField[contains(@fieldName,'psTotalPieces')]/fieldContent"]
The key change is in the predicate portion:
Before: [@fieldName='psTotalPieces_7DM0L0Z6Y']
After: [contains(@fieldName,'psTotalPieces')]
This will match any textField element where the @fieldName attribute contains the substring 'psTotalPieces', regardless of what comes before or after it.
Other usable XPath functions:
starts-with
ends-with
[Metadata.Text:Dataset="Log",Model="XML",Path="/root/textFields/textField[contains(@fieldName,'psTotalPieces')]/fieldContent"]
The key change is in the predicate portion:
Before: [@fieldName='psTotalPieces_7DM0L0Z6Y']
After: [contains(@fieldName,'psTotalPieces')]
This will match any textField element where the @fieldName attribute contains the substring 'psTotalPieces', regardless of what comes before or after it.
Other usable XPath functions:
starts-with
ends-with
-
michealjordan
- Newbie
- Posts: 1
- Joined: Tue Mar 24, 2026 4:13 am
Re: Create Private Data from XML Log
You need to clearly identify whether the tag is an attribute or a child node in the XML. If it's an attribute, add the @ symbol. If it's a child node, the syntax you're using is correct, but make sure the XML structure matches.