Need to know the XPath derivation in DS to read an xml

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sendmkpk
Premium Member
Premium Member
Posts: 97
Joined: Mon Apr 02, 2007 2:47 am

Need to know the XPath derivation in DS to read an xml

Post by sendmkpk »

hi,

I want to know the XPath derivation for the below XML, tried to figure it out for a while, but ......

want to read the name="MK_T_9117_MOD" and value="MMA" part

Here is the xml i have

<TranslationResponse xmlns="http://w3.ibm.com/xmlns/ibmww/crm/blueh ... nfigurator" xmlns:com="http://w3.ibm.com/xmlns/ibmww/com" xmlns:sap="http://www.ibm.com/bh/cnfg/fed/documents/sap">
<IBM_GWA_Metadata>
<com:CharSet>String</com:CharSet>
</IBM_GWA_Metadata>
<Messages highestSeverity="ok">
<Message severity="ok">ok</Message>
</Messages>
<Differences/>
<Document>
<GenericSAPDocument>
<sap:Material id="9117NEW" quantity="1">
<sap:LineItem>10</sap:LineItem>
<sap:ExternalReferences instanceGUID="12DE2C7688D000002200093F84B50000"/>
<sap:CharacteristicValue name="MK_T_9117_MOD" value="MMA"/>
<sap:CharacteristicValue name="MK_MTM" value="9117MMA"/>
<sap:CharacteristicValue name="MK_PROCESS_TYPE" value="NEW"/>
<sap:CharacteristicValue name="MK_SYSTEM_TYPE" value="9117"/>
sendmkpk
Premium Member
Premium Member
Posts: 97
Joined: Mon Apr 02, 2007 2:47 am

Post by sendmkpk »

using
/sap:TranslationResponse/sap:Document/sap:GenericSAPDocument/sap:Material/sap:CharacteristicValue/@name
/sap:TranslationResponse/sap:Document/sap:GenericSAPDocument/sap:Material/sap:CharacteristicValue/@value

but no output is thrown.
sendmkpk
Premium Member
Premium Member
Posts: 97
Joined: Mon Apr 02, 2007 2:47 am

Post by sendmkpk »

also tried

/defns:TranslationResponse/defns:Document/defns:GenericSAPDocument/defns:sap:Material/defns:sap:LineItem/text()
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Could be a variety of things going on.

Just for structure's sake, I would suggest entirely removing the namespaces (just zap then in an editor in a small test document), then having a single column for CharacteristicValue and end the xpath with it (fill in the higher elements) .../.../CharacteristicValue/ Make it the repeating element and see if you get "n" rows for how many CharacteristicValue elements you have.

If not...then there's something else going on. If you get the rows you want, then at least you know the navigation is ok and it is probably a namespace issue.

What release are you using? (namespaces were a mess prior to 8.1 with FP1).

After seeing how it goes without any namespaces, what happens when you try:

/TranslationResponse/Document/GenericSAPDocument/sap:Material/sap:CharacteristicValue/

?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
sendmkpk
Premium Member
Premium Member
Posts: 97
Joined: Mon Apr 02, 2007 2:47 am

Post by sendmkpk »

hi,

imported the TD from file and did it.
Post Reply