Output Complex XML File

Reply
Frequent Learner
Posts: 1

Output Complex XML File

I need to create an xml file which conforms to the attached xml file, as well as adhering to XML v1.0 and XML Schema v1.0.

I have no experience with xml and am hoping that someone who has that experience can comment on whether this is achievable. 

I have installed SAS XML Mapper as I believe it will be required to generate an XML map file to be used to create an output file. 

 

Other info;

Using SAS 9.3 on AIX.

Currently I am writing output as a .csv file using a file statement in a data step.

Some variables are null in the source dataset, I'm not sure how this affects the XML output. 

Regular Contributor
Posts: 150

Re: Output Complex XML File

Posted in reply to Seb_Royer

I use XML daily (and I use JSON a lot, which is similar). On XML, don't get too confused: it is really 2 things, elements (<LastName>) and attributes (<Name last='Churchill'...).

 

Which one to use is 100% in the hands of the person reading it. Hence, anyone can write whatever they want in those tags and anyone can interpret the tags as they see fit. XML is the easiest thing out there but freaks people out all of the time. Once you get the simplicity, all is well. It is just the way to get info on what is being moved. Think of it as a Goodwill form. What are you donating? This object. Ok, thank you.

 

BTW. XML is probably going away (replaced by JSON but that is another story). JSON is even simpler.

 

I never use SAS for XML or JSON. I front with something like Python or C#. Solutions should be future-proofed and I prefer engines that handle XML/JSON better. Let SAS do the data/proc side but use something else for dealing with hierarchical values. XMLMAP Is most likely C++ behind the scenes so roll your own, IMO.

 

The C# or Python is probably 5 lines of code so it is not hard.

 

 

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