XSD - How to create a default XML

Hi all,

I defined a XML Schema... so I've a .xsd file.

I defined the schema using "default" attribute... for example:
<xs:element name="color" type="xs:string" default="red"/>

Now, I would like to generate an empty XML file, from the XML Schema.

How can I do that?

Thanks a lot.

Bye
-- 
Stefano Giannone
MCP .NET
http://www.giasoft.it



0
3/21/2005 8:40:08 AM
dotnet.xml 7266 articles. 0 followers. Follow

6 Replies
490 Views

Similar Articles

[PageSpeed] 59


Stefano wrote:


> I defined a XML Schema... so I've a .xsd file.
> 
> I defined the schema using "default" attribute... for example:
> <xs:element name="color" type="xs:string" default="red"/>
> 
> Now, I would like to generate an empty XML file, from the XML Schema.

..NET 1.x and its xsd.exe tool has support to generate an XML schema from 
an XML instance document but not the other way round.
But there are some XML editors around that claim they support generating 
a sample XML from a DTD or schema.
And Google turns up some stuff
<http://www.google.com/search?hl=en&lr=&c2coff=1&q=generate+sample+XML+from+XML+schema&btnG=Search>
maybe you can find something useful there.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
3/21/2005 11:57:19 AM
Hi Martin,

thanks for the answer.

I need to do that programmatically, both from JavaScript (client side) and
ASP.NET (so .NET 1.x... server side).

Any ideas?

Thanks!

Bye
-- 
Stefano Giannone
MCP .NET
http://www.giasoft.it


"Martin Honnen" <mahotrash@yahoo.de> ha scritto nel messaggio
news:O%23Qzo0gLFHA.436@TK2MSFTNGP09.phx.gbl...
>
>
> Stefano wrote:
>
>
> > I defined a XML Schema... so I've a .xsd file.
> >
> > I defined the schema using "default" attribute... for example:
> > <xs:element name="color" type="xs:string" default="red"/>
> >
> > Now, I would like to generate an empty XML file, from the XML Schema.
>
> .NET 1.x and its xsd.exe tool has support to generate an XML schema from
> an XML instance document but not the other way round.
> But there are some XML editors around that claim they support generating
> a sample XML from a DTD or schema.
> And Google turns up some stuff
>
<http://www.google.com/search?hl=en&lr=&c2coff=1&q=generate+sample+XML+from+
XML+schema&btnG=Search>
> maybe you can find something useful there.
>
> -- 
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


0
3/21/2005 1:47:48 PM

Stefano wrote:


> I need to do that programmatically, both from JavaScript (client side) and
> ASP.NET (so .NET 1.x... server side).

There are some examples around, at least for .NET using the SOM (schema 
object model), the most promising earlier thread I can find on that is here:
<http://groups-beta.google.com/group/microsoft.public.dotnet.xml/browse_frm/thread/238aba965f4a5f7c/9fec532900467890?q=create+XML+document+from+schema+group:microsoft.public.dotnet.xml#9fec532900467890>

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
3/21/2005 2:38:54 PM
OK, thanks!

Maybe OT... but... what about JavaScript side?

Bye
-- 
Stefano Giannone
MCP .NET
http://www.giasoft.it


"Martin Honnen" <mahotrash@yahoo.de> ha scritto nel messaggio
news:Ofdi2OiLFHA.2764@tk2msftngp13.phx.gbl...
>
>
> Stefano wrote:
>
>
> > I need to do that programmatically, both from JavaScript (client side)
and
> > ASP.NET (so .NET 1.x... server side).
>
> There are some examples around, at least for .NET using the SOM (schema
> object model), the most promising earlier thread I can find on that is
here:
>
<http://groups-beta.google.com/group/microsoft.public.dotnet.xml/browse_frm/
thread/238aba965f4a5f7c/9fec532900467890?q=create+XML+document+from+schema+g
roup:microsoft.public.dotnet.xml#9fec532900467890>
>
> -- 
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


0
3/21/2005 3:13:46 PM

Stefano wrote:

> what about JavaScript side?

MSXML 4 has support for a SOM (schema object model) too thus if you 
script MSXML 4 with J(ava)Script you could in theory walk the SOM of a 
schema and try to generate an XML instance. I don't know of code 
examples doing that however.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
3/21/2005 4:26:18 PM
OK, thank you again!

