Linking XForm model instances by an instance data node

62 Views Asked by At

I'm trying to understand XForms and I have a doubt with the model specification. I need to model a composition, and I really don't know how to do it. Suposse you need to create this form, with a Composite Pattern: enter image description here I'm thinking something like this:

<xf:model>
    <xf:instance xmlns="">

        <person>
            <name>Arianne</name>
            <surname>Boissieu</surname>
            <pet>dog</pet>
        </person>

        <pet-options>
            <bird>
                <name/>
                <plumage-color/>
                <bird-beak/>
            </bird>
            <dog id="dog">
                <name/>
                <tail-size/>
                <hair-color/>
            </dog>
        </pet-options>

    </xf:instance>
</xf:model>

Any idea how to link these instances saying what kind of pet has a person and what are its values?

1

There are 1 best solutions below

0
On

first of all your example is not valid. An instance is only allowed a single rootnode. you are having 2. However you can have as many instances as you like.

Regarding your actual question: what are you trying to do more exactly? I assume you're asking for some xpath to link persons + pets but in which context? Please provide more detail.