BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nigromx
Fluorite | Level 6

Hello everyone:

 

I have a question, I trying read an xml file from a webservice, all is ok until I want load result into a dataset. The problem occurrs by an accent into xml tag, by example <country>México</country>.

 

This is the code:

 

filename response '/tmp/Output.xml';
filename respmap '/tmp/Output.map';

Libname response xmlv2 xmlmap=respmap automap=replace;
Libname clmfile XMLV2 '/tmp/Output.xml' XMLMAP='/tmp/Output.map';

 

The error is:

 

ERROR: The creation of the XML Mapper file failed.
ERROR: Error in the LIBNAME statement.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
nigromx
Fluorite | Level 6

Hello everyone:

 

I can resolve the problem with this lines

 

proc soap in=<filein> out=<fileout> url=<url> soapaction=<soapaction> envelope;

 

envelop is an option of proc soap that store complete soap result in the outputfile, fileout in this case. The complete result include

 

<?xml version="1.0" encoding="iso-8859-1" ?>

 

Thanks very much.

 

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

What encoding is your SAS session using?  Run either of these lines of code to find out.

proc options option=encoding; run;
%put %sysfunc(getoption(encoding));
nigromx
Fluorite | Level 6

Hello Tom:

 

Thanks for your help the result was:

 

%put %sysfunc(getoption(encoding));
LATIN1

 

Thanks in advance.

Tom
Super User Tom
Super User

You will probably need to run SAS with unicode support so that it can handle the characters.

You might be able to just get away with adding an ENCODING=option to the filename statement that points to the XML file.

Ksharp
Super User


filename x temp;
Libname response xmlv2 '/tmp/Output.xml'   xmlmap=x   automap=replace;

proc copy in=response  out=work noclone;

run;

nigromx
Fluorite | Level 6

Hello everyone:

 

I add manually

 

<?xml version="1.0" encoding="iso-8859-1" ?>

to the out file of proc soap, and work very well. ¿proc soap can add this automatically? 

 

Thanks in advance.

nigromx
Fluorite | Level 6

Hello everyone:

 

I can resolve the problem with this lines

 

proc soap in=<filein> out=<fileout> url=<url> soapaction=<soapaction> envelope;

 

envelop is an option of proc soap that store complete soap result in the outputfile, fileout in this case. The complete result include

 

<?xml version="1.0" encoding="iso-8859-1" ?>

 

Thanks very much.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1591 views
  • 3 likes
  • 3 in conversation