Hello, I’m new with CloverETL and I’m encountering a problem in parsing an XML file.
The file has a structure like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
<cs:Results xmlns:cs="http://www.endeca.com/MDEX/conversation/2/0"
xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
<cs:ContentElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="cs:LQL" Id="LQLConfig">
<cs:ResultRecords NumRecords="390" Name="Posts">
<cs:DimensionHierarchy />
<cs:AttributeMetadata name="FactPost_PostId"
type="mdex:string" />
<cs:AttributeMetadata name="FactPost_TimeId"
type="mdex:string" />
<cs:AttributeMetadata name="FactPost_Type"
type="mdex:string" />
<cs:Record>
<cs:attribute name="FactPost_PostId" type="mdex:string">100002635219620_411535012277669
</cs:attribute>
<cs:attribute name="FactPost_TimeId" type="mdex:string">2013-05-01T01:49:35+0000
</cs:attribute>
<cs:attribute name="FactPost_Type" type="mdex:string">FB_POST_SEARCH_1
</cs:attribute>
</cs:Record>
<cs:Record>
<cs:attribute name="FactPost_PostId" type="mdex:string">420550781295893_592578997426403
</cs:attribute>
<cs:attribute name="FactPost_TimeId" type="mdex:string">2013-05-01T03:17:52+0000
</cs:attribute>
<cs:attribute name="FactPost_Type" type="mdex:string">FB_POST_SEARCH_1
</cs:attribute>
</cs:Record>
</cs:ResultRecords>
</cs:ContentElement>
</cs:Results>
</soapenv:Body>
</soapenv:Envelope>
I’ve tried with this mapping code:
<Context xpath="/soapenv:Envelope" outPort="0" namespacePaths='soapenv="http://schemas.xmlsoap.org/soap/envelope/";cs="http://www.endeca.com/MDEX/conversation/2/0"'>
<Context xpath="./soapenv:Body/cs:Results/cs:ContentElement/cs:ResultRecords">
<Mapping cloverField="FactPost_PostId" xpath="./cs:Record/cs:attribute[@name='FactPost_PostId']" />
<Mapping cloverField="FactPost_TimeId" xpath="./cs:Record/cs:attribute[@name='FactPost_TimeId']" />
<Mapping cloverField="FactPost_Type" xpath="./cs:Record/cs:attribute[@name='FactPost_Type']" />
</Context>
</Context>
With this mapping code I get an error, which says that “Result of xpath filling field ‘FactPost_PostId’ contains two or more values!”
How can I parse the above XML source for getting 2 records each with the three attributes “FactPost_PostId”, “FactPost_TimeId” and “FactPost_TimeId”?