You can use the xsd.exe file to convert an xml file into an xsd file...
Here is some VERY scrappy code I wrote to do it...it will write a dataset
schema to an xsd file...
Dim xmloutput As String
xmloutput = bigResultdata.GetXmlSchema
xmloutput = xmloutput.Replace(" encoding=""utf-16""?>", "?>")
My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\"
& classname & ".xml", xmloutput, False)
ShellandWait(My.Application.Info.DirectoryPath & "\xsd.exe", """" &
My.Application.Info.DirectoryPath & "\" & classname & ".xml"" /c /l:vb /d",
My.Application.Info.DirectoryPath)
My.Computer.FileSystem.CopyFile(My.Application.Info.DirectoryPath & "\" &
classname & ".xml", outputdir & "\" & classname & ".xsd", True)
Hope that helps
John Sheppard
"mr t" <tascien@xxxxxx> wrote in message
news:96d7c58c-c8a8-4d2d-ad34-944177483272@xxxxxx
> The DataTable xml written out, produces the following xml. can anyone
> show me how to extract that schema and put it in external file? the
> reason for this, is that I want to apply that structure to multiple
> different xml files and don't want to change the structure in each
> file. thanks. I guess it would involve to putting the content from
> <xs:schema to </xs:schema> into xsd file and referencing it somehow?
> don't know how to do that.
>
> <NewDataSet>
> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/
> XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
> xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
> <xs:element name="NewDataSet" msdata:IsDataSet="true"
> msdata:MainDataTable="wg_Profile" msdata:UseCurrentLocale="true">
> <xs:complexType>
> <xs:choice minOccurs="0" maxOccurs="unbounded">
> <xs:element name="wg_Profile" msprop:Name="Profile"
> msprop:PK="MemberID">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="DbName" type="xs:string"
> minOccurs="0" />
> <xs:element name="Name" type="xs:string"
> minOccurs="0" />
> <xs:element name="Type" type="xs:string"
> minOccurs="0" />
> <xs:element name="SubType" type="xs:string"
> minOccurs="0" />
> <xs:element name="Pos" type="xs:int" minOccurs="0" />
> <xs:element name="Length" type="xs:int" default="0"
> minOccurs="0" />
> <xs:element name="Options" type="xs:string"
> minOccurs="0" />
> <xs:element name="OptionsDirection" type="xs:string"
> minOccurs="0" />
> <xs:element name="InputType" type="xs:string"
> minOccurs="0" />
> <xs:element name="Display" type="xs:boolean"
> minOccurs="0" />
> <xs:element name="Default" type="xs:string"
> minOccurs="0" />
> <xs:element name="Required" type="xs:boolean"
> minOccurs="0" />
> <xs:element name="RequiredError" type="xs:boolean"
> minOccurs="0" />
> <xs:element name="InvalidDataError" type="xs:string"
> minOccurs="0" />
> <xs:element name="Group" type="xs:string"
> minOccurs="0" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> <wg_Profile>
> <DbName>MemberID</DbName>
> </wg_Profile>
> <wg_Profile>
> <DbName>LastName</DbName>
> </wg_Profile>
> <wg_Profile>
> <DbName>FirstName</DbName>
> </wg_Profile>
> <wg_Profile>
> <DbName>ProfileName</DbName>
> </wg_Profile>
> <wg_Profile>
> <DbName>Birthday</DbName>
> <Name>Birthday MM/DD/YYYY</Name>
> <SubType>Date</SubType>
> <Display>true</Display>
> <Default />
> <Required>true</Required>
> <InvalidDataError>Invalid Date MM/DD/YYYY</InvalidDataError>
> </wg_Profile>
> <wg_Profile>
> <DbName>Gender</DbName>
> <Name>Gender</Name>
> <Options>Male;Female</Options>
> <OptionsDirection>0</OptionsDirection>
> <InputType>RadioList</InputType>
> <Display>true</Display>
> <Default>Female</Default>
> <Required>true</Required>
> </wg_Profile>
> <wg_Profile>
> </NewDataSet>