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
-
PorterButler
- Newbie
- Posts: 1
- Joined: Mon Feb 09, 2026 4:07 pm
- Location: vietnam
Re: Create Private Data from XML Log
This method is more stable than using index [25] or [26], which are easily changed when the provider adjusts the PDF/XML structure.
PorterButler, I will bring you completely msn games new knowledge.