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>


0
a_borka (15)
9/25/2008 1:08:33 AM
dotnet.xml 7266 articles. 0 followers. Follow

6 Replies
806 Views

Similar Articles

[PageSpeed] 10

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/library/x6c1kb0s(VS.80).aspx



-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
9/25/2008 12:46:45 PM
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/library/x6c1kb0s(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?
0
navid (6)
9/25/2008 4:46:55 PM
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/
0
mahotrash (1777)
9/25/2008 4:55:35 PM
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?
0
navid (6)
9/25/2008 5:10:48 PM
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?
0
navid (6)
9/25/2008 6:06:12 PM
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/
0
mahotrash (1777)
9/26/2008 11:47:11 AM
Reply:

Similar Artilces:

creating excel docs on web server
i need to create complex excel docs for download by users. on MS site however it is recommended against excel/office on server environments. http://support.microsoft.com:80/support/kb/articles/Q257/7/57.asp fine, but then what is the way out? TIA ...

Remove Drive w/ selection based on associated DOS drive letter
I am trying to find a way to call CM_Query_And_Remove_SubTree() or SetupDiRemoveDevice() on the basis of the associated DOS drive letter. There seem to be multiple name-spaces for both physical and logical drives. I have found a number of well-hidden bridges for tying some of them together, but have been unable to find one that lets me start with the drive letter and chain down to the ID I need to drive one of the remove functions. Any Suggestions? MetaJack wrote: > I am trying to find a way to call CM_Query_And_Remove_SubTree() or > SetupDiRemoveDevice() on the basis ...

Creating A Custom Occurance for Tasks
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: pop I'm trying to create a task and have it occur every other week (which is easily done in the calendar). However, when I go to the &quot;Occurs&quot; drop down that is not an option so I choose &quot;Custom&quot;. Once I do this my entire Entourage freezes and I can't do anything within Entourage. My Force Quit doesn't show Entourage as &quot;Not Responding&quot; but the Entourage toolbars grey out and I can't do anything in which case I have to Force Quite Ent...

How to create a report that prints at certain frequencies
I have a database that generates work orders of tasks that are performed at certain frequencies. For example, check oil in truck - frequency every 4 weeks. How do I create a report (in form of a work order) that will print automatically when that date comes up? First create a WorkOrderPrintLog table with a text column Task and a date/time column DatePrinted to log when the reports are printed. Then write a VBA function in a standard module as follows: Public Function PrintWorkOrder(strTask, intWeeks, strReport) Dim cmd As ADODB.Command Dim strSQL As String Dim strCriteria ...

XML 2005 Late-Breaking and Product Presentation Deadline
XML 2005 Late-Breaking and Product Presentation Deadline - Tutorials Added/ changed XML 2005, November 14-18, Atlanta Hilton Hotel, Atlanta, GA http://www.xmlconference.org The deadline for late-breaking, product presentations, and town hall submissions is Friday, September 16. http://2005.xmlconference.org/node/31 The late-breaking presentations are intended to be filled with late- breaking news; however good presentations on other topics that don't duplicate material already on the program will also be considered for these slots. Submissions on fresh topics such as Ajax, alternatives ...

How do I lock a formatted ecell sheet that I created?
How do I lock a formatted sheet with formulas and sums that will be imputed in the future, etc. so the formulas are not erased and so the sheet could be used again and again? Do that involves also saving into a template that could be reused If so, how do I do that? Thanks in advance. Select the cells that should be locked and then use: format|cells|protection tab|check lock Select the cells that should be unlocked and uncheck that setting. Depending on the number of cells of each type, it may be easier to lock (or unlock) all the cells and just unlock (or lock) the others. Then you...

How to create e-mail addresses based on group membership in E2K3 running on W2K3
Hello, I need to create different email address for different users in my Exchange 2003 server running on Windows Server 2003. I would like to be able to do this by using AD group membership and Exchange recipient policies rules. I have browsed MS support.microsoft.com web site and found KB 317298 ( http://support.microsoft.com/kb/317298 )and also looked at www.msexchange.org . Both articles seem very straight forward. When I get to modifying the rule in "Recipient Policies" this is where I get lost. I have used adsiedit.msc to lookup my group which is called "Dogfood E...

why do my documents print in faded colors?
Excel 11.56 - Windows XP - When I receive Excel documents via e-mail they print out in faded/muted colors. My printer is not in need of new cartiridges. My documents print just fine - but when I receive documents from other people the colors are very light! Thanks for any assistance. Artistic friends? Perhaps you are printing in draft mode. File, Page Setup, Page (tab), Options the choices depend on your printer, and I don't really think they are stored with the sheet. I have a Canon printer, and I see "Standard" for print quality. --- HTH, David McRitch...

How to initialize a multidoc application without a document?
The program is developed under Visual C++ 6.0. The program is the multiple-document application. I would like the program to start without opening a document. How to realize? Use CCommandLineInfo::FileNothing in your app's initinstance. Something like this: // This all goes in CMyApp::InitInstance CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; if (!ProcessShellCommand(cmdInfo)) return FALSE; --------- Ajay Kalra ajaykalra@yahoo.com ...

Documentation for Literal Constants
I'm looking for C/C++ syntax documentation on literal constants. In particular, I was trying to find out what the rules are for applying signs (+/-) to values with non-decimal notation such as octal and hexadecimal. But I don't seem to find any documentation that covers this. Can anyone offer any tips? Thanks. -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm Hi Jonathan, Are you looking for this ? http://msdn.microsoft.com/library/en-us/vclang/html/_pluslang_literals.asp http://msdn.microsof...

create MULTIPLE IM accounts for corporation?
My corporation wishes to use Windows Live Messenger in-house. The software comes pre-installed on all the CPUs we buy. However, as IT Manager I need to create about 40 IM *accounts*. I sucessfully created 5 using our company's email addresses but then I got the error that I had exceed the number of allowed accounts created. I think it's somehow noting our firewall's IP address. Any computer I use within the building refuses to make new accounts. The support site said the problem would resolve itself after 72 hours but it has not. I have posted to many Microsoft f...

Broken formatting while pasting document
Hi, I have a tricky question. How to restore formatting while coping data from one file to another? Issue: I have some rows with grey background in Excel file A. When I copy this rows with Paste Special function (selecting Formatting) I see this rows collored in black in the new file B. How can I get rid of this feature? And this issue happens not on each computer. On my it works correctly, on my co-worker PC it works with mistake. What can be the root cause? -- Manatee ------------------------------------------------------------------------ Manatee's Profile: http://www.excelforum.co...

Long time user,can't create a chart-help!
Using office since 1995 and creating superb charts. Just installed office 07 in a new computer and I am stuck. In the past for all additions I would enter ,for example =A1:A500,B1:B500, Choose my chart style and a chart would be generated after filling in the various dialogue boxes. I do the same now and I just get error messages. Can I set-up Excel to behave in the manner that I am accustomed to. Thanks for your help My 2007 machine is in the other room, so I can't test right now. Try referencing the address with the parent worksheet's name: =Sheet1!A1:A500,Sheet1!B1:B500 ...

What is a file permission error when saving a document in Word 07
I am trying to save a word document I am working on and after I hit save I get the message "file permission error". What is this? and how do I fix it? Thankyou Hi jcs0730, Is the file on removable media (eg CD/DVD or a USB stick)? If so, that may be the cause of the problem. Alternatively, if you've accessed the file from a read-only location on a network, you could get such an error if you try to save your changes back to the same location. -- Cheers macropod [Microsoft MVP - Word] "jcs0730" <jcs0730@discussions.microsoft.com> wrote in mes...

Create 2nd toolbar
Hi there, I was wondering how do I create a 2nd toolbar right underneath the first one? If I use the resource editor and created a single toolbar IDR_MAINFRAME and I load it with: if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_FIXED | CBRS_TOOLTIPS) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } If I need a 2nd toolbar (IDR_SECONDTOOL), how do I load that if I use the resource editor to create the toolbar? Thanks, Robert Did you try? ...