Bye
-- 
Stefano Giannone
MCP .NET
http://www.giasoft.it


"Martin Honnen" <mahotrash@yahoo.de> ha scritto nel messaggio
news:eDCg3KjLFHA.2252@TK2MSFTNGP15.phx.gbl...
>
>
> Stefano wrote:
>
> > what about JavaScript side?
>
> MSXML 4 has support for a SOM (schema object model) too thus if you
> script MSXML 4 with J(ava)Script you could in theory walk the SOM of a
> schema and try to generate an XML instance. I don't know of code
> examples doing that however.
>
>
> -- 
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


0
3/21/2005 4:39:27 PM
Reply:

Similar Artilces:

Get Xml from web .
This is a link to an address where I would like to access xml. http://setiathome2.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=user_xml&email=XXXX The XXXX is the email address of a user. All I want to do is access the xml and view it in a datagrid. I have read several tuturials and articles and have not been able to find something that would explain how to do this. Does anyone know of a sample code or something close I could use as a reference. I am using visualstudio.net. and visual basic. THX Take a look at using the following classes on your app: HttpWebRequest HttpWebResponse DataSe...

Change Default Add-in Folder
Great Day! Is there a way to change default add-in folder in Excel so in stead o going to the C:\Documents and Settings\"username"\Applicatio Data\Microsoft\Addins\ it goes to my folder (C:/MyAddins). Thank you. Compound -- compoun ----------------------------------------------------------------------- compound's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1155 View this thread: http://www.excelforum.com/showthread.php?threadid=38688 I think if you use Regedit to modify this key value: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Gene...

what r the XML softwares?
Hi everybody, I am new in this field and i need a help from you .... can u tell me which all r the softwares r needed for doing an Xml prog.(with version) . Thank you, Joshua Joseph Joshua wrote: > Hi everybody, > I am new in this field and i need a help from you .... > can u tell me which all r the softwares r needed for doing an Xml > prog.(with version) . Thank you, > Joshua Joseph Hi, Your question is not clear. XML is the native language for dot net. Hence if you are tr...

Need help creating a formula
I would like to create a formula that will check to see if there is value in one of two cells, multiply the found value by a value i another cell and return a total. Specifically: Cell B1 Cell B2 CellB3 Either B1 or B2 will contain a value, not both. If B1 has a value, it will be multiplied by the value in B37 and th result displayed in B3. If B2 has a value, it will be multiplied by the value in B38 and th result displayed in B3. Th -- storeman496 ----------------------------------------------------------------------- storeman4966's Profile: http://www.excelforum.com/member.ph...

