Home All Groups Group Topic Archive Search About

How do I find this piece of xml in a dataset?

Author
22 Nov 2005 12:24 AM
jlp
Hey all, this may be a noob question but...

I am loading an xml file into a dataset but there is a piece of data in
it that I can not find in the dataset. In the xml there is an element
that looks somthing like this.

<somegroupofpeople>
    <persontype>Male
        <person>
            <fname>John</fname>
            <lname>Doe</lname>
        </person>
        <person>
            <fname>Joe</fname>
            <lname>Dirt</lname>
        </person>
    </persontype>
    <persontype>Female
        <person>
            <fname>Jane</fname>
            <lname>Doe</lname>
        </person>
        <person>
            <fname>Joe</fname>
            <lname>Dirt in drag</lname>
        </person>
    </persontype>
</somegroupofpeople>
<somegroupofpeople>...

This is just an example. The real data has elements that differ. What I
can't seem to find or navigate to is what would be values "Male" or
"Female" in persontype.

My first impression is that this kind of layout is kind of goofy in that
the sex should be an element or attribute of <person>. However I am no
xml guru and any tool that I run it through tells me that it is well
formed so what do I know.

If I needed to do something for persontype in each group of people
dependent on its value, how do I find this piece of the xml in a
dataset?

I hope this makes sense.

Thanks all.

Author
22 Nov 2005 10:03 AM
Cor Ligthert [MVP]
jlp,

I don't believe this is a dataset. A dataset has normally not nested three
levels.
Dataset  Value Dataset name
DataTable Value table name
DataItems (with there own tagnames and values)

Try to open this in your IDE with the solution explorer. Than the schema
will be showed if this is one.

And if you than have not the answer, reply.

I hope this helps,

Cor
Author
11 Dec 2005 5:00 PM
rossu
This is not well formed xml.

You can't have something like
<a> data <b>more data</b></a>

The best way to deal with this data is
<Person>
   <Sex>Male</Sex>
   <fname>John</fname>
   <lname>Doe<lname>
<Person>
which would allow you to search on Sex.

The following is legal xml but would make a horrific db to use
<group>
  <persontype>make</persontype>
  <person>
    <fname>John</fname>
    <lname>Doe</lname>
   </person>
  <person>
    <fname>Joe</fname>
    <lname>Dirt</lname>
   </person>
</group>


Show quote
"jlp" wrote:

> Hey all, this may be a noob question but...
>
> I am loading an xml file into a dataset but there is a piece of data in
> it that I can not find in the dataset. In the xml there is an element
> that looks somthing like this.
>
> <somegroupofpeople>
>     <persontype>Male
>         <person>
>             <fname>John</fname>
>             <lname>Doe</lname>
>         </person>
>         <person>
>             <fname>Joe</fname>
>             <lname>Dirt</lname>
>         </person>
>     </persontype>
>     <persontype>Female
>         <person>
>             <fname>Jane</fname>
>             <lname>Doe</lname>
>         </person>
>         <person>
>             <fname>Joe</fname>
>             <lname>Dirt in drag</lname>
>         </person>
>     </persontype>
> </somegroupofpeople>
> <somegroupofpeople>...
>
> This is just an example. The real data has elements that differ. What I
> can't seem to find or navigate to is what would be values "Male" or
> "Female" in persontype.
>
> My first impression is that this kind of layout is kind of goofy in that
> the sex should be an element or attribute of <person>. However I am no
> xml guru and any tool that I run it through tells me that it is well
> formed so what do I know.
>
> If I needed to do something for persontype in each group of people
> dependent on its value, how do I find this piece of the xml in a
> dataset?
>
> I hope this makes sense.
>
> Thanks all.
>

AddThis Social Bookmark Button