I'm very new to xml, and struggling a bit..
I want to use an .xsd file passed to a windows application to define a
dataset's schema, and also (if possible) pass other metadata associated with
given elements of the schema (tables and columns) that the application also
requires. I've guessed that Annotations are a way to do this, so added
<xs:annotation> elements to the xsd file (see example below).
I can set up the dataset fine:
Dim ds As New DataSet()
ds.ReadXmlSchema("XMLSchema1.xsd")
All tables and columns set up beautifully. But what object do I use to get
at the metadata in the annotations, and associate it easily with the
relevant tables and columns within the dataset? I've played with the
xmlDataDocument class, the xmlSchemaAnnotated class, and various others, but
I'm fast losing contact with the ground...
Alternatively, is there a better way to pass such metadata?
Thanks!
Jonathan
Here's the sample xsd file:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="XMLSchema1"
targetNamespace="http://tempuri.org/XMLSchema1.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema1.xsd"
xmlns:mstns="http://tempuri.org/XMLSchema1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Table1">
<xs:complexType>
<xs:annotation>
<xs:appinfo>Meta data about Table1</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element name="ID1" type="xs:integer">
<xs:annotation>
<xs:appinfo>Metat data about column ID1</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Text1" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Table2">
<xs:complexType>
<xs:annotation>
<xs:appinfo>Meta data about Table2</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element name="ID2" type="xs:integer" />
<xs:element name="Text2" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>