XML that is built on runtime
Hello, I have build xml by xmldom on runtime (on server) (it is only in memory, and doesn't in any file). How can I move the xml context from the server to client & vice versa ? Thanks :) On the server, you can add an XML Web control as shown below.... Dim xml_doc As New System.Xml.XmlDocument Dim s_xml Dim temp s_xml = "" s_xml = s_xml & "<xml id=" & Chr(34) & "kkk" & Chr(34) & ">" s_xml = s_xml & "<people id=" & Chr(34) & "kkk" & Chr(34) & ">" s_xml = ...

Can I use an industry standard XSD and ADO.NET / SQLServer to output a conforming XML file
We have tentatively agreed with a supplier to exchange order information. The plan is to use an 'industry standard' order schema definition from say www.xcbl.org. Is there are simple way to use ADO.NET in this scenario. Ideally (naively) I would like to do something along these lines : 1. Create a SQLServer stored proc that returns a dataset (or similar) containing the order details such as : select PurchaseOrderID,ProductID,Qty from PurchaseOrder join PurchaseOrderItem...... 2. In a COM+ object (not entirely relevant to the problem, but this is how it will work), I would expe...

Creating a goto/anchor in excel based on a cell value
Hello, I am creating a financial worksheet for a client in which the user can choose options from a drop down menu. What I want to happen is, based on the option the user chooses, the model sends them to a certain cell on the same sheet. Ex: If user chooses 1 from the drop down, it sends them to cell A4. If the user chooses 2 from the drop down, it sends them to cell A5. Also, I would like to know how to trigger a macro based on a cell value Here is the code I thought might work =if(A1=1, Run_OLM(),"") Any advice on these topics is much appreciated. Thanks in advance. Tushar...

HP Image Editor files default to C:\ directory
Re: HP 3970 Scanner Hello Everyone: Maybe someone here has or has used this scanner and knows the answer. I will make my question as straightforward as possible. Once I have scanned an image and 'saved it,' it defaults to the C:\ directory unless I choose another location. If it is saved in another directory, it will not show up on the image editor so I unable to print or edit the image. Is there a way to change the settings so that an image is automatically saved to a default location other than C:\ or do I have to move an image to the C:\ location each time I ...

Creating hidden modal property sheet
How do I create hidden modal property sheet? The property sheet is created with DoModal. If I cannot create it hidden maybe I can create it with position off screen and make it hidden later and then center on the screen. > How do I create hidden modal property sheet? The property sheet is created > with DoModal. If I cannot create it hidden maybe I can create it with > position off screen and make it hidden later and then center on the screen. Make it modeless and hide it. If its hidden why would it matter if its modal or not. --- Ajay No, I cannot create it modeless. I need to...

layout help-creating 2 pages on 8 1/2 x 11 paper for booklet
I am new to Publisher, so bear with me.... I am trying to create a booklet using 8 1/2 x 11 paper in positioned in landscape position. I would like to get 2 pages on one piece of paper, but with the text in a portrait position, if that makes sense. Can anyone guide me? Thanks. -- Lauren When you setup your publication as a booklet, the pages are presented in the correct order automatically. The half pages will be portrait. Have you tried to setup a booklet? If you have, what problems are you experiencing? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.or...

Newly Created Function not Working
Hello I am using an excel function that I dropped into a VBA module. Th function works fine for me but when I copied the function into colleauges computer it is not working. We keep getting the error NAME returned. Any ides as to why this could be happening? We are bot running excel 2000. The function I am using is the sheetoffset functio if that helps at all -- nuve ----------------------------------------------------------------------- nuver's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1003 View this thread: http://www.excelforum.com/showthread.php?threadi...

creating a template for photos
Is there a way to create a template in Microsoft Word for photos? And to also import a group of photos all at once rather than importing them and formating them individually? The answer to your first question is almost certainly "yes", but you have not given enough information. As for the second question, you could use mailmerge to insert all of the photos into a document. See the "Graphics from data base" item under the "Special merges" section of fellow MVP Cindy Meister's website at http://homepage.swissonline.ch/cindymeister/MergFram.htm...

Outlook 2010
I have configured a few email accounts: 1 Exchange (work) and 2 pop3/smtp (private). I can't find an option to set my exchange account as a default one for sending emails. So I often send work emails from private account - pretty annoying feature... :) Please help ...

Opening .xml file with my application
Hi I have an application to show the data in .xml file in different mode. When I want to right click on the xml file and select my application to open the xml file. In this case in the application side how to take file name as a parameter to open the xml file and link it to the File->Open menu item in the application. Thanks in advance. Murali. you have to process the command line parameters to get the file name. "PMURALI" <pmurali@osi-systems.co.in> wrote in message news:ubod584WFHA.2740@TK2MSFTNGP14.phx.gbl... > Hi > > I have an application to show the...

Loosing schema information while converting DataSet to XML
Hello, I have a Client/Server system based on a single generic communication method using XML (as done in MS Project-Server or SharePoint-WebServices). To transfer DataSets I'am using XmlDataDocument. This works fine. However the created XmlDataDocument does not contain schema information, i.e. the datatypes of the columns in the dataset-tables are lost. Is there any way to include the shema info? (I cannot use dataSet.WriteXml because I don't need a file or stream, I need a XmlDocument!) Thank you Wolfgang Code fragment: // Create dataset or get it from database DataSet data...

Excel 2000
Hi, I wanted to create an automatic seacrh in MS Excel or MS Access. For example in Column A1, I have "APPLE" and then column "A2" should search for the unit price of APPLE in a database. And then on on cell B1=Orange, B2 should search for the unit price of orange in a database. How do I do that thanks Hi have a look at VLOOKUP for this. See: http://www.contextures.com/xlFunctions02.html -- Regards Frank Kabel Frankfurt, Germany "echo7" <echo7@discussions.microsoft.com> schrieb im Newsbeitrag news:709085ED-2C2A-44A0-9492-42E4CB24DF00@microsoft.com......

