Connecting Tech Pros Worldwide Help | Site Map

create xml document based from schema

  #1  
Old September 25th, 2008, 02:15 AM
Andy B
Guest
 
Posts: n/a
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>


  #2  
Old September 25th, 2008, 01:55 PM
Martin Honnen
Guest
 
Posts: n/a

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/
  #3  
Old September 25th, 2008, 05:55 PM
Navid
Guest
 
Posts: n/a

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?
  #4  
Old September 25th, 2008, 06:05 PM
Martin Honnen
Guest
 
Posts: n/a

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/
  #5  
Old September 25th, 2008, 06:25 PM
Navid
Guest
 
Posts: n/a

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?
  #6  
Old September 25th, 2008, 07:15 PM
Navid
Guest
 
Posts: n/a

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?
  #7  
Old September 26th, 2008, 12:55 PM
Martin Honnen
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I create an XSD document based on an XML file content? Bill Nguyen answers 13 June 22nd, 2007 12:15 AM
Using XmlSerializer to create an Xml document for SQL Server 2005 (having a date typed attribute) Henrik Dahl answers 10 January 5th, 2007 10:05 AM
Generate XML document from Schema vidarno@gmail.com answers 1 May 3rd, 2006 08:19 PM
Invalid XML document generated from WriteXML() on a strongly typed dataset Dave answers 1 November 12th, 2005 03:22 AM