You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2002/10/28 22:13:34 UTC
cvs commit: jakarta-commons/betwixt/xdocs overview.xml
rdonkin 2002/10/28 13:13:34
Modified: betwixt project.properties project.xml
betwixt/src/test/org/apache/commons/betwixt/dotbetwixt
TestBeanToXml.java
betwixt/xdocs overview.xml
Log:
Updated by email address and changed examples in overview document so that they are correctly rendered by maven.
Revision Changes Path
1.4 +1 -0 jakarta-commons/betwixt/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/project.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- project.properties 27 Oct 2002 01:28:18 -0000 1.3
+++ project.properties 28 Oct 2002 21:13:34 -0000 1.4
@@ -15,3 +15,4 @@
# documentation properties
maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
+maven.junit.fork=true
1.16 +1 -1 jakarta-commons/betwixt/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/project.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- project.xml 27 Oct 2002 01:34:00 -0000 1.15
+++ project.xml 28 Oct 2002 21:13:34 -0000 1.16
@@ -28,7 +28,7 @@
<developer>
<name>Robert Burrell Donkin</name>
<id>rdonkin</id>
- <email>robertdonkin@mac.com</email>
+ <email>rdonkin@apache.org</email>
<organization></organization>
</developer>
<developer>
1.2 +4 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/dotbetwixt/TestBeanToXml.java
Index: TestBeanToXml.java
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/dotbetwixt/TestBeanToXml.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestBeanToXml.java 7 Aug 2002 16:37:47 -0000 1.1
+++ TestBeanToXml.java 28 Oct 2002 21:13:34 -0000 1.2
@@ -97,12 +97,10 @@
//---------------------------------- Tests
public void testOne() throws Exception {
- /*
// THIS TEST FAILS IN MAVEN
xmlAssertIsomorphicContent(
parseFile("src/test/org/apache/commons/betwixt/dotbetwixt/rbean-result.xml"),
parseFile("src/test/org/apache/commons/betwixt/dotbetwixt/rbean-result.xml"));
- */
}
1.3 +50 -50 jakarta-commons/betwixt/xdocs/overview.xml
Index: overview.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/xdocs/overview.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- overview.xml 7 Aug 2002 21:29:21 -0000 1.2
+++ overview.xml 28 Oct 2002 21:13:34 -0000 1.3
@@ -12,7 +12,7 @@
<section name="Getting Started">
<p>Probably the best way to get started is to look at some examples. The best
-example to start with is the Ant target "demo.rss" which runs the RSSBeanWriter
+example to start with is the Ant target &quot;demo.rss&quot; which runs the RSSBeanWriter
sample program in the src/test directory. Once you've got the Jakarta Commons
build system working, by installing Ant and creating your own build.properties
to point to the required JARs type the following at a command line</p>
@@ -52,11 +52,11 @@
<p>This example uses attributes for primitive types.</p>
-<pre><CustomerBean name="James">
- <order id="1">...</order>
- <order id="2">...</order>
- <emailAddress>jstrachan@apache.org</emailAddress>
-</CustomerBean></pre>
+<pre>&lt;CustomerBean name=&quot;James&quot;&gt;
+ &lt;order id=&quot;1&quot;&gt;...&lt;/order&gt;
+ &lt;order id=&quot;2&quot;&gt;...&lt;/order&gt;
+ &lt;emailAddress&gt;jstrachan@apache.org&lt;/emailAddress&gt;
+&lt;/CustomerBean&gt;</pre>
</section>
@@ -66,16 +66,16 @@
extra element (which can be quite common in XML schemas). Also note that some
element names have been changed.</p>
-<pre><customer>
- <name>James</name>
- <orders>
- <order id="1">...</order>
- <order id="2">...</order>
- </orders>
- <email-addresses>
- <email-address>jstrachan@apache.org</email-address>
- </email-addresses>
-</customer> </pre>
+<pre>&lt;customer&gt;
+ &lt;name&gt;James&lt;/name&gt;
+ &lt;orders&gt;
+ &lt;order id=&quot;1&quot;&gt;...&lt;/order&gt;
+ &lt;order id=&quot;2&quot;&gt;...&lt;/order&gt;
+ &lt;/orders&gt;
+ &lt;email-addresses&gt;
+ &lt;email-address&gt;jstrachan@apache.org&lt;/email-address&gt;
+ &lt;/email-addresses&gt;
+&lt;/customer&gt; </pre>
<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,57 +97,57 @@
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><?xml version="1.0" encoding="UTF-8" ?>
-<info>
- <element name="channel"/>
- <addDefaults/>
-</info></pre>
+<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+&lt;info&gt;
+ &lt;element name=&quot;channel&quot;/&gt;
+ &lt;addDefaults/&gt;
+&lt;/info&gt;</pre>
<p>The above means to use the name 'channel' for the outer most element for the
-given type. The <addDefaults> means to add the defaults from the introspector.
+given type. The &lt;addDefaults&gt; means to add the defaults from the introspector.
This allows you to just rename a few properties then let the introspector do the
-rest. There is also a <hide> element which allows one or more properties to be
-hidden. Also note that the <element> and <attribute> tags can be
+rest. There is also a &lt;hide&gt; element which allows one or more properties to be
+hidden. Also note that the &lt;element&gt; and &lt;attribute&gt; 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><?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>
-</info>
+<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+&lt;info primitiveTypes=&quot;attribute&quot;&gt;
+ &lt;element name=&quot;channel&quot;/&gt;
+ &lt;element name=&quot;customerList&quot;&gt;
+ &lt;element name=&quot;customer&quot; property=&quot;customers&quot;/&gt;
+ &lt;/element&gt;
+ &lt;element name=&quot;foo&quot;&gt;
+ &lt;attribute name=&quot;qqq&quot; property=&quot;ppp&quot;/&gt;
+ &lt;element name=&quot;bar&quot; property=&quot;xyz&quot;/&gt;
+ &lt;hide property=&quot;something&quot;/&gt;
+ &lt;addDefaults/&gt;
+ &lt;/element&gt;
+&lt;/info&gt;
</pre>
<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 <info> element is optional and can be
+<p>The primitiveTypes attribute in the &lt;info&gt; 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
-<element> or <attribute> tag. e.g. to add constant attributes such
+&lt;element&gt; or &lt;attribute&gt; tag. e.g. to add constant attributes such
as a version label to the
generated XML...</p>
-<pre><?xml version="1.0" encoding="UTF-8" ?>
-<info primitiveTypes="element">
- <element name="rss"/>
- <attribute name="version" value="0.91"/>
- <element name="channel"/>
- <addDefaults/>
- </element>
-</info>
+<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+&lt;info primitiveTypes=&quot;element&quot;&gt;
+ &lt;element name=&quot;rss&quot;/&gt;
+ &lt;attribute name=&quot;version&quot; value=&quot;0.91&quot;/&gt;
+ &lt;element name=&quot;channel&quot;/&gt;
+ &lt;addDefaults/&gt;
+ &lt;/element&gt;
+&lt;/info&gt;
</pre>
</section>
@@ -155,7 +155,7 @@
<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 & setter methods
+automatically guess the properties in a bean and their getters &amp; 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>
@@ -169,8 +169,8 @@
properties'.</p>
<pre>public class SomeBean {
- public <CollectionType> getFoo*();
- public void addFoo(<SingularType> foo);
+ public &lt;CollectionType&gt; getFoo*();
+ public void addFoo(&lt;SingularType&gt; foo);
}</pre>
<p>Where CollectionType can be an array, a Collection, Enumeration, Iterator,
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>