1

I am trying to create an XSD schema file from an existing XML file but am getting errors. Currently I am trying to use the XSD command prompt tool to generate the XSD file. Any advice on mistakes with my XML file? Or any other tools I should try instead? Here is my XML file:

<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882' xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'> <s:Schema id='RowsetSchema'> <s:ElementType name='row' content='eltOnly'> <s:AttributeType name="c0" rs:name="FIRST_NAME" rs:number="1" rs:nullable="true"> <s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="30"/> </s:AttributeType> <s:AttributeType name="c1" rs:name="MIDDLE_NAME" rs:number="2" rs:nullable="true"> <s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="30"/> </s:AttributeType> <s:AttributeType name="c2" rs:name="LAST_NAME" rs:number="3"> <s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="60" rs:maybenull="false"/> </s:AttributeType> <s:AttributeType name="c3" rs:name="OTHER_ID" rs:number="4" rs:nullable="true"> <s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="24"/> </s:AttributeType> <s:AttributeType name="c4" rs:name="FS_LUN_CODE_ID" rs:number="5" rs:nullable="true"> <s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="2"/> </s:AttributeType> <s:AttributeType name="c5" rs:name="FS_NAME_ID_PAYOR" rs:number="6" rs:nullable="true"> <s:datatype dt:type="int" dt:maxLength="4" rs:precision="10" rs:fixedlength="true"/> </s:AttributeType> <s:AttributeType name="c6" rs:name="FS_TRAN_TIME" rs:number="7" rs:nullable="true"> <s:datatype dt:type="int" dt:maxLength="4" rs:precision="10" rs:fixedlength="true"/> </s:AttributeType> <s:AttributeType name="c7" rs:name="NAME_ID" rs:number="8"> <s:datatype dt:type="int" dt:maxLength="4" rs:precision="10" rs:fixedlength="true" rs:maybenull="false"/> </s:AttributeType> <s:AttributeType name="c8" rs:name="FS_TRAN_DATE" rs:number="9" rs:nullable="true"> <s:datatype dt:type="date" dt:maxLength="6" rs:fixedlength="true"/> </s:AttributeType> <s:extends type="rs:rowbase"/> </s:ElementType> </s:Schema> <rs:data> <z:row c0='SHELLI' c1='A' c2='AANENSON' c3='671590' c4='N' c5='0' c6='32885' c7='12' c8='2007-09-11'/> <z:row c0='SHELLI' c1='A' c2='AANENSON' c3='671590' c4='N' c5='0' c6='32885' c7='12' c8='2007-09-11'/> <z:row c0='SHELLI' c1='A' c2='AANENSON' c3='671590' c4='N' c5='0' c6='32885' c7='12' c8='2007-09-11'/> <z:row c0='SHELLI' c1='A' c2='AANENSON' c3='671590' c4='N' c5='0' c6='32885' c7='12' c8='2007-09-11'/> <z:row c0='WILLIAM' c1='' c2='AASEN' c3='916031' c4='N' c5='0' c6='55833' c7='13' c8='2007-07-27'/> <z:row c0='WILLIAM' c1='' c2='AASEN' c3='916031' c4='N' c5='0' c6='55833' c7='13' c8='2007-07-27'/> <z:row c0='WILLIAM' c1='' c2='AASEN' c3='916031' c4='N' c5='0' c6='55833' c7='13' c8='2007-07-27'/> </rs:data> </xml> 

3 Answers 3

1

It is my understanding that an XSDL schema document can only describe one namespace. Your XML document makes use of multiple namespaces, so you need to have a XSD file for each namespace (i.e. dt.xsd, rs.xsd z.xsd etc.)

Not familiar with SSIS, but I would assume that if it supports multiple XML namespaces and can validate each namespace against a schema, that it should support an XSD per namespace.

Sign up to request clarification or add additional context in comments.

Comments

0

A very simple way to accomplish this would be to download the 30 day trial of Altova XML Spy. It has a very nice XML to XSD feature that you can customize completely.

1 Comment

Thank you, Spy is a very helpful software. But it generated more than one XSD file from the above XML file. I only want one XSD file cause I want to use this to create an SSIS package. Any ideas?
0

That looks like a document defined by NOTE-XML-Data, an W3C Note (not a Rec), rather than an XML Schema Document. Does your tool have options for the type of document output?

2 Comments

I don't understand your question, Jon. Can you elaborate?
By XSD I normally understand an XMLSchema Document, as described at w3.org/XML/Schema. This doesn't look like one. It doesn't have the XMLSchema namespace or use any of it's elements. This is an XML Data document, very different.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.