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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1565 views
  • 3 likes
  • 3 in conversation