I am having trouble understanding strongly typed datasets and XML files. I
have the following schema:
<xs:schema id="Pages" targetNamespace="http://asdf.org/EOBEPages.xsd"
elementFormDefault="qualified"
xmlns="http://asdf.org" xmlns:mstns="http://asdf.org/EOBEPages.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="EOBEPages">
<xs:complexType>
<xs:sequence>
<xs:element name="Page">
<xs:complexType>
<xs:sequence>
<xs:element name="PageTitle" type="xs:string" />
<xs:element name="PageText" type="xs:string" />
<xs:element name="PageNumber" type="xs:integer" />
<xs:element name="NumImages" type="xs:integer" />
<xs:element name="ImagesDescription" type="xs:string" minOccurs="0"
maxOccurs="1" />
<xs:element name="ImageDefinitions">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema
I load the xml data into the dataset no problem, and can access the "page"
info by:
myDataset.Page(index).pageTitle
, etc, but can NOT access the "ImageDefinitions", because I guess I don't
understand how. What I wanted to do is something like:
myVar = myDataset.Page(index).ImageDefinitions(index2).Des cription
but this is not part of the dataset... why? How can I get access to the
image definition descriptions based on the page index?
Thanks a bunch!
MC Ddatasets are tables with relationships. every xml complex type becomes a new
table. ImageDefinitions becomes a table which you can access.
myVar = myDataset.ImageDefinitions(index).Description
if you have a relionship setup you can access ImageDefinitions rows from
Page rows using GetChildRows
-- bruce (sqlwork.com)
"Big D" <a@.a.com> wrote in message
news:uam6WMY9DHA.1632@.TK2MSFTNGP12.phx.gbl...
> I am having trouble understanding strongly typed datasets and XML files.
I
> have the following schema:
> <xs:schema id="Pages" targetNamespace="http://asdf.org/EOBEPages.xsd"
> elementFormDefault="qualified"
> xmlns="http://asdf.org" xmlns:mstns="http://asdf.org/EOBEPages.xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="EOBEPages">
> <xs:complexType>
> <xs:sequence
> <xs:element name="Page">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="PageTitle" type="xs:string" />
> <xs:element name="PageText" type="xs:string" />
> <xs:element name="PageNumber" type="xs:integer" />
> <xs:element name="NumImages" type="xs:integer" />
> <xs:element name="ImagesDescription" type="xs:string" minOccurs="0"
> maxOccurs="1" /
> <xs:element name="ImageDefinitions">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Description" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> I load the xml data into the dataset no problem, and can access the "page"
> info by:
> myDataset.Page(index).pageTitle
> , etc, but can NOT access the "ImageDefinitions", because I guess I don't
> understand how. What I wanted to do is something like:
> myVar = myDataset.Page(index).ImageDefinitions(index2).Des cription
> but this is not part of the dataset... why? How can I get access to the
> image definition descriptions based on the page index?
> Thanks a bunch!
> MC D
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment