On 8/28/2013 9:56 AM, RPGLIST wrote:
I don't believe so, actually I'm only attempting to extract the first
section of the document right now and there is no field like that.
Error code 12 is saying I have a mixed case, but I'm telling it in the
options to ignore any case, so I've been beating my head against the glass
:)
The case option only applies to how XML-INTO matches your the XML names
to the subfields. Problems with the case option wouldn't cause a parser
error, it would cause a status 353 error (XML document does not match
the RPG variable).
The RNX0351 message should say what offset it discovered the error at.
Error code 12 isn't complaining about the case of "XML". That's just
explaining that it might have found XML or xml or XmL. It's complaining
about finding a processing instruction with the name XML, in some case.
A processing instruction has this form:
<?PITarget PIContent?>
The <?xml at the beginning of your document looks like a processing
instruction, but it's just the XML declaration.
But if you have another <?xml later in your document, then that _would_
be a processing instruction, and I believe it's not valid for a PI to
have the name "xml".
You could try using XML-SAX with your XML file. There's a simple XML-SAX
program below that doesn't actually do anything but you can set a
breakpoint on the "return" statement in the handler and check each event
as it comes in. If the "string" pointer is set, you check the length
(stringlen) and then check the value of the string. You can watch the
progress of the parser as it works through your document and narrow down
where it's choking on the XML.
Debugging an event where the string pointer is not set
> EVAL _QRNU_XMLSAX(event)
_QRNU_XMLSAX(EVENT) = 'START_DOCUMENT '
> EVAL string
STRING = SPP:*NULL
Debugging an event where the string pointer is set
> EVAL _QRNU_XMLSAX(event)
_QRNU_XMLSAX(EVENT) = 'VERSION_INFO '
> EVAL string
STRING = SPP:00008000460840CF
> EVAL stringlen
STRINGLEN = 3
> EVAL string:c 3
STRING:C 3 = '1.0'
H dftactgrp(*no) debug(*xmlsax)
* Add a prototype for "hdlr" if you're not on 7.1
D commArea s 10a
/free
xml-sax(e) %handler(hdlr : commArea)
%xml('myfile.xml' : 'doc=file');
*inlr = '1';
/end-free
P hdlr b
D hdlr pi 10i 0
D comm like(commArea)
D event 10i 0 value
D string * value
D stringlen 20i 0 value
D exceptionId 10i 0 value
/free
return 0;
/end-free
P e
As an Amazon Associate we earn from qualifying purchases.