Reputation: 146
I am stuck trying to get multiple XML with XPaths.
Two XML files and XPaths are like this:
<?xml version="1.0" encoding="UTF-8"?>
<bq:ProcessB xmlns:bq="http://www.w3.com/xxml/1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:oa="http://www.openapplications.org/oagis/9" languageCode="en-US">
<oa:ApplicationArea xmlns:IOutput="com.wm.pkg.xslt.extension.IOutputMap">
<oa:Sender>
<oa:ID>A12345</oa:ID>
<oa:File>testing1.xml</oa:File>
<oa:ComID>BALON</oa:ComID>
<oa:RefID>1123</oa:RefID>
</oa:Sender>
<oa:MUSIC>TEST-0000-000-0000</oa:MUSIC>
</oa:ApplicationArea>
</bq:ProcessB>
XPath:
record.bq.music = /bq:ProcessB/oa:ApplicationArea/oa:MUSIC
record.bq.fields.ID = /bq:ProcessB/oa:ApplicationArea/oa:Sender/oa:ID
And second XML and XPath:
<?xml version="1.0" encoding="UTF-8"?>
<bq:ProcessA xmlns:bq="http://www.w3.com/xxml/1" xmlns:oa="http://www.openapplications.org/oagis/9">
<bq:ProcessB languageCode="en-US" systemEnvironmentCode="QAS" releaseID="6.20">
<oa:ApplicationArea>
<oa:Sender>
<oa:ID>A12345</oa:ID>
<oa:File>testing1.xml</oa:File>
<oa:ComID>BALON</oa:ComID>
<oa:RefID>1123</oa:RefID>
</oa:Sender>
<oa:MUSIC>TEST-0000-000-0000</oa:MUSIC>
</oa:ApplicationArea>
</bq:ProcessB>
</bq:ProcessA>
XPath:
record.bq.music = /bq:ProcessA/bq:ProcessB/oa:ApplicationArea/oa:MUSIC
record.bq.fields.ID = /bq:ProcessA/bq:ProcessB/oa:ApplicationArea/oa:Sender/oa:ID
I have tried these wildcards but one works or the other. I can't get both xml to work with a single xpath expression instead of two.
*
//
axes - ancestor-or-self
Upvotes: 0
Views: 381
Reputation:
The two XPath expressions
//oa:ApplicationArea/oa:MUSIC
and
//oa:ApplicationArea/oa:Sender/oa:ID
work on both XML documents, given the NS prefix bq
is defined.
Upvotes: 1