Strongly typed datasets and XML

Discussion in 'ASP .Net' started by Big D, Feb 17, 2004.

  1. Big D

    Big D Guest

    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).Description

    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
     
    Big D, Feb 17, 2004
    #1
    1. Advertising

  2. Big D

    bruce barker Guest

    datasets 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" <> wrote in message
    news:...
    > 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).Description
    >
    > 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
    >
    >
     
    bruce barker, Feb 17, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Duncan Welch

    Strongly typed datasets and nested repeaters

    Duncan Welch, Apr 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,055
    MattC
    Apr 7, 2005
  2. chris
    Replies:
    2
    Views:
    2,082
    chris
    Feb 25, 2006
  3. Mike P

    strongly typed datasets

    Mike P, Aug 30, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    369
    Mike P
    Aug 30, 2006
  4. Ben
    Replies:
    0
    Views:
    345
  5. Thomas Zaleski

    Webservices and strongly typed datasets

    Thomas Zaleski, Jul 9, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    149
    Thomas Zaleski
    Jul 9, 2003
Loading...

Share This Page