Click here to Skip to main content
15,939,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a XML file that I am importing into a database, however, I need to ensure that the user has selected an appropriate target database.

In turn, I am counting the target table's columns:
SQL
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'SOME_TABLE'


and comparing it to the count of elements declared in the XML schema. However, I cannot figure out how to count the <xs:element>'s of the schema.

Here is an example:

XML
<xs:element id="list" name="list">
<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:annotated">
<xs:sequence>
<xs:element minOccurs="0" name="simpleType" 
<xs:element ...>
<xs:element ...>
type="xs:localSimpleType"/>
</xs:sequence>
<xs:attribute name="itemType" type="xs:QName" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>

Any help would be appreciated (examples are even better)!
Thanks
Posted
Updated 30-Jan-10 18:22pm

1 solution

Have a look at these links thay should help to point you in the right direction.

Traversing XML Schemas[^]
Manage XML Schema File ( add element - Attribute)[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900