|
wrote:
I have to say, the thing that was crazy-making about this... I really
thought I had tried allowextra and allowmissing.
That is, I thought I had exhausted all permutations of the path,
allowextra and allowmissing options along with the construction/naming of
the data structure. And I had looked all over Google for examples. Most
of the examples I found were using very straightforward XML and therefore,
not extremely helpful. Also, the DS situation becomes confusing in a hurry
to me.
Anyway, I was able to get my stuff working. :) I really appreciate
everyone taking the time to post some thoughts. It was really a life-saver.
Thank you!
cw
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Vernon Hamberg
Sent: Sunday, March 02, 2014 10:12 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: XML-INTO - new to this...
AH - have to leave something as an exercise for the reader!
I actually think it was enough to mention the allowextra, as I did in my
first post - - that's all that was needed to make Chris' code work
correctly.
Regards
Vern
On 3/2/2014 12:07 PM, Henrik Rützou wrote:
Vernon,vhamberg@xxxxxxxxxxxxxxx>wrote:
The real problem is that you never brings real wood to the fire!
On Sun, Mar 2, 2014 at 6:51 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
Vernon
to help another will never be dull regardles of the weather ;-)
On Sun, Mar 2, 2014 at 5:07 PM, Vernon Hamberg <
allowmissing=yes option.
Sounds good, Chris.
As I read it, if you don't use the allowextra, you have to make your
DS account for every element or attribute from the nodes the path
defines and down. And if you have that "text-data" situation, you
need the 6.1 PTF - but not for your situation, fortunately.
Henrik sent some nice examples of what should work for you - seems
he already tried them out!! It must be a dull day in Denmark!
I think trying both approaches is a good learning experience, as you
say
- this thing has taken a bit of practice, even for the limited use
I've made of it and the simple XML I've had to work with.
Cheers
Vern
On 3/2/2014 8:43 AM, Wyatt, Chris (FGWA-IL) wrote:
Thanks! I'm going to try this. I assumed that if it found thespecified, it would just load the DS and finish without having to go
data I
further into the nesting.
XML totally makes sense to me, but the surrounding jargon isto an "only-occasionally" programmer like myself.
confusing
I'll try allowextra. ...or build more DS to get the sessionhandlefield. It'll be a learning experience.
To Peter...rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Thank you!
We *are* at V6R1. Is that PTF more recent? I think we're up-to-date.
Thank you so much for taking the time to respond! I'm very grateful!
cw
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:
Sent: Sunday, March 02, 2014 3:40 AMdatasubf is for elements with this form -
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: XML-INTO - new to this...
To Chris - I don't think you have the issue Peter cites. The use of
<tagname attr="value">text data</tagname>'allowextra=yes' option.
Note that 'text data' has no name.
You LoginResponse element has another element within it -
SessionHandle
- this has to be part of your LocalResponse DS. Or you can try the
Here is something from the docs on XML-INTO options -specified, the operation will fail with status 00353 (XML does not
"If unexpected XML data is found, and 'allowextra=yes' is not
match RPG variable)."
HTHsays:
Vern
On 3/2/2014 2:18 AM, Peter Dow wrote:
Hi Chris,
I ran into this problem myself - at the time I was on a v5r4 machine.
Are you on v6r1 yet? See this article:
https://www.ibm.com/developerworks/community/wikis/home?lang=en#/w
iki/
We13116a562db_467e_bcd4_882013aec57a/page/Two%20new%20options%20fo
r%20
XML-INTO%20with%20a%20V6R1%20PTF
(or http://preview.tinyurl.com/xml-into-datasubf-countprefix)
which
V6R1 PTF SI34938 adds two new %XML options for the XML-INTO
operation, available for programs compiled with TGTRLS(V6R1M0) or
greater. To take advantage of this enhancement, RPG programs will
have to be recompiled with PTF SI34941.
The new options are
* datasubf
* countprefix
The/datasubf/option enables the XML-INTO operation to handle XML
elements in the following form:
<tagname attr="value">text data</tagname>
The/countprefix/option provides a way to detect the number of
subfields and subfield array elements which were set by the
XML-INTO operation. It reduces the need to specify the
opcodes as opposed to the old string methods. I thought it was/is
--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx>
pdow@xxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxx> /
On 3/1/2014 4:02 PM, Wyatt, Chris (FGWA-IL) wrote:
Hello all,
This has me tearing my hair out on a weekend... Boo.
I'm attempting to parse some XML. I'm trying to use the new(er)
the most straightforward you can imagine...
attribute.I'm trying to pull the 'true' value out of the LoginResponse
workHandle='-3369e2f8:1445eea302e:-799e' systemTimestamp='2014-02-28Here's the XML... (Yes, it's MAPICS)
<?xml version='1.0' encoding='UTF-8'?> <System-Link version='1.0'
hostVersion='1.0'>
<LoginResponse actionSucceeded='true'>
<SessionHandle value='-3369e2f8:1445eea302e:-799f'/>
</LoginResponse>
<Response sessionHandle='-3369e2f8:1445eea302e:-799f'
20:54:41.668' systemTimeZoneOffset='-6:00'>
actionSucceeded='true'/><UpdateResponse name='updateObject_ItemRevision'
that the</Response>
</System-Link>
Here's my code... (variable "rpns" is my xml)
D* Local fields
D retField S N inz(*off)
D LoginResponse DS qualified
D action...
D Succeeded 10
/FREE
// was the login request successful?
xml-into LoginResponse
%xml(rpns:'path=System-Link/LoginResponse +
case=any doc=string');
if LoginResponse.actionSucceeded='true';
retField = *on;
ENDIF;
I'm getting this error...
The XML document does not match the RPG variable; reason code 1.
Cause . . . . . : While parsing an XML document, the parser found
and theXML document does not correspond to RPG variable
loginresponse
subfield foroptions do not allow for this. The reason code is 1. The
exact
document namewhich the error was detected is loginresponse. The options are
"path=System-Link/LoginResponse case=any doc=string". The
XML
file.is *N; *N indicates that the XML document was not an
external
and 5.In the process of trial and error, I've also received reason code
4
DS. It's making me crazy.What am I doing wrong?!? I've messed with the path, the options,
the
protection is active.Thank you for your help.---
Christopher Wyatt
This email is free from viruses and malware because avast!
Antivirus
(RPG400-L) mailing list To post a message email:http://www.avast.com--
This is the RPG programming on the IBM i (AS/400 and iSeries)
RPG400-L@midrange.comTo subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-lhttp://archive.midrange.com/rpg400-l.
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
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.