Update of /cvsroot/jaxme/JaxMe2/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv5613/docs
Modified Files:
Design.html ChangeLog.html Customizing.html
Log Message:
Added customization framework. See docs/Customization.html for
details. Added Marty Kube to the list of project members. See
docs/Design.html.
Index: Design.html
===================================================================
RCS file: /cvsroot/jaxme/JaxMe2/docs/Design.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Design.html 4 Sep 2002 01:26:53 -0000 1.3
+++ Design.html 21 Mar 2003 21:31:08 -0000 1.4
@@ -947,6 +947,14 @@
<th>Result</th>
<th>Question</th>
</tr>
+ <tr>
+ <td>2003-18-03</td>
+ <td>Jochen Wiedmann</td>
+ <td>2 out of three positive:<br>
+ Jochen Wiedmann (joe at users.sourceforge.net, Initiator)<br>
+ Thalia Rubio (tr7 at users.sourceforge.net)</td>
+ <td>Promote Marty Kube ([EMAIL PROTECTED]) to new project member</td>
+ </tr>
</table>
<a name="references">
Index: ChangeLog.html
===================================================================
RCS file: /cvsroot/jaxme/JaxMe2/docs/ChangeLog.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ChangeLog.html 20 Feb 2003 21:02:01 -0000 1.6
+++ ChangeLog.html 21 Mar 2003 21:31:08 -0000 1.7
@@ -29,6 +29,20 @@
<th>Changed</th>
</tr>
</thead> <tbody>
+ <tr>
+ <td valign="top">2003-Mar-16</td>
+ <td valign="top">Jochen Wiedmann</td>
+ <td>
+ <ul>
+ <li>The NamespaceSupport class is now implementing
+ javax.xml.namespace.NamespaceContext.</li>
+ <li>Added the DatatypeConverterImpl class, which implements
+ javax.xml.bind.DatatypeConverter</li>
+ <li>Added the JaxMeSchemaWriter and its global and
+ schema bindings.</li>
+ </ul>
+ </td>
+ </tr>
<tr>
<td valign="top">2002-Feb-20</td>
<td valign="top">
Index: Customizing.html
===================================================================
RCS file: /cvsroot/jaxme/JaxMe2/docs/Customizing.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Customizing.html 22 Feb 2003 00:35:40 -0000 1.1
+++ Customizing.html 21 Mar 2003 21:31:08 -0000 1.2
@@ -1,88 +1,456 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <title>Customizing the generated classes</title>
-
- <style type="text/css">
-
[EMAIL PROTECTED] url("style.css");
- </style>
-</head>
- <body bgcolor="#ffffff">
-<!--Don't remove the table - it keeps the code together-->
-<table width="100%">
- <tbody>
- <tr>
- <td>
-
- <div id="pagebody"> <br>
- <br>
-
- <table width="100%">
- <tbody>
- <tr>
- <td>
-
- <h1> Customizing the generated classes </h1>
- </td>
- </tr>
-
-
- </tbody>
- </table>
-
-
- <p>It is not unusual that the generated classes do not satisfy
- all your needs. A possible workaround is using manually derived subclasses,
- but that's sometimes not very convenient. A more comfortable solution
- might be to extend the generated classes by adding your own methods.</p>
-
- <p>Before going on, remember that the various generators can
-create a lot of classes for you. So the first thing to decide is: Which
-class do you actually want to extend? The element class (for example
- <samp>ClsMyDocument</samp>)? The handler class (for example
<samp>ClsMyDocumentHandler</samp>)?
- A bean class (for example <samp>ClsMyDocumentBean</samp>?
-You can extend all!</p>
-
- <p>Let's take a look at an example, taken from <a
- href="../examples/misc/implements.xsd">implements.xsd</a>: </p>
-
- <pre> <xs:element name="ObserverDemo"><br>
<xs:annotation><br> <xs:appinfo><br> <jm:implements
class="ClsObserverDemo"<br> interface="java.util.Observer"/><br>
<jm:javasource class="ClsObserverDemo"><br> public void
update(java.util.Observable o, Object arg) {<br> if (arg instanceof
Integer) {<br> if (eObservedNumbers == null) {<br>
eObservedNumbers = new java.util.ArrayList();<br> }<br>
eObservedNumbers.add(arg);<br> }<br> }<br>
</jm:javasource><br> </xs:appinfo><br>
</xs:annotation><br> <xs:complexType><br>
<xs:sequence><br> <xs:element name="ObservedNumbers"
type="xs:integer"<br> minOccurs="0" maxOccurs="unbounded"/><br>
</xs:sequence><br> </xs:complexType><br>
</xs:element><br> </pre>
-
- <p>This example generates an element class which is implementing
- the Java interface <samp>java.util.Observer</samp>. An Observer
- must have a method <samp>update(Observable, Object)</samp>, so we
-add it here.</p>
-
- <p>The extended class is the element class, so both the
<samp>jm:implements</samp>
- and <samp>jm:javasource</samp> sections take an attribute <samp>class</samp>
- specifying the element class name.</p>
-
- <p>You may use an arbitrary number of <samp>jm:implements</samp>
- and <samp>jm:javasource</samp> sections, with varying class names
- or not.<br>
- </p>
- <a href="Decorators.html">Next </a><a
- href="RunTestApp.html">Previous </a><a
- href="index.html">Table of Contents</a><br>
-
- <hr>
- <div id="bottommenu"> <!--   inserts a space --> <a
- href="site/FAQ.html"> FAQ </a> | <a
- href="Reference.html"> Reference </a> | <a
- href="mailto:[EMAIL PROTECTED]"> Contact </a> | <a
- href="site/feedback.html"> Comments </a> | <a href="#"
- onclick="history.go(1);"> Forward </a> | <a href="#"
- onclick="history.go(-1);"> Back </a> | <a href="#top"> Top
- of Page </a> </div>
-
- <hr> </div>
- </td>
- </tr>
-
- </tbody>
-</table>
- <br>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>Customizing the generated classes</title>
+</head>
+<body bgcolor="#ffffff">
+<h1>Customizing the generated classes</h1>
+<p>It is not unusual that the generated classes do not satisfy
+all your needs. This document describes the customization possibilities
+that JaxMe gives you.
+
+<ul>
+ <li><a href="#manual">Subclassing</a> the generated sources</li>
+ <li><a href="#automatic">Automatic</a> modification of the
+ generated sources
+ <ul>
+ <li><a href="#classTypes">Class types</a></li>
+ <li>Choosing the class being <a href="#extends">extended</a></li>
+ <li>Choosing the interfaces being
+ <a href="#implements">implemented</a></li>
+ <li>Making a class <a href="#abstract">abstract</a></li>
+ <li><a href="#rawSource">Adding sources</a> to the extended
+ classes</a></li>
+ </ul>
+ </li>
+ <li>Writing your own <a href="#schemaWriters">source generators</a>
+ <ul>
+ <li><a href="#events">Events</a></li>
+ </ul>
+ </li>
+</ul>
+
+<a name="manual">
+<h2>Subclassing the generated sources</h2>
+<p>The most basic type of customization is extending a generated
+interface or a generated class. There is only a single additional
+step: To let the JaxMe runtime know that you want to use your
+subclass and not the original class. This is all so obvious, that we
+omit an example, except for the modification of the config file.</p>
+<p>Suggest, that JaxMe has generated an interface
+<samp>com.mycompany.xml.Address</samp> and an implementation
+<samp>com.mycompany.xml.AddressImpl</samp> for you. Your intention
+is to use <samp>com.mycompany.myapp.Address</samp> and
+<samp>com.mycompany.myapp.AddressImpl</samp> instead.
+JaxMe also generates a file
+<samp>com/mycompany/xml/Configuration.xml</samp> for you. Besides
+other things, it might contain the following:
+<pre>
+ <Manager elementInterface="com.mycompany.xml.Address"
+ elementClass="com.mycompany.xml.AddressImpl"
+ .../>
+</pre>
+All you need to do is changing the interface and class names
+to your extensions.</p>
+<p>Unfortunately the modification of the <samp>Configuration.xml</samp>
+cannot yet be done automatically from within JaxMe. However, you can
+do this quite easily from within Ant, for example by using the following
+target:</p>
+<pre>
+ <copy file="dir1/com/mycompany/xml/Configuration.xml"
+ tofile="dir2/com/mycompany/xml/Configuration.xml">
+ <filterset begintoken='"' endtoken='"'>
+ <filter
+ token="com.mycompany.xml.Address"
+ value="com.mycompany.myapp.Address"/>
+ <filter
+ token="com.mycompany.xml.AddressImpl"
+ value="com.mycompany.myapp.AddressImpl"/>
+ </filterset>
+ </copy>
+</pre>
+<p>Finally do not forget to use the modified <samp>Configuration.xml</samp>
+rather than the unmodified. :-) (The danger to forget this is the
+best reason to provide a possibility of modification within JaxMe as
+soon as possible.)</p>
+
+<a name="automatic">
+<h2>Automatic modification of the generated sources</h2>
+<p>A completely different approach is the automatic modification
+of generated sources. The main difference is that you are able
+to change multiple files with a single switch.</p>
+<p>Automatic modification is based on the concept of <code>class
+types</code>. You have to understand what class types there are
+and what names they have, before going into the details.</p>
+<ul>
+ <li><a href="#classTypes">Class types</a></li>
+ <li>Choosing the class being <a href="#extends">extended</a></li>
+ <li>Choosing the interfaces being <a href="#implements">implemented</a></li>
+ <li>Making a class <a href="#abstract">abstract</a></li>
+ <li><a href="#rawSource">Adding sources</a> to the extended classes</a></li>
+</ul>
+
+<a name="classTypes">
+<h3>Class types</h3>
+<p>Any JaxMe <a href="Reference.html#schemaWriters">SchemaWriter</a> knows
+about certain <code>class types</code>. For example, the builtin
+<code>JAXBSchemaWriter's</code> class types are:
+<table border="1">
+ <tr>
+ <th valign="top">Name<br>Java constant</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td valign="top">
+ <a name="jaxme.xmlInterface">
+ jaxme.xmlInterface<br>
+ <a
href="api/net/sf/jaxme/generator/schema/SchemaClass.html#CLASS_TYPE_XML_INTERFACE">CLASS_TYPE_XML_INTERFACE</a></td>
+ <td>This is the interface that the generated XML objects are implementing.
+ By default, they are extending
+ <a href="api/net/sf/jaxme/JMElement.html">JMElement</a>, which is
+ itself an extension of <code>javax.xml.bind.Element</code>, as specified
+ by <a href="http://java.sun.com/xml/jaxb">JAXB</a>.
+ You can choose a different interface being extended, however,
+ it must be a subinterface of
+ <a href="api/net/sf/jaxme/JMElement.html">JMElement</a>.</td>
+ </tr>
+ <tr>
+ <td valign="top">jaxme.xmlClass<br>
+ <a
href="api/net/sf/jaxme/generator/schema/SchemaClass.html#CLASS_TYPE_XML">CLASS_TYPE_XML</a></td>
+ <td>This is the class of the actual XML objects. In other words,
+ it is the class implementing <code>jaxme.xmlInterface</code>.
+ You are free to choose a superclass, which should in practice
+ be extending <a href="api/net/sf/jaxme/impl/JMElementImpl.html">
+ JMElementImpl.html</a>. However, in theory any class implementing
+ <a href="api/net/sf/jaxme/JMElement.html">JMElement</a> could do.
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">jaxme.marshallerClass<br
+ <a
href="api/net/sf/jaxme/generator/schema/SchemaClass.html#CLASS_TYPE_MARSHALLER">CLASS_TYPE_MARSHALLER</a></td>
+ <td>This is a class which is internally used by the
+ <a href="http://java.sun.com/xml/jaxb">JAXB</a> Marshaller. It is
+ mainly a SAX 2 driver (generating SAX 2 events), with some minor
+ extensions required by JaxMe. The default implementation is
+ extending <a href="api/net/sf/jaxme/impl/JMXmlSerializerImpl.html">
+ JMXmlSerializerImpl</a>. However, any implementation of
+ <a href="api/net/sf/jaxme/JMXmlSerializer.html">
+ JMXmlSerializer</a> should do.</td>
+ </tr>
+ <tr>
+ <td valign="top">jaxme.unmarshallerClass<br>
+ <a
href="api/net/sf/jaxme/generator/schema/SchemaClass.html#CLASS_TYPE_UNMARSHALLER">CLASS_TYPE_UNMARSHALLER</a></td>
+ <td>This is a class which is internally used by the
+ <a href="http://java.sun.com/xml/jaxb">JAXB</a> Unmarshaller. It is
+ mainly a SAX 2 ContentHandler, with some minor extensions required
+ by JaxMe. The default implementation is extending
+ extending <a href="api/net/sf/jaxme/impl/JMHandlerImpl.html">
+ JMHandlerImpl</a>. However, any implementation of
+ <a href="api/net/sf/jaxme/JMHandler.html">
+ JMHandler</a> should do.</td>
+ <td>
+ </tr>
+ <tr>
+ <td valign="top">jaxme.validatorClass<br>
+ <a
href="api/net/sf/jaxme/generator/schema/SchemaClass.html#CLASS_TYPE_VALIDATOR">CLASS_TYPE_VALIDATOR</a></td>
+ <td>This class will be used by the
+ <a href="http://java.sun.com/xml/jaxb">JAXB</a> Validator. We're
+ talking future here, because currently the Validator works by
+ marshalling and unmarshalling the objects, which is not really
+ efficient. An interface for the internal classes is not yet
+ specified.</td>
+ <td>
+ </tr>
+ <tr>
+ <td valign="top">jaxme.managerClass<br>
+ <a
href="api/net/sf/jaxme/generator/schema/SchemaClass.html#CLASS_TYPE_MANAGER">CLASS_TYPE_MANAGER</a></td>
+ <td>Another class, which is not yet generated or specified: The
+ so-called Manager. In JaxMe 1 the Manager is responsible for
+ writing objects into a database or reading them from the
+ database. An interface for the persistence related classes is not yet
+ specified. However, it will most probably follow closely the
+ <code>JMManager</code> from JaxMe 1.</td>
+ <td>
+ </tr>
+</table>
+<p>Automatic customization means configuring class types. A class type
+is configured by using a so-called class declaration. However, there
+are various points where you could configure class types. The actual
+target classes depend on the class declarations location. For example,
+the global and least specific class declaration configures all classes
+of a given class type. However, any more specific class declaration
+will overwrite the global declaration. The global class declaration
+can be compared to the <a href="http://java.sun.com/xml/jaxb">JAXB</a>
+global bindings. An example class declaration looks as follows:</p>
+<pre>
+ <jm:class type="jaxme.xmlInterface">
+ <jm:extends name="java.lang.Cloneable"/>
+ </jm:class>
+</pre>
+<p>The example states, that all generated interfaces of type
+<code>jaxme.xmlInterface</code> will extend <code>java.lang.Cloneable</code>.
+See the description of the <a href="#extends">extends</a> element
+below for a more detailed description.</p>
+<p>It is also possible to attach a class declaration to a schema or
+even to a given complex type. This will effectively limit the scope
+of the declaration to the classes generated by the schema or the
+class generated by the complex type. Not all classes, of course,
+only those of the matching class type.</p>
+<p>It is worth noting, that JaxMe class types are not limited to the
+above types. Any derived schema writer will most probably add more
+class types. Read the respective schema writers documentation for
+details.</p>
+
+
+<a name="extends">
+<h3>Choosing the class or interface being extended</h3>
+<p>First of all, extension follows the rules of the JVM.
+In other words, in a Java interface you can extend an arbitrary
+number of Java interfaces. In a Java class you can extend a single
+Java class. Currently the only generated interface is
+<code>jaxme.xmlInterface</code>, all other generated sources
+are Java classes.</p>
+<p>However, Java classes can of course still <em>implement</em>
+an arbitrary number of interfaces. Implementation of interfaces
+is described in the <a href="#implements">next section</a>.</p>
+<p>When changing the extended class or interface, you should also
+keep in mind, that JaxMe assumes that your classes are extending
+and/or implementing certain interfaces. This is typically ensured
+by choosing a suitable superinterface or superclass. Thus it
+is recommended, that you derive subinterfaces or subclasses
+from the default and specify them as being extended. This
+will always work. Although completely different superclasses
+cannot be recommended, it is definitely possible. The constraints
+of interfaces being implemented are described in the
+<a href="#classTypes">previous</a> section.</p>
+<p>Let's see an example. The following is taken from
+<a href="../examples/jaxme/Customization.xsd">
+ examples/jaxme/Customization.xsd</a>:</p>
+<pre>
+ <xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jm="http://jaxme.sf.net/namespaces/jaxme2/schema">
+ <xs:annotation>
+ <xs:appinfo>
+ <!-- Make the interface of the XML objects extend
+ java.lang.Cloneable -->
+ <jm:class type="jaxme.xmlInterface">
+ <jm:extends name="java.lang.Cloneable"/>
+ </jm:class>
+ </xs:appinfo>
+ </xs:annotation>
+ ...
+ </xs:schema>
+</pre>
+<p>The example contains a class declaration, sitting in the
+<code>xs:annotation/xs:appinfo</code> section of the schema. This is a
+<code>schema</code> class declaration: In other words, it applies to
+all generated interfaces of type <code>jaxme.xmlInterface</code>,
+which are derived by the schema. The class declaration could also
+sit in the <code>xs:annotation/xs:appinfo/jm:defaults</code>
+section of the outermost schema: This would be a <code>global</code>
+class declaration, thus applying to all elements, even those
+from included schemata. However, class declarations with schema
+scope take precedence.</p>
+<p>Finally, you could as well put put a class declaration into the
+section <code>xs:complexType/xs:annotation/xs:appinfo</code>, thus
+configuring the single class derived from that type. This would
+of course take precedence over global and schema class declarations.</p>
+<p>A closing word on the validity of the above example: It is incomplete!
+Of course you can make an element cloneable, but there is one problem
+left: The cloned object may contain Collections. Cloning a collection
+means sharing the elements. In other words, one has to overwrite the
+<code>clone()</code> method. This can be done quite easily using
+<code>clone(JAXBContextImpl)</code>. We'll see an example later on
+in the section on <a href="#rawSource">adding Java sources</a>.
+
+
+<a name="implements">
+<h3>Choosing the interfaces being implemented</h3>
+<p>As only classes can implement interfaces, this section doesn't
+apply to the <a href="#classTypes">class type</a>
+<code><a href="#jaxme.xmlInterface">jaxme.xmlInterface</a></code>.
+However, the following remains valid for all other class types.</p>
+<p>Any generated class type implements a list of builtin interfaces.
+Currently you can only add more interfaces to the list. (Could be
+changed easily, if someone requires such a feature.) Let's take
+a look at an example from the file
+<a href="../examples/jaxme/Customization.xsd">
+examples/jaxme/Customization.xsd</a>:</p>
+<pre>
+ <xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jm="http://jaxme.sf.net/namespaces/jaxme2/schema">
+ <xs:annotation>
+ <xs:appinfo>
+ <jm:class type="jaxme.xmlUnmarshaller">
+ <jm:implements name="java.util.Observer"/>
+ </jm:class>
+ </xs:appinfo>
+ </xs:annotation>
+ ...
+ </xs:schema>
+</pre>
+<p>This example would add the interface <code>java.util.Observer</code>
+to the list of interfaces being implemented by the
+<code><a href="#jaxme.xmlUnmarshaller">jaxme.xmlUnmarshaller</a></code>.
+As in the <a href="#extends">previous</a> section, you may place
+the class declaration in the global bindings
+(<samp>xs:schema/xs:annotation/xs:appinfo/jm:defaults/jm:class</samp),
+in the schema bindings
+(<samp>xs:schema/xs:annotation/xs:appinfo/jm:class</samp),
+or in the complex type bindings
+(<samp>xs:complexType/xs:annotation/xs:appinfo/jm:class),
+on your choice. If there is more than one matching class declaration,
+the most specific applies.</p>
+<p>The above example is again simplified: Implementing the interface
+<code>java.util.Observer</code> means implementing a method
+<code>void update(java.util.Observable, java.lang.Object)</code>,
+which the generated classes typically don't have. In other words,
+the classes generated by the above directive cannot be compiled,
+because they lack such a method. There are three possible solutions
+for the problem:
+<ol>
+ <li>Making the generated class abstract; this is demonstrated in
+ the <a href="#abstract">next</a> section. If the class is
+ abstract, then you must obviously use a manually written
+ subclass, as described in the section on
+ <a href="#manual">manually extended subclasses</a>.</li>
+ <li>Implementing the method in a superclass and changing the
+ superclass with <a href="#extends">extends</a>.</li>
+ <li>Automatically adding the method to the generated class; this
+ is demonstrated in the section on <a href="rawSource">adding
+ Java sources</a>.</li>
+</ol></p>
+
+
+<a name="abstract">
+<h3>Making the generated classes abstract</h3>
+<p>As in the section on <a href="#implements">implementation of
+interfaces</a>, this one also applies to generated classes only
+and not to generated interfaces. Also note that making a class abstract
+implies, that you have to use a <a href="#manual">manually written
+subclass</a>.</p>
+<p>We'll take the example from the <a href="#implements">previous</a>
+section again, where we made a marshaller class implementing the
+interface <code>java.util.Observer</code>. The generated class
+could not be compiled, because it lacked the method
+<code>Observable.update(java.util.Observable, java.lang.Observer)</code>.
+One solution is to make the class abstract, which works as follows:</p>
+<pre>
+ <xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jm="http://jaxme.sf.net/namespaces/jaxme2/schema">
+ <xs:annotation>
+ <xs:appinfo>
+ <jm:class type="jaxme.xmlUnmarshaller" abstract="true">
+ <jm:implements name="java.util.Observer"/>
+ </jm:class>
+ </xs:appinfo>
+ </xs:annotation>
+ ...
+ </xs:schema>
+</pre>
+<p>Note the use of the <samp>abstract</samp> attribute.</p>
+
+
+<a name="rawSource">
+<h3>Adding sources to the generated classes</h3>
+<p>Unlike the previous sections, this one is again valid for both
+generated classes and generated interfaces. We are talking about
+adding pieces of Java code to a generated class and that makes
+sense for interfaces as well.</p>
+<p>We'll demonstrate the extension with manually written sources
+with two examples, both are already known. The first one is the
+<code>Observable</code> example. In the <a href="#abstract">previous</a>
+section we made a class compilable by declaring it as abstract. A
+much more suitable approach is to add the missing method
+<code>Observable.update(java.util.Observable, java.lang.Observer)</code>
+like this:</p>
+<pre>
+ <xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jm="http://jaxme.sf.net/namespaces/jaxme2/schema">
+ <xs:annotation>
+ <xs:appinfo>
+ <jm:class type="jaxme.xmlUnmarshaller">
+ <jm:implements name="java.util.Observer"/>
+ <jm:rawSource>
+ public void update(java.util.Observable pObservable,
+ Object pObject) {
+ // Do something here...
+ }
+ </jm:rawSource>
+ </jm:class>
+ </xs:appinfo>
+ </xs:annotation>
+ ...
+ </xs:schema>
+</pre>
+<p>Note that we are using the fully qualified class name
+<code>java.util.Observable</code>: JaxMe's automatic generation of
+import statements doesn't work with raw sources. Of course we do not
+need the fully qualified name of the Object class, and the same
+goes for any class which we <em>know</em> being imported.</p>
+<p>The second example finishs the <code>Cloneable</code> demo from
+the section on <a href="#extends">extension</a>. We have to implement
+a public clone method by using the existing method
+<code>clone(JAXBContextImpl)</code>. Of course that requires access
+to an instance of JAXBContextImpl. We assume that such an instance
+is stored in the static field <code>com.mycompany.myapp.CONTEXT</code>.
+That allows us to specify the following:</p>
+<pre>
+ <xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jm="http://jaxme.sf.net/namespaces/jaxme2/schema">
+ <xs:annotation>
+ <xs:appinfo>
+ <!-- Make the interface of the XML objects extend
+ java.lang.Cloneable -->
+ <jm:class type="jaxme.xmlInterface">
+ <jm:extends name="java.lang.Cloneable"/>
+ </jm:class>
+ <jm:class type="jaxme.xmlClass">
+ <jm:rawSource>
+ public Object clone() {
+ return clone(com.mycompany.myapp.CONTEXT);
+ }
+ </jm:rawSource>
+ </jm:class>
+ </xs:appinfo>
+ </xs:annotation>
+ ...
+ </xs:schema>
+</pre>
+<p>And there we have it: XML objects implementing the <code>Cloneable</code>
+interface. :-)</p>
+
+
+<a name="schemaWriters">
+<h2>Writing your own schema writers</h2>
+<p>JaxMe is well prepared to write your own schema writers.
+A schema writer is an instance of
+<a href="api/net/sf/jaxme/generator/SchemaWriter.html">SchemaWriter</a>.
+In what follows, we assume that you write your schema writer by deriving
+a subclass from
+<a href="api/net/sf/jaxme/generator/impl/JaxMeSchemaWriter.html">
+JaxMeSchemaWriter</a>. This is by no means necessary, but obviously
+the most simple approach.</p>
+<p>Writing a schema writer means attaching your class to four different
+stages of the JaxMe generator:
+<ol>
+ <li>First of all, you have to register your schema writer in the
+ schema readers list of writers.</li>
+ <li>The <a href="#events">schema parser stage</a>
+ implements an event model. The parser emits events like "Here's an
+ attribute I have read". You are able to parse additional information
+ and modify the generated tree.</li>
+ <li>The <a href="#factory">schema writers factory</a> stage: The schema
+ writer takes the tree created by the parser as input and creates a
+ shadow tree of corresponding objects, the so-called source generators.
+ The creation of a source generator is an event. You may attach yourself
+ to the event and replace the source generator with your own instance.
+</ol>
+
+</body>
+</html>
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Jaxme-jaxb-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxme-jaxb-dev