Based on an article in SystemINetwork on 14th May 2009 from you we have coded a program to reveive
and proces XML-files using the XML-SAX function.
In the xmlHandler procedure there is a select - endsl structure like this:
Code: Select all
P xmlHandler B
D xmlHandler PI 10i 0
D ignore 1a
D event 10i 0 value
D string * value
D stringLen 20i 0 value
D exceptionId 10i 0 value
D value s 65535a based(String)
D ucs2val s 16363c based(String)
.
.
.
select;
when event = *XML_START_DOCUMENT;
.
.
when event = *XML_START_ELEMENT;
depth += 1;
if depth = 1;
stackname(depth) = '/' + %subst(value:1:stringLen);
else;
stackname(depth) = stackname(depth-1) + '/'
+ %subst(value:1:stringLen);
endif;
stackval(depth) = '';
when event = *XML_ATTR_NAME;
depth += 1;
stackname(depth) = stackname(depth-1) + '/@'
+ %subst(value:1:stringLen);
stackval(depth) = '';
when event = *XML_END_ELEMENT
.
.
when event = *XML_CHARS
or event = *XML_PREDEF_REF
or event = *XML_ATTR_CHARS
or event = *XML_ATTR_PREDEF_REF;
stackval(depth) += %subst(value:1:stringLen);
when event = *XML_UCS2_REF
or event = *XML_ATTR_UCS2_REF;
stackval(depth) += %char(%subst( ucs2val : 1
: %div(stringLen:2) ));
endsl;
This would cause this event *XML_UCS2_REF or *XML_ATTR_UCS2_REF to happen and convert the value in ucs2val
to be converted from ucs2 to ebcdic and saved in stackval.
So far so good.
But what about the *XML_START_ELEMENT and *XML_ATTR_NAME ?
Aren't they also in ucs2 format?
But here it looks like they are returned in the jobs ccsid. In this case EBCDIC.
Is it so so if you specify the option "ccsid=ucs2" then the data are returned in ucs2 format but
the element and the attribut-name is returned in ebcdic?
Kind regards
Peder Udesen