|
On Jul 12, 2019, at 6:20 PM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:
On 2019-07-12 2:05 PM, Marvin Radding wrote:
...
<OTLocation DisplayName="Location" Protocol="http" ... more attributes >
<![CDATA[2000 152748 663513 663526 810132]]>
<Value source="core">2000 152748 663513 663526 810132</Value>
</OTLocation>
... -----------------------------------------------------------------------------------
xml-into output %xml(%trim(resultxml) :
' doc=file '
+ ' datasubf=data '
+ ' case=any ' );
Marvin, your XML has more XML child elements for OTLocation following the data for OTLocation. Even with datasubf, XML-INTO doesn't support that.
The doc page about datasubf says this:
"The values for all the other subfields of the data structure must be set by attributes. Therefore, the item cannot have any child items, and the other subfields of the data structure must all be scalar subfields."
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasd/datasubfopt.htm
I made a little example similar to yours, and I found that I could get all the data if I did the XML-INTO twice, once with datasubf and then again without datasubf. I had to code allowextra and allowmissing for both.
dcl-ds ds qualified;
a char(10);
b char(10);
data char(10);
end-ds;
dcl-s theXml varchar(100);
theXml = '<ds a="aaa">'
+ 'some data'
+ '<b>bbb</b>'
+ '</ds>';
xml-into ds %xml(theXml
: 'datasubf=data allowextra=yes allowmissing=yes');
xml-into ds %xml(theXml
: 'allowextra=yes allowmissing=yes');
return;
In debug, after the first XML-INTO:
EVAL dsDS.A = 'aaa '
DS.B = ' '
DS.DATA = 'some data '
After the second XML-INTO:
EVAL dsDS.A = 'aaa '
DS.B = 'bbb '
DS.DATA = 'some data '
--
Barbara
--
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-2025 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.