0

I have XML-string like:

<Tree Name="tree1">
    <Service>Service1</Service>
    <Tree Name="tree2">
         <Service>Service2</Service>
         <Service>Service3</Service>
    </Tree>
    <Service>Service4</Service>
    <Tree Name="tree3">
        <Service>Service4</Service>
        <Service>service5</Service>
    </Tree>
</Tree>

and binding structure:

    <mapping ordered="false" allow-repeats="true" abstract="true" type-name="Tree"
         class="Tree">
    <collection ordered="false" allow-repeats="true" get-method="getTrees" set-method="setTrees" usage="optional">
        <structure usage="optional" ordered="false" allow-repeats="true" map-as="Tree" name="Tree"/>
    </collection>
    <collection ordered="false" allow-repeats="true"  get-method="getServices" set-method="setServices" usage="optional">
        <structure usage="optional" ordered="false" allow-repeats="true"   map-as="Service" name="Service"/>
    </collection>
    <value style="attribute" name="Name" get-method="getName" set-method="setName" usage="optional"/>
    </mapping>

But when I try unmarshall xml I catch in root only one Tree and only one Service. Is there any posibilites to get all data from xml?

Marlon
  • 19,924
  • 12
  • 70
  • 101
Xsar
  • 1
  • 2

1 Answers1

0

I solved this problem by using such construction in binding.xml:

<collection ordered="false" get-method="getCollection" set-method="setCollection" usage="optional">
      <structure map-as="Service" name="Service" usage="optional"/>
      <structure map-as="Tree" name="Tree" usage="optional"/>
</collection>

That gives me collection with all elements and I can sort it manually.

Xsar
  • 1
  • 2