BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

 

There is a lot of examples how to convert an xml file into a dataset and a dataset into an xml file.

How ever, if we are interested to )convert a dataset into an xml file using a specific xml schema definition, how can we do that using SAS?

 

EX:  SAS Dataset  .... reading the xml schema definition (xsd)....then obtaining the proper xml file

 

XSD (XML Schema Definition) is a World Wide Web Consortium (W3C) recommendation that specifies how to formally describe the elements in an Extensible Markup Language (XML) document. This description can be used to verify that each item of content in a document adheres to the description of the element in which the content is to be placed. XSD

 

Look at this simple XML document called "note.xml":

<?xml version="1.0"?>
< note>
 < to>Tove</to>
 < from>Jani</from>
 < heading>Reminder</heading>
 < body>Don't forget me this weekend!</body>
< /note>
 
 
 
<?xml version="1.0"?>
< xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.w3schools.com"
xmlns="https://www.w3schools.com"
elementFormDefault="qualified">

< xs:element name="note">
 < xs:complexType>
   < xs:sequence>
     < xs:element name="to" type="xs:string"/>
     < xs:element name="from" type="xs:string"/>
     < xs:element name="heading" type="xs:string"/>
     < xs:element name="body" type="xs:string"/>
   < /xs:sequence>
 < /xs:complexType>
< /xs:element>

< /xs:schema>

 

Regards,

Alepage

1 REPLY 1

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1249 views
  • 0 likes
  • 2 in conversation