How to import XML (with RelaxNG schema) to SAS?

Reply
Regular Contributor
Posts: 161

How to import XML (with RelaxNG schema) to SAS?

Ladies and Gentlemen:

I hope to convert an HAVE.xml file (2 GB) to WANT.sas7bdat file using the HAVE.rnc schema file.  May I ask how to convert the file with the help of the schema file?

I tried the following method I saw online, but it failed and freeze my PC.

title1 'XML WORKSHOP EXERCISE #2';

libname in xml 'F:\folder\have.xml';

I also tried SAS XML Mapper, but it failed also because the xml file is so big.

Thank you!Smiley Happy

SAS Employee
Posts: 4

Re: How to import XML (with RelaxNG schema) to SAS?

SAS doesn't directly support RelaxNG schemas. You can use third party tools to convert the .rnc to an XML Schema (.xsd) file. I know that Oxygen and trang (and probably others) have that ability, though I have never used either for that purpose and therefore can't make any recommendations. If that doesn't work well, there are also tools to generate an .xsd directly from the .xml file. I have done that in Oxygen, with reasonable results.

Another option would be to use a representative subset of the .xml file (usually 100K or so is plenty) to create the XMLMap. I know it can be a nuisance to manually edit complex or deeply nested .XML files, but there are often ways of obtaining or generating smaller examples.

Ask a Question
Discussion stats
  • 1 reply
  • 207 views
  • 0 likes
  • 2 in conversation