[Dev] one more question regarding itemref

Morgen Sagen morgen at osafoundation.org
Tue Jan 25 22:21:20 PST 2005


On Jan 25, 2005, at 10:36 AM, Alec Flett wrote:

>  ok, last question, I swear:
>
>  is it possible to simpliy nest xml nodes rather than declare them all 
> at a high level and reference them?
>
>  i.e. is this:
>  <tag1 itsName="foo"><subnode/></tag1>
>  <tag2 itsName="bar"><tag1 itemref="foo"/></tag1>
>
>  the same as:
>  <tag2 itsName="bar">
>    <tag1>
>      <subnode/>
>    </tag1>
>  </tag2>
>
>  (which essentially makes "tag1" an "anonymous" inner node)
>
>  Alec

You may nest items' XML elements, which implies that the outer item is 
the repository parent of the inner item.  But the syntaxes above won't 
work with the parcel loader; you have to explicitly specify itemrefs.  
Only elements with itsName= specified will be created as items, and all 
other elements are processed as attribute assignments upon the 
containing element.

<Parcel itsName="example"
     xmlns="http://osafoundation.org/parcels/core"
     xmlns:cm="http://osafoundation.org/parcels/osaf/contentmodel"
     
xmlns:con="http://osafoundation.org/parcels/osaf/contentmodel/contacts"
     xmlns:this="http://example.org/parcels/example">

     <cm:ContentItem itsName="foo">

        <con:Contact itsName="bar">
            <emailAddress value="example at example.org" />
        </con:Contact>

        <sharer itemref="me:foo/bar" />

     </cm:ContentItem>

</Parcel>

The above would define a Parcel item 'example', with a child 
ContentItem named 'foo', and foo would have a Contact item child named 
'bar'.  bar's 'emailAddress' attribute will be assigned 
'example at example.org'.  foo's 'sharer' attribute will be assigned (an 
itemref) to bar.



More information about the Dev mailing list