473,394 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Extracting schema..

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:schemainto 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>
Jun 27 '08 #1
1 1206
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.Inf o.DirectoryPath & "\" &
classname & ".xml", outputdir & "\" & classname & ".xsd", True)

Hope that helps

John Sheppard

"mr t" <ta*****@gmail.comwrote in message
news:96**********************************@d1g2000h sg.googlegroups.com...
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:schemainto 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>

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vika Zafrin | last post by:
Hello, group. I am working with some texts, literary and otherwise, marking them up as I go, without a set DTD. I do not plan to have a DTD in place at all, at least not for the encoding part...
4
by: Porthos | last post by:
Hi All, I've been working on mining data from a schema file (all attribute data so far) and have come to the point where I need to get information that is contained in tags. For instance,...
4
by: Curious | last post by:
Hi, I have a class with properties and each property has specific datatypes. Is it possible to extract the datatypes of each property found in a class? I would like to extract these...
1
by: RSH | last post by:
Im trying to write a simple app that will show all of the user created tables along with their columns and column datatypes. Any suggestions on how to approach this??? Thanks!
7
by: Amit | last post by:
Hi everybody,I have 2 dropdowns and on selected index change the second dropdown is populated accordingly and so on.i am displaying the selected value in a label for the user so that he comes to...
1
by: annaannie | last post by:
hello sir, My aim is to extract 'id' and 'ac' from given XML files,and store the results in two different files.the code i wrote can extract 'ids',and give the output in a file.But i cant extract...
6
by: Werner | last post by:
Hi, I try to read (and extract) some "self extracting" zipefiles on a Windows system. The standard module zipefile seems not to be able to handle this. False Is there a wrapper or has...
0
by: akshaychand | last post by:
Hi, I am designing a Schema Editor using the Schema Object Model in .NET 2.0. I am currently facing an problem wherein I want to list all the built-in data types as well as the custom types that...
2
by: clawsicus | last post by:
Hi list, I'm trying to use regular expressions to help me quickly extract the contents of messages that my application will receive. I have worked out most of the regex but the last section of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.