Putting information from XML-Paths in an Array

Post Reply
w2pcrew
Newbie
Posts: 3
Joined: Thu Apr 19, 2018 11:59 am

Putting information from XML-Paths in an Array

Post by w2pcrew »

Hello, I got a XML-File looking kind of like this:

<Report>
<PreflightResult errors="0" criticalfailures="0" noncriticalfailures="0" signoffs="0" fixes="0" warnings="2">
<PreflightResultEntry type="Check" level="warning">
<PreflightResultEntryMessage xml:lang="de-DE">
<Message>Number of pages is wrong </Message>
</PreflightResultEntryMessage>
</PreflightResultEntry>
<PreflightResultEntry type="Check" level="warning">
<PreflightResultEntryMessage xml:lang="de-DE">
<Message> Size is wrong</Message>
</PreflightResultEntryMessage>
</PreflightResultEntry>
...
</PreflightResult>
</Report>

Now I want to select all the "<message>"-tags. But i dont know how many there are, because every report can be different. So my idea was to select them in an array, and I could do this by using "Metadata.TextIndexed", but Switch shows an error that only a single path can be selected.

I hope I was able to describe my problem correctly, I'd be glad if someone maybe could help me.
Thanks in advance,
w2pcrew
Arthur
Member
Posts: 114
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Putting information from XML-Paths in an Array

Post by Arthur »

I would be inclined to say you need a XSLT transformation to return only the Message values in a new XML. This way you will have only what you need :)
But the XSLT is not so much of my fields of expertise, so should that be the case - I'd leave that to have more experienced folks here to help you with this :)
r.zegwaard
Member
Posts: 93
Joined: Fri Jul 08, 2011 10:31 am
Location: The Netherlands

Re: Putting information from XML-Paths in an Array

Post by r.zegwaard »

When building the location path, you sould set the "Location path syntax" to "XPath expression" and then set "Result data type" to "Text Indexed".
This wil result in a ;-separated list.
Post Reply