|
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,elements:
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
--
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
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
--
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.