12-05-2017 11:49 AM - last edited on 12-05-2017 12:56 PM by ChrisHemedinger
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;
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.
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
Message: schema_reference.4: Failed to read schema document
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>.
12-05-2017 12:05 PM
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.
12-05-2017 12:16 PM
this is how my xml file structure would be, I didn't want to attach it, so copying and pasting it.
12-05-2017 03:59 PM
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