commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/xdocs/guide binding.xml
Date Sun, 12 Dec 2004 11:09:26 GMT
rdonkin     2004/12/12 03:09:26

  Modified:    betwixt/xdocs/guide binding.xml
  Log:
  Documentation for mixed collection element name guessing. Issue#32634. Contributed by Christoph
Gaffga.
  
  Revision  Changes    Path
  1.12      +40 -0     jakarta-commons/betwixt/xdocs/guide/binding.xml
  
  Index: binding.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/xdocs/guide/binding.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- binding.xml	6 Oct 2004 21:38:06 -0000	1.11
  +++ binding.xml	12 Dec 2004 11:09:26 -0000	1.12
  @@ -535,6 +535,46 @@
            });
   ]]></source></p>
       </subsection>
  +    <subsection name='Mixed Collections - Guessing Element Names'>
  +            <p>
  +A collection may contain objects of several different types. If you 
  +specify a name for the collections elements in the dot-betwixt-files (for these
  +'mixed' collections), you can't say by its XML element what kind of object it was.
  +Therefore, by omitting the <code>name</code>-attribute for a collection in
 
  +dot-betwixt-files, Betwixt will map each object contained in that collection separately.
  +            </p>
  +            <p>
  +As an example, we assume a small <code>TestClass</code> having only one property
  +named <code>col</code> of type <code>java.util.Collection</code>.
The collection
  +contains object of different types. With a usual dot-betwixt-file we would expect
  +to have all items in the collection be of the same element-type in the XML output.
  +Now we omit the name and let Betwixt guess the names for the items in the collection:
  +<source><![CDATA[
  +  <?xml version="1.0" encoding="ISO-8859-15"?>
  +  <info primitiveTypes="element">
  +    <element name="test-class">
  +      <element name="mixed-collection">
  +         <element property="col"/> <!-- without name-attribute! -->
  +      </element>
  +    </element>
  +  </info>
  +]]></source>
  +The output would now look like:
  +<source><![CDATA[
  +  <test-class>
  +    <mixed-collection>
  +      <string>String x</string>
  +      <integer>5</integer>
  +      <another-class>
  +        ...
  +      </another-class>
  +    </mixed-collection>
  +  </test-class>
  +]]></source>
  +As you can see above the collection's items are named diffent depending on
  +their type.
  +      </p>
  +    </subsection>
   </section>
   
       <section name='Converting Objects And Primitives To Strings (And Back Again)'>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message