need XML help with nested tables

Discussion in 'ASP .Net' started by Steve Klett, Dec 5, 2003.

  1. Steve Klett

    Steve Klett Guest

    (I posted this in ADO group, but I think this group will be better)

    Hi-

    I need to develop an FAQ section for our website. We would like to break up
    the FAQ by products, then categories with each category having n
    question/answer pairs.
    I would like to pass parameters in the querystring based on what the
    product/category the user selected, then populate a datagrid with the
    correct set of question/answer

    I am pretty new to XML, but basically I made something like this:
    <products>
    <product>
    <name>prod1</name>
    <partNum>prod1</partNum>
    <categories>
    <category>
    <name>basic category</name>
    <faqs>
    <faq>
    <question>This is a sample question</question>
    <answer>this is the answer</answer>
    </faq>
    </faqs>
    </category>
    </categories>
    </product>
    <product>
    <name>prod2</name>
    <partNum>prod2</partNum>
    <categories>
    <category>
    <name>basic something or something category</name>
    <faqs>
    <faq>
    <question>This is another question</question>
    <answer>and this is another answer</answer>
    </faq>
    </faqs>
    </category>
    </categories>
    </product>
    </products>



    So, then I use a DataSet and the ReadXML() method, this result in 5 tables.
    I was hoping that it would somehow be nested for me, but the way it is right
    now I can't see an easy way to use it the way I want.

    the first table lists the products(good)
    the second table I can't really tell what is in there
    third tables has all the categories, so on and so on.

    What is confusing is... what is the point of structuring data hierarchically
    in XML file if you can't maintain it? I'm sure you can, but how? Is what
    I'm doing not common?

    Someone please shed a little light on this for me, I would appreciate it!!

    Thanks,
    Steve
    Steve Klett, Dec 5, 2003
    #1
    1. Advertising

  2. Steve Klett

    Mary Chipman Guest

    Create a dataset with datarelations between the tables you want
    nested. Set the Nested property prior to writing the xml:

    ds.Relations["relationName"].Nested = true;

    -- Mary
    MCW Technologies
    http://www.mcwtech.com

    On Thu, 4 Dec 2003 16:44:58 -0800, "Steve Klett"
    <> wrote:

    >(I posted this in ADO group, but I think this group will be better)
    >
    >Hi-
    >
    >I need to develop an FAQ section for our website. We would like to break up
    >the FAQ by products, then categories with each category having n
    >question/answer pairs.
    >I would like to pass parameters in the querystring based on what the
    >product/category the user selected, then populate a datagrid with the
    >correct set of question/answer
    >
    >I am pretty new to XML, but basically I made something like this:
    ><products>
    > <product>
    > <name>prod1</name>
    > <partNum>prod1</partNum>
    > <categories>
    > <category>
    > <name>basic category</name>
    > <faqs>
    > <faq>
    > <question>This is a sample question</question>
    > <answer>this is the answer</answer>
    > </faq>
    > </faqs>
    > </category>
    > </categories>
    > </product>
    > <product>
    > <name>prod2</name>
    > <partNum>prod2</partNum>
    > <categories>
    > <category>
    > <name>basic something or something category</name>
    > <faqs>
    > <faq>
    > <question>This is another question</question>
    > <answer>and this is another answer</answer>
    > </faq>
    > </faqs>
    > </category>
    > </categories>
    > </product>
    ></products>
    >
    >
    >
    >So, then I use a DataSet and the ReadXML() method, this result in 5 tables.
    >I was hoping that it would somehow be nested for me, but the way it is right
    >now I can't see an easy way to use it the way I want.
    >
    >the first table lists the products(good)
    >the second table I can't really tell what is in there
    >third tables has all the categories, so on and so on.
    >
    >What is confusing is... what is the point of structuring data hierarchically
    >in XML file if you can't maintain it? I'm sure you can, but how? Is what
    >I'm doing not common?
    >
    >Someone please shed a little light on this for me, I would appreciate it!!
    >
    >Thanks,
    >Steve
    >
    Mary Chipman, Dec 5, 2003
    #2
    1. Advertising

  3. Steve Klett

    neverstill Guest

    Hi Mary, thanks for the response.

    So I would setup the relationions prior to reading teh XML, correct? Have
    you ever seen any examples of this?

    Thanks again,
    Steve




    "Mary Chipman" <> wrote in message
    news:...
    > Create a dataset with datarelations between the tables you want
    > nested. Set the Nested property prior to writing the xml:
    >
    > ds.Relations["relationName"].Nested = true;
    >
    > -- Mary
    > MCW Technologies
    > http://www.mcwtech.com
    >
    > On Thu, 4 Dec 2003 16:44:58 -0800, "Steve Klett"
    > <> wrote:
    >
    > >(I posted this in ADO group, but I think this group will be better)
    > >
    > >Hi-
    > >
    > >I need to develop an FAQ section for our website. We would like to break

    up
    > >the FAQ by products, then categories with each category having n
    > >question/answer pairs.
    > >I would like to pass parameters in the querystring based on what the
    > >product/category the user selected, then populate a datagrid with the
    > >correct set of question/answer
    > >
    > >I am pretty new to XML, but basically I made something like this:
    > ><products>
    > > <product>
    > > <name>prod1</name>
    > > <partNum>prod1</partNum>
    > > <categories>
    > > <category>
    > > <name>basic category</name>
    > > <faqs>
    > > <faq>
    > > <question>This is a sample question</question>
    > > <answer>this is the answer</answer>
    > > </faq>
    > > </faqs>
    > > </category>
    > > </categories>
    > > </product>
    > > <product>
    > > <name>prod2</name>
    > > <partNum>prod2</partNum>
    > > <categories>
    > > <category>
    > > <name>basic something or something category</name>
    > > <faqs>
    > > <faq>
    > > <question>This is another question</question>
    > > <answer>and this is another answer</answer>
    > > </faq>
    > > </faqs>
    > > </category>
    > > </categories>
    > > </product>
    > ></products>
    > >
    > >
    > >
    > >So, then I use a DataSet and the ReadXML() method, this result in 5

    tables.
    > >I was hoping that it would somehow be nested for me, but the way it is

    right
    > >now I can't see an easy way to use it the way I want.
    > >
    > >the first table lists the products(good)
    > >the second table I can't really tell what is in there
    > >third tables has all the categories, so on and so on.
    > >
    > >What is confusing is... what is the point of structuring data

    hierarchically
    > >in XML file if you can't maintain it? I'm sure you can, but how? Is

    what
    > >I'm doing not common?
    > >
    > >Someone please shed a little light on this for me, I would appreciate

    it!!
    > >
    > >Thanks,
    > >Steve
    > >

    >
    neverstill, Dec 8, 2003
    #3
  4. Steve Klett

    Mary Chipman Guest

    Once you add the data to a dataset you can then set the DataRelations
    between the different DataTables. There's examples in online help --
    see the topic "Adding a Relationship between Tables". Gotdotnet.com
    probably has other examples or tutorials as well. Then once you've set
    up the relations, you can then set the nested property to true.

    -- Mary
    MCW Technologies
    http://www.mcwtech.com

    On Mon, 8 Dec 2003 09:53:32 -0800, "neverstill"
    <> wrote:

    >Hi Mary, thanks for the response.
    >
    >So I would setup the relationions prior to reading teh XML, correct? Have
    >you ever seen any examples of this?
    >
    >Thanks again,
    >Steve
    >
    >
    >
    >
    >"Mary Chipman" <> wrote in message
    >news:...
    >> Create a dataset with datarelations between the tables you want
    >> nested. Set the Nested property prior to writing the xml:
    >>
    >> ds.Relations["relationName"].Nested = true;
    >>
    >> -- Mary
    >> MCW Technologies
    >> http://www.mcwtech.com
    >>
    >> On Thu, 4 Dec 2003 16:44:58 -0800, "Steve Klett"
    >> <> wrote:
    >>
    >> >(I posted this in ADO group, but I think this group will be better)
    >> >
    >> >Hi-
    >> >
    >> >I need to develop an FAQ section for our website. We would like to break

    >up
    >> >the FAQ by products, then categories with each category having n
    >> >question/answer pairs.
    >> >I would like to pass parameters in the querystring based on what the
    >> >product/category the user selected, then populate a datagrid with the
    >> >correct set of question/answer
    >> >
    >> >I am pretty new to XML, but basically I made something like this:
    >> ><products>
    >> > <product>
    >> > <name>prod1</name>
    >> > <partNum>prod1</partNum>
    >> > <categories>
    >> > <category>
    >> > <name>basic category</name>
    >> > <faqs>
    >> > <faq>
    >> > <question>This is a sample question</question>
    >> > <answer>this is the answer</answer>
    >> > </faq>
    >> > </faqs>
    >> > </category>
    >> > </categories>
    >> > </product>
    >> > <product>
    >> > <name>prod2</name>
    >> > <partNum>prod2</partNum>
    >> > <categories>
    >> > <category>
    >> > <name>basic something or something category</name>
    >> > <faqs>
    >> > <faq>
    >> > <question>This is another question</question>
    >> > <answer>and this is another answer</answer>
    >> > </faq>
    >> > </faqs>
    >> > </category>
    >> > </categories>
    >> > </product>
    >> ></products>
    >> >
    >> >
    >> >
    >> >So, then I use a DataSet and the ReadXML() method, this result in 5

    >tables.
    >> >I was hoping that it would somehow be nested for me, but the way it is

    >right
    >> >now I can't see an easy way to use it the way I want.
    >> >
    >> >the first table lists the products(good)
    >> >the second table I can't really tell what is in there
    >> >third tables has all the categories, so on and so on.
    >> >
    >> >What is confusing is... what is the point of structuring data

    >hierarchically
    >> >in XML file if you can't maintain it? I'm sure you can, but how? Is

    >what
    >> >I'm doing not common?
    >> >
    >> >Someone please shed a little light on this for me, I would appreciate

    >it!!
    >> >
    >> >Thanks,
    >> >Steve
    >> >

    >>

    >
    Mary Chipman, Dec 9, 2003
    #4
  5. Steve Klett

    neverstill Guest

    great, thanks Mary!


    "Mary Chipman" <> wrote in message
    news:...
    > Once you add the data to a dataset you can then set the DataRelations
    > between the different DataTables. There's examples in online help --
    > see the topic "Adding a Relationship between Tables". Gotdotnet.com
    > probably has other examples or tutorials as well. Then once you've set
    > up the relations, you can then set the nested property to true.
    >
    > -- Mary
    > MCW Technologies
    > http://www.mcwtech.com
    >
    > On Mon, 8 Dec 2003 09:53:32 -0800, "neverstill"
    > <> wrote:
    >
    > >Hi Mary, thanks for the response.
    > >
    > >So I would setup the relationions prior to reading teh XML, correct?

    Have
    > >you ever seen any examples of this?
    > >
    > >Thanks again,
    > >Steve
    > >
    > >
    > >
    > >
    > >"Mary Chipman" <> wrote in message
    > >news:...
    > >> Create a dataset with datarelations between the tables you want
    > >> nested. Set the Nested property prior to writing the xml:
    > >>
    > >> ds.Relations["relationName"].Nested = true;
    > >>
    > >> -- Mary
    > >> MCW Technologies
    > >> http://www.mcwtech.com
    > >>
    > >> On Thu, 4 Dec 2003 16:44:58 -0800, "Steve Klett"
    > >> <> wrote:
    > >>
    > >> >(I posted this in ADO group, but I think this group will be better)
    > >> >
    > >> >Hi-
    > >> >
    > >> >I need to develop an FAQ section for our website. We would like to

    break
    > >up
    > >> >the FAQ by products, then categories with each category having n
    > >> >question/answer pairs.
    > >> >I would like to pass parameters in the querystring based on what the
    > >> >product/category the user selected, then populate a datagrid with the
    > >> >correct set of question/answer
    > >> >
    > >> >I am pretty new to XML, but basically I made something like this:
    > >> ><products>
    > >> > <product>
    > >> > <name>prod1</name>
    > >> > <partNum>prod1</partNum>
    > >> > <categories>
    > >> > <category>
    > >> > <name>basic category</name>
    > >> > <faqs>
    > >> > <faq>
    > >> > <question>This is a sample question</question>
    > >> > <answer>this is the answer</answer>
    > >> > </faq>
    > >> > </faqs>
    > >> > </category>
    > >> > </categories>
    > >> > </product>
    > >> > <product>
    > >> > <name>prod2</name>
    > >> > <partNum>prod2</partNum>
    > >> > <categories>
    > >> > <category>
    > >> > <name>basic something or something category</name>
    > >> > <faqs>
    > >> > <faq>
    > >> > <question>This is another question</question>
    > >> > <answer>and this is another answer</answer>
    > >> > </faq>
    > >> > </faqs>
    > >> > </category>
    > >> > </categories>
    > >> > </product>
    > >> ></products>
    > >> >
    > >> >
    > >> >
    > >> >So, then I use a DataSet and the ReadXML() method, this result in 5

    > >tables.
    > >> >I was hoping that it would somehow be nested for me, but the way it is

    > >right
    > >> >now I can't see an easy way to use it the way I want.
    > >> >
    > >> >the first table lists the products(good)
    > >> >the second table I can't really tell what is in there
    > >> >third tables has all the categories, so on and so on.
    > >> >
    > >> >What is confusing is... what is the point of structuring data

    > >hierarchically
    > >> >in XML file if you can't maintain it? I'm sure you can, but how? Is

    > >what
    > >> >I'm doing not common?
    > >> >
    > >> >Someone please shed a little light on this for me, I would appreciate

    > >it!!
    > >> >
    > >> >Thanks,
    > >> >Steve
    > >> >
    > >>

    > >

    >
    neverstill, Dec 9, 2003
    #5
    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. Peter Bassett
    Replies:
    3
    Views:
    917
    Augustus
    Aug 15, 2003
  2. Otuatail

    Tables within tables

    Otuatail, Jul 31, 2004, in forum: HTML
    Replies:
    7
    Views:
    486
  3. Chris Brat
    Replies:
    5
    Views:
    688
    =?iso-8859-1?q?Luis_M._Gonz=E1lez?=
    Aug 22, 2006
  4. Ultrus
    Replies:
    3
    Views:
    364
    Stefan Behnel
    Jul 9, 2007
  5. Replies:
    0
    Views:
    298
Loading...

Share This Page