Generete an XML instance from its XSD

Hi

Is there a way to generate in code an empty instance of an XML from it's XSD?
I have a lot of schemas and I want at run time to create an empty instance 
for them (I then have to fill one or two fields). 

Shahar 
0
Ron1 (234)
8/22/2007 2:06:03 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
533 Views

Similar Articles

[PageSpeed] 59

Shahar Ron wrote:

> Is there a way to generate in code an empty instance of an XML from it's XSD?
> I have a lot of schemas and I want at run time to create an empty instance 
> for them (I then have to fill one or two fields). 

Check out this article 
<URL:http://msdn2.microsoft.com/en-us/library/aa302296.aspx> which has 
code to create a sample document from a schema. I think it even creates 
default contents for elements, if that is not what you want then you 
need to adapt the code to only create the elements but no contents.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
8/22/2007 2:25:43 PM
Reply:

Similar Artilces:

Generate XSD from class
Hi, Is there a way to generate an XSD from a class programmatically, so without using xsd.exe? Thanks, B. xsd.exe uses a number of classes that are documented "for internal use only" in the Framework SDK documentation. You can use ILDASM or check in Rotor to see which ones they are. Alternatively you can program against the XSD inference assembly from [0] -- HTH Christoph Schittko [MVP] Software Architect, .NET Mentor [0] http://apps.gotdotnet.com/xmltools/xsdinference/ "Bert" <no@thanks.com> wrote in message news:Xns9458A5C4F6FB2nothankscom@195.130.132.70....

Excel
I would like to have several worksheets open in seperate instances of Excel rather than in one instance. In other words, I need to compare one worksheet against another and having both in one instance makes it difficult to do this. I have searched but cannot find where I can configure the software to do this. Can you help? Thanks. Hi not quite sure but goto 'Tools - Options - General' and check 'Windows in taskbar' -- Regards Frank Kabel Frankfurt, Germany judy wrote: > I would like to have several worksheets open in seperate > instances of Excel rather than i...

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

How do I count instances of a reference?
Hello all, I have a spreadsheet project I need to complete for a spreadsheet with multiple worksheets (13 in total, 1 per month and a results page). Each of the monthly worksheets will contain the same type of data but this data will vary in quantity. it is for an IT support desk to calculate the number of times a certain field is populated for each person. Column's A, B & C are the same data in both worksheets. Worksheet 1 Column A Column B Column C Person 1 Field 1 Trigger Worksheet 2 Column A Column B Column C Person 1 ...

Only one running instance of application
Hello How do I check if my (MFC) application is allready running on the computer? I want to be sure that only one instance of my application is running. cheers Peter See if Bob's tip mentioned here helps you http://www.mooremvp.freeserve.co.uk/Win32/framed_tip007.htm -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "Peter Stausholm" <pindemad@yahoo.com> wrote in message news:fdyNb.74624$jf4.4748342@news000.worldonline.dk... > Hello > > How do I check if my (MFC) application is allready running on the computer? > I want to be...

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

SBS2003R2, SQL Wkgp 2005, Sharepoint MSDE,Cant create 2005 Instanc
We have an SBS 2003 SP2 server that had the SharePoint with MSDE (Ver 80). We installed the SQL Server 2005 Workgroup Edition from SBS Premium 2 DVD. Throughout the installation we were not prompted for authentication method or collation sequence however SQL installed without problem and we then installed Sp2 & SP3. We then created some empty databases but later realised they were created under the MSDE instance but we want them installed under SQL 2005 work-group which we installed. The databases are empty so we are happy to recreate them if need be. We tried uninstallin...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

SmartList Export to Excel Opens Another Instance of Excel
Client just moved from SP1 to SP2 on v9 Dynamics GP. Also using Excel 2003. Complaint is that while on SP1, they could export from SmartList to Excel; with Excel adding workbooks to the current Excel instance. Through the toolbar window, they could easily flip through workbooks (they have several various exports throughout their daily routine). However, now with SP2, each export will open a new instance of Excel. This results in several Excel programs open at the bottom of the screen, with each containing only one workbook. Although this may seem trivial, it does make it inco...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

