|
On Mar 14, 2019, at 12:07 PM, Stephen Coyle <stephenfcoyle@xxxxxxxxx> wrote:
Ok...thank you....following up....
Both the XML and the RPG were only partial listings of what I'm actually
working with.
The actual XML content will have elements that I am not defining in the
data structure so I coded the allowextra.
The XML content also has elements that are not dimensions of an array that
may be missing data.
I understand how allowmissing=yes can be replaced by count fields on array
elements that may not be present in the XML.
Isn't allowmissing=yes still needed if I have stand alone elements not in
an array that may not have data?
As for the DS definition, I did not code OrderID as an array because I'm
not sure how to mirror the content of the XML I was sent.
That is my primary issue....how to define the DS to mimic the structure
I've been given.
It seems they have multiple OrderID, Brand and Division elements at the
same level without them being wrapped in parent tags.
If all elements associated with an OrderID were wrapped in <Order> </Order>
tags, I could define Order as an array in the DS.
But OrderID, Brand and Division seem to be stand alone under
<OrderInformation>, but there is more than 1 of each being sent.
I've removed the detail under <InvoiceOrderItems> in this snippet to better
see the structure.
I apologize if I am not explaining this well.
The only way I can see to define the DS would be defining each OrderID
separately and I don't want to do that.
-<OrderInformation>
*<OrderID>9000</OrderID>*
<Brand>MyBrand</Brand>
<Division>Div100</Division>
-<InvoiceOrderItems>
</InvoiceOrderItems>
*<OrderID>9001</OrderID>*
<Brand>MyBrand</Brand>
<Division>Div100</Division>
-<InvoiceOrderItems>
</InvoiceOrderItems>
</OrderInformation>
Thanks again,
- Steve
On Thu, Mar 14, 2019 at 10:35 AM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:
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
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.