× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

what you can do is, insert this in your options: ns=remove
This will ignore the namensspaces in your XML paths.

Like this:
options = 'doc=file +
path=Message/Header/Documents/Document +
case=any +
ns=remove +
allowextra=yes +
allowmissing=yes';

KF

-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] Im Auftrag von
Hudson, Ron
Gesendet: Mittwoch, 2. Juni 2021 13:04
An: RPG programming on IBM i
Betreff: RE: How to process a : in the field name of a XML document

Thanks Jon. Very simple once you know the trick.


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Tuesday, June 1, 2021 4:55 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How to process a : in the field name of a XML document

Thos are namespaces. You just need to tell XML-INTO what to do with them.
You can either merge them into the name (so ns1:myfield becomes ns1_myfield)
or remove them (so it becomes simply myfield).

I wrote about it here;
https://www.itjungle.com/2018/09/05/guru-an-introduction-to-processing-xml-w
ith-rpg-part-3/
<https://www.itjungle.com/2018/09/05/guru-an-introduction-to-processing-xml-
with-rpg-part-3/>


Jon Paris

On Jun 1, 2021, at 3:04 PM, Hudson, Ron <RonHudson@xxxxxxxxx> wrote:

Starting to do business with a new 3rd party warehouse. Their XML
documents contain a ":" which RPG doesn't like.
Is there any trick to processing this?

Below is a fragment of the RPG code that would work if it wasn't for the
":". My only idea is to write a program to remove the ":" before
processing, which would be a last resort.

D ns0:Document DS qualified
D ns0:ExternalDocumentNo...
D 12a
D ns0:ExternalReference...
D 4a
D ns0:DocumentLines...
D likeds(DocLines_t)

D DocLines_t DS qualified
D based(Template)
D ns0:DocumentLine...
D likeds(DocLine_t)
D dim(999)

D DocLine_t DS qualified
D based(Template)
D ns0:OrderQuantity...
D 9a
.
.
.
options = 'doc=file +
path=ns0:Message/ns0:Header/ns0:Documents/ns0:Document +
case=any +
allowextra=yes +
allowmissing=yes';

XML-Into ns0:Document %xml(IFS_PathFile: options);


Portion of XML file:
<ns0:Message>
<ns0:Header>
<ns0:MessageID>35772</ns0:MessageID>
<ns0:CreationDateTime>2021-05-31T12:57:41</ns0:CreationDateTime>
<ns0:ProcesAction>INSERT</ns0:ProcesAction>
<ns0:FromTradingPartner>LOGWISE</ns0:FromTradingPartner>
<ns0:ToTradingPartner>INVUE</ns0:ToTradingPartner>
<ns0:Database>Dynamics_RAPP_115</ns0:Database>
<ns0:CompanyName>Logwise Amsterdam BV</ns0:CompanyName>
<ns0:Information>SND-SHIPMENT</ns0:Information>
</ns0:Header>
<ns0:Documents>
<ns0:Document>
<ns0:DocumentType>2</ns0:DocumentType>
<ns0:No>U210001407</ns0:No>
<ns0:Customer>
<ns0:No>K00102</ns0:No>
<ns0:EANCode>INVUE</ns0:EANCode>
<ns0:Name>Invue Security Products</ns0:Name>
<ns0:Address>Saturnusstraat 17d</ns0:Address>
<ns0:City>Hoofddorp</ns0:City>
<ns0:PostCode>2132 ND</ns0:PostCode>
<ns0:CountryRegionCode>NL</ns0:CountryRegionCode>
<ns0:CountryName>Nederland</ns0:CountryName>
<ns0:Contact>Simon Schipper</ns0:Contact>
<ns0:PhoneNo>023-8900150</ns0:PhoneNo>
<ns0:VATRegistrationNo>NL806855356B01</ns0:VATRegistrationNo>

<ns0:E-Mail>SimonSchipper@xxxxxxxxx</ns0:E-Mail<mailto:SimonSchipper@invue.c
om%3c/ns0:E-Mail>>
<ns0:PaymentTermsCode>30</ns0:PaymentTermsCode>
</ns0:Customer>

Thanks
Ron


--
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@xxxxxxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxxxxxxxxx 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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.