Re: If you work with XML...
Hi shunt:
Sory return to your post,but i need some help here with schemas...
I have a Schema.xsl that I want to convert to a .xml file...
In this moment I have the reference in my code:
Code:
Imports System.Xml
Imports System.Xml.Schema
Can you post some code to exemplified the way to do this?
Thanks
Re: If you work with XML...
Hi, I don't think I fully understand your requirement. An XML Schema is XML. You can load a schema file directly into an XMLDocument object. Also, if you have an .XSL file you can simply rename the file to .XML.
Open the xsl file with IE or notepad and you will see that it is an XML file.
Perhaps you actually want to generate an XML file from an XSL file?
Re: If you work with XML...
Hi:
Quote:
Perhaps you actually want to generate an XML file from an XSL file?
Yes that's it...but I don't know the way to do this programatically...I need some help with a few lines of code if you have ok?
Thanks
Re: If you work with XML...
Sorry. Firstly I made a mistake. A schema file has a file extension ".xsd". A template file has a file extension ".xsl".
An XSD (schema) describes the layout of an XML file. An XSL (template) transforms one xml file from one format to another.
I see you said "Schema.xsl", so for clarrity, do you have a schema or a template?
Re: If you work with XML...
Sory...I Have a .XSD(schema) file
Re: If you work with XML...
Okay... A schema file simply defines what the XML must conform to. Unfortunately, there is no magic "generate" function that will generate all the nodes required by your XSD. The good news is that an XSD is essentially the same as the dictionary of a database. It describes a set of tables and a set of attributes. I have never tried to use an XSD to generate XML before, but if I was to try, I would start by using an ADO.NET dataset object. Create a dataset object and then try using the ReadXMLSchema function. This should initialize the table objects in the dataset and you can then populate tables using standard ADO.NET methods. Then when you want to generate the XML just use WriteXml or GetXml functions.
Just google "dataset ReadXmlSchema" for examples
Re: If you work with XML...
ok...I will try your suggestion
Thanks