Activities Not Created For Incoming Mail
I have CRM 3.0 SBE installed along with the Exchange Router. The CRM mail box is set up and the forwarding rules have been configured for the users. I have the options set to track all email. However, no incoming emails are being converted to activities, regardless of whether they contain a tracking token. They are being forwarded to the CRM mailbox, but they are not making it into CRM. Any ideas? Hello, Did you check the event log for any errors occurring? Is the "Microsoft CRM-Exchange E-Mail Router Service" up and running? Best regards, Merijn van Mourik "bpro...

document printing question
I have set up an invitation on a 5.5 x 8.5 format, but cannot have the document print without the "centering graphics" (not sure what to call them) that appear when I do a print preview -- DeniseK Are you planning to print two invitations per sheet or is your stock already 5.5 x 8.5? In page setup, landscape, type 5.5 width, 8.5 height. Publisher will say it will print two copies per sheet. If your stock is already 5.5 x 8.5 you must setup your printer for a custom size. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com ...

Autogenerating documentation from the c# source code comments
Hi, I am wanting to automatically generate my documentation from my C# code comments. Specifically I am wanting to generate examples that look like this http://msdn.microsoft.com/en-us/library/ch45axte.aspx where code examples are shown for VB.NET, C#. C++, F# and JScript How do you do this and can you do this with VS2010 Pro. I have searched and cannot find a website telling me how to do this. I would prefer to include a C# example in my source code comments and have the code generation tool generate from this the examples in VB.Net, C++, F# and JScript examples automatical...

