From: droide on
Hi, all,

I'm exploring the LIBNAME XML engine, and the following test code in
particular:

options nocenter noxwait xsync;

%put ENCODING=%sysfunc(getoption(encoding));

data tmp ( encoding = latin1 );
length char $1 htmlencode $20;
do ade = 0 to 255;
char = byte( ade );
htmlencode = htmlencode( char, 'amp gt lt apos quot 7bit' );
diff = ( char = htmlencode );
htmldecode = htmldecode( htmlencode );
ade2 = rank( htmldecode );
ok = ( char = htmldecode );
output;
end;
stop;
run;

proc print data = tmp; var ade ade2 htmlencode diff ok; run;

libname xmlfile xml "tmp.xml" xmlencoding = latin1;
data xmlfile.tmp; set tmp ( encoding = latin1 ); run;
data tmp2 ( encoding = latin1 ); set xmlfile.tmp; run; /* error occurs
after this run */

proc compare listall base = tmp compare = tmp2; run;

The first error message in the log is:

23 data tmp2 ( encoding = latin1 ); set xmlfile.tmp; run;
ERROR: Character is unclassifiable.
encountered during XMLMap parsing
occurred at or near line 4, column 15
ERROR: XML describe error: Internal processing error.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements.
This may cause NOTE: No observations in data set.
WARNING: The data set WORK.TMP2 may be incomplete. When this step was
stopped there were 0
observations and 0 variables.

There are at least two problems currently:

1) The XML version of characters like ADE=1 CHAR=BYTE(1) or '01'x,
appear simply as '2020'x instead of '200120'x or just '01'x, or better
yet "". My attempts at specifying XMLENCODING= and using the
system option ENCODING have not helped to resolve this at all (usually
specifying a particular ENCODING, like UTF-8 or UTF-16, at invocation,
results in some kind of kernel error in SAS).

2) Even though the XML engine successfully outputs '00'x (NUL) as
'200020'x in the XML, when it is input via the erroneous data step
shown above, it generates "character is unclassifiable", etc. and
cannot load any more data from the TMP.XML file.

I am using SAS/LE with Enterprise Guide 4.1, on a Windows XP Pro x64
platform - similar results also occur under Windows XP Pro (32-bit).

Any help/ideas would be greatly appreciated!

Thanks!
Andy Barnett
barnet(a)nc.rr.com
Raleigh, NC