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
mpunktmayer
Participant
Posts: 10 Joined: Wed Apr 29, 2015 12:48 am
Post
by mpunktmayer » Wed Apr 29, 2015 12:55 am
I need to create a XML File with a structure like this:
Code: Select all
<customer>
<customernr></customernr>
<details>
<way>Phone</way>
<information>01641747162</information>
<way>Email</way>
<information>idontknow@internet.de</information>
<way>fax</way>
<information>2198362565</information>
</details>
</customer>
if I use the path in the description of the XML Output the stage aggregates the attributes into one field. I will get a xml tag output like this
I need them separated like in the example.
How can I manage this problem?
eostic
Premium Member
Posts: 3838 Joined: Mon Oct 17, 2005 9:34 am
Post
by eostic » Wed Apr 29, 2015 1:58 pm
Are phone, email, and fax additional tags with their own values? ...or are they attributes? In your example they are just plain text values inside of <way>. Is that what you want?
Ernie
mpunktmayer
Participant
Posts: 10 Joined: Wed Apr 29, 2015 12:48 am
Post
by mpunktmayer » Wed Apr 29, 2015 11:57 pm
They are plain text values inside of the attribute <way>.
eostic
Premium Member
Posts: 3838 Joined: Mon Oct 17, 2005 9:34 am
Post
by eostic » Thu Apr 30, 2015 5:37 am
show us the xpath (in the description of the input link) for each of your columns.
Ernie
mpunktmayer
Participant
Posts: 10 Joined: Wed Apr 29, 2015 12:48 am
Post
by mpunktmayer » Mon May 04, 2015 12:53 am
The example below was not real.
I tried to describe my problem as easy as possible.
This is the output I really need:
Code: Select all
<Request>
<ChgUsrId>DEG0011P</ChgUsrId>
<Customer>
<CstmrKey>5424776201</CstmrKey>
<SafekeepingAccount>
<AcctDtls>362802001</AcctDtls>
<AddressAssociations>
<DocTp>OR00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>2</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>J</PrtFmtInd>
</Details>
</AddressAssociations>
<AddressAssociations>
<DocTp>OD00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>2</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>N</PrtFmtInd>
</Details>
</AddressAssociations>
<AddressAssociations>
<DocTp>HV00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>1</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>J</PrtFmtInd>
</Details>
</AddressAssociations>
<AddressAssociations>
<DocTp>FA00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>2</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>J</PrtFmtInd>
</Details>
</AddressAssociations>
<AddressAssociations>
<DocTp>KM00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>1</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>J</PrtFmtInd>
</Details>
</AddressAssociations>
<AddressAssociations>
<DocTp>DP00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>1</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>J</PrtFmtInd>
</Details>
</AddressAssociations>
<AddressAssociations>
<DocTp>ER00</DocTp>
<Details action="I">
<Original>
<AddrSeqNb>2</AddrSeqNb>
<CstmrKey>5424776201</CstmrKey>
<PstbxInd>N</PstbxInd>
<CmltvAcctngInd>E</CmltvAcctngInd>
</Original>
<PrtFmtInd>J</PrtFmtInd>
</Details>
</AddressAssociations>
</SafekeepingAccount>
</Customer>
</Request>
xpath will be
Code: Select all
/Request/ChgUsrId/text()
/Request/Customer/CstmrKey/text()
/Request/Customer/SafekeepingAccount/AcctDtls/text()
/Request/Customer/SafekeepingAccount/AddressAssociations/DocTp/text()
/Request/Customer/SafekeepingAccount/AddressAssociations/DocTp/Details/Original/AddrSeqNb/text()
/Request/Customer/SafekeepingAccount/AddressAssociations/DocTp/Details/Original/CstmrKey/text()
/Request/Customer/SafekeepingAccount/AddressAssociations/DocTp/Details/Original/PstbxInd/text()
/Request/Customer/SafekeepingAccount/AddressAssociations/DocTp/Details/Original/CmltvAcctngInd/text()
/Request/Customer/SafekeepingAccount/AddressAssociations/DocTp/Details/PrtFmtInd/text()
eostic
Premium Member
Posts: 3838 Joined: Mon Oct 17, 2005 9:34 am
Post
by eostic » Mon May 04, 2015 5:46 am
...and do you have 7 rows coming in with AddrSeqNb? and AddrSeqNb is the key? What are you getting?
Ernie
mpunktmayer
Participant
Posts: 10 Joined: Wed Apr 29, 2015 12:48 am
Post
by mpunktmayer » Mon May 04, 2015 5:56 am
The Key is CstmrKey & AcctDtls.
For every combination there will be 7 different DocTypes with the same attributes.
If I use the posted xpath i get this output
Code: Select all
<Request>
<ChgUsrId>
DXX000P
</ChgUsrId>
<Customer>
<CstmrKey>
211212327880
</CstmrKey>
<SafekeepingAccount>
<AcctDtls>
1027123123518000
</AcctDtls>
<AddressAssociations>
<DocTp>
CR00
OD00
HV00
FA00
KM00
DP00
ER00
</DocTp>
<Details>
<Original>
<AddrSeqNb>
2
2
1
2
1
1
2
</AddrSeqNb>
<CstmrKey>
1027123123518000
1027123123518000
1027123123518000
1027123123518000
1027123123518000
1027123123518000
1027123123518000
</CstmrKey>
<PstbxInd>
N
N
N
N
N
N
N
</PstbxInd>
<CmltvAcctngInd>
E
E
E
E
E
E
E
</CmltvAcctngInd>
</Original>
<PrtFmtInd>
J
J
J
J
J
J
J
</PrtFmtInd>
</Details>
</AddressAssociations>
</SafekeepingAccount>
</Customer>
</Request>
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Mon May 04, 2015 7:03 am
mpunktmayer wrote: The example below was not real.
I tried to describe my problem as easy as possible.
ps. Never a good idea. Real examples get you real answers.
-craig
"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Posts: 3838 Joined: Mon Oct 17, 2005 9:34 am
Post
by eostic » Mon May 04, 2015 9:58 am
I can't guess what it is going to do with two of them checked, but when first doing this, make sure that your key is simply one of the columns in the "innermost" nesting.
It's really a "repetition element" and helps outline what the lowest level repeating node will be.
You can and should play with it, but the first one I would try is AddrSeqNb ...and if that doesn't work, the problem may simply be that you don't have any uniqueness to the groups (they all pertain to the same customer key value).
...and hmm. Look at DocTp...that looks like the natural separator. ...and if I am looking at it correctly, you have it modeled this way in your xpath, but it is NOT that way in your written example. DocTp is not the parent in the example xml, but it is in your xpath spec. Check that very carefully.
Ernie