473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

create xml document based from schema

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>
Sep 25 '08 #1
6 3982
Andy B wrote:
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/
Sep 25 '08 #2
Martin Honnen wrote:
Andy B wrote:
>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?
Sep 25 '08 #3
Navid wrote:
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/
Sep 25 '08 #4
Martin Honnen wrote:
Navid wrote:
>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?
Sep 25 '08 #5
Navid wrote:
Martin Honnen wrote:
>Navid wrote:
>>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?
Sep 25 '08 #6
Navid wrote:
>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/
Sep 26 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jari Kujansuu | last post by:
I can successfully parse XML document using SAX or DOM and I can also validate XML document against schema. Problem is that my program should deal with user-defined schemas which means that when...
2
by: Michael Hertz | last post by:
Assume there is a XSD schema which describes the maximum possible number of fields which can occur in a XML document. How do I create such a form either as a HTML form or a text file from the XSD...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
3
by: Dhananjayan | last post by:
Hi, I have a java webservice running on Axis, Iam able to create a java client to invoke the webservice and obtain the result. But iam not able to invoke the service from .Net client.. Here are...
2
by: WideBoy | last post by:
Hi I have access to a large xml schema namespace which has complicated references, structures, etc for all sorts of things. Amongst which are personDetails, and their UK postal address. What I...
1
by: Mike | last post by:
Greetings, We have a requirement to utilize some sort of data storage, and XML strikes as being as viable a technology as the next one. I have started by using the XMLSchema designer to cook...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
0
by: Thomas | last post by:
How do you create an XML document based on an XML Schema? I have an XML Schema that defines several primary XML document types (i.e. the top-level element contains 4 complex type child elements...
13
by: Bill Nguyen | last post by:
Is it possible to create your won XSD to use with .NET based on an XML content? For example the one below: <?xml version="1.0"?> <pcats:FuelsDoc...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.