Page 1 of 1

XML Output with recursive fields

Posted: Wed Apr 29, 2015 12:55 am
by mpunktmayer
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

Code: Select all

<way>
	Phone
	Email
	fax
</way>	
I need them separated like in the example.
How can I manage this problem?

Posted: Wed Apr 29, 2015 1:58 pm
by eostic
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

Posted: Wed Apr 29, 2015 11:57 pm
by mpunktmayer
They are plain text values inside of the attribute <way>.

Posted: Thu Apr 30, 2015 5:37 am
by eostic
show us the xpath (in the description of the input link) for each of your columns.

Ernie

Posted: Mon May 04, 2015 12:53 am
by mpunktmayer
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()

Posted: Mon May 04, 2015 5:46 am
by eostic
...and do you have 7 rows coming in with AddrSeqNb? and AddrSeqNb is the key? What are you getting?

Ernie

Posted: Mon May 04, 2015 5:56 am
by mpunktmayer
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>

Posted: Mon May 04, 2015 7:03 am
by chulett
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.

Posted: Mon May 04, 2015 9:58 am
by eostic
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