Site Navigation:

sbxb

A mapped binding example

This sample's code is also located in the package {@link org.otvl.sbxbsamp.simple}.

The SoftBean object model

The target XML format

<Page>

<url>http://sourceforge.net/</url>

<frame id="right">

<x>200</x>

<y>80</y>

</frame>

<frame id="left">

<x>0</x>

<y>80</y>

</frame>

</Page>

The binding specification

pbs.org.otvl.sbxbsamp.simple.Page.0.url=url

pbs.org.otvl.sbxbsamp.simple.Page.1.theFrames=frame(pbs,name)

pbs.org.otvl.sbxbsamp.simple.Frame.0.name=@id

pbs.org.otvl.sbxbsamp.simple.Frame.1.x=x

pbs.org.otvl.sbxbsamp.simple.Frame.2.y=y

As we can see it is possible to indicate the key that must be used to insert the "Frame" sub-objects into the "theFrames" mapped collection. The is the name of a property of the sub-object, here "name" that follows the name of the binding to use: "frame(pbs,name)".