|
I cannot see how that would be terribly useful Mark - optional elements and attributes would pose an interesting problem - and how would you ever know if you'd got it right?
I wish someone could explain to me why the current method of name/structure mapping is apparently so problematic? It seems to me the most intuitive and easy to understand - why make it harder?
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Mar 25, 2018, at 12:13 AM, mlazarus<mlazarus@xxxxxxxxxxxx> wrote:
Jon,
How about by relative position? I would like this as an option for the Eval-Corr keyword, too.
-mark
On 3/24/2018 12:46 PM, Jon Paris wrote:
Not wishing to be rude to anyone - but I have never understood why people have so many problems understanding this. If there wasn't a requirement for the names/structure to match how on earth could it possibly work without some additional parameter providing a "this element goes in this field" mapping?--
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Mar 24, 2018, at 8:26 AM, Vernon Hamberg<vhamberg@xxxxxxxxxxxxxxx> wrote:
I admit that sometimes IBM's documentation has to be read a few times to get what it means - saying that, here is something pretty far down the opening page for XML-INTO:
* The XML data for an RPG data structure is expected to have an XMLThe key phrase, "same name", is the thing - and at first it doesn't seem to have the strength of the requirement we have here - but it does.
element with the same name as the data structure and child
elements and/or attributes with the same names as the RPG subfields.
Anyhow, I have been a "victim" of this at the beginning of using this op-code, so you are not alone.
Regards
Vern
On 3/23/2018 10:51 AM, SCOURTNEY@xxxxxxxxxxx wrote:
Thanks a million Craig and Barbara ...
I read a load of documentation but nothing stated that I needed to use the original element tags ..
Just tried it out and eureka ...
Thanks ...
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Craig Richards
Gesendet: Friday, 23 March 2018 16:48
An: RPG programming on the IBM i (AS/400 and iSeries)
Betreff: Re: RPGLE XML-INTO
Well ok, since I did most of it already - here is how you could do it in one xml-into:
Dcl-S XMLDoc VarChar( 512 );
Dcl-DS docID Qualified Template;
ProprietaryDocumentIdentifier Char( 26 );
End-Ds;
Dcl-DS genDate Qualified Template;
datetimestamp Char( 26 );
End-Ds;
Dcl-DS ASN Qualified;
thisDocumentGenerationDateTime LikeDS( genDate );
thisDocumentIdentifier LikeDS( docID );
End-Ds;
XMLDoc = '<ASN>'
+ '<thisDocumentGenerationDateTime>'
+ '<DateTimeStamp>19.03.2018 08:50:55</DateTimeStamp>'
+ '</thisDocumentGenerationDateTime>'
+ '<thisDocumentIdentifier>'
+ '<ProprietaryDocumentIdentifier>87323619.03.2018
08:50:55</ProprietaryDocumentIdentifier>'
+ '</thisDocumentIdentifier>'
+ '</ASN>';
Xml-Into ASN
%Xml( XMLDoc : 'path=ASN case=any allowmissing=yes' );
regards,
Craig
On 23 March 2018 at 15:32, Craig Richards<craig@xxxxxxxxxxxxxxxx> wrote:
Sean,
You need to make sure at the level you path to that your xml elements
match the data structure subfield names.
here is an example using 2 separate xml-into with your data.
You could do it with one xml-into if you build a more nest
datastructure but you'd need to match more subfield names to the xml elements:
I'm not staying this is the best way to parse that document, I'm a bit
pressed for time but this example will show you something that works
Dcl-S XMLDoc VarChar( 512 );
Dcl-DS thisDocId_T;
ProprietaryDocumentIdentifier Char( 26 );
End-Ds;
Dcl-DS docGenDate_T;
datetimestamp Char( 26 );
End-Ds;
Dcl-DS ASN Qualified;
docGenDate LikeDS( docGenDate_T );
thisDocid LikeDS( thisDocId_T );
End-Ds;
XMLDoc = '<ASN>'
+ '<thisDocumentGenerationDateTime>'
+ '<DateTimeStamp>19.03.2018 08:50:55</DateTimeStamp>'
+ '</thisDocumentGenerationDateTime>'
+ '<thisDocumentIdentifier>'
+ '<ProprietaryDocumentIdentifier>87323619.03.2018
08:50:55</
ProprietaryDocumentIdentifier>'
+ '</thisDocumentIdentifier>'
+ '</ASN>';
Xml-Into ASN.docGenDate
%Xml( XMLDoc : 'path=ASN/thisDocumentGenerationDateTime
case=any allowmissing=yes' );
Xml-Into ASN.thisDocid
%Xml( XMLDoc : 'path=ASN/thisDocumentIdentifier case=any
allowmissing=yes' );
regards,
Craig
On 23 March 2018 at 14:36,<SCOURTNEY@xxxxxxxxxxx> wrote:
Hello all,
I am playing around with XML-INTO and for some reason cannot get this
example to work :
I keep getting : RNX0353 The XML document does not match the RPG
variable;
Example XML
<ASN>
<thisDocumentGenerationDateTime>
<DateTimeStamp>19.03.2018
08:50:55</DateTimeStamp>
</thisDocumentGenerationDateTime>
<thisDocumentIdentifier>
<ProprietaryDocumentIdentifier>87323619.03.2018
08:50:55</ProprietaryDocumentIdentifier>
</thisDocumentIdentifier>
</ASN>
RPG CODE
d ASN ds qualified
d docGenDate LikeDS(docGenDate_T)
d thisDocid LikeDS(thisDocId_T )
*-----------------------------------------
* thisdocumentgenerationdatetime
*-----------------------------------------
d docGenDate_T ds
d datetimestamp 26
*-----------------------------------------
* thisdocumentidentifier
*-----------------------------------------
d thisDocId_T ds
* proprietarydocumentidentifier
d docId 26
XML-INTO ASN %XML(XML_Source: 'doc=file +
case=any +
allowmissing=yes');
Any help would be greatly appreciated.
Mit freundlichen Grüßen / Kind regards / Bien à vous,
Sean
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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: http://amzn.to/2dEadiD
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.