Programmatically Update a Form's Combo Box Default Value and SQL Record Source
I have one Sales Activity form that I use for data entry and for viewing all records by Sales Person (EmployeeID). Without having to have multiple instances of this form, I want to accomplish the below; based on which EmployeeID (sales person) opens the form in either mode: 1. For the data entry mode – I want the Combo Box’s Default Value to change, based on my user (EmployeeID); 2. Show All Records mode – I want the SQL record source to filter on that sales person’s records (EmployeeID) I’ve got some code for passwords, so I hope I can utilize that part of it; I just do not know how to do ...

outlook mail services by default
I want use outlook for my mails, but outlook express is my mail services by default. How i can restore my outlook in default mail services? ...

XML Error Message
When I click on the Summary button for a case I receive an error message stating the following. Error: Object doesn's support this property or method Xml: undefined The only choice I have is to click the OK button. I then am able to go into the summary without any issues. This is just an annoying error and if anyone can help me figure out why it is being displayed I would appreciate it. Thanks. Keith I assume you are using an add-in like c360 Activity Summary, since there is no "Summary" in CRM out of the box. I would check with c360's support if that's where ...

How can I add tabs to Bluetooth devices with windows default drive
I want to add an extension profile like FTP to windows default bluetooth driver stack and show a tab when right click on the bluetooth icon. It is said that "By impltmenting a shell proterty handler for the application" in Bluetooth Wireless Technology FAQ. I've tried that but it is only add a property sheet in Bluetooth settings, and my question is how to add a tab in the context menu just like "send a file" tab. Does it need a ContexMenuHandler and where should I registe it? ...

XML Serialization:: Too many ArrayList elements
I'm using XML Serialization to try and get this structure: <LibraryCategories> <LibraryCatgeory>1</LibraryCatgeory> <LibraryCatgeory>2</LibraryCatgeory> <LibraryCatgeory>3</LibraryCatgeory> </LibraryCategories> My class has a public property called LibraryCategories, of type ArrayList: [XmlElement(Type = typeof(LibraryCategoryItem))] public ArrayList LibraryCategories; In addition, I have class which defines the LibraryCategory item: public class LibraryCategoryItem { public string LibraryCategory; } The proble...

Control Button to Create a New Record in Another Form
I've developed a MS Access application for Trade Shows. One of my tables contains all basic client info. This table is used as the data source for both a complete client form and a partial data form. Both forms can show all clients (individually). Using the partial data form I want to create a button that copies the current record and creates a new record in a form titled Trade Show Attendees. Other data in the Trade Show Attendees must be entered to complete that attendee's record. Some of the data entered will populate the TradeShow Attendees table. Can anyone describe t...

Leading and trailing spaces trimmed with SQL XML
Hi, I am inserting data into a table using xml bulk insert. One of the field is of string type and contains data with leading and trailing spaces. But on insert the spaces automatically trimmed off. Can you please tell me how to avoid this trimming of spaces, as i have to insert data using xml. EXEC sp_xml_preparedocument @hDoc OUTPUT, @InsertLines INSERT INTO tblLine WITH (TABLOCKX) ([Text]) SELECT [Text] FROM OPENXML (@hDoc, '/Lines/Line', 1) WITH ([Text] nvarchar(max)) EXEC sp_xml_removedocument @hDoc Thank you Frank bad_clone (bad_clone@hotmail.com) writes: ...

Creating a yearbook
I am creating a yearbook. It is for a very small group of kids. Are there any templates in publisher? Do any one have any suggestions? I have not used Publisher before. Thanks Jay Do you have a database with the kids names and other information? The catalog merge is an excellent way to make a directory. What version Publisher are you using? These articles are for 2003, but it is about the same in 2007. Mail and catalog merge http://office.microsoft.com/en-us/publisher/CH062524751033.aspx -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft...

I can't create and delete users.
Hi, i have a Dynamics CRM Workgruop Sever 4.0 (for partners) in a server of my company, had had problems with product registration and Leon Tribe tell me the solution. Now the problem is that I want to create more users and the options do not appear, not create and not delete, only print and export to excel with my account and the administrator account. I would appreciate someone explain to me what happens. Thank's __________ Informaci�n de ESET Smart Security, versi�n de la base de firmas de virus 5362 (20100813) __________ ESET Smart Security ha comprobado este mensaje. http://w...