|
Well it is not an array so how would it ever have more than one?
You also made the mistake of saying allowextra (which is OK but don't use
it unless you need it) and allowmissing which if you are using countprefix
you should never need to use. In fact you should try and avoid it like the
plague because (as you have seen here) it allows RPG to all you everything
was OK when it clearly wasn't.
I haven't time to dig in in detail but I think you need something more
like this:
Dcl-DS OrderInformation;
OrderID varchar(50) ;
Brand varchar(50) ;
Division varchar(50) ;
countInvoiceOrderItems int(5);
Dcl-DS InvoiceOrderItems;
countItem int(5);
Dcl-DS Item Dim(10);
ItemShipDate varchar(50) ;
Carrier varchar(50) ;
End-DS ;
End-DS ;
End-DS ;
Then remove allowmssing and allowextra.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Mar 14, 2019, at 9:49 AM, Stephen Coyle <stephenfcoyle@xxxxxxxxx>wrote:
was
Hi All,
So I'm finally getting a chance to play with XML-INTO and I thought it
going pretty good.elements
Then this came up....
In the sample below the data structure only gets populated with OrderID
9000.
OrderID 9001 gets dropped.
Not sure how to make multiple OrderID elements populate into a DS array.
It seems to me that there are multiple OrderID, Brand and Division
within OrderInformation.the
I understand how it would be ambiguous but do not know how to structure
DS to capture it.Order
Do I need to ask the XML supplier to wrap each order within their own
tag?didn't
Here is the XML and RPG.
I know the XML-INTO is referencing structures and an XML path that I
copy into the email...only showing the relevant bits.allowmissing=yes');
Thanks in advance for any info,
- Steve
-<OrderInformation>
<OrderID>9000</OrderID>
<Brand>MyBrand</Brand>
<Division>Div100</Division>
-<InvoiceOrderItems>
-<Item Num="1">
<ItemShipDate>2019-01-16T00:00:07+00:00</ItemShipDate>
<Carrier>FEDEX</Carrier>
</Item>
-<Item Num="2">
<ItemShipDate>2019-01-16T00:00:07+00:00</ItemShipDate>
<Carrier>FEDEX</Carrier>
</Item>
</InvoiceOrderItems>
<OrderID>9001</OrderID>
<Brand>MyBrand</Brand>
<Division>Div100</Division>
-<InvoiceOrderItems>
-<Item Num="1">
<ItemShipDate>2019-01-16T00:00:07+00:00</ItemShipDate>
<Carrier>FEDEX</Carrier>
</Item>
</InvoiceOrderItems>
</OrderInformation>
Dcl-DS OrderInformation;
OrderID varchar(50) ;
Brand varchar(50) ;
Division varchar(50) ;
Dcl-DS InvoiceOrderItems;
Dcl-DS Item Dim(10);
ItemShipDate varchar(50) ;
Carrier varchar(50) ;
End-DS ;
End-DS ;
End-DS ;
XML-INTO FactoryInvoice
%Xml(%Trim(@XMLPath):
'case=any doc=file countprefix=count
path=ReceiverID/SenderID/FactoryInvoice allowextra=yes
--questions.
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
link: https://amazon.midrange.com
Help support midrange.com by shopping at amazon.com with our affiliate
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.