Desktop productivity for business analysts and programmers

How to transform a dataset into an xml file using a specific xml schema defintion (xsd)

Reply
Regular Contributor
Posts: 170

How to transform a dataset into an xml file using a specific xml schema defintion (xsd)

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

Ask a Question
Discussion stats
  • 0 replies
  • 128 views
  • 0 likes
  • 1 in conversation