XML-INTO - new to this...

"Wyatt, Chris (FGWA-IL)" <[email protected]>
Newsgroups gmane.comp.systems.as400.mapics,gmane.comp.lang.as400.rpg
Message-ID <4beab616d53a49f08ff241380bce512b@DM2PR05MB640.namprd05.prod.outlook.com>
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) opcodes as opposed to the old string methods.  I thought it was/is the most straightforward you can imagine...

I'm trying to pull the 'true' value out of the LoginResponse attribute.

Here'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' workHandle='-3369e2f8:1445eea302e:-799e' systemTimestamp='2014-02-28 20:54:41.668' systemTimeZoneOffset='-6:00'>
		<UpdateResponse name='updateObject_ItemRevision' actionSucceeded='true'/>
	</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 that the 
  XML document does not correspond to RPG variable loginresponse and the     
  options do not allow for this. The reason code is 1. The exact subfield for
  which the error was detected is loginresponse. The options are             
  "path=System-Link/LoginResponse case=any doc=string". The XML document name
  is *N; *N indicates that the XML document was not an external file.        

In the process of trial and error, I've also received reason code 4 and 5.

What am I doing wrong?!?  I've messed with the path, the options, the DS.  It's making me crazy.

Thank you for your help.

Christopher Wyatt



-- 
This is the MAPICS ERP System Discussion (MAPICS-L) mailing list
To post a message email: MAPICS-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/mapics-l
or email: MAPICS-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/mapics-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.