Example eConnect XML documents
MSDN says the following: Installing eConnect schema When you include the schemas component of the eConnect install, the installer places schema files in a schemas folder on your computer. The following schema resources are available: The install places the .xsd schema files in the directory c:\Program Files\Microsoft Great Plains\eConnect9\XML Schema\Incoming XSD Individual Schemas. The files in the directory contain the schema for each eConnect XML document. The install places a file named eConnect.xsd that contains the schema definition for all eConnect XML documents. The install typicall...

XML variable for description on receipt?
Hi, I would like to add a description (actually all of those 3 extended descriptions) to display on the printed receipt under the main description. What is the variable to do that? Entry.Item.Description Entry.Item.ExtendedDescription Entry.Item.SubDescription1 Entry.Item.SubDescription2 Entry.Item.SubDescription3 R. "Zorian" <Zorian@discussions.microsoft.com> wrote in message news:F4425EAC-62B6-46FE-826A-D8BA2AA75DBB@microsoft.com... > Hi, I would like to add a description (actually all of those 3 extended > descriptions) to display on the printed receipt un...

Outlook 2003 opens multiple instances
When I double click the desktop icon for outlook it opens twice or has two instances available in the task manager window. Once I disable or end these and reopen outlook it is fine. Also, we are currently running Viewmail and Viewfax from Active Voice. Any help would be grealty appreciated. Charles Garcia wrote: > When I double click the desktop icon for outlook it opens > twice or has two instances available in the task manager > window. Once I disable or end these and reopen outlook it > is fine. This happens randomly for me too. In fact, for a long time it used to a...

Saving DataSet as XML in ADO format using VB.NET
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about the performance and it might improve if I used the native data providers for .NET. I am not sure if I am missing something but how do I save the .NET DataSet to XML in the OLD ADO format? Thanks for you help in advance and it is most appreciated. In the ...

xml to SQL
Hey we have a project in which a company produces a XML page in reply to actions on it's site. I see that SQL 2000 works well with XML so Can someone point me in the right direction, I would like to take the XML from thier SQL and have it "post" to own sql server (add,create, data, modifity and delete data on the fly). I was looking at doing XML to HTML and then passing to some a ASP but if we can grab from the responsetext then we could save time and headaches. Now I really know next to nothing about XML but I am reading all the newsgroups and pulled now TONS of xml / sql stuff ...

new xml file is larger than the original
i'm working on a windows application that will edit and create xml files from another application. the original file is 83k, the one created by my vb.net program is 153k but all i add is a new xmlelement when i use the other program and add a xmlelement is only increased the file to 85k. how come my application increased 70k in size and also added the <?xml version="1.0"?> when i didn't tell it to. how do i duplicated a xml file and only add the xml element that i want to insert. where did the extra 70k come from. thanks here is my code: Dim newEvtEnr...

xml data in excel
I have designed an excel template with tabular format (row by row input) for user input. I have to make the validation for those input. My question is that is it possible to use XML schema as the input format template and use it for the data validation like normal XML validation. Could anyone suggest me how to do that?? Million thanks. ...

XSLT, XML to XML
Hello, I would like to transform this; <?xml version="1.0" encoding="utf-8" ?> <ProductList> <Product> <ID>1</ID> <Name>Gadget</Name> </Product> </ProductList> to this; <?xml version="1.0" encoding="utf-8" ?> <ProductList> <Product> <ID>1</ID> <Name>Gadget</Name> </Product> </ProductList> Basically I am hoping to use XslTransform and an XSLT stylesheet to change the format of some input XML so i...

Replace existing workflow instance after initiation with new versi
Is there any way I can do this. I had thought of flagging the associated entity, deleting the workflow and then iniating the new one on all flagged records? There's no special built-in way to do this replacement directly. A few steps will be involved in this: Make sure your new workflow can be initiated "on demand" (as well as whatever business logic triggers you are using for normal operations). Use advanced find to identify all the records of the relevant type which have associated system jobs of type workflow with the status you are interested in (perhaps only waiting ...

XML vs. SQL Database
I am developing a home project to be later released as an online application. I am currently using XML to store game data, user/member data, and other. Assuming a user base of 10,000 active users, is there a conflict if one user is updating information and another user is creating data on the same xml file? For example: User 1: update inventory that exists in the XML file User 2: new user adding their inventory data in the XML file Thanks for your help. Michael "Michael Jesse" <michaeljesse1973@sbcglobal.net> wrote in message news:tUVDd.13357$iC4.7938@newssvr30.news....