Connecting Tech Pros Worldwide Forums | Help | Site Map

create xml document based from schema

Andy B
Guest
 
Posts: n/a
#1: Sep 25 '08
I have the following schema. I need to know how to make an xml document
based from it. The main worry I have is the DateTime field.

<?xml version="1.0" encoding="utf-8"?>

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="NewsArticle">

<xs:complexType>

<xs:sequence>

<xs:element name="Description" type="xs:string" />

<xs:element name="Body" type="xs:string" />

</xs:sequence>

<xs:attribute name="title" type="xs:string" use="required" />

<xs:attribute name="Date" type="xs:dateTime" use="required" />

</xs:complexType>

</xs:element>

</xs:schema>



Martin Honnen
Guest
 
Posts: n/a
#2: Sep 25 '08

re: create xml document based from schema


Andy B wrote:
Quote:
I have the following schema. I need to know how to make an xml document
based from it. The main worry I have is the DateTime field.
Do you want to do that programmatically? You could use the xsd.exe tool
to infer a.NET class in VB or C# from the XML, then you could compile
and instantiate the class and populate its members to finally serialize
the class instance to XML.
http://msdn.microsoft.com/en-us/libr...0s(VS.80).aspx



--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Navid
Guest
 
Posts: n/a
#3: Sep 25 '08

re: create xml document based from schema


Martin Honnen wrote:
Quote:
Andy B wrote:
Quote:
>I have the following schema. I need to know how to make an xml
>document based from it. The main worry I have is the DateTime field.
>
Do you want to do that programmatically? You could use the xsd.exe tool
to infer a.NET class in VB or C# from the XML, then you could compile
and instantiate the class and populate its members to finally serialize
the class instance to XML.
http://msdn.microsoft.com/en-us/libr...0s(VS.80).aspx
>
>
>
Hi Martin,
I am trying to use the xsd.exe tool i am trying to do something similar
and i was just writing my own library to do it but want to try this out.
I am using Visual Studios 2008 V3.5 and i cant seem to find the tool to
add to my external tools. Any idea where it might be or where i could
get it from?
Martin Honnen
Guest
 
Posts: n/a
#4: Sep 25 '08

re: create xml document based from schema


Navid wrote:
Quote:
I am trying to use the xsd.exe tool i am trying to do something similar
and i was just writing my own library to do it but want to try this out.
I am using Visual Studios 2008 V3.5 and i cant seem to find the tool to
add to my external tools. Any idea where it might be or where i could
get it from?
xsd.exe is a command line tool so open up a Visual Studio 2008 command
prompt
Programs -Visual Studio 2008 -Visual Studio Tools -Visual Studio
command prompt
and use xsd.exe from the command line.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Navid
Guest
 
Posts: n/a
#5: Sep 25 '08

re: create xml document based from schema


Martin Honnen wrote:
Quote:
Navid wrote:
>
Quote:
>I am trying to use the xsd.exe tool i am trying to do something
>similar and i was just writing my own library to do it but want to try
>this out.
>I am using Visual Studios 2008 V3.5 and i cant seem to find the tool
>to add to my external tools. Any idea where it might be or where i
>could get it from?
>
xsd.exe is a command line tool so open up a Visual Studio 2008 command
prompt
Programs -Visual Studio 2008 -Visual Studio Tools -Visual Studio
command prompt
and use xsd.exe from the command line.
>
Is it possible to use it inside an application?
For example if i have a Windows Form application once the schema is
defined or even before the application is started onLoad() to use this
to get the classes from a XML schema file?
Navid
Guest
 
Posts: n/a
#6: Sep 25 '08

re: create xml document based from schema


Navid wrote:
Quote:
Martin Honnen wrote:
Quote:
>Navid wrote:
>>
Quote:
>>I am trying to use the xsd.exe tool i am trying to do something
>>similar and i was just writing my own library to do it but want to
>>try this out.
>>I am using Visual Studios 2008 V3.5 and i cant seem to find the tool
>>to add to my external tools. Any idea where it might be or where i
>>could get it from?
>>
>xsd.exe is a command line tool so open up a Visual Studio 2008 command
>prompt
>Programs -Visual Studio 2008 -Visual Studio Tools -Visual Studio
>command prompt
>and use xsd.exe from the command line.
>>
Is it possible to use it inside an application?
For example if i have a Windows Form application once the schema is
defined or even before the application is started onLoad() to use this
to get the classes from a XML schema file?
Is there any way using the xsd.exe tool to find out if a element or
attribute is required or what the minOccurs is?
Martin Honnen
Guest
 
Posts: n/a
#7: Sep 26 '08

re: create xml document based from schema


Navid wrote:
Quote:
Quote:
>xsd.exe is a command line tool so open up a Visual Studio 2008 command
>prompt
>Programs -Visual Studio 2008 -Visual Studio Tools -Visual Studio
>command prompt
>and use xsd.exe from the command line.
>>
Is it possible to use it inside an application?
For example if i have a Windows Form application once the schema is
defined or even before the application is started onLoad() to use this
to get the classes from a XML schema file?
You would use xsd.exe while developing your application to infer the
class code files from the schema, then you would add the classes to your
project to compile and build them together with the rest of your
application.



--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Closed Thread