problem with sorting datastructures ....

Hello,

i am a relative beginner in programming and have to solve a problem with sorting and analysing lists.

the case:

i have a datastructure (Vector) wich contains references to a second datastructure (also Vector).

The first one handles spezial objects (extended Vector) from the type of the second Structure (type Component extends Vector).

The components ave different attributes like size, ID that describe a geometric object.

A object (component) can be stand-alone or can be part of a group. If it is part of a group, a spezial flag is set and the reference to a array ao all group members is set.

e.g:

datastructure 1 (manages the different components in datastructure 2)

-

Index | component

-

0| Obj1

-

1| obj2

-

datastructure 2 (type component)

(obj1)

--

index | Object

--

0| (int) ID

--

1| (float) size

--

2| (boolean) isGroup

--

3| (component[]) groupComponents

--

Now i have to write these structure into an xml file and i have to build my tree with JDOM. But i don't knwo how to build the tree in order to the group data.

The tree have to look like this:

<root>

<content>

<group def="1">

<group def="1.1">

<element1>

<element2>

</group>

<group def ="1.2"

><element3>

<element4>

</group>

</group>

</content>

</root>

i have to step though all elements, take a look in witch group it is (if it is) and build these groups.

But i have no idea how to to this.

It would be great if someone may help me with a pseudo code example.

Regards

Marcus

[1847 byte] By [Masom17a] at [2007-9-28 8:17:29]
# 1

Hi Masom,

I have not read in deepth what your problem was but I remembered reading something about the buzzwords you mention.

<a href="http://developer.java.sun.com/developer/earlyAccess/xml/jaxb/">Java Architecture for XML Binding (JAXB)</a> is available as a Beta release. JAXB provides an API and tools that automate the mapping between XML documents and Java objects.

Sometimes even complex problems are solved for you...

usally by SUN.

-Michael

noresizea at 2007-7-9 19:30:31 > top of Java-index,Other Topics,Algorithms...
# 2
test : http://developer.java.sun.com/developer/earlyAccess/xml/jaxb/
noresizea at 2007-7-9 19:30:31 > top of Java-index,Other Topics,Algorithms...