BookmarkSubscribeRSS Feed
Malathi13
Obsidian | Level 7

Hi,

I tried using the code in this thread for xml conversion, I got the following error.

7 filename xx temp;

8 libname xx xmlv2 'C:\Users\mgs\Desktop\ems1.xml' automap=replace

8 ! xmlmap=xx;

ERROR: The creation of the XML Mapper file failed.

ERROR: Error in the LIBNAME statement.

9 proc copy in=xx out=work;

10 run;

ERROR: Libref XX is not assigned.

NOTE: Statements not processed because of errors noted above.

NOTE: PROCEDURE COPY used (Total process time):

real time 0.00 seconds

 

can you suggest, what went wrong in the code.

 

Thank you

M

cpu time 0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.

NOTE: Parsing with high validation.

WARNING: XMLMap parser encountered XML issue

Exception class: org.xml.sax.SAXParseException

ID: <null>

Message: schema_reference.4: Failed to read schema document

'http://nemsis.org/media/XSD_v3/_nemsis_v3.3.4/3.3.4.140328/XSDs/NEMSIS_XSDs_v3.3.4.140328/EMSDataSet...

v3.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root

element of the document is not <xsd:schema>.

Line: 2

Column: 248

5 REPLIES 5
Reeza
Super User

What version of SAS are you using? Do you have access to SAS XML Mapper?

Malathi13
Obsidian | Level 7

Hi Reeza,

I have SAS 9.4 and I don't have XML mapper.

Reeza
Super User

It’s included in your license so I would suggest installing it, especially if you have complicated XML that the automapper cannot read. Can you post an example of your XML? It doesn't need to be the actual file, but files that are consistent with your data structure. 

Malathi13
Obsidian | Level 7

Hi Reeza,

this is how my xml file structure would be, I didn't want to attach it, so copying and pasting it.

 

<?xml version="1.0"?>

-<EMSDataSet>

-<Record>

-<inc_disposition>

      <DispositionID>000000</DispositionID>

     <IncidentID>000000</IncidentID>

     <PatientDisposition>012012</PatientDisposition>

     <Base_Hospital_Contacted>0000</Base_Hospital_Contacted>

</inc_disposition>

 

 

thank you

M

BrunoMueller
SAS Super FREQ

If your file looks like this, then there should be no problem in read it.

 

See this sample

filename xmlsrc temp;
data _null_;
  infile cards;
  input;
  file xmlsrc;
  put _infile_;
cards4;
<?xml version="1.0"?>
<EMSDataSet>
<Record>
<inc_disposition>
<DispositionID>000000</DispositionID>
<IncidentID>000000</IncidentID>
<PatientDisposition>012012</PatientDisposition>
<Base_Hospital_Contacted>0000</Base_Hospital_Contacted>
</inc_disposition>
</Record>
</EMSDataSet>
;;;;

filename xmlmap temp;

libname xmlin xmlv2 xmlfileref=xmlsrc xmlmap=xmlmap automap=replace;

proc copy in=xmlin out=work;
run;

See also this post, where the XML Mapper is used with XML parsing validation set to minimal

https://communities.sas.com/t5/SAS-Procedures/Error-while-generating-XML-Map-in-XML-Mapper/td-p/1733...

 

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
  • 5 replies
  • 2801 views
  • 0 likes
  • 3 in conversation