commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: jakarta-commons/betwixt/xdocs overview.xml
Date Sun, 15 Dec 2002 19:58:36 GMT
rdonkin     2002/12/15 11:58:36

  Modified:    betwixt  project.xml
               betwixt/xdocs overview.xml
  Changed example documentation so that it works better with latest version of maven
  Revision  Changes    Path
  1.19      +4 -0      jakarta-commons/betwixt/project.xml
  Index: project.xml
  RCS file: /home/cvs/jakarta-commons/betwixt/project.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- project.xml	15 Dec 2002 17:11:57 -0000	1.18
  +++ project.xml	15 Dec 2002 19:58:36 -0000	1.19
  @@ -62,21 +62,25 @@
  +      <url></url>
  +      <url></url>
  +      <url></url>
  +      <url></url>
   <!-- runtime dependencies only required for testing and sample programs -->
  1.4       +63 -63    jakarta-commons/betwixt/xdocs/overview.xml
  Index: overview.xml
  RCS file: /home/cvs/jakarta-commons/betwixt/xdocs/overview.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- overview.xml	28 Oct 2002 21:13:34 -0000	1.3
  +++ overview.xml	15 Dec 2002 19:58:36 -0000	1.4
  @@ -17,7 +17,7 @@
   build system working, by installing Ant and creating your own 
   to point to the required JARs type the following at a command line</p>
  -<pre>ant demo.rss</pre>
  +<source><![CDATA[ant demo.rss]]></source>
   <p>This uses the Commons Digester RSSDigester example to parse an RSS document, 
   create a Channel bean and then write it out again as XML using the default 
  @@ -26,7 +26,7 @@
   <p>The next example to look at is</p>
  -<pre>ant demo.rss2</pre>
  +<source><![CDATA[ant demo.rss2]]></source>
   <p>This is similar to the above but uses a BeanReader to parse the RSS file. So 
   this is Betwixt defaulting the Digester rules required to parse the XML document. 
  @@ -39,11 +39,11 @@
   <p>There are various ways of mapping beans to an XML structure. For example 
   consider a simple bean</p>
  -<pre>public class CustomerBean {
  +<source><![CDATA[public class CustomerBean {
       public String getName();
       public Order[] getOrders();
       public String[] getEmailAddresses();
   <p>This could be mapped to XML as these various ways</p>
  @@ -52,11 +52,11 @@
   <p>This example uses attributes for primitive types.</p>
  -<pre>&amp;lt;CustomerBean name=&amp;quot;James&amp;quot;&amp;gt;
  -    &amp;lt;order id=&amp;quot;1&amp;quot;&amp;gt;...&amp;lt;/order&amp;gt;
  -    &amp;lt;order id=&amp;quot;2&amp;quot;&amp;gt;...&amp;lt;/order&amp;gt;
  -    &amp;lt;emailAddress&amp;gt;;lt;/emailAddress&amp;gt;
  +<source><![CDATA[<CustomerBean name='James'>
  +    <order id='1'>...</order>
  +    <order id='2'>...</order>
  +    <emailAddress></emailAddress>
  @@ -66,16 +66,16 @@
   extra element (which can be quite common in XML schemas). Also note that some 
   element names have been changed.</p>
  -    &amp;lt;name&amp;gt;James&amp;lt;/name&amp;gt;
  -    &amp;lt;orders&amp;gt;
  -        &amp;lt;order id=&amp;quot;1&amp;quot;&amp;gt;...&amp;lt;/order&amp;gt;
  -        &amp;lt;order id=&amp;quot;2&amp;quot;&amp;gt;...&amp;lt;/order&amp;gt;
  -    &amp;lt;/orders&amp;gt;
  -    &amp;lt;email-addresses&amp;gt;
  -        &amp;lt;email-address&amp;gt;;lt;/email-address&amp;gt;
  -    &amp;lt;/email-addresses&amp;gt;
  -&amp;lt;/customer&amp;gt;    </pre>
  +    <name>James</name>
  +    <orders>
  +        <order id='1'>...</order>
  +        <order id='2'>...</order>
  +    </orders>
  +    <email-addresses>
  +        <email-address></email-address>
  +    </email-addresses>
  +</customer>    ]]></source>
   <p>Betwixt aims to provide a diversity of possible mappings such that the 
   developer can choose, if they wish, how their beans appear as XML to support 
  @@ -97,65 +97,65 @@
   then the default introspection rules are used.</p>
   <p>The simplest possible file may just set the name of the element. e.g.</p>
  -<pre>&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;
  -  &amp;lt;element name=&amp;quot;channel&amp;quot;/&amp;gt;
  -  &amp;lt;addDefaults/&amp;gt;
  +<source><![CDATA[<?xml version='1.0' encoding='UTF-8' ?>
  +  <element name='channel'/>
  +  <addDefaults/>
   <p>The above means to use the name 'channel' for the outer most element for the 
  -given type. The &amp;lt;addDefaults&amp;gt; means to add the defaults from the
  +given type. The <![CDATA[<addDefaults>]]> means to add the defaults from the
   This allows you to just rename a few properties then let the introspector do the 
  -rest. There is also a &amp;lt;hide&amp;gt; element which allows one or more properties
to be 
  -hidden. Also note that the &amp;lt;element&amp;gt; and &amp;lt;attribute&amp;gt;
tags can be 
  +rest. There is also a <![CDATA[<hide>]]> element which allows one or more properties
to be 
  +hidden. Also note that the <![CDATA[<element>]]> and <![CDATA[<attribute>]]>
tags can be 
   nested to any 
   kind of depth allowing whatever XML structure you wish. This can be useful if 
   you wish to wrap collections in some arbitrary collection tags or to group 
   properties of a bean together in some XML structure. e.g.</p>
  -<pre>&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;
  -&amp;lt;info primitiveTypes=&amp;quot;attribute&amp;quot;&amp;gt;
  -  &amp;lt;element name=&amp;quot;channel&amp;quot;/&amp;gt;
  -    &amp;lt;element name=&amp;quot;customerList&amp;quot;&amp;gt;
  -      &amp;lt;element name=&amp;quot;customer&amp;quot; property=&amp;quot;customers&amp;quot;/&amp;gt;
  -    &amp;lt;/element&amp;gt;
  -    &amp;lt;element name=&amp;quot;foo&amp;quot;&amp;gt;
  -      &amp;lt;attribute name=&amp;quot;qqq&amp;quot; property=&amp;quot;ppp&amp;quot;/&amp;gt;
  -      &amp;lt;element name=&amp;quot;bar&amp;quot; property=&amp;quot;xyz&amp;quot;/&amp;gt;
  -    &amp;lt;hide property=&amp;quot;something&amp;quot;/&amp;gt;
  -    &amp;lt;addDefaults/&amp;gt;
  -  &amp;lt;/element&amp;gt;
  +<source><![CDATA[<?xml version='1.0' encoding='UTF-8' ?>
  +<info primitiveTypes='attribute'>
  +  <element name='channel'/>
  +    <element name='customerList'>
  +      <element name='customer' property='customers'/>
  +    </element>
  +    <element name='foo'>
  +      <attribute name='qqq' property='ppp'/>
  +      <element name='bar' property='xyz'/>
  +    <hide property='something'/>
  +    <addDefaults/>
  +  </element>
   <p>Note that the <code>.betwixt</code> file specifies the mapping for
a single bean.
   So, whilst you can add extra elements (as above), it can't be used to specify 
   to names for child beans through nesting <code>element</code> elements.</p>
  -<p>The primitiveTypes attribute in the &amp;lt;info&amp;gt; element is optional
and can be 
  +<p>The primitiveTypes attribute in the <![CDATA[<info>]]> element is
optional and can be 
   used to specify whether primitive java types (strings, numbers, dates etc) are 
   specified as attributes or elements by default.</p>
   <p>Finally static text can be specified using a value attribute inside an 
  -&amp;lt;element&amp;gt; or &amp;lt;attribute&amp;gt; tag. e.g. to add constant
attributes such 
  +<![CDATA[<element>]]> or <![CDATA[<attribute>]]> tag. e.g. to add
constant attributes such 
   as a version label to the 
   generated XML...</p>
  -<pre>&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;
  -&amp;lt;info primitiveTypes=&amp;quot;element&amp;quot;&amp;gt;
  -  &amp;lt;element name=&amp;quot;rss&amp;quot;/&amp;gt;
  -    &amp;lt;attribute name=&amp;quot;version&amp;quot; value=&amp;quot;0.91&amp;quot;/&amp;gt;
  -    &amp;lt;element name=&amp;quot;channel&amp;quot;/&amp;gt;
  -    &amp;lt;addDefaults/&amp;gt;
  -  &amp;lt;/element&amp;gt;
  +<source><![CDATA[<?xml version='1.0' encoding='UTF-8' ?>
  +<info primitiveTypes='element'>
  +  <element name='rss'/>
  +    <attribute name='version' value='0.91'/>
  +    <element name='channel'/>
  +    <addDefaults/>
  +  </element>
   <section name="Bean naming conventions">
   <p>The Java Beans specification contains various naming conventions that should 
   be used when writing beans that will allow the beans introspector to 
  -automatically guess the properties in a bean and their getters &amp;amp; setter methods

  +automatically guess the properties in a bean and their getters <![CDATA[&]]>
setter methods 
   etc. Betwixt will use these same naming conventions to deduce how to make the 
   beans appear as XML. There are some other naming conventions that you can use to 
   make your beans easier to output as XML or parse.</p>
  @@ -168,10 +168,10 @@
   <p>To use: create an add method to match the getter method for 'composite 
  -<pre>public class SomeBean {
  -    public &amp;lt;CollectionType&amp;gt; getFoo*();
  -    public void addFoo(&amp;lt;SingularType&amp;gt; foo);
  +<source><![CDATA[public class SomeBean {
  +    public <CollectionType> getFoo*();
  +    public void addFoo(<SingularType> foo);
   <p>Where CollectionType can be an array, a Collection, Enumeration, Iterator, 
   Map. The [SinglularType] refers to the type of an item in the collection. The 
  @@ -184,25 +184,25 @@
   <p>In the RSS example from Digester there's a bean which matches this pattern.</p>
   public class Channel
       public Item[] getItems();
       public void addItem(Item item);
   <p>This means that the following bean does not match this naming convention, 
   since the plural property name does not start with the singular name..</p>
  -<pre>public class Foo {
  +<source><![CDATA[public class Foo {
       public Collection getPeople();
       public void addPerson(Person person);
   <p>Though these two beans do match</p>
  -<pre>public class Foo {
  +<source><![CDATA[public class Foo {
       public Collection getPersonCollection();
       public void addPerson(Person person);
  @@ -210,7 +210,7 @@
       public Iterator getPersonIterator();
       public void addPerson(Person person);
   <p>The following are other valid examples of <i>composite-getter</i>
methods and 
   their matching <i>adder</i> methods.</p>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message