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

J

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.
 
C

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
 
G

Guest

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top