Conditional formatiing based on another cell
Hi, How can I change the colour of a cell and a seperate query an entir row based on the value in a call. For example cell A1 has a number 20 in it. Cell B1 is blank. If "yes" is entered in to cell B1, I want cel A1 to change to be in bold and a grey box. Ihave tried conditiona formatting but doesnt seem to work. Thank -- Number_ ----------------------------------------------------------------------- Number_8's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=659 View this thread: http://www.excelforum.com/showthread.php?threadid=37566 select A1, then...

how to Merge to xml document ?
Hello, I've to merge a peace of xml in another xml document. Here is an example: The doc: <layout> <win x="0"> <visible>false</visible> <text>coucou</text> </win> </layout> The other xml peace : <layout> <win x="10"> <visible>true</visible> <backcolor rgb="25,25,25"> </win> </layout> The merge result should be: <layout> <win x="10"> <visible>truevisible> <text>coucou</text> <backcolor rgb=&qu...

How to associate XML with XSD
Hi all, I've decided it's time to get a little bit smarter about how I deal with XML in my apps, so I have a couple of really basic questions (that probably demonstrate my complete lack of understanding of the underlying concepts): 1. Assuming that I have an XML file and its associated XSD file, what do I put into the XML file to tell Visual Studio to use the XSD file to wire up intellisense? The examples I've seen using "xmlns" all seem to use an internet URL to specify the schema file, but I don't have a web server... 2. Is there something else that I need ...

How to have Invoice Format be based on Customer Class ID?
Our company has two separate divisions which each invoice separately. We would like for each division to print its own invoice format. We will segregate customers by Class ID. Is there a way to have a given Customer Class ID default to a given Invoice Format? (Others have suggested VBA... can someone get us started on that code?) Thanks! Yes you could do this either using Dexterity or VBA. You would, of course, only be able to do this if printing single document because if you print a batch of invoices (by choosing a range of some sort) then it prints as one big report and so it woul...

create a single date column from seperate month, day and year colu
The data I received came with the month day and year seperated out into seperate columns. I manage to concantenate the date to show i.e. 112002 or 10102002 representing 1/1/2002 and 10/10/2002. What can I do to create a date field from this or should I use the seperate columns to create a date field. Thanks Try Format([SomeFieldName],"Short Date") -- Milton Purdy ACCESS State of Arkansas "UGAJohn" wrote: > The data I received came with the month day and year seperated out into > seperate columns. I manage to concantenate the date to sh...

batch create mailboxes E2K7?
How do i batch create mailboxes for an entire organization in e2k7?, do i need to set a recipient policy and process it? Exchange Server 2007: Bulk creation of mailboxes using Exchange Management Shell http://exchangepedia.com/blog/2006/11/exchange-server-2007-bulk-creation-of.html Exchange Server 2007: Bulk mailbox-enabling users using Exchange Shell http://exchangepedia.com/blog/2006/12/id-written-about-how-to-bulk-create.html -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: exchangepedia.com/blog ---------------------------------------------- "Guillermo Lov...

Weird files created in root folder when downloading mail
Recently I've been getting weird files in the root of drive c whenever I open Outlook 2003 and start downloading mail. Today the files are named s3us.x where x is 1 to 9 and a to v then starting over with 11. For example: s3us.1 s3us.2 s3us.3 .... s3us.9 s3us.a s3us.b .... s3us.v s3us.11 s3us.12 The files cannot be accessed while outlook is open. After closing outlook I still couldn't access my mail and took a guess and killed ccApp.exe. After killing that program I was able to access the files. I've opened a few files with text editors and the contents resembles my mail. Any...