This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > March 2004 > How to make a XSD file from following XML doc.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to make a XSD file from following XML doc.
Jim

2004-03-22, 5:32 pm

Hi everyone,

I have following XML doc:

<Application><Header><UserId/><Password/></Header><borr:Borrower xmlns:borr="http://www.test.com/schema/"><borr:name/><borr:date/></borr:Borrower></Application>

How can I create corresponding XSD file.

Thanks in advance.

Jim

Chris Lovett

2004-03-30, 10:12 pm

You could use the XSD inference engine which you can download from on
www.gotdotnet.com

"Jim" <anonymous@discussions.microsoft.com> wrote in message
news:D3ABAA5A-CCC3-46A5-92C6-8B4A821F0DE9@microsoft.com...
> Hi everyone,
>
> I have following XML doc:
>
> <Application><Header><UserId/><Password/></Header><borr:Borrower

xmlns:borr="http://www.test.com/schema/"><borr:name/><borr:date/></borr:Borr
ower></Application>
>
> How can I create corresponding XSD file.
>
> Thanks in advance.
>
> Jim
>



Jim

2004-03-30, 10:13 pm

Thanks for your reply.

There are two following XSD files were generated by using XSD inference 1.0:

One is testXSD.xsd which in the import statement the schemaLocation was added to point to second XSD file.

<?xml version="1.0" encoding="utf-8"?><xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import namespace="http://www.test.com/schema/" schemaLocation="testXSD1.xsd" /><xs:element n
ame="Application"><xs:complexType><xs:sequence><xs:element name="Borrower"><xs:complexType><xs:sequence><xs:element name="name" /><xs:element name="date" /></xs:sequence></xs:complexType></xs:element><xs:element xmlns:q1="http://www.test.com/schema/" ref=
"q1:Borrower" /></xs:sequence></xs:complexType></xs:element></xs:schema>

Seond XSD file is TestXSD1.xsd:

<?xml version="1.0" encoding="utf-8"?><xs:schema xmlns:tns="http://www.test.com/schema/" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.test.com/schema/" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:elemen
t name="Borrower"><xs:complexType><xs:sequence><xs:element name="name" /><xs:element name="date" /></xs:sequence></xs:complexType></xs:element></xs:schema>

But problem is:
test.xml which was used to generat above xsd files cannot be validate aganist above xsd file.
That means in this situation, the generating XSD file cannot be used to validate previous XML instance which was used to
generated XSD files.


Thanks again.
Jim

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews