xml and tree node question

J

John Underwood

Hi.. I'm look for suggestions in handling the following.. In the xml
below, I read
that in and add it to a tree.. Just reading it in it puts it in the
following format:

Companies
Company
New
Stuff 1
New
Stuff 2
Company
New
Stuff 3
New
Stuff 4

I'd like to combine Nodes that are similiar under a node.. Like this:

Companies
Company
New
Stuff 1
Stuff 2
Company
New
Stuff 3
Stuff 4
OR:
Companies
Company
New
Stuff 1
Stuff 2
Stuff 3
Stuff 4


Is this best way to handle this to loop through nodes to see if that
node exists, and if so add to that node? Or would there be a better
way to write my xml? I'm just look ing for suggestions of how people
normally handle this sort of thing...

thanks...
John

<?xml version="1.0" encoding="utf-8" ?>
<companies>
<company>
<new value="someValue">stuff 1</new>
<new value="someValue">stuff 2</new>
</company>
<company>
<new value="someValue">stuff 3</new>
<new value="someValue">stuff 4</new>
</company>
</companies>
 
M

Mohamoss

Hi John
a trick that you can do is ...... read the whole xml file into a dataset,
then it will creata a table for each group of nodes that have the same name
... then move each of these table to a new dataset ............ then
change the namespace property of the dataset " to the name that you want to
be the new container of all your similar nood ... hope that would help
 

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