Posted: Fri Feb 21, 2003 10:38 am Post subject: Losing Attributes on tree assignment
Apprentice
Joined: 05 Jun 2002 Posts: 34 Location: New York
Hi,
I am building an RFH2 with a usr folder by assigning values from an incoming XML message. The inbound XML has <key> elements with attributes like this:
<TESTDATA>
<RUNNUMBER>1000010</RUNNUMBER>
<RUNTYPE>RUN</RUNTYPE>
<INTERFACENAME>ESIINVOICE</INTERFACENAME>
<SOURCECAT>NORMAL</SOURCECAT>
<REGID>1</REGID>
<SEQUNCENUM>1</SEQUNCENUM>
<APPLICATIONDATA>
<KEYS>
<key name="InvoiceNumber">503555</key>
<key name="InvoiceTotal">150000.00</key>
</KEYS>
</APPLICATIONDATA>
<SAMPLE>TEST ONE</SAMPLE>
</TESTDATA>
When I assign the <APPLICATIONDATA> all the keys get moved to the OutputRoot but I lose the attributes. Is this the way it is supposed to work?
Here is my output in <usr> folder:
<ADAPTER type="Adapter"><INTERFACENAME>ESIINVOICE</INTERFACENAME><RUNNUMBER>1000010</RUNNUMBER><RUNTYPE>RUN</RUNTYPE><SOURCECAT>NORMAL</SOURCECAT><REGID>1</REGID>
<APPLICATIONDATA><KEYS>
<key>503555</key><key>150000.00</key></KEYS>
</APPLICATIONDATA></ADAPTER>
notice the <key> elements no longer have attributes.
Here is my ESQL:
SET OutputRoot.MQRFH2.usr.ADAPTER.(XML.attr)type='Adapter';
SET OutputRoot.MQRFH2.usr.ADAPTER.INTERFACENAME = InputRoot.XML.TESTDATA.INTERFACENAME;
SET OutputRoot.MQRFH2.usr.ADAPTER.RUNNUMBER = InputRoot.XML.TESTDATA.RUNNUMBER;
SET OutputRoot.MQRFH2.usr.ADAPTER.RUNTYPE = InputRoot.XML.TESTDATA.RUNTYPE;
SET OutputRoot.MQRFH2.usr.ADAPTER.SOURCECAT= InputRoot.XML.TESTDATA.SOURCECAT;
SET OutputRoot.MQRFH2.usr.ADAPTER.RUNNUMBER = InputRoot.XML.TESTDATA.RUNNUMBER;
SET OutputRoot.MQRFH2.usr.ADAPTER.BATCHSIZE = InputRoot.XML.TESTDATA.BATCHSIZE;
SET OutputRoot.MQRFH2.usr.ADAPTER.REGID = InputRoot.XML.TESTDATA.REGID;
SET OutputRoot.MQRFH2.usr.ADAPTER.SEQUENCENUM = InputRoot.XML.TESTDATA.SEQUENCENUM;
SET OutputRoot.MQRFH2.usr.ADAPTER.APPLICATIONDATA = InputRoot.XML.TESTDATA.APPLICATIONDATA;
SET OutputRoot.XML.SAMPLE = InputRoot.XML.TESTDATA.SAMPLE;
Does this mean I have to assign each element/attribute individually?
Thanks!
hi,
as far as i know, the formal RFH2 spec prohibits the use of XML attributes in the usr folder. only flat structures are allowed.
depending on what you aim with the RFH2 data, consider bitstreaming the data before putting it into the RFH2.
coding would be something like:
SET OutputRoot.MQRFH2.usr.APPLICATIONDATA = ASBITSTREAM(InputRoot.XML.TESTDATA.APPLICATIONDATA);
of course, before accessing the usr data in your target application, you will have to perform an explicit parse on the bitstream. in ESQL this could be achieved by using the CREATE FIELD function, e.g.
CREATE LASTCHILD OF OutputRoot.XML.TESTDATA DOMAIN 'XML' PARSE (InputRoot.MQRFH2.usr.APPLICATIONDATA);
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum