r2448 - in branches: . jaxme jaxme/upstream jaxme/upstream/0.5.1 jaxme/upstream/0.5.1/ant jaxme/upstream/0.5.1/etc jaxme/upstream/0.5.1/examples jaxme/upstream/0.5.1/examples/rss jaxme/upstream/0.5.1/examples/xs jaxme/upstream/0.5.1/examples/xs/Claes_Larsson jaxme/upstream/0.5.1/examples/xs/primer jaxme/upstream/0.5.1/prerequisites jaxme/upstream/0.5.1/src jaxme/upstream/0.5.1/src/api jaxme/upstream/0.5.1/src/api/javax jaxme/upstream/0.5.1/src/api/javax/xml jaxme/upstream/0.5.1/src/api/javax/xml/bind jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers jaxme/upstream/0.5.1/src/api/javax/xml/bind/util jaxme/upstream/0.5.1/src/api/javax/xml/namespace jaxme/upstream/0.5.1/src/documentation jaxme/upstream/0.5.1/src/documentation/conf jaxme/upstream/0.5.1/src/documentation/content jaxme/upstream/0.5.1/src/documentation/content/xdocs jaxme/upstream/0.5.1/src/documentation/content/xdocs/api jaxme/upstream/0.5.1/src/documentation/content/xdocs/js jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs jaxme/upstream/0.5.1/src/documentation/lib jaxme/upstream/0.5.1/src/documentation/manual jaxme/upstream/0.5.1/src/documentation/resources jaxme/upstream/0.5.1/src/documentation/resources/images jaxme/upstream/0.5.1/src/jaxme jaxme/upstream/0.5.1/src/jaxme/org jaxme/upstream/0.5.1/src/jaxme/org/apache jaxme/upstream/0.5.1/src/jaxme/org/apache/ws jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util jaxme/upstream/0.5.1/src/js jaxme/upstream/0.5.1/src/js/org jaxme/upstream/0.5.1/src/js/org/apache jaxme/upstream/0.5.1/src/js/org/apache/ws jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/jparser jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2 jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle jaxme/upstream/0.5.1/src/pm jaxme/upstream/0.5.1/src/pm/org jaxme/upstream/0.5.1/src/pm/org/apache jaxme/upstream/0.5.1/src/pm/org/apache/ws jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/junit jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb jaxme/upstream/0.5.1/src/test jaxme/upstream/0.5.1/src/test/java jaxme/upstream/0.5.1/src/test/java/org jaxme/upstream/0.5.1/src/test/java/org/apache jaxme/upstream/0.5.1/src/test/java/org/apache/ws jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/junit jaxme/upstream/0.5.1/src/test/jaxb jaxme/upstream/0.5.1/src/test/jaxb/jira jaxme/upstream/0.5.1/src/test/pm jaxme/upstream/0.5.1/src/webapp jaxme/upstream/0.5.1/src/webapp/java jaxme/upstream/0.5.1/src/webapp/java/org jaxme/upstream/0.5.1/src/webapp/java/org/apache jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp jaxme/upstream/0.5.1/src/xs jaxme/upstream/0.5.1/src/xs/org jaxme/upstream/0.5.1/src/xs/org/apache jaxme/upstream/0.5.1/src/xs/org/apache/ws jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl

Marcus Better marcusb-guest at costa.debian.org
Sun Sep 17 11:21:31 UTC 2006


Author: marcusb-guest
Date: 2006-09-17 11:21:23 +0000 (Sun, 17 Sep 2006)
New Revision: 2448

Added:
   branches/jaxme/
   branches/jaxme/upstream/
   branches/jaxme/upstream/0.5.1/
   branches/jaxme/upstream/0.5.1/LICENSE
   branches/jaxme/upstream/0.5.1/NOTICE
   branches/jaxme/upstream/0.5.1/ant/
   branches/jaxme/upstream/0.5.1/ant/api.xml
   branches/jaxme/upstream/0.5.1/ant/clover.xml
   branches/jaxme/upstream/0.5.1/ant/docs.xml
   branches/jaxme/upstream/0.5.1/ant/forrest-targets.ent
   branches/jaxme/upstream/0.5.1/ant/forrest.properties
   branches/jaxme/upstream/0.5.1/ant/jm.xml
   branches/jaxme/upstream/0.5.1/ant/js.xml
   branches/jaxme/upstream/0.5.1/ant/macros.xml
   branches/jaxme/upstream/0.5.1/ant/pm.xml
   branches/jaxme/upstream/0.5.1/ant/xs.xml
   branches/jaxme/upstream/0.5.1/build.xml
   branches/jaxme/upstream/0.5.1/etc/
   branches/jaxme/upstream/0.5.1/etc/KEYS
   branches/jaxme/upstream/0.5.1/etc/package-list
   branches/jaxme/upstream/0.5.1/examples/
   branches/jaxme/upstream/0.5.1/examples/rss/
   branches/jaxme/upstream/0.5.1/examples/rss/dc.xsd
   branches/jaxme/upstream/0.5.1/examples/rss/rdf.xsd
   branches/jaxme/upstream/0.5.1/examples/rss/rss.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/
   branches/jaxme/upstream/0.5.1/examples/xs/Claes_Larsson/
   branches/jaxme/upstream/0.5.1/examples/xs/Claes_Larsson/schema.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/XMLSchema.dtd
   branches/jaxme/upstream/0.5.1/examples/xs/datatypes.dtd
   branches/jaxme/upstream/0.5.1/examples/xs/datatypes.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/primer/
   branches/jaxme/upstream/0.5.1/examples/xs/primer/address.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/primer/currency.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/primer/ipo.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/primer/po.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/primer/po1.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/primer/report.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/structures.xsd
   branches/jaxme/upstream/0.5.1/examples/xs/xml.xsd
   branches/jaxme/upstream/0.5.1/jaxme.properties.sample
   branches/jaxme/upstream/0.5.1/prerequisites/
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-DOM.html
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-SAX.html
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-ant.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-antlr.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hsqldb.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hypersonic.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-junit.html
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-log4j.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-tomcat.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xerces.txt
   branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xmldb.txt
   branches/jaxme/upstream/0.5.1/prerequisites/README
   branches/jaxme/upstream/0.5.1/prerequisites/TaminoAPI4J.jar
   branches/jaxme/upstream/0.5.1/prerequisites/TaminoJCA.jar
   branches/jaxme/upstream/0.5.1/prerequisites/ant-1.5.4.jar
   branches/jaxme/upstream/0.5.1/prerequisites/antlr.jar
   branches/jaxme/upstream/0.5.1/prerequisites/hsqldb-1.7.1.jar
   branches/jaxme/upstream/0.5.1/prerequisites/junit.jar
   branches/jaxme/upstream/0.5.1/prerequisites/log4j-1.2.8.jar
   branches/jaxme/upstream/0.5.1/prerequisites/servlet.jar
   branches/jaxme/upstream/0.5.1/prerequisites/xercesImpl.jar
   branches/jaxme/upstream/0.5.1/prerequisites/xml-apis.jar
   branches/jaxme/upstream/0.5.1/prerequisites/xmldb-api-20021118.jar
   branches/jaxme/upstream/0.5.1/prerequisites/xmldb-api-sdk-20021118.jar
   branches/jaxme/upstream/0.5.1/src/
   branches/jaxme/upstream/0.5.1/src/api/
   branches/jaxme/upstream/0.5.1/src/api/javax/
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/XMLConstants.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverter.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverterInterface.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Element.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBContext.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBException.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/MarshalException.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Marshaller.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/NotIdentifiableEvent.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ParseConversionEvent.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PrintConversionEvent.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PropertyException.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/TypeConstraintException.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshalException.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Unmarshaller.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshallerHandler.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEvent.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventHandler.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventLocator.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationException.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Validator.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractMarshallerImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/DefaultValidationEventHandler.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/NotIdentifiableEventImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ParseConversionEventImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/PrintConversionEventImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventLocatorImpl.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/package.html
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/package.html
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBResult.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBSource.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/ValidationEventCollector.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/package.html
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/NamespaceContext.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/QName.java
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/package.html
   branches/jaxme/upstream/0.5.1/src/api/javax/xml/package.html
   branches/jaxme/upstream/0.5.1/src/documentation/
   branches/jaxme/upstream/0.5.1/src/documentation/README.txt
   branches/jaxme/upstream/0.5.1/src/documentation/conf/
   branches/jaxme/upstream/0.5.1/src/documentation/conf/cli.xconf
   branches/jaxme/upstream/0.5.1/src/documentation/content/
   branches/jaxme/upstream/0.5.1/src/documentation/content/downloads.cgi
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/book.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/index.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/downloads.ehtml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/features.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/index.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/book.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/xmlrpc.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/book.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/factory.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/index.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/jparser.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/methods.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/optimizations.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/book.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/chains.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/proxy.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/typesafeenum.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/versioning.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/placeholders.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/sql.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/license.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/mailinglists.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/misc.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/news.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/book.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/index.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/ino.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/jdbc.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/related.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/release.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/resources.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/site.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/tabs.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/book.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/generic.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/index.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/logical.xml
   branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/syntax.xml
   branches/jaxme/upstream/0.5.1/src/documentation/lib/
   branches/jaxme/upstream/0.5.1/src/documentation/lib/jimi-1.0.jar
   branches/jaxme/upstream/0.5.1/src/documentation/manual/
   branches/jaxme/upstream/0.5.1/src/documentation/manual/address.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/addressxsd.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/faq.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/firststeps.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/glossary.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/jaxme2.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/license.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/marshalling.xml
   branches/jaxme/upstream/0.5.1/src/documentation/manual/xjctask.xml
   branches/jaxme/upstream/0.5.1/src/documentation/release-0.3.tar.bz2
   branches/jaxme/upstream/0.5.1/src/documentation/release-0.4.tar.bz2
   branches/jaxme/upstream/0.5.1/src/documentation/resources/
   branches/jaxme/upstream/0.5.1/src/documentation/resources/images/
   branches/jaxme/upstream/0.5.1/src/documentation/resources/images/group-logo.gif
   branches/jaxme/upstream/0.5.1/src/documentation/resources/images/icon.png
   branches/jaxme/upstream/0.5.1/src/documentation/resources/images/jaxme-application-workflow.png
   branches/jaxme/upstream/0.5.1/src/documentation/resources/images/jaxme-compiler-workflow.png
   branches/jaxme/upstream/0.5.1/src/documentation/skinconf.xml
   branches/jaxme/upstream/0.5.1/src/jaxme/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMElement.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMManager.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMMarshaller.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMPI.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshaller.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshallerHandler.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMValidator.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observable.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observer.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PM.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMException.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMParams.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/ValidationEvents.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/WildcardAttribute.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLConstants.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLWriter.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressPrinter.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Generator.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Main.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/PropertySource.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaException.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaOption.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaReader.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/XJCTask.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/GeneratorImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/Inliner.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/SchemaReaderImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AtomicTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AttributeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexContentSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Context.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Facet.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/GroupSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ListTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ObjectSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ParticleSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/PropertySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGFactory.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGItem.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGlet.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SchemaSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleContentSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/TypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/UnionTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AbstractContext.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyAttributePropertySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyElementPropertySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ArrayPropertySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AtomicTypeSGImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/EnumerationSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/FacetImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/GlobalContext.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBAttributeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexContentTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBGroupSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBObjectSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBParticleSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBPropertySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGFactory.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGItem.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaReader.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSimpleContentTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSGFactory.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSchemaReader.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/LocalContext.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/MultiplePropertySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ParsePrintSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SerializableSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SimpleTypeRestrictionSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/XjcSerializable.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/AllHandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/BeanGeneratingVisitor.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ChoiceHandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/DriverGeneratingVisitor.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/EmptyElementHandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupHandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupUtil.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSGImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/MarshalChildsMethodGeneratingVisitor.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitor.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitorImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleWalker.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SequenceHandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDREFSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/JMChar.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ListTypeSGImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/PrimitiveTypeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/QNameSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/SimpleTypeSGImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/StringSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnionTypeSGImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedIntSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedShortSG.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/DateFilter.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/JavaNamer.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/QNameUtil.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/Reflect.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/ReflectResolver.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/CharSetXMLWriter.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/Configuration.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/DatatypeConverterImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JAXBContextImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMControllerImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMMarshallerImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMPIImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriver.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriverController.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXElementParser.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXGroupParser.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerHandlerImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMValidatorImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/OrderedAttributeXMLWriter.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/PassThroughXMLWriter.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/ValidationEventImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/XMLWriterImpl.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/BaseTestCase.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/DefaultValueTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EnumerationTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EventsTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JaxbTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JiraTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/MarshallerTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/NestedGroupTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/ParserTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrintParseTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrinterCreatorTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/RecursionTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/WildcardTest.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/package.html
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Base64Binary.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/ClassLoader.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Configurator.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMBuilder.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMSerializer.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Duration.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/HexBinary.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceResolver.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceSupport.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceUser.java
   branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/package.html
   branches/jaxme/upstream/0.5.1/src/js/
   branches/jaxme/upstream/0.5.1/src/js/org/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/AbstractJavaMethod.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationEngine.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationJavaSourceObject.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/DirectAccessible.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IncreasingTarget.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngine.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngineImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationTarget.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentedObject.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaClassInitializer.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaComment.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaConstructor.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaField.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaInnerClass.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaMethod.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQName.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQNameImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSource.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceObject.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/LocalJavaField.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Parameter.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/PlaceHolder.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TextFile.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TypedValue.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Util.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/WriterTarget.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/JavaSourceResolver.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcCaller.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcClientGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfo.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfoFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanProperty.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanReaderException.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanSchemaWriter.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TextFileImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TypedValueImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/jparser/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/jparser/java15.g
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/AntlrTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BasicTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BeanReaderTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/MultipleInheritanceTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/TypesafeEnumerationTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/VersionTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTestRemoteClass.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/create.sql
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/drop.sql
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Ant.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ChainGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/CompiledClassReflector.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/InterfaceDescription.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/MethodKey.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ProxyGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Reflector.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/SourceReflector.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/TypesafeEnumerationGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/VersionGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ant.properties
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/AntLinkChecker.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/JavaParser.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/LinkChecker.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLogger.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLoggerFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLogger.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLoggerFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLogger.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLoggerFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Logger.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerAccess.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintStreamLogger.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintWriterLogger.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BinaryColumn.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BooleanConstraint.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Case.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Column.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnReference.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnSet.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/CombinedConstraint.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ConstrainedStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Constraint.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/DeleteStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Expression.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ForeignKey.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Function.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Index.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/InsertStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/JoinReference.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ObjectFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Parts.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/RawSQLCode.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Schema.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectTableReference.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SetStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Statement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/StringColumn.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Table.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/TableReference.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/UpdateStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Value.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/BufferPool.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Column.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2ColumnImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGeneratorImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Schema.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Table.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2TableImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/PageSize.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpace.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpaceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumn.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumnImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGeneratorImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchema.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTable.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTableImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/AbstractColumn.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/BooleanConstraintImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CaseImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnReferenceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnSetImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CombinedConstraintImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstrainedStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstraintImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/DeleteStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ExpressionImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ForeignKeyImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/FunctionImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/IndexImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/InsertStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/JoinReferenceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ObjectFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/PartsImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/RawSQLCodeImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectTableReferenceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SetStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementMetaData.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableReferenceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/UpdateStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ValueImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ViewImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/VirtualColumn.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/CreateTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/DB2Test.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/JoinTest.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/Oracle8Test.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReference.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReferenceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraJoinReferenceImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraObjectFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactory.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGenerator.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGeneratorImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatement.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatementImpl.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraStatementMetaData.java
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/package.html
   branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/package.html
   branches/jaxme/upstream/0.5.1/src/overview.html
   branches/jaxme/upstream/0.5.1/src/pm/
   branches/jaxme/upstream/0.5.1/src/pm/org/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/ConnectionDetails.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomColumnData.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomTableData.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JaxMeJdbcSG.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcComplexTypeSG.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcSchemaSG.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcTypeSG.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/TableDetails.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMIdImpl.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMImpl.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/IURLEncoder.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoException.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoManager.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoObject.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoResponseHandler.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder14.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JDbPm.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/PMJdbcImpl.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/junit/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/junit/SessionTest.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/package.html
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java
   branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html
   branches/jaxme/upstream/0.5.1/src/test/
   branches/jaxme/upstream/0.5.1/src/test/README
   branches/jaxme/upstream/0.5.1/src/test/java/
   branches/jaxme/upstream/0.5.1/src/test/java/org/
   branches/jaxme/upstream/0.5.1/src/test/java/org/apache/
   branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/
   branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/
   branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/junit/
   branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/junit/PrintParse.java
   branches/jaxme/upstream/0.5.1/src/test/jaxb/
   branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xml
   branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/build.xml
   branches/jaxme/upstream/0.5.1/src/test/jaxb/defaults.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/enumeration.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/group.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jaxb.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-10.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-12.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-17.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-20.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-21.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-46.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-65.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-72.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsi
   branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/xjcSerializable.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/nestedGroups.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/recursion.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/rss.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/simpleTypeRestriction.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/types.xsd
   branches/jaxme/upstream/0.5.1/src/test/jaxb/wildcards.xsd
   branches/jaxme/upstream/0.5.1/src/test/pm/
   branches/jaxme/upstream/0.5.1/src/test/pm/initdb.sql
   branches/jaxme/upstream/0.5.1/src/test/pm/session.xsd
   branches/jaxme/upstream/0.5.1/src/webapp/
   branches/jaxme/upstream/0.5.1/src/webapp/build.xml
   branches/jaxme/upstream/0.5.1/src/webapp/compile.jsp
   branches/jaxme/upstream/0.5.1/src/webapp/index.jsp
   branches/jaxme/upstream/0.5.1/src/webapp/java/
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/BaseServlet.java
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/InitServlet.java
   branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/JaxMeServlet.java
   branches/jaxme/upstream/0.5.1/src/webapp/web.xml
   branches/jaxme/upstream/0.5.1/src/xs/
   branches/jaxme/upstream/0.5.1/src/xs/org/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/SchemaTransformer.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XPathMatcher.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAnnotation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAny.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAppinfo.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAtomicType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributable.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttribute.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributeGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSComplexType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSContentHandler.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSDocumentation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElement.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSEnumeration.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSIdentityConstraint.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSKeyRef.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSListType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSModelGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSNotation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObject.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObjectFactory.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSOpenAttrs.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParser.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSchema.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleContentType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSUnionType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSWildcard.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/DOMSerializer.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAppinfoImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAtomicTypeRestrictionImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSContentHandlerImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSDocumentationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSElementImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSEnumerationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSIdentityConstraintImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSKeyRefImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeRestrictionImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSModelGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSNotationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSOpenAttrsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSParticleImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleContentTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeRestrictionImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeRestrictionImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUtil.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSWildcardImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAny.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAttribute.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClass.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClassOwner.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBElement.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBEnumeration.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGlobalBindings.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaTypeOwner.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavadoc.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBProperty.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBPropertyOwner.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchema.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchemaBindings.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleContentType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumClass.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumMember.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBWildcard.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsObjectFactory.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsSchema.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAppinfoImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAttributeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBClassImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBElementImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBEnumerationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGlobalBindingsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavaTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavadocImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBObjectFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBParser.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBPropertyImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaBindingsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleContentTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumClassImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumMemberImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBWildcardImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsSchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ClaesLarssonTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DTDParserTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DumpUtils.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/FormatTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JAXBParserTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JiraTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/NISTTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTestBase.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/SyntaxTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/TestSrcContent.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/WSDLTest.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/AttributeSetter.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/ChildSetter.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/DOMBuilder.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/TextSetter.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XSContext.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsObjectCreator.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsSAXParser.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AbstractXsSAXParser.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AttributeSetterImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/ChildSetterImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/LocSAXException.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/TextSetterImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XSContextImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XsSAXParserImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractAtomicType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractBuiltinType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractListType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractSimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnySimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyURI.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBase64Binary.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBoolean.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSByte.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDate.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDateTime.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDecimal.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDouble.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDuration.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntities.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntity.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSFloat.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGDay.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonth.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonthDay.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYear.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYearMonth.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSHexBinary.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSID.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREF.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREFs.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInt.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInteger.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLanguage.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLong.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNCName.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMToken.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMTokens.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSName.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNegativeInteger.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonNegativeInteger.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonPositiveInteger.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNormalizedString.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNotation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSPositiveInteger.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSQName.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSShort.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSString.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSTime.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSToken.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedByte.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedInt.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedLong.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedShort.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/DTDParser.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateFormat.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateTimeFormat.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsTimeFormat.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XmlLang.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGDefRef.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGOccurs.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAnyURI.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsBlockSet.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsComplexContentType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsDerivationSet.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAnnotation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAny.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAppinfo.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEChoice.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEComplexContent.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEDocumentation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEEnumeration.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEField.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEFractionDigits.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEImport.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEInclude.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKey.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKeyref.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsELength.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEList.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxExclusive.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxInclusive.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxLength.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinExclusive.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinInclusive.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinLength.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsENotation.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEPattern.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERedefine.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERestriction.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESchema.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESelector.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESequence.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESimpleContent.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETopLevelSimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETotalDigits.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnion.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnique.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEWhiteSpace.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsFormChoice.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAllModel.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAttrDecls.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGComplexTypeModel.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGIdentityConstraint.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGNestedParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGSimpleRestrictionModel.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGTypeDefParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsID.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNCName.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObject.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObjectFactory.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsQName.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsRedefinable.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSchemaHeader.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSimpleDerivationSet.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAll.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAnnotated.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttribute.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroupRef.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexRestrictionType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTElement.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExplicitGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExtensionType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacet.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacetBase.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFixedFacet.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroupRef.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTIdentityConstraint.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTKeybase.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalComplexType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalElement.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalSimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNamedGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNestedParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNumFacet.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTOpenAttrs.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRealGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRestrictionType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExplicitGroup.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExtensionType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleRestrictionType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelComplexType.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelElement.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTypeDefParticle.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTWildcard.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsToken.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGDefRefImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGOccursImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnnotationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnyImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAppinfoImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEChoiceImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEComplexContentImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEDocumentationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEEnumerationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFieldImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFractionDigitsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEImportImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEIncludeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyrefImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsELengthImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEListImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxExclusiveImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxInclusiveImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxLengthImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinExclusiveImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinInclusiveImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinLengthImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsENotationImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEPatternImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERedefineImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERestrictionImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESelectorImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESequenceImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESimpleContentImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETopLevelSimpleTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETotalDigitsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUnionImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUniqueImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEWhiteSpaceImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTElementImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExplicitGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExtensionTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetBaseImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFixedFacetImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupRefImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTKeybaseImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalAllElementImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalComplexTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalElementImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalSimpleTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNamedGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNumFacetImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTOpenAttrsImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRealGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRestrictionTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExplicitGroupImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExtensionTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleRestrictionTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelComplexTypeImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelElementImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/package.html
   branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/package.html
   branches/jaxme/upstream/0.5.1/status.xml
Log:
Imported upstream sources.


Added: branches/jaxme/upstream/0.5.1/LICENSE
===================================================================
--- branches/jaxme/upstream/0.5.1/LICENSE	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/LICENSE	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Added: branches/jaxme/upstream/0.5.1/NOTICE
===================================================================
--- branches/jaxme/upstream/0.5.1/NOTICE	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/NOTICE	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product contains an implementation of the Document Object Model
+Level 2 Core (DOM). DOM is copyright (c) 2000, World Wide Web
+Consortium. See prerequisites/LICENSE-DOM.html for details.
+
+This product contains HSQLDB. HSQLDB is Copyright (c) 2001-2002, The
+HSQL Development Group. See prerequisites/LICENSE-hsqldb.txt for
+details. HSQLDB is based on Hypersonic SQL, which is Copyright
+(c) 1995-2000, The Hypersonic SQL Group. See
+prerequisites/LICENSE-hypersonic.txt for details.
+
+This product contains JUnit. JUnit was originally written by Erich Gamma
+and Kent Beck and is distributed under the terms of the Common Public
+License, v1.0. For details see prerequisites/LICENSE-junit.html.
+
+This product includes SAX. SAX is in the public domain. See
+prerequisites/LICENSE-SAX.html for details.
+
+This product includes software developed by the XML:DB Initiative
+(http://www.xmldb.org/). See prerequisites/LICENSE-xmldb.txt for
+details.
+
+This product includes the AntLR parser generator (http://www.antlr.org/).
+AntLR is in the public domain. See prerequisites/LICENSE-antlr.txt for
+details.
+
+This product includes the Beaver parser generator (http://beaver.sf.net/),
+which is Copyright (c) 2003-2004, Alexander Demenchuk <alder at softanvil.com>.
+See prerequisites/LICENSE-beaver.txt for details.

Added: branches/jaxme/upstream/0.5.1/ant/api.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/api.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/api.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+<!--
+ * Copyright 2002-2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project name="API" default="all">
+    <import file="clover.xml"/>
+
+    <property name="build.api" location="${build}/api"/>
+    <property name="build.api.classes" location="${build.api}/classes"/>
+    <property name="src.api" location="src/api"/>
+
+    <target name="API.clean">
+        <delete dir="${build.api}"/>
+    </target>
+   
+    <path id="api.class.path">
+        <pathelement location="${preqs}/xml-apis.jar"/>
+    </path>
+
+    <target name="API.compile" depends="init">
+        <jc srcdir="${src.api}" destdir="${build.api.classes}"
+            classpathref="api.class.path" excludes="" java14classes=""/>
+    </target>
+
+    <target name="API.jar" depends="API.compile">
+        <jarzip srcdir="${src.api}" classesdir="${build.api.classes}"
+                filename="jaxmeapi"/>
+    </target>
+
+    <target name="all" depends="API.jar"/>
+
+    <target name="test" depends="API.jar"/>
+</project>

Added: branches/jaxme/upstream/0.5.1/ant/clover.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/clover.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/clover.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,23 @@
+<project name="Clover" default="clover.swing">
+    <import file="macros.xml"/>
+
+    <property name="build.clover.html" location="${build}/clover.html"/>
+   
+    <target name="init" if="build.clover.db">
+        <taskdef resource="clovertasks"/>
+        <clover-setup initString="${build.clover.db}"/>
+    </target>
+
+    <target name="clover.html">
+        <clover-report>
+            <current outfile="${build.clover.html}">
+                <format type="html"/> 
+            </current>   
+        </clover-report>
+    </target>
+
+    <target name="clover.swing">
+        <clover-view/>
+    </target>
+</project>
+   
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/ant/docs.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/docs.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/docs.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,189 @@
+<!DOCTYPE project [
+  <!ENTITY forrest-targets SYSTEM "forrest-targets.ent">
+]>
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+-->
+<project name="Docs" default="all">
+    <import file="pm.xml"/>
+
+    <property name="build.docs" location="${build}/docs"/>
+    <property name="build.docs.src.documentation" location="${build.docs}/src/documentation"/>
+    <property name="build.apidocs" location="${build.docs.src.documentation}/content/apidocs"/>
+    <property name="build.manual" location="${build.docs.src.documentation}/content/manual"/>
+    <property name="build.site" location="${build.docs}/build/site"/>
+    <property name="src.documentation" location="${basedir}/src/documentation"/>
+
+    <target name="check.forrest.home" unless="forrest.home">
+        <echo>The property forrest.home is not set. This property should contain the</echo>
+        <echo>location of the Apache Forrest distribution, which is required to</echo>
+        <echo>build the JaxMe documentation. Apache Forrest (version 0.5, as of</echo>
+        <echo>this writing) is available on</echo>
+        <echo>    http://xml.apache.org/forrest/</echo>
+        <echo/>
+        <echo>The property can be set in</echo>
+        <echo>${jaxme.properties.location.1},</echo>
+        <echo>in ${jaxme.properties.location.2},</echo>
+        <echo>or on the command line using -Dforrest.home=&lt;directory&gt;.</echo>
+        <fail>Missing Apache Forrest, terminating.</fail>
+    </target>
+
+    <target name="check.docbookxsl.home" unless="docbookxsl.home">
+        <echo>The property docbookxsl.home is not set. This property should contain</echo>
+        <echo>the location of the DocBook XSL distribution, a set of stylesheets</echo>
+        <echo>used to build the JaxMe documentation. The DocBook XSL distribution</echo>
+        <echo>(version 1.61.3, as of this writing) is available on</echo>
+        <echo>http://sf.net/projects/docbook.</echo>
+        <echo/>
+        <echo>The property can be set in</echo>
+        <echo>${jaxme.properties.location.1},</echo>
+        <echo>in ${jaxme.properties.location.2},</echo>
+        <echo>or on the command line using -Ddocbookxsl.home=&lt;directory&gt;.</echo>
+        <fail>Missing DocBook XSL, terminating.</fail>
+    </target>
+
+    <target name="check.docbook.home" unless="docbook.home">
+        <echo>The property docbook.home is not set. This property should contain</echo>
+        <echo>the location of the DocBook distribution, which includes in particular</echo>
+        <echo>the DocBook DTD. This DTD is used to build the JaxMe documentation.</echo>
+        <echo>The DocBook XML distribution (version 4.1.2, as of this writing)</echo>
+        <echo>is available on http://www.oasis-open.org/docbook/.</echo>
+        <echo/>
+        <echo>The property can be set in</echo>
+        <echo>${jaxme.properties.location.1},</echo>
+        <echo>in ${jaxme.properties.location.2},</echo>
+        <echo>or on the command line using -Ddocbook.home=&lt;directory&gt;.</echo>
+        <fail>Missing DocBook, terminating.</fail>
+    </target>
+
+    <target name="Docs.all" depends="javadoc,docbook.html,old.releases,forrest,replace"
+          description="Generates the documentation"/>
+
+    <target name="javadoc" depends="all"
+          description="Generates the API documentation">
+        <delete dir="${build.apidocs}"/>
+        <mkdir dir="${build.apidocs}"/>
+        <path id="docs.class.path">
+          <path refid="pm.class.path"/>
+          <path refid="xs.class.path"/>
+          <path refid="js.class.path"/>
+          <path refid="jaxme.class.path"/>
+        </path>
+        <javadoc
+                         access="protected"
+                         author="true"
+                   classpathref="docs.class.path"
+                        destdir="${build.apidocs}"
+                   nodeprecated="false"
+               nodeprecatedlist="false"
+                        noindex="false"
+                       nonavbar="false"
+                         notree="false"
+                     splitindex="false"
+                            use="false"
+                        version="true"
+                   packagenames="javax.xml.*,org.apache.ws.jaxme.*"
+                   overview="src/overview.html">
+          <excludepackage name="org.apache.ws.jaxme.examples.misc.address"/>
+          <excludepackage name="org.apache.ws.jaxme.junit"/>
+          <excludepackage name="org.apache.ws.jaxme.pm.junit"/>
+          <excludepackage name="org.apache.ws.jaxme.sqls.junit"/>
+          <excludepackage name="org.apache.ws.jaxme.xs.junit"/>
+          <link href="http://java.sun.com/j2se/1.4.2/docs/api/"
+                offline="true" packagelistloc="${basedir}/etc/package-list"/>
+          <sourcepath>
+            <pathelement location="${src.api}"/>
+            <pathelement location="${src.xs}"/>
+            <pathelement location="${src.js}"/>
+            <pathelement location="${src.jm}"/>
+            <pathelement location="${src.pm}"/>
+            <pathelement location="${build.js.src}"/>
+            <pathelement location="${build.jm.src}"/>
+          </sourcepath>
+        </javadoc>
+    </target>
+
+    &forrest-targets;
+
+    <!-- Run "ant doc -Dbuild.online.site=true" to activate this  -->
+    <target name="replace" if="build.online.site">
+        <echo>Replacing downloads.html with downloads.cgi</echo>
+        <replace dir="${build.docs}/build/site" value="downloads.cgi">
+          <include name="**/*.html"/>
+          <replacetoken>downloads.html</replacetoken>
+        </replace>
+    </target>
+
+    <target name="forrest" depends="check.forrest.home"
+          description="Generates the online site">
+        <mkdir dir="${build.docs.src.documentation}"/>
+        <copy todir="${build.docs.src.documentation}">
+          <fileset dir="${src.documentation}" excludes="manual/**/*"/>
+        </copy>
+        <property name="project.home" location="${build.docs}"/>
+        <antcall target="site"/>
+    </target>
+
+    <target name="forrestwar" depends="check.forrest.home">
+        <mkdir dir="${build.docs.src.documentation}"/>
+        <copy todir="${build.docs.src.documentation}">
+          <fileset dir="${src.documentation}" excludes="manual/**/*"/>
+        </copy>
+        <property name="project.home" location="${build.docs}"/>
+        <antcall target="war"/>
+    </target>
+
+	<target name="old.releases" if="build.online.site">
+        <untar compression="bzip2" dest="${build.docs.src.documentation}/content"
+            src="src/documentation/release-0.3.tar.bz2"/>
+        <untar compression="bzip2" dest="${build.docs.src.documentation}/content"
+            src="src/documentation/release-0.4.tar.bz2"/>
+	</target>
+
+    <target name="docbook.html"
+              depends="check.docbookxsl.home,check.docbook.home,docbook.html.14,docbook.html.50"
+              description="Generates the Manual"/>
+ 
+    <target name="docbook.html.14" unless="have50">
+        <delete dir="{build.manual}"/>
+        <mkdir dir="${build.manual}"/>
+        <style in="${basedir}/src/documentation/manual/jaxme2.xml"
+               out="${build.manual}/index.html"
+             force="${force}"
+            style="${docbookxsl.home}/html/chunk.xsl">
+          <xmlcatalog>
+            <dtd publicid="-//OASIS//DTD DocBook XML V4.1.2//EN" location="${docbook.home}/docbookx.dtd"/>
+          </xmlcatalog>
+        </style>
+    </target>
+
+    <target name="docbook.html.50" if="have50">
+        <!-- We need an explicit factory, because the Xalan version
+             of Java 5.0.2 throws an ArrayIndexOutOfBoundsException. -->
+        <delete dir="{build.manual}"/>
+        <mkdir dir="${build.manual}"/>
+        <style in="${basedir}/src/documentation/manual/jaxme2.xml"
+               out="${build.manual}/index.html"
+             force="${force}"
+            style="${docbookxsl.home}/html/chunk.xsl">
+          <xmlcatalog>
+            <dtd publicid="-//OASIS//DTD DocBook XML V4.1.2//EN" location="${docbook.home}/docbookx.dtd"/>
+          </xmlcatalog>
+          <factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
+        </style>
+    </target>
+</project>
+   
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/ant/forrest-targets.ent
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/forrest-targets.ent	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/forrest-targets.ent	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,191 @@
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+-->
+
+<!--
+This build.xml snippet contains Forrest targets for Ant 1.5+.  It checks that
+the user has set ${forrest.home}, either in one of:
+  build.properties
+  project.properties
+  ant.properties
+  .ant.properties
+or with the FORREST_HOME environment variable, and prints an informative error
+message if not found.
+
+Usage:
+1) Copy this file to somewhere in your project.
+2) Add the following to the top of your project's Ant build.xml script
+(adjusting the path):
+
+  <!DOCTYPE project [
+    <!ENTITY forrest-targets SYSTEM "file:./forrest-targets.ent">
+  ]>
+
+3) Before the closing '</project>' in your build.xml, add this:
+
+  &forrest-targets;
+  
+This is like expanding a macro: it pulls in the contents of this file.
+
+A minimal build.xml would thus be:
+
+<!DOCTYPE project [
+<!ENTITY forrest-targets SYSTEM "file:./forrest-targets.ent">
+]>
+
+<project default="site">
+    &forrest-targets;
+</project>
+-->
+
+  <target name="site" depends="forrest.init" description="Generates static HTML documentation">
+    <ant antfile="${forrest.home}/forrest.antproxy.xml" target="site"/>
+  </target>
+
+  <target name="webapp" depends="forrest.init" description="Generates an unpackaged webapp of the website">
+    <ant antfile="${forrest.home}/forrest.antproxy.xml" target="webapp"/>
+  </target>
+
+  <target name="war" depends="forrest.init" description="Generates a .war file containing the website">
+    <ant antfile="${forrest.home}/forrest.antproxy.xml" target="war"/>
+  </target>
+
+  <target name="validate" depends="forrest.init" description="Validates XML documentation files">
+    <ant antfile="${forrest.home}/forrest.antproxy.xml" target="validate"/>
+  </target>
+
+  <target name="forrest.init" depends="forrest.sethome, forrest.home.defined"/>
+
+  <target name="forrest.sethome" depends="forrest.loadenv,
+  forrest.checkenv, forrest.checkhome, forrest.check-build.properties,
+  forrest.check-project.properties, forrest.check-ant.properties,
+  forrest.check-.ant.properties"/>
+
+  <target name="forrest.loadenv" unless="forrest.home.present">
+    <property environment="env"/>
+    <echo level="verbose">Forrest: Got ${env.FORREST_HOME}</echo>
+  </target>
+
+  <target name="forrest.checkenv" if="env.FORREST_HOME">
+    <echo level="verbose">Found $FORREST_HOME..</echo>
+    <property name="forrest.home" location="${env.FORREST_HOME}"/>
+    <echo level="verbose">forrest.home set to ${forrest.home}</echo>
+    <available file="${forrest.home}" type="dir" property="forrest.home.present"/>
+  </target>
+
+
+  <target name="forrest.checkhome">
+    <available file="${forrest.home}" type="dir" property="forrest.home.present"/>
+    <available file="build.properties" type="file" property="build.properties.present"/>
+    <available file="project.properties" type="file" property="project.properties.present"/>
+    <available file="ant.properties" type="file" property="ant.properties.present"/>
+    <available file=".ant.properties" type="file" property=".ant.properties.present"/>
+  </target>
+
+  <!-- No we can't extract the commonalities below into an antcall'ed target,
+  because it wouldn't be able to set forrest.home -->
+  <target name="forrest.check-build.properties" unless="forrest.home.present"
+  if="build.properties.present">
+    <echo level="verbose">Forrest: Checking build.properties..</echo>
+    <loadproperties srcfile="build.properties">
+      <filterchain>
+        <linecontains>
+          <contains value="forrest.home"/>
+        </linecontains>
+      </filterchain>
+    </loadproperties>
+    <available file="${forrest.home}" type="dir" property="forrest.home.present"/>
+
+  </target>
+
+  <target name="forrest.check-project.properties" unless="forrest.home.present"
+  if="project.properties.present">
+    <echo level="verbose">Forrest: Checking project.properties..</echo>
+    <loadproperties srcfile="project.properties">
+      <filterchain>
+        <linecontains>
+          <contains value="forrest.home"/>
+        </linecontains>
+      </filterchain>
+    </loadproperties>
+    <available file="${forrest.home}" type="dir" property="forrest.home.present"/>
+  </target>
+
+  <target name="forrest.check-ant.properties" unless="forrest.home.present"
+  if="ant.properties.present">
+    <echo level="verbose">Forrest: Checking ant.properties..</echo>
+    <loadproperties srcfile="ant.properties">
+      <filterchain>
+        <linecontains>
+          <contains value="forrest.home"/>
+        </linecontains>
+      </filterchain>
+    </loadproperties>
+    <available file="${forrest.home}" type="dir" property="forrest.home.present"/>
+  </target>
+
+  <target name="forrest.check-.ant.properties" unless="forrest.home.present"
+  if=".ant.properties.present">
+    <echo level="verbose">Forrest: Checking .ant.properties..</echo>
+    <loadproperties srcfile=".ant.properties">
+      <filterchain>
+        <linecontains>
+          <contains value="forrest.home"/>
+        </linecontains>
+      </filterchain>
+    </loadproperties>
+    <available file="${forrest.home}" type="dir" property="forrest.home.present"/>
+  </target>
+
+  <target name="forrest.home.defined" depends="forrest.sethome" unless="forrest.home.present">
+    <property name="path" value="${user.home}/xml-forrest/build/dist/shbat"/>
+    <pathconvert targetos="windows" property="winpath">
+      <path>
+        <pathelement location="${path}"/>
+      </path>
+    </pathconvert>
+    <pathconvert targetos="unix" property="unixpath">
+      <path>
+        <pathelement
+          location="${path}"/>
+      </path>
+    </pathconvert>
+
+    <echo>
+      ----------------------------------------------
+      To run this target, you need Forrest installed.
+      Please do the following:
+
+      export CVSROOT=:pserver:anoncvs at cvs.apache.org:/home/cvspublic
+      cvs checkout xml-forrest
+      cd xml-forrest
+      build      (Windows)
+      ./build.sh (Unix)
+
+      Then either:
+
+      - Set FORREST_HOME as the Forrest build instructions describe
+      - Create a build.properties, with the forrest.home property pointing to
+        the forrest shbat directory, eg:
+
+        forrest.home=${winpath}  (Windows)
+        forrest.home=${unixpath}  (Unix)
+
+        (adjusting the path according to where your xml-forrest is)
+      ----------------------------------------------
+    </echo>
+    <fail message="Need to define $${forrest.home}"/>
+  </target>

Added: branches/jaxme/upstream/0.5.1/ant/forrest.properties
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/forrest.properties	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/forrest.properties	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,114 @@
+###############################################################################
+# Copyright 2002-2004  The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+
+##############
+# Properties used by forrest.build.xml for building the website
+##############
+
+# Prints out a summary of Forrest settings for this project
+#forrest.echo=false
+
+# Project name (used to name .war file)
+project.name=JaxMe 2
+
+# Specifies name of Forrest skin to use
+#project.skin=forrest-site
+#project.skin=avalon-tigris
+#project.skin=krysalis-site
+
+
+##############
+# layout properties
+
+# Properties that must be set to override the default locations
+#
+# Parent properties must be set. This usually means uncommenting
+# project.content-dir if any other property using it is uncommented
+
+#project.status=status.xml
+#project.content-dir=${basedir}/src/documentation
+#project.conf-dir=${project.content-dir}/conf
+#project.sitemap=${project.content-dir}/sitemap.xmap
+#project.xdocs-dir=${project.content-dir}/content/xdocs
+#project.stylesheets-dir=${project.content-dir}/resources/stylesheets
+#project.images-dir=${project.content-dir}/resources/images
+#project.schema-dir=${project.content-dir}/resources/schema
+#project.skins-dir=${project.content-dir}/skins
+#project.skinconf=${project.content-dir}/skinconf.xml
+#project.lib-dir=${project.content-dir}/lib
+#project.classes-dir=${project.content-dir}/classes
+project.site-dir=${basedir}/build
+project.temp-dir=${basedir}/tmp
+
+
+##############
+# Cocoon catalog entity resolver properties
+
+# A local catalog to supplement the default Forrest catalog
+#project.catalog=${project.schema-dir}/catalog
+
+# The verbosity level for the entity resolver (1..10)
+forrest.catalog.verbosity=1
+
+
+##############
+# validation properties
+
+# These props determine if validation is performed at all
+# Values are inherited unless overridden.
+# Eg, if forrest.validate=false, then all others are false unless set to true.
+#forrest.validate=true
+#forrest.validate.xdocs=${forrest.validate}
+#forrest.validate.skinconf=${forrest.validate}
+#forrest.validate.sitemap=${forrest.validate}
+#forrest.validate.stylesheets=${forrest.validate}
+#forrest.validate.skins=${forrest.validate}
+#forrest.validate.skins.stylesheets=${forrest.validate.skins}
+
+
+# Key:
+# *.failonerror=(true|false)    stop when an XML file is invalid
+# *.includes=(pattern)         Comma-separated list of path patterns to validate
+# *.excludes=(pattern)         Comma-separated list of path patterns to not validate
+
+#forrest.validate.failonerror=true
+#forrest.validate.includes=**/*
+#forrest.validate.excludes=
+#
+#forrest.validate.xdocs.failonerror=${forrest.validate.failonerror}
+#
+#forrest.validate.xdocs.includes=**/*.x*
+#forrest.validate.xdocs.excludes=site.xml
+#
+#forrest.validate.skinconf.includes=${skinconf-file}
+#forrest.validate.skinconf.excludes=
+#forrest.validate.skinconf.failonerror=${forrest.validate.failonerror}
+#
+#forrest.validate.sitemap.includes=${sitemap-file}
+#forrest.validate.sitemap.excludes=
+#forrest.validate.sitemap.failonerror=${forrest.validate.failonerror}
+#
+#forrest.validate.stylesheets.includes=**/*.xsl
+#forrest.validate.stylesheets.excludes=
+#forrest.validate.stylesheets.failonerror=${forrest.validate.failonerror}
+#
+#forrest.validate.skins.includes=**/*
+#forrest.validate.skins.excludes=**/*.xsl
+#forrest.validate.skins.failonerror=${forrest.validate.failonerror}
+#
+#forrest.validate.skins.stylesheets.includes=**/*.xsl
+#forrest.validate.skins.stylesheets.excludes=
+#forrest.validate.skins.stylesheets.failonerror=${forrest.validate.skins.failonerror}

Added: branches/jaxme/upstream/0.5.1/ant/jm.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/jm.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/jm.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,215 @@
+<?xml version="1.0"?>
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+-->
+<project default="all" name="JM">
+    <import file="js.xml"/>
+    <import file="xs.xml"/>
+
+    <property name="build.jm" location="${build}/jm"/>
+    <property name="build.jm.classes" location="${build.jm}/classes"/>
+    <property name="build.jm.reports" location="${build.jm}/reports"/>
+    <property name="build.jm.src" location="${build.jm}/src"/>
+    <property name="build.jm.test" location="${build.jm}/test"/>
+    <property name="build.jm.test.jaxme" location="${build.jm.test}/jaxme"/>
+    <property name="build.jm.test.jaxme.src" location="${build.jm.test.jaxme}/src"/>
+    <property name="src.jm" location="src/jaxme"/>
+
+    <path id="jaxme.class.path">
+      <pathelement location="${preqs}/junit.jar"/>
+      <pathelement location="${dist}/jaxmeapi-${version}.jar"/>
+      <pathelement location="${dist}/jaxmejs-${version}.jar"/>
+      <pathelement location="${dist}/jaxmexs-${version}.jar"/>
+      <pathelement location="${preqs}/ant.jar"/>
+      <pathelement location="${preqs}/xml-apis.jar"/>
+      <pathelement location="${preqs}/beaver.jar"/>
+      <pathelement location="${preqs}/antlr.jar"/>
+    </path>
+
+    <path id="jaxme.test.path">
+      <path refid="jaxme.class.path"/>
+      <pathelement location="${dist}/jaxme2-${version}.jar"/>
+    </path>
+
+    <target name="clean">
+        <delete dir="${build.jm}"/>
+    </target>
+
+    <target name="dirs" depends="JS.dirs">
+        <mkdir dir="${build.jm.src}"/>
+        <mkdir dir="${build.jm.classes}"/>
+        <mkdir dir="${build.jm.reports}"/>
+        <mkdir dir="${build.jm.test.jaxme.src}"/>
+        <mkdir dir="${dist}"/>
+    </target>
+
+    <target name="JM.precompile" depends="dirs,JS.all,XS.all,JS.taskdef">
+        <chainGenerator destDir="${build.jm.src}">
+            <classpath>
+                <pathelement location="${src.jm}"/>
+            </classpath>   
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.AttributeSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.AttributeSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.AttributeSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.AttributeSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.ComplexContentSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.ComplexContentSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.ComplexContentSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.ComplexContentSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.ComplexTypeSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.ComplexTypeSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.ComplexTypeSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.GroupSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.GroupSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.GroupSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.GroupSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.ObjectSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.ObjectSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.ObjectSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.ObjectSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.ParticleSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.ParticleSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.ParticleSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.ParticleSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.PropertySG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.PropertySGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.PropertySGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.PropertySGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.SchemaSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.SchemaSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.SchemaSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.SchemaSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.SGFactory"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.SGFactoryChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.SGFactoryChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.SGFactoryImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.SimpleContentSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.SimpleContentSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.SimpleContentSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.SimpleContentSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.SimpleTypeSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.SimpleTypeSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.SimpleTypeSGImpl"/>
+            <chain
+                controllerInterfaceName="org.apache.ws.jaxme.generator.sg.TypeSG"
+                chainInterfaceName="org.apache.ws.jaxme.generator.sg.TypeSGChain"
+                proxyClassName="org.apache.ws.jaxme.generator.sg.impl.TypeSGChainImpl"
+                implementationClassName="org.apache.ws.jaxme.generator.sg.impl.TypeSGImpl"/>
+        </chainGenerator>
+    </target>
+
+    <target name="JM.compile" depends="dirs,JM.precompile">
+        <javac classpathref="jaxme.class.path" debug="${debug}"
+            optimize="${optimize}" destdir="${build.jm.classes}"
+             source="1.3" target="1.3"
+            failonerror="true">
+            <src>
+                <pathelement location="${src.jm}"/>
+                <pathelement location="${build.jm.src}"/>   
+            </src>
+            <exclude name="org/apache/ws/jaxme/impl/CharSetXMLWriter.java" unless="have14"/>
+            <exclude name="org/apache/ws/jaxme/junit/*Test.java"/>
+            <exclude name="org/apache/ws/jaxme/examples/misc/address/*.java"/>
+        </javac>
+        <jar destfile="${dist}/jaxme2-rt-${version}.jar">
+            <fileset dir="${build.jm.classes}">
+                <exclude name="org/apache/ws/jaxme/generator/**/*"/>
+                <exclude name="org/apache/ws/jaxme/examples/**/*"/>
+                <exclude name="org/apache/ws/jaxme/junit/**/*"/>
+            </fileset>
+        </jar>
+        <jar destfile="${dist}/jaxme2-${version}.jar">
+            <fileset dir="${build.jm.classes}">
+                <exclude name="org/apache/ws/jaxme/examples/**/*"/>
+                <exclude name="org/apache/ws/jaxme/junit/**/*"/>
+            </fileset>
+        </jar>
+        <zip destfile="${dist}/jaxme2-src-${version}.zip">
+            <fileset dir="${src.jm}"/>
+            <fileset dir="${build.jm.src}"/>
+        </zip>
+    </target>
+
+    <target name="all" depends="JM.compile"/>
+
+    <target name="JM.generate.jaxb" if="jaxb.home">
+        <ant dir="src/test/jaxb" inheritall="false" inheritrefs="false">
+            <property name="build" location="${build.jm}"/>
+            <property name="dist" location="${dist}"/>
+            <property name="preqs" location="${preqs}"/>
+            <property name="run.jaxb" value="true"/>
+            <property name="jaxb.home" location="${jaxb.home}"/>
+        </ant>
+    </target>
+
+    <target name="JM.generate.jaxme" depends="JM.compile">
+        <ant dir="src/test/jaxb" inheritall="false" inheritrefs="false">
+            <property name="build" location="${build.jm}"/>
+            <property name="dist" location="${dist}"/>
+            <property name="preqs" location="${preqs}"/>
+            <property name="run.jaxme" value="true"/>
+            <property name="testsrc" location="src/test"/>
+        	<property name="version" value="${version}"/>
+        </ant>
+    </target>
+
+    <target name="JM.generate" depends="JM.generate.jaxme"/>
+
+    <target name="JM.localtest" depends="JM.generate">
+        <javac debug="${debug}"
+            optimize="${optimize}" destdir="${build.jm.classes}"
+            source="1.3" target="1.3"
+            failonerror="true">
+            <src>
+                <pathelement location="${src.jm}"/>
+                <pathelement location="${build.jm.src}"/>
+            </src>
+            <classpath>
+                <pathelement location="${build.jm}/test/jaxme/classes"/>
+                <path refid="jaxme.class.path"/>
+            </classpath>
+            <include name="org/apache/ws/jaxme/junit/*Test.java"/>
+        </javac>
+        <path id="jaxme.junit.path">
+            <path refid="jaxme.test.path"/>
+            <pathelement location="${build.jm.classes}"/>
+            <pathelement location="${build.jm}/test/jaxme/classes"/>
+            <pathelement location="${build.jm}/test/jaxme/src"/>
+            <pathelement location="${build.jm}/examples/src"/>
+        </path>
+        <runtests reportsdir="${build.jm.reports}" classpathref="jaxme.junit.path">
+            <tests>
+                <fileset dir="${src.jm}"
+                    includes="org/apache/ws/jaxme/junit/**/*Test.java"/>
+            </tests>
+        </runtests>
+    </target>
+   
+    <target name="test" depends="JS.test,XS.test,JM.localtest"/>
+</project>

Added: branches/jaxme/upstream/0.5.1/ant/js.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/js.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/js.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,197 @@
+<?xml version="1.0"?>
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+-->
+<project name="JS" default="all">
+    <import file="clover.xml"/>
+
+    <property name="build.js" location="${build}/js"/>
+    <property name="build.js.src" location="${build.js}/src"/>
+    <property name="build.js.db" location="${build.js}/db"/>
+    <property name="build.js.db.db" location="${build.js.db}/db"/>
+    <property name="build.js.classes" location="${build.js}/classes"/>
+    <property name="build.js.test.classes" location="${build.js}/test/classes"/>
+    <property name="build.js.src" location="${build}/src"/>
+    <property name="build.js.reports" location="${build.js}/reports"/>
+
+    <property name="jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+    <property name="jdbc.url" value="jdbc:hsqldb:${build.js.db.db}"/>
+    <property name="jdbc.user" value="sa"/>
+    <property name="jdbc.password" value=""/>
+    <property name="src.js" location="${basedir}/src/js"/>
+
+    <path id="js.class.path">
+      <pathelement location="${preqs}/log4j-1.2.8.jar"/>
+      <pathelement location="${preqs}/ant-1.5.4.jar"/>
+      <pathelement location="${preqs}/junit.jar"/>
+      <pathelement location="${preqs}/antlr.jar"/>
+    </path>
+
+    <path id="js.test.path">
+        <path refid="js.class.path"/>
+        <pathelement location="${preqs}/hsqldb-1.7.1.jar"/>
+        <pathelement location="${dist}/jaxmejs-${version}.jar"/>
+        <pathelement location="${build.js.test.classes}"/>
+    </path>
+
+    <target name="JS.clean">
+        <delete dir="${build.js}"/>
+    </target>
+
+    <target name="dirs">
+        <mkdir dir="${build.js.classes}"/>
+        <mkdir dir="${build.js.src}"/>
+        <mkdir dir="${build.js.test.classes}"/>
+    </target>
+
+    <target name="JS.antlr" depends="dirs">
+        <java classname="antlr.Tool" failonerror="true">
+            <classpath>
+                <pathelement location="${preqs}/antlr.jar"/>   
+            </classpath>
+            <arg line="-o ${build.js.src}/org/apache/ws/jaxme/js/jparser"/>
+            <arg file="${src.js}/org/apache/ws/jaxme/js/jparser/java15.g"/>
+        </java>
+    </target>
+   
+    <target name="JS.compile" depends="JS.antlr,init">
+        <javac destdir="${build.js.classes}" debug="${debug}"
+            source="1.3" target="1.3"
+            optimize="${optimize}" classpathref="js.class.path">
+            <src>
+                <pathelement location="${src.js}"/>
+                <pathelement location="${build.js.src}"/>
+            </src>
+            <exclude name="org/apache/ws/jaxme/js/junit/**/*.java"/>
+            <exclude name="org/apache/ws/jaxme/logging/JavaUtilLogger*"
+                unless="have14"/>
+        </javac>
+        <copy todir="${build.js.classes}">
+            <fileset dir="${src.js}" includes="**/*.properties"/>
+        </copy>
+    </target>
+
+    <target name="JS.jar" depends="JS.compile">
+        <jarzip filename="jaxmejs" srcdir="${src.js}"
+            classesdir="${build.js.classes}"/>
+    </target>
+
+    <target name="JS.taskdef" depends="JS.jar">
+        <taskdef resource="org/apache/ws/jaxme/js/pattern/ant.properties"
+            classpathref="js.test.path"/>
+    </target>
+
+    <target name="JS.generate.proxy" depends="dirs,JS.taskdef">
+        <proxyGenerator targetClass="org.apache.ws.jaxme.js.junit.ObservableList"
+                    extendedClass="java.util.Observable" destDir="${build.js.src}">
+            <implementedInterface mandatory="true" interface="java.util.List"/>
+        </proxyGenerator>
+    </target>
+
+    <target name="JS.generate.enum" depends="JS.taskdef">
+        <enumGenerator targetClass="org.apache.ws.jaxme.js.junit.EnumExample"
+                   destDir="${build.js.src}">
+            <item name="JOE" value="John Doe"/>
+            <item name="POPEYE" value="Olivia's Lover"/>
+            <item name="DONALD" value="The Duck King"/>
+        </enumGenerator>
+    </target>
+
+    <target name="JS.check.db">
+        <uptodate property="exists.db"
+           srcfile="${src.js}/org/apache/ws/jaxme/js/junit/create.sql"
+        targetfile="${build.js.db.db}.properties"/>
+    </target>
+
+    <target name="JS.generate.db" depends="JS.check.db" unless="exists.db">
+    	<delete dir="${build.js.db}"/>
+        <mkdir dir="${build.js.db}"/>
+        <sql
+            src="${src.js}/org/apache/ws/jaxme/js/junit/create.sql"
+            driver="${jdbc.driver}"
+            url="${jdbc.url}"
+            userid="${jdbc.user}"
+            password="${jdbc.password}" 
+            classpathref="js.test.path"/>
+    </target>
+
+    <target name="JS.generate.version" depends="JS.generate.db">
+        <versionGenerator
+                   driver="${jdbc.driver}"
+                      url="${jdbc.url}"
+                     user="${jdbc.user}"
+                 password="${jdbc.password}"
+                   tables="MAIN SUB SUBSUB"
+                verColumn="VER"
+              targetClass="org.apache.ws.jaxme.js.junit.MAINCloner"
+        generatingLogging="true"
+                  destDir="${build.js.src}"/>
+    </target>
+
+    <target name="JS.generate.xmlrpc" depends="JS.taskdef">
+        <xmlRpcGenerator
+                targetPackage="org.apache.ws.jaxme.js.junit.xmlrpcclient"
+                      destDir="${build.js.src}">
+            <dispatcher name="org.apache.ws.jaxme.js.junit.xmlrpcclient.Dispatcher"
+                implementingXmlRpcHandler="false"/>
+            <serverClasses dir="${src.js}" includes="**/XmlRpcClientTestRemoteClass.java"/>
+        </xmlRpcGenerator>   
+    </target>
+
+    <target name="JS.generate.compile"
+           depends="dirs,JS.generate.proxy,JS.generate.enum,JS.generate.version,JS.generate.xmlrpc">
+        <javac destdir="${build.js.test.classes}"
+            debug="${debug}" optimize="${optimize}"
+            includes="org/apache/ws/jaxme/js/junit/**/*"
+            source="1.3" target="1.3"
+            classpathref="js.test.path">
+          <src path="${src.js}"/>
+          <src path="${build.js.src}"/>
+        </javac>
+    </target>
+
+    <target name="JS.generate" depends="JS.generate.compile"/>
+
+    <target name="all" depends="JS.generate"/>
+
+    <target name="test" depends="JS.generate">
+        <runtests reportsdir="${build.js.reports}" classpathref="js.test.path">
+            <tests>
+                <fileset dir="${src.js}">
+                    <include name="org/apache/ws/jaxme/js/junit/**/*Test.java"/>
+                    <include name="org/apache/ws/jaxme/sqls/junit/**/*Test.java"/>
+                </fileset>
+            </tests>
+            <properties>
+                <sysproperty key="jdbc.driver" value="${jdbc.driver}"/>
+                <sysproperty key="jdbc.url" value="${jdbc.url}"/>
+                <sysproperty key="jdbc.user" value="${jdbc.user}"/>
+                <sysproperty key="jdbc.password" value="${jdbc.password}"/>
+            	<sysproperty key="js.src" value="${src.js}"/>
+            </properties>
+        </runtests>
+    </target>
+
+    <target name="JS.antlr.test" depends="JS.jar">
+        <java classname="org.apache.ws.jaxme.js.util.JavaParser">
+            <classpath>
+                <pathelement location="dist/jaxmejs-${version}.jar"/>
+                <pathelement location="${preqs}/antlr.jar"/>   
+            </classpath>
+            <arg file="src/js/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java"/>   
+        </java>
+    </target>
+</project>

Added: branches/jaxme/upstream/0.5.1/ant/macros.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/macros.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/macros.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,93 @@
+<!--
+ * Copyright 2002-2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project name="Macros" default="all">
+    <property name="jaxme.properties.location.1" location="${user.home}/.jaxme.properties"/>
+    <property name="jaxme.properties.location.2" location="${basedir}/jaxme.properties"/>
+    <available file="${jaxme.properties.location.1}" property="jaxme.properties.location" value="${jaxme.properties.location.1}"/>
+    <property name="jaxme.properties.location" location="${basedir}/jaxme.properties"/>
+    <echo>Loading custom properties from ${jaxme.properties.location}</echo>
+    <property file="${jaxme.properties.location}"/>
+
+    <property name="build" location="build"/>
+    <property name="dist" location="${basedir}/dist"/>
+    <property name="preqs" location="${basedir}/prerequisites"/>
+
+    <condition property="have14" value="true">
+      <not>
+        <or>
+          <equals arg1="${ant.java.version}" arg2="1.1"/>
+          <equals arg1="${ant.java.version}" arg2="1.2"/>
+          <equals arg1="${ant.java.version}" arg2="1.3"/>
+        </or>
+      </not>
+    </condition>
+
+    <condition property="have50">
+      <and>
+        <equals arg1="${have14}" arg2="true"/>
+        <not> 
+          <equals arg1="${ant.java.version}" arg2="1.4"/>
+        </not>
+      </and>
+	</condition>
+
+    <macrodef name="jc">
+        <attribute name="srcdir"/>
+        <attribute name="destdir"/>
+        <attribute name="classpathref"/>
+        <attribute name="excludes"/>
+        <attribute name="java14classes"/>
+        <sequential>
+            <mkdir dir="@{destdir}"/>
+            <javac destdir="@{destdir}" srcdir="@{srcdir}" debug="${debug}"
+                optimize="${optimize}" classpathref="@{classpathref}"
+                excludes="@{excludes}" source="1.3" target="1.3">
+                <exclude name="@{java14classes}" unless="have14"/>
+            </javac>
+        </sequential>
+    </macrodef>
+
+    <macrodef name="jarzip">
+        <attribute name="filename"/>
+        <attribute name="classesdir"/>
+        <attribute name="srcdir"/>
+        <sequential>
+            <mkdir dir="${dist}"/>
+            <jar destfile="${dist}/@{filename}-${version}.jar" basedir="@{classesdir}"/>
+            <zip destfile="${dist}/@{filename}-src-${version}.zip" basedir="@{srcdir}"/>
+        </sequential>
+    </macrodef>
+
+    <macrodef name="runtests">
+        <attribute name="reportsdir"/>
+        <attribute name="classpathref"/>
+        <element name="tests"/>
+        <element name="properties" optional="true"/>
+        <sequential>
+            <mkdir dir="@{reportsdir}"/>
+            <junit printsummary="yes" haltonfailure="yes">
+                <classpath refid="@{classpathref}"/>
+                <formatter type="plain"/>
+                <batchtest todir="@{reportsdir}">
+                    <tests/>
+                </batchtest>
+                <properties/>   
+            </junit>
+        </sequential>
+    </macrodef>
+
+    <target name="all"/>
+</project>

Added: branches/jaxme/upstream/0.5.1/ant/pm.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/pm.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/pm.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,144 @@
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project name="PM" default="all">
+    <import file="jm.xml"/>
+
+    <property name="build.pm" location="${build}/pm"/>
+    <property name="build.pm.classes" location="${build.pm}/classes"/>
+    <property name="build.pm.db" location="${build.pm}/db"/>
+    <property name="build.pm.reports" location="${build.pm}/reports"/>
+    <property name="build.pm.test" location="${build.pm}/test"/>
+    <property name="build.pm.test.classes" location="${build.pm.test}/classes"/>
+    <property name="build.pm.test.src" location="${build.pm.test}/src"/>
+    <property name="src.pm" location="src/pm"/>
+
+    <property name="jdbc.pm.driver" value="org.hsqldb.jdbcDriver"/>
+    <property name="jdbc.pm.url" value="jdbc:hsqldb:${build.pm.db}/db"/>
+    <property name="jdbc.pm.user" value="sa"/>
+    <property name="jdbc.pm.password" value=""/>
+   
+    <path id="pm.class.path">
+        <pathelement location="${preqs}/junit.jar"/>
+        <pathelement location="${dist}/jaxmeapi-${version}.jar"/>
+        <pathelement location="${dist}/jaxmejs-${version}.jar"/>
+        <pathelement location="${dist}/jaxmexs-${version}.jar"/>
+        <pathelement location="${dist}/jaxme2-${version}.jar"/>
+        <pathelement location="${preqs}/beaver.jar"/>   
+        <pathelement location="${preqs}/hsqldb-1.7.1.jar"/>
+        <pathelement location="${preqs}/ant.jar"/>
+        <pathelement location="${preqs}/xml-apis.jar"/>
+        <pathelement location="${preqs}/xercesImpl.jar"/>
+        <pathelement location="${preqs}/xmldb-api-20021118.jar"/>
+        <!-- These aren't in the CVS and aren't necessary for the build -->
+        <pathelement location="${preqs}/TaminoAPI4J.jar"/>
+        <pathelement location="${preqs}/TaminoJCA.jar"/>
+    </path>
+
+    <path id="pm.runtime.path">
+        <path refid="pm.class.path"/>
+        <pathelement location="${dist}/jaxmepm-${version}.jar"/>
+    </path>
+
+	<available classname="com.softwareag.tamino.db.api.objectModel.sax.TSAXDocument"
+		        property="have.inoapi4j"
+		    classpathref="pm.class.path"/>
+
+    <target name="clean">
+        <delete dir="${build.pm}"/>
+        <delete dir="${dist}" includes="jaxmepm*"/>
+    </target>
+
+    <target name="dirs" depends="JM.dirs">
+        <mkdir dir="${build.pm.classes}"/>
+        <mkdir dir="${build.pm.test.src}"/>
+        <mkdir dir="${build.pm.test.classes}"/>
+    </target>
+
+    <target name="PM.compile" depends="dirs,JM.all">
+        <javac classpathref="pm.class.path" debug="${debug}"
+            optimize="${optimize}" destdir="${build.pm.classes}"
+            source="1.3" target="1.3"
+            srcdir="${src.pm}">
+            <exclude name="org/apache/ws/jaxme/pm/junit/**/*"/>
+            <exclude name="org/apache/ws/jaxme/**/api4j/*" unless="have.inoapi4j"/>
+            <exclude name="org/apache/ws/jaxme/pm/ino/URLEncoder14.java" unless="have14"/>   
+        </javac>
+        <jarzip filename="jaxmepm" srcdir="${src.pm}" classesdir="${build.pm.classes}"/>
+    </target>
+
+    <target name="PM.check.db">
+        <uptodate property="PM.uptodate.db" srcfile="src/test/pm/initdb.sql" targetfile="${build.pm.db}/db.properties"/>
+    </target>
+
+    <target name="PM.init.db" depends="PM.check.db" unless="PM.uptodate.db">
+    	<delete dir="${build.pm.db}"/>
+        <mkdir dir="${build.pm.db}"/>
+    	<sql classpathref="pm.runtime.path" driver="${jdbc.pm.driver}"
+	        password="${jdbc.pm.password}" src="src/test/pm/initdb.sql"
+	       url="${jdbc.pm.url}" userid="${jdbc.pm.user}"/>
+    </target>
+
+    <target name="all" depends="PM.compile"/>
+
+    <target name="PM.taskdef" depends="JM.all">
+        <taskdef classname="org.apache.ws.jaxme.generator.XJCTask" classpathref="pm.runtime.path" name="xjc"/>
+    </target>
+
+    <target name="PM.generate" depends="PM.compile,PM.taskdef,PM.init.db">
+        <xjc target="${build.pm.test.src}">
+            <schema dir="src/test/pm" includes="*.xsd"/>
+            <sgFactoryChain className="org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG"/>
+            <schemaReader className="org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader"/>
+            <produces dir="${build.pm.test.src}" includes="org/apache/ws/jaxme/test/pm/session/*"/>
+            <property name="jdbc.driver" value="${jdbc.pm.driver}"/>
+            <property name="jdbc.url" value="${jdbc.pm.url}"/>
+            <property name="jdbc.user" value="${jdbc.pm.user}"/>
+            <property name="jdbc.password" value="${jdbc.pm.password}"/>
+        </xjc>
+    </target>
+
+    <target name="PM.generate.compile" depends="PM.generate">
+        <javac debug="${debug}"
+            source="1.3" target="1.3"
+            optimize="${optimize}" destdir="${build.pm.test.classes}">
+            <classpath>
+                <path refid="pm.class.path"/>
+                <pathelement location="${dist}/jaxmepm-${version}.jar"/>
+            </classpath>
+            <src path="${build.pm.test.src}"/>
+            <src path="${src.pm}"/>
+            <include name="org/apache/ws/jaxme/test/pm/**/*"/>
+            <include name="org/apache/ws/jaxme/pm/junit/**/*"/>
+            <exclude name="org/apache/ws/jaxme/pm/ino/URLEncoder14.java" unless="have14"/>   
+        </javac>
+        <copy todir="${build.pm.test.classes}">
+            <fileset dir="${build.pm.test.src}" includes="**/*.xml,**/*.properties"/>
+        </copy>
+    </target>
+
+    <target name="test" depends="JM.test,PM.generate.compile">
+        <path id="pm.junit.path">
+            <path refid="pm.class.path"/>
+            <pathelement location="${dist}/jaxmepm-${version}.jar"/>
+            <pathelement location="${build.pm.test.classes}"/>
+        </path>
+        <runtests reportsdir="${build.pm.reports}" classpathref="pm.junit.path">
+            <tests>
+                <fileset dir="${src.pm}" includes="org/apache/ws/jaxme/pm/junit/**/*Test.java"/>
+            </tests>
+        </runtests>
+    </target>
+</project>

Added: branches/jaxme/upstream/0.5.1/ant/xs.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/ant/xs.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/ant/xs.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,61 @@
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+-->
+<project name="XS" default="all">
+    <import file="api.xml"/>
+ 
+    <property name="build.xs" location="${build}/xs"/>
+    <property name="build.xs.classes" location="${build.xs}/classes"/>
+    <property name="build.xs.reports" location="${build.xs}/reports"/>
+    <property name="src.xs" location="${basedir}/src/xs"/>
+
+    <path id="xs.class.path">
+        <pathelement location="${preqs}/xml-apis.jar"/>
+        <pathelement location="${preqs}/junit.jar"/>
+        <pathelement location="${dist}/jaxmeapi-${version}.jar"/>
+    </path>
+
+    <target name="XS.clean">
+        <delete dir="${build.xs}"/>
+    </target>
+   
+    <target name="XS.compile" depends="API.all">
+        <jc srcdir="${src.xs}" destdir="${build.xs.classes}"
+            classpathref="xs.class.path" excludes="" java14classes=""/>
+    </target>
+
+    <target name="XS.jar" depends="XS.compile">
+        <jarzip filename="jaxmexs" classesdir="${build.xs.classes}"
+            srcdir="${src.xs}"/>
+    </target>
+
+    <target name="all" depends="XS.jar"/>
+
+    <target name="test" depends="XS.jar">
+        <path id="xs.test.path">
+            <path refid="xs.class.path"/>
+            <pathelement location="${dist}/jaxmexs-${version}.jar"/>
+            <pathelement location="${preqs}/xercesImpl.jar"/>
+        </path>
+        <runtests reportsdir="${build.xs.reports}" classpathref="xs.test.path">
+            <tests>
+                <fileset dir="${src.xs}"
+                    includes="org/apache/ws/jaxme/xs/junit/**/*Test.java"
+                    excludes="org/apache/ws/jaxme/xs/junit/WSDLTest.java"/>
+            </tests>
+        </runtests>
+    </target>
+</project>

Added: branches/jaxme/upstream/0.5.1/build.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/build.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/build.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project name="JaxMe" default="all">
+    <property name="version" value="0.5.1"/>
+    <property name="debug" value="true"/>
+    <property name="optimize" value="false"/>   
+
+    <import file="ant/pm.xml"/>
+    <import file="ant/docs.xml"/>
+   
+    <target name="dist" depends="clean,all,Docs.all">
+        <tar tarfile="${dist}/ws-jaxme-${version}-bin.tar.gz" compression="gzip" longfile="gnu">
+	       <tarfileset prefix="ws-jaxme-${version}" dir="${basedir}">
+	           <include name="LICENSE"/>
+               <include name="NOTICE"/>
+               <include name="README*"/>
+	           <include name="examples/**/*"/>
+               <include name="prerequisites/LICENSE*"/>
+               <include name="prerequisites/README"/>
+               <include name="prerequisites/ant*.jar"/>
+               <include name="prerequisites/junit*.jar"/>
+               <include name="prerequisites/log4j*.jar"/>
+               <include name="prerequisites/xercesImpl.jar"/>
+               <include name="prerequisites/xml-apis.jar"/>
+               <include name="prerequisites/xmldb-api-*.jar"/>
+	       </tarfileset>
+	       <tarfileset prefix="ws-jaxme-${version}/docs" dir="${build.site}"/>
+           <tarfileset prefix="ws-jaxme-${version}/lib" dir="dist">
+               <include name="*.jar"/>
+               <include name="*.zip"/>
+           </tarfileset>
+        </tar>
+        <tar tarfile="${dist}/ws-jaxme-${version}-src.tar.gz" compression="gzip" longfile="gnu">
+           <tarfileset prefix="ws-jaxme-${version}" dir="${basedir}">
+               <include name="src/**/*"/>
+               <include name="etc/**/*"/>
+               <include name="examples/**/*"/>
+               <include name="LICENSE"/>
+               <include name="NOTICE"/>
+               <include name="README*"/>
+			   <include name="build.xml"/>
+           	   <include name="ant/*"/>
+               <include name="jaxme.properties.sample"/>
+               <include name="status.xml"/>
+               <include name="prerequisites/*"/>
+           </tarfileset>
+        </tar>
+        <checksum algorithm="MD5" fileext=".md5">
+            <fileset dir="${dist}"/>
+        </checksum>
+    </target>
+
+    <target name="clean" depends="init"
+         description="Cleans the subdirectories 'build' and 'dist'">
+        <delete dir="${build}"/>
+        <delete dir="${dist}"/>
+    </target>
+
+    <target name="check.export.site" unless="ws.site.dir">
+        <fail>You need to set the property ws.site.dir when invoking
+            target export-site</fail>
+    </target>
+
+    <target name="export.site" depends="check.export.site,clean">
+        <antcall target='Docs.all'>
+            <param name="build.online.site" value="true"/>
+        </antcall>
+        <delete>
+            <fileset dir="${ws.site.dir}" excludes="**/CVS/*.*"/>
+        </delete>
+        <copy todir="${ws.site.dir}">
+	    <fileset dir="${build.site}"/>
+        </copy>
+    </target>
+</project>

Added: branches/jaxme/upstream/0.5.1/etc/KEYS
===================================================================
--- branches/jaxme/upstream/0.5.1/etc/KEYS	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/etc/KEYS	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+pub  1024D/DE240A64 2003-11-18 Jochen Wiedmann <jochen at apache.org>
+sig 3       DE240A64 2003-11-18   Jochen Wiedmann <jochen at apache.org>
+sub  1024g/D19EFD9A 2003-11-18
+sig         DE240A64 2003-11-18   Jochen Wiedmann <jochen at apache.org>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.2.3 (MingW32)
+
+mQGiBD+6c/kRBACbyYXCRkH8HsVXXeJV2+V13jbPUO1xKASFoxWpkMZ/guCmMPhE
+oVOe9c6MTVB6g0FH4w9XWA084TpFu8PNzFEEuTkH9tHJZTXV6118nLOdM5TKfBh9
+5Fvzjp9EnNp5LqF78lekQyeJoI2JlkEox8KsJ8KIFQ4o/lW+7BVvGk1kjwCgxM6u
+VfX5GvpLvspu/Nkxl4xrwTsD+wWGdYHd4jU19UFLLcra7rx/sLoNY6icK/rp5ouw
+OxfMT7qIKkr4C+P7fvhGy2dmopSHFJwZYvDHVBfr2Qc5js0SwGyP0Ts/wfhJuO5I
+gXrruXyabxShe2Y9d/j5aPqDy7E2kpq7C7n5CwZH/K/yphw94/6wXUAFtzCn1CZG
+ozFMBACFaNIhTxF78OfH9OskeCrJxe90fcKdq1VfXeCbf/LpirLXpIOyvhDemnhn
+Xi7JuPMBrOg1q5Oksy80R20k1FApHlTW35V6G0nTqes/Tm7FmLnaGwx7TdJ4OgQy
+jbkpxnsSkIUE418aY6bfmgg3KKSLS14Fv5qWRPzuM+LE2hSq+LQjSm9jaGVuIFdp
+ZWRtYW5uIDxqb2NoZW5AYXBhY2hlLm9yZz6IXgQTEQIAHgUCP7pz+QIbAwYLCQgH
+AwIDFQIDAxYCAQIeAQIXgAAKCRBhIzOj3iQKZLCfAKC9pE4Np9T9wCLvi18Z9G/V
+nGpa+wCggLtIZhcyjP2YkaTdgnHdZx34NwG5AQ0EP7pz+xAEAL1R35kDxNfnStQ5
+9uwxrXFt5M9iDaM4YnFRtL2TAP4xKO8Ze6JGGkZv2JnS1qL1/f6MqFtvNP1dEf3F
+5wfJbz2j/L+lYsjmDd85syNytdQ12TGv/HGz0jQJ7ZWxNXBWU9qRWuHADojWI41G
+xmavZGQPAPV36zh4alJxMBmFahT3AAMHA/9RAUHO97G8Frj7juadYVMIJu9sl4pv
+O4g47US+QrLDboRkN1UbeQcJzvaQ/TTmhSvGcebf1l98VobPD9uMefFvtz+KBsdU
+5MOvWdZaCLrQX57Ded8ThRVM1wxWanPuqNiZre8nK6Ye+kn35NaEimmWnvZwx/Sj
+OMMsU3VVyp71GIhJBBgRAgAJBQI/unP7AhsMAAoJEGEjM6PeJApkMvkAnjy6vpHG
+d2zxUWEdS0jqwiUNmtbcAJ9mAeXplALl34w6XyzWYgIYHUaGaQ==
+=FBZP
+-----END PGP PUBLIC KEY BLOCK-----
+
+
+pub  1024D/B1313DE2 2003-01-15 Robert Burrell Donkin (CODE SIGNING KEY) <rdonkin at apache.org>
+sig 3       B1313DE2 2003-01-15   Robert Burrell Donkin (CODE SIGNING KEY) <rdonkin at apache.org>
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.0.7 (GNU/Linux)
+
+mQGiBD4lztcRBAClmlgorzoHH7IVYYerQY0e7QU0X3+4PRGGZVcbkZA3qMZV8rG3
+FSB4qp3cLX7rnco26oQbP4jSqXe1piEzYloyzYvgW9t0uFOFF7N8h9XtgA3E836v
+DE/dbrteJ6wZZvS0BR1J0u2/+3nSf4bdmzjd8JPMCIp4q4ztTMTNsWKUswCg3vRA
+NpL1bO0lTi5M013YhY+8wHcD/0Swc47PQuruwL+54ZMFFEHu+24UukU/7T6X2hos
+ERgq9HkUyqK5mOEqp4Y4AfhwPfzp/qOFbg+Jn0IIVg3XGZhTLyeBiwHpXBhJw2TT
+FXhLxm9G2PoYgkhMSgOo4wrHLCMszfvOABzCEZ4TAw3k4s3X4PSfNjHjOHUNYWhb
+1BNLA/wIVDCdOyHoUvw6R0rCTKFcHSXu7XQxjYIBKGAQkcNlCZElqNVlqa+eQTPW
+3AHXor/TUDzzd4afjkvmWaayGDZwOSWlsfqfPItvzTNzmE44wqfICa0/aMgkU6aZ
+m/k+UMFegH1YVBaAl0aj8Gx+T5B7JqA9i7+lmw3nwB1Ge0miBbQ9Um9iZXJ0IEJ1
+cnJlbGwgRG9ua2luIChDT0RFIFNJR05JTkcgS0VZKSA8cmRvbmtpbkBhcGFjaGUu
+b3JnPohZBBMRAgAZBQI+Jc7XBAsHAwIDFQIDAxYCAQIeAQIXgAAKCRDVM051sTE9
+4qflAJ9B2L8SOnFRnoJktHImJU9JO72IdwCgpM08Fi8O0dI5WuOFdz5sLobqioY=
+=nk3Z
+-----END PGP PUBLIC KEY BLOCK-----

Added: branches/jaxme/upstream/0.5.1/etc/package-list
===================================================================
--- branches/jaxme/upstream/0.5.1/etc/package-list	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/etc/package-list	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,135 @@
+java.applet
+java.awt
+java.awt.color
+java.awt.datatransfer
+java.awt.dnd
+java.awt.event
+java.awt.font
+java.awt.geom
+java.awt.im
+java.awt.im.spi
+java.awt.image
+java.awt.image.renderable
+java.awt.print
+java.beans
+java.beans.beancontext
+java.io
+java.lang
+java.lang.ref
+java.lang.reflect
+java.math
+java.net
+java.nio
+java.nio.channels
+java.nio.channels.spi
+java.nio.charset
+java.nio.charset.spi
+java.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+java.sql
+java.text
+java.util
+java.util.jar
+java.util.logging
+java.util.prefs
+java.util.regex
+java.util.zip
+javax.accessibility
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+javax.imageio
+javax.imageio.event
+javax.imageio.metadata
+javax.imageio.plugins.jpeg
+javax.imageio.spi
+javax.imageio.stream
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+javax.net
+javax.net.ssl
+javax.print
+javax.print.attribute
+javax.print.attribute.standard
+javax.print.event
+javax.rmi
+javax.rmi.CORBA
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.kerberos
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.cert
+javax.sound.midi
+javax.sound.midi.spi
+javax.sound.sampled
+javax.sound.sampled.spi
+javax.sql
+javax.swing
+javax.swing.border
+javax.swing.colorchooser
+javax.swing.event
+javax.swing.filechooser
+javax.swing.plaf
+javax.swing.plaf.basic
+javax.swing.plaf.metal
+javax.swing.plaf.multi
+javax.swing.table
+javax.swing.text
+javax.swing.text.html
+javax.swing.text.html.parser
+javax.swing.text.rtf
+javax.swing.tree
+javax.swing.undo
+javax.transaction
+javax.transaction.xa
+javax.xml.parsers
+javax.xml.transform
+javax.xml.transform.dom
+javax.xml.transform.sax
+javax.xml.transform.stream
+org.ietf.jgss
+org.omg.CORBA
+org.omg.CORBA.DynAnyPackage
+org.omg.CORBA.ORBPackage
+org.omg.CORBA.TypeCodePackage
+org.omg.CORBA.portable
+org.omg.CORBA_2_3
+org.omg.CORBA_2_3.portable
+org.omg.CosNaming
+org.omg.CosNaming.NamingContextExtPackage
+org.omg.CosNaming.NamingContextPackage
+org.omg.Dynamic
+org.omg.DynamicAny
+org.omg.DynamicAny.DynAnyFactoryPackage
+org.omg.DynamicAny.DynAnyPackage
+org.omg.IOP
+org.omg.IOP.CodecFactoryPackage
+org.omg.IOP.CodecPackage
+org.omg.Messaging
+org.omg.PortableInterceptor
+org.omg.PortableInterceptor.ORBInitInfoPackage
+org.omg.PortableServer
+org.omg.PortableServer.CurrentPackage
+org.omg.PortableServer.POAManagerPackage
+org.omg.PortableServer.POAPackage
+org.omg.PortableServer.ServantLocatorPackage
+org.omg.PortableServer.portable
+org.omg.SendingContext
+org.omg.stub.java.rmi
+org.w3c.dom
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers

Added: branches/jaxme/upstream/0.5.1/examples/rss/dc.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/rss/dc.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/rss/dc.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"
+	targetNamespace="http://purl.org/dc/elements/1.1/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/">
+	<xs:element name="date" type="xs:date"/>
+	<xs:element name="language" type="xs:language"/>
+	<xs:element name="publisher" type="xs:string"/>
+	<xs:element name="creator" type="xs:string"/>
+	<xs:element name="rights" type="xs:string"/>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/examples/rss/rdf.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/rss/rdf.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/rss/rdf.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema targetNamespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rss="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:attribute name="about" type="xs:anyURI"/>
+	<xs:attribute name="resource" type="xs:anyURI"/>
+	<xs:element name="RDF">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:any namespace="##any" maxOccurs="unbounded"/>
+			</xs:sequence>
+		</xs:complexType>
+		<xs:unique name="itemID">
+			<xs:annotation>
+				<xs:documentation>This constraints should not be placed inside the RDF schema, but XSD v1.1 leaves us no option</xs:documentation>
+			</xs:annotation>
+			<xs:selector xpath="rss:item"/>
+			<xs:field xpath="@rdf:about"/>
+		</xs:unique>
+		<xs:unique name="resourceUniqueness">
+			<xs:selector xpath="rss:item"/>
+			<xs:field xpath="@rdf:resource"/>
+		</xs:unique>
+		<xs:key name="resourceKey">
+			<xs:selector xpath=".//rdf:li"/>
+			<xs:field xpath="@rdf:resource"/>
+		</xs:key>
+		<xs:keyref name="resourceRef" refer="rdf:resourceKey">
+			<xs:selector xpath=".//rss:item"/>
+			<xs:field xpath="@rdf:about"/>
+		</xs:keyref>
+	</xs:element>
+	<xs:element name="li">
+		<xs:complexType>
+			<xs:attribute ref="rdf:resource"/>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="Seq">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="rdf:li" maxOccurs="25"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/examples/rss/rss.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/rss/rss.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/rss/rss.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema targetNamespace="http://purl.org/rss/1.0/" xmlns:rss="http://purl.org/rss/1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:annotation>
+		<xs:documentation>last modification: 2003-06-10, based on RSS v1.0</xs:documentation>
+	</xs:annotation>
+	<xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd"/>
+	<xs:import namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" schemaLocation="rdf.xsd"/>
+	<xs:element name="channel">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="rss:title"/>
+				<xs:element ref="rss:link" minOccurs="0"/>
+				<xs:element ref="rss:description" minOccurs="0"/>
+				<xs:any namespace="http://purl.org/dc/elements/1.1/" maxOccurs="unbounded"/>
+				<xs:element name="image">
+					<xs:complexType>
+						<xs:anyAttribute namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="strict"/>
+					</xs:complexType>
+				</xs:element>
+				<xs:element ref="rss:items"/>
+			</xs:sequence>
+			<xs:anyAttribute namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="strict"/>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="items">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:any namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="strict"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+			<xs:element name="image">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element ref="rss:title"/>
+							<xs:element ref="rss:url"/>
+							<xs:element ref="rss:link"/>
+						</xs:sequence>
+						<xs:anyAttribute namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="strict"/>
+					</xs:complexType>
+				</xs:element>
+		<xs:element name="title" type="xs:string"/>
+	<xs:element name="url" type="xs:anyURI"/>
+	<xs:element name="link" type="xs:anyURI"/>
+	<xs:element name="description" type="xs:string"/>
+	<xs:element name="item">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="rss:title"/>
+				<xs:element ref="rss:link" minOccurs="0"/>
+				<xs:any namespace="http://purl.org/dc/elements/1.1/" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
+			</xs:sequence>
+			<xs:anyAttribute namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#" processContents="strict"/>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/Claes_Larsson/schema.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/Claes_Larsson/schema.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/Claes_Larsson/schema.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1767 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema structures.xsd">
+  <xs:element name="pmiod_smioc">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="component"/>
+        <xs:element ref="code"/>
+        <xs:element maxOccurs="unbounded" ref="gridfamily"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="transient"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="persistent"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="dependency"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- COMPONENT -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="component">
+    <xs:complexType>
+      <xs:attribute name="local_name" use="required"/>
+      <xs:attribute name="long_name"/>
+      <xs:attribute name="simulated" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="ocean"/>
+            <xs:enumeration value="sea_ice"/>
+            <xs:enumeration value="ocean_biogeochemistry"/>
+            <xs:enumeration value="atmosphere"/>
+            <xs:enumeration value="atmospheric_chemistry"/>
+            <xs:enumeration value="land"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- The user does not modify "component" in the SMIOC -->
+  <!--
+    The coherence between the PMIOD/SMIOC component local_name and
+    the ones chosen in the SCC should be ensured by the GUI
+  -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- CODE -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="code">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="laboratory"/>
+        <xs:element ref="contact"/>
+        <xs:element ref="documentation"/>
+        <xs:element maxOccurs="unbounded" ref="Fortran_units"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!-- The user does not modify "code" in the SMIOC -->
+  <xs:element name="laboratory" type="xs:string"/>
+
+  <xs:element name="contact" type="xs:string"/>
+
+  <xs:element name="documentation" type="xs:string"/>
+
+  <xs:element name="Fortran_units">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="min_value"/>
+        <xs:element minOccurs="0" ref="max_value"/>
+        <xs:element minOccurs="0" ref="increment"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!-- Fortran_units needed by coupler -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- GRIDFAMILY -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="gridfamily">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="grid"/>
+      </xs:sequence>
+      <xs:attribute name="local_name" use="required" type="xs:ID"/>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    In the SMIOC, the user chooses one grid among the ones
+    described by the developer for each gridfamily in the PMIOD but
+    is not allowed to change anything in the chosen grid tree
+  -->
+  <xs:element name="grid">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="physical_space"/>
+        <xs:element ref="sampled_space"/>
+        <xs:element minOccurs="0" ref="computational_space"/>
+      </xs:sequence>
+      <xs:attribute name="local_name" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="physical_space">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="longitude_dimension"/>
+        <xs:element ref="latitude_dimension"/>
+        <xs:element ref="vertical_dimension"/>
+      </xs:sequence>
+      <xs:attribute name="long_name" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="longitude_dimension">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="valid_min"/>
+        <xs:element ref="valid_max"/>
+      </xs:sequence>
+      <xs:attribute name="units" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="degrees_east"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="latitude_dimension">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="valid_min"/>
+        <xs:element ref="valid_max"/>
+      </xs:sequence>
+      <xs:attribute name="units" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="degrees_north"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="vertical_dimension">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="valid_min"/>
+        <xs:element ref="valid_max"/>
+      </xs:sequence>
+      <xs:attribute name="units" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="meters"/>
+            <xs:enumeration value="bar"/>
+            <xs:enumeration value="millibar"/>
+            <xs:enumeration value="decibar"/>
+            <xs:enumeration value="atmosphere"/>
+            <xs:enumeration value="pascal"/>
+            <xs:enumeration value="hPa"/>
+            <xs:enumeration value="unitless"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="positive" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="down"/>
+            <xs:enumeration value="up"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="standard_name"/>
+      <xs:attribute name="long_name"/>
+      <xs:attribute name="formula_terms"/>
+    </xs:complexType>
+  </xs:element>
+  <!-- All dimension units needed by coupler -->
+  <!--
+     All valid_min and valid_max may be needed by coupler
+    (coherence check)
+  -->
+  <xs:element name="sampled_space">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="structure"/>
+        <xs:element maxOccurs="unbounded" ref="indexing_dimension"/>
+      </xs:sequence>
+      <xs:attribute name="pole_covered" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="structure">
+    <xs:complexType>
+      <xs:attribute name="structure_type" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="reglonlatvert"/>
+            <xs:enumeration value="irreglonlat_regvert"/>
+            <xs:enumeration value="irreglonlat_sigmavert"/>
+            <xs:enumeration value="reglonlat_sigmavert"/>
+            <xs:enumeration value="unstructlonlat_regvert"/>
+            <xs:enumeration value="unstructlonlat_sigmavert"/>
+            <xs:enumeration value="unstructlonlatvert"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="volume_type">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="type1"/>
+            <xs:enumeration value="type2"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- structure_type and volume_type needed by coupler -->
+  <xs:element name="indexing_dimension">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="extent"/>
+        <xs:element minOccurs="0" ref="nbr_overlap"/>
+      </xs:sequence>
+      <xs:attribute name="local_name" use="required"/>
+      <xs:attribute name="time_dependency">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="extent">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- extent may be needed by coupler for coherence check -->
+  <xs:element name="nbr_overlap">
+    <xs:complexType mixed="true">
+      <xs:attribute name="periodic" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- nbr_overlap needed by coupler -->
+  <xs:element name="computational_space">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="points"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="subgrid"/>
+      </xs:sequence>
+      <xs:attribute name="compute_type">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="arakawa_a"/>
+            <xs:enumeration value="arakawa_b"/>
+            <xs:enumeration value="arakawa_c"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- compute_type not needed by coupler -->
+  <xs:element name="points">
+    <xs:complexType>
+      <xs:attribute name="local_name" use="required"/>
+      <xs:attribute name="long_name"/>
+      <xs:attribute name="time_dependency">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- points local_name and time_dependency needed by driver -->
+  <xs:element name="subgrid">
+    <xs:complexType>
+      <xs:attribute name="local_name" use="required"/>
+      <xs:attribute name="long_name"/>
+      <xs:attribute name="associated_points_local_name"/>
+      <xs:attribute name="time_dependency">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    subgrid local_name associated_points_local_name
+    time_dependency needed by coupler
+  -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- TRANSIENT -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="transient">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="standard_name"/>
+        <xs:element ref="physics"/>
+        <xs:element ref="numerics"/>
+        <xs:element ref="computation"/>
+        <xs:element ref="intent"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="transient_dependency"/>
+      </xs:sequence>
+      <xs:attribute name="local_name" use="required" type="xs:ID"/>
+      <xs:attribute name="long_name"/>
+    </xs:complexType>
+  </xs:element>
+  <!-- transient local_name needed by coupler with associate info -->
+  <!-- - - - - - - - - STANDARD_NAME - - - - - - - - - - - - - -->
+  <xs:element name="standard_name" type="xs:string"/>
+  <!--
+    Ideally, the units and the standard names should be checked
+    against the CF convention in the GUI for the PMIOD (and in SASA
+    for the SMIOCs).  How to make the link automatically?
+  -->
+  <!-- The user will not modify "standard_name" in the SMIOC -->
+  <!-- standard_name local_name needed by coupler (I/O) -->
+  <!-- - - - - - - - - - -  PHYSICS  - - - - - - - - - - - - - -->
+  <xs:element name="physics">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="units"/>
+        <xs:element minOccurs="0" ref="valid_min"/>
+        <xs:element minOccurs="0" ref="valid_max"/>
+        <xs:element minOccurs="0" ref="nbr_bundles"/>
+      </xs:sequence>
+      <xs:attribute name="transient_type">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="single"/>
+            <xs:enumeration value="vector"/>
+            <xs:enumeration value="bundle"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_bundles">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- The user will not modify "physics" tree in the SMIOC -->
+  <!--
+    transient_type and nbr_bundles needed by coupler for coherence
+    checks
+  -->
+  <!-- - - - - - - - - - -  NUMERICS  - - - - - - - - - - - - - -->
+  <xs:element name="numerics">
+    <xs:complexType>
+      <xs:attribute name="type" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="xs:float"/>
+            <xs:enumeration value="xs:double"/>
+            <xs:enumeration value="xs:string"/>
+            <xs:enumeration value="xs:integer"/>
+            <xs:enumeration value="xs:nonPositiveInteger"/>
+            <xs:enumeration value="xs:negativeInteger"/>
+            <xs:enumeration value="xs:positiveInteger"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- The user will not modify "numerics" tree in the SMIOC -->
+  <!-- numerics type needed by coupler for coherence checks -->
+  <!-- - - - - - - - - - -  COMPUTATION  - - - - - - - - - - - - - -->
+  <xs:element name="computation">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="associated_gridfamily"/>
+        <xs:element maxOccurs="unbounded" ref="associated_points_or_subgrid"/>
+        <xs:element minOccurs="0" ref="method"/>
+      </xs:sequence>
+      <xs:attribute name="mask" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="mask_time_dependency">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="conditional_computation"/>
+    </xs:complexType>
+  </xs:element>
+  <!-- The user will not modify "computation" tree in the SMIOC -->
+  <xs:element name="associated_gridfamily">
+    <xs:complexType>
+      <xs:attribute name="local_name" use="required" type="xs:IDREF"/>
+    </xs:complexType>
+  </xs:element>
+  <!-- Must be chosen by the developer among gridfamily local_names -->
+  <!--
+    associated_gridfamily local_name needed by coupler
+    (coherence check)
+  -->
+  <xs:element name="associated_points_or_subgrid">
+    <xs:complexType>
+      <xs:attribute name="local_name"/>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    Must be chosen by the developer among points or subgrid 
+    local_names
+  -->
+  <!--
+    associated_points_or_subgrid local_name needed by coupler
+    (coherence check)
+  -->
+  <xs:element name="method">
+    <xs:complexType>
+      <xs:attribute name="type">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="mean"/>
+            <xs:enumeration value="max"/>
+            <xs:enumeration value="min"/>
+            <xs:enumeration value="median"/>
+            <xs:enumeration value="variance"/>
+            <xs:enumeration value="CDATA"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    method type may be needed by coupler for local
+    transformation ?
+  -->
+  <!-- - - - - - - - - - - -  INTENT - - - - - - - - - - - - - - -->
+  <xs:element name="intent">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:choice>
+          <xs:element minOccurs="0" ref="input"/>
+          <xs:element minOccurs="0" maxOccurs="unbounded" ref="output"/>
+        </xs:choice>
+        <xs:element minOccurs="0" ref="saved_in_restart"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="saved_in_restart" type="xs:string"/>
+  <!--  PRISM choices are true | false (false if not present) -->
+  <!--
+    needed by coupler when we will have a psmile function to save 
+    the restarts automatically
+  -->
+  <xs:element name="input">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="origin"/>
+        <xs:element minOccurs="0" ref="exchange_date"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded"
+ref="target_transformation"/>
+        <xs:element minOccurs="0" ref="coupling_restart_file"/>
+        <xs:element ref="debug_mode"/>
+      </xs:sequence>
+      <xs:attribute name="required_but_changeable">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="minimal_period" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <!-- All elements contained in input are needed by the coupler -->
+  <!--
+    The user may remove the element input in the SMIOC, except
+    if input is required_but_changeable, in which case the user
+    must keep it in the SMIOC but may change its tree below
+  -->
+  <!--
+    The minimal period is the period at which the prism_get is
+    called in the code
+  -->
+  <xs:element name="debug_mode" type="xs:string"/>
+  <!--  PRISM choices are true | false (boolean?) -->
+  <!--
+    If debug_mode is true, the data will automatically be written to
+    a file below the prism_get after reception
+  -->
+  <!--
+    The user is allowed to change debug_mode value 
+    in the SMIOC
+  -->
+  <xs:element name="output">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="destination"/>
+        <xs:element ref="exchange_date"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded"
+ref="source_transformation"/>
+        <xs:element ref="debug_mode"/>
+      </xs:sequence>
+      <xs:attribute name="minimal_period" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <!-- The user may remove and/or add element output in the SMIOC -->
+  <!--
+    The minimal period is the period at which the prism_put is
+    called in the code
+  -->
+  <!--
+    If debug_mode is true, the data will automatically be written to
+    a file below the prism_put before sending
+  -->
+  <!-- The user is allowed to change debug_mode value in the SMIOC -->
+  <!-- - - - - - - - - -  ORIGIN - - - - - - - - - - - - - -->
+  <xs:element name="origin">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="variable_name"/>
+        <xs:choice>
+          <xs:element ref="file"/>
+          <xs:element ref="src_component"/>
+        </xs:choice>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!--
+     The user is allowed to add or remove elements origin,
+    or modify the tree below origin in the SMIOC
+  -->
+  <!-- - - - - - - - - DESTINATION - - - - - - - - - - - - -->
+  <xs:element name="destination">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="variable_name"/>
+        <xs:choice>
+          <xs:element ref="file"/>
+          <xs:element ref="tgt_component"/>
+        </xs:choice>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    The user is allowed to modify in the SMIOC the tree below
+    destination
+  -->
+  <xs:element name="variable_name">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="src_component">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="tgt_component">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!-- - - - - - -  - EXCHANGE_DATE - - - - - - - - - - - - -->
+  <xs:element name="exchange_date">
+    <xs:complexType>
+      <xs:choice>
+        <xs:element ref="period"/>
+        <xs:element maxOccurs="unbounded" ref="precise_day"/>
+        <xs:element ref="list"/>
+        <xs:element ref="once"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    The user is allowed to change the exchange_date in the
+    SMIOC
+  -->
+  <xs:element name="period">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="nbr_years"/>
+        <xs:element minOccurs="0" ref="nbr_months"/>
+        <xs:element minOccurs="0" ref="nbr_days"/>
+        <xs:element minOccurs="0" ref="nbr_hours"/>
+        <xs:element minOccurs="0" ref="nbr_mins"/>
+        <xs:element minOccurs="0" ref="nbr_secs"/>
+        <xs:element minOccurs="0" ref="nbr_msecs"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="precise_day">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="daynbr_in_month"/>
+        <xs:element minOccurs="0" ref="hour"/>
+        <xs:element minOccurs="0" ref="minutes"/>
+        <xs:element minOccurs="0" ref="seconds"/>
+        <xs:element minOccurs="0" ref="milliseconds"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!--
+     The coupling or I/O can be performed every X day of
+    each month at a precise time (0:00:00:000 by default)
+  -->
+  <xs:element name="daynbr_in_month">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="list">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="date"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    The coupling or I/O can be performed on different
+    precise dates
+  -->
+  <xs:element name="once" type="xs:string"/>
+  <!-- PRISM choices are beginning | end | beginning_and_end -->
+  <!--
+    The coupling or I/O can be performed only at the
+    beginning of the run, only at the end, or both
+  -->
+  <!-- - - - - - - -  TRANSFORMATIONS - - - - - - - - - - -->
+  <xs:element name="source_transformation">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="source_time_operation"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="local_transformation"/>
+        <xs:element minOccurs="0" ref="interpolation"/>
+        <xs:element minOccurs="0" ref="conservation"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded"
+ref="algebraic_combination"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="statistics"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="target_transformation">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="local_transformation"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="algebraic_correction"/>
+        <xs:element minOccurs="0" ref="target_time_operation"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="statistics"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    The user is allowed to remove, add, change the
+    transformations in the SMIOC except the ones that have
+    the attribute required_as_is="true" (false by default)
+  -->
+  <xs:element name="source_time_operation">
+    <xs:complexType mixed="true">
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- PRISM choices are average | accumul |  t_min | t_max -->
+  <xs:element name="local_transformation">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:choice minOccurs="0">
+          <xs:element ref="scattering"/>
+          <xs:element ref="gathering"/>
+        </xs:choice>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="reduction"/>
+        <xs:element minOccurs="0" ref="masking"/>
+        <xs:element minOccurs="0" ref="extrapolation"/>
+        <xs:element minOccurs="0" ref="add_scalar"/>
+        <xs:element minOccurs="0" ref="mult_scalar"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="scattering">
+    <xs:complexType mixed="true">
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- PRISM choices for scattering are scconvA | scconvB -->
+  <xs:element name="gathering">
+    <xs:complexType mixed="true">
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- PRISM choices are gaconvA | gaconvB -->
+  <xs:element name="reduction">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="reduc_type"/>
+        <xs:element ref="reduc_dim"/>
+      </xs:sequence>
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="reduc_type" type="xs:string"/>
+  <!-- PRISM choices are minimum | maximum | average -->
+  <xs:element name="reduc_dim" type="xs:string"/>
+  <!-- PRISM choices are first | second | third | fourth -->
+  <xs:element name="masking">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:choice>
+          <xs:element ref="variable_mask"/>
+          <xs:element ref="external_mask"/>
+        </xs:choice>
+        <xs:element ref="mask_value"/>
+      </xs:sequence>
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="variable_mask">
+    <xs:complexType/>
+  </xs:element>
+  <xs:element name="external_mask">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="name"/>
+        <xs:element ref="file"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="mask_value">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="extrapolation">
+    <xs:complexType>
+      <xs:choice>
+        <xs:element ref="nbr_neighbours"/>
+        <xs:element ref="weight"/>
+      </xs:choice>
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_neighbours">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="weight">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="file"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="add_scalar">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="mult_scalar">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="required_as_is">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="interpolation">
+    <xs:complexType>
+      <xs:choice>
+        <xs:element ref="interp3D"/>
+        <xs:sequence>
+          <xs:element ref="interp2D"/>
+          <xs:element ref="interp1D"/>
+        </xs:sequence>
+        <xs:sequence>
+          <xs:element ref="interp1D"/>
+          <xs:element ref="interp1D"/>
+          <xs:element ref="interp1D"/>
+        </xs:sequence>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="interp3D">
+    <xs:complexType>
+      <xs:choice>
+        <xs:element ref="nneighbour3D"/>
+        <xs:element ref="conservativ3D"/>
+        <xs:element ref="user3D"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nneighbour3D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="nbr_neighbours"/>
+        <xs:element minOccurs="0" ref="gaussian_variance"/>
+        <xs:element ref="restric_type3D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="gaussian_variance">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="restric_type3D" type="xs:string"/>
+  <!-- PRISM choices are restrica3D | restricb3D -->
+  <xs:element name="nbr_bins">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="para_search" type="xs:string"/>
+  <!-- PRISM choices are approximate | precise -->
+  <xs:element name="conservativ3D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="restric_type3D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="order"/>
+        <xs:element minOccurs="0" ref="gradient_varname"/>
+        <xs:element ref="normalisation3D"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="order" type="xs:string"/>
+  <!-- PRISM choices are first | second -->
+  <xs:element name="normalisation3D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="methodnorm3D"/>
+        <xs:element ref="nearnei"/>
+        <xs:element ref="truevolume"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="methodnorm3D" type="xs:string"/>
+  <!-- PRISM choices are norma3D | normb3D | normc3D -->
+  <xs:element name="nearnei" type="xs:string"/>
+  <!-- PRISM choices are true | false -->
+  <xs:element name="truevolume" type="xs:string"/>
+  <!-- PRISM choices are true | false -->
+  <xs:element name="user3D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="file"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="interp2D">
+    <xs:complexType>
+      <xs:choice>
+        <xs:element ref="nneighbour2D"/>
+        <xs:element ref="bilinear"/>
+        <xs:element ref="bicubic"/>
+        <xs:element ref="conservativ2D"/>
+        <xs:element ref="user2D"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nneighbour2D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="nbr_neighbours"/>
+        <xs:element minOccurs="0" ref="gaussian_variance"/>
+        <xs:element ref="restric_type2D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="restric_type2D" type="xs:string"/>
+  <!-- PRISM choices are latlon | latitude -->
+  <xs:element name="bilinear">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="restric_type2D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="bicubic">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="bicubic_method"/>
+        <xs:element minOccurs="0" ref="gradient_varname"/>
+        <xs:element ref="restric_type2D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="bicubic_method" type="xs:string"/>
+  <!-- PRISM choices are gradient | sixteen -->
+  <xs:element name="gradient_varname">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:string">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:string"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="conservativ2D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="restric_type2D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="order"/>
+        <xs:element minOccurs="0" ref="gradient_varname"/>
+        <xs:element ref="normalisation2D"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="normalisation2D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="methodnorm2D"/>
+        <xs:element ref="nearnei"/>
+        <xs:element ref="truearea"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="methodnorm2D" type="xs:string"/>
+  <!-- PRISM choices are fracarea | destarea | none) -->
+  <xs:element name="truearea" type="xs:string"/>
+  <!-- PRISM choices are true | false -->
+  <xs:element name="user2D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="file"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="interp1D">
+    <xs:complexType>
+      <xs:choice>
+        <xs:element ref="nneighbour1D"/>
+        <xs:element ref="linear"/>
+        <xs:element ref="cubic"/>
+        <xs:element ref="conservativ1D"/>
+        <xs:element ref="user1D"/>
+        <xs:element ref="none"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nneighbour1D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="nbr_neighbours"/>
+        <xs:element minOccurs="0" ref="gaussian_variance"/>
+        <xs:element ref="unit_logarithm"/>
+        <xs:element ref="restric_type1D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="restric_type1D" type="xs:string"/>
+  <!-- PRISM choices are restrica1D | restricb1D -->
+  <xs:element name="unit_logarithm" type="xs:string"/>
+  <!-- PRISM choices are true | false -->
+  <xs:element name="linear">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="unit_logarithm"/>
+        <xs:element ref="restric_type1D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="cubic">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="unit_logarithm"/>
+        <xs:element ref="restric_type1D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="para_search"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="conservativ1D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="restric_type1D"/>
+        <xs:element ref="nbr_bins"/>
+        <xs:element ref="order"/>
+        <xs:element minOccurs="0" ref="gradient_varname"/>
+        <xs:element ref="normalisation1D"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="normalisation1D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="methodnorm1D"/>
+        <xs:element ref="nearnei"/>
+        <xs:element ref="truelength"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="methodnorm1D" type="xs:string"/>
+  <!-- PRISM choices are norma1D | normb1D | normc1D) -->
+  <xs:element name="truelength" type="xs:string"/>
+  <!-- PRISM choices are true | false -->
+  <xs:element name="user1D">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="file"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="none">
+    <xs:complexType/>
+  </xs:element>
+  <xs:element name="algebraic_combination">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="name"/>
+        <xs:element minOccurs="0" ref="operand"/>
+        <xs:element minOccurs="0" ref="scalar"/>
+        <xs:choice minOccurs="0">
+          <xs:element ref="variable_mask"/>
+          <xs:element ref="external_mask"/>
+        </xs:choice>
+        <xs:element minOccurs="0" ref="comb_method"/>
+        <xs:element minOccurs="0" ref="comb_parameter"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="operand" type="xs:string"/>
+  <!-- PRISM choices are sinus | log | bundle_combine -->
+  <xs:element name="scalar">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="comb_method" type="xs:string"/>
+  <!-- PRISM choices are smooth | raw -->
+  <xs:element name="comb_parameter">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="conservation" type="xs:string"/>
+  <!-- PRISM choices are global (only one choice for now) -->
+  <xs:element name="algebraic_correction">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="name"/>
+        <xs:element ref="file"/>
+        <xs:element minOccurs="0" ref="operand"/>
+        <xs:element minOccurs="0" ref="scalar"/>
+        <xs:element minOccurs="0" ref="external_mask"/>
+        <xs:element minOccurs="0" ref="comb_method"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="target_time_operation" type="xs:string"/>
+  <!-- PRISM choices are time_nneighbour | time_linear -->
+  <xs:element name="statistics" type="xs:string"/>
+  <!--
+    PRISM choices are fld_minimum | fld_maximum |
+    fld_integral | mask_integral | notmask_integral
+  -->
+  <!-- - - - - - -  TRANSIENT_DEPENDENCY - - - - - - - - - - - -->
+  <xs:element name="transient_dependency">
+    <xs:complexType>
+      <xs:attribute name="dep_variable" use="required" type="xs:IDREF"/>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    The developer specifies other transient variable
+    local_names in the PMIOD; the user cannot change that in
+    the SMIOC
+  -->
+  <!-- not needed by coupler -->
+  <!-- - - - - - - - COUPLING_RESTART_FILE - - - - - - - - - - - - -->
+  <xs:element name="coupling_restart_file">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="file"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!-- needed by coupler -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- PERSISTENT -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="persistent">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" ref="standard_name"/>
+        <xs:element ref="physics"/>
+        <xs:element ref="numerics"/>
+        <xs:element ref="persistent_value"/>
+        <xs:element minOccurs="0" ref="saved_in_restart"/>
+      </xs:sequence>
+      <xs:attribute name="local_name" use="required"/>
+      <xs:attribute name="long_name"/>
+      <xs:attribute name="persist_type" use="required">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="local"/>
+            <xs:enumeration value="global"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="persistent_value">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    If the developer wants to specify that the user cannot change the
+    value, he uses PCDATA and not configurable
+  -->
+  <!--
+    Should the global parameters (that need to be coherent) among all
+    components be in the SCC?
+  -->
+  <!--
+    all persistent elements needed by coupler to answer
+    prism_get_persist
+  -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- DEPENDENCY -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="dependency" type="xs:string"/>
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <!-- GENERIC ELEMENTS -->
+  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+  <xs:element name="valid_min">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="valid_max">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="value">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="min_value">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="max_value">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="increment">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    If there is no max_value and no increment specified, min_value is
+    the only possible value; if there is only min_value and
+    max_value, the increment is 1 by default.
+  -->
+  <xs:element name="name">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:string">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:string"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="configurable">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="default"/>
+        <xs:element ref="label"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="choice"/>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="guiattribute"/>
+      </xs:sequence>
+      <xs:attribute name="any_value">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    any_value="true" indicates that any value, besides the proposed
+    choices if any, is also acceptable  (false by default)
+  -->
+  <xs:element name="default" type="xs:string"/>
+  <xs:element name="label" type="xs:string"/>
+  <xs:element name="choice">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="min_choice"/>
+        <xs:element minOccurs="0" ref="max_choice"/>
+        <xs:element minOccurs="0" ref="inc_choice"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="guiattribute">
+    <xs:complexType mixed="true">
+      <xs:attribute name="key" use="required"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="min_choice" type="xs:string"/>
+  <xs:element name="max_choice" type="xs:string"/>
+  <xs:element name="inc_choice" type="xs:string"/>
+  <!--
+    If there is no max_choice and no increment specified, min_choice
+    is the only value of this choice "element"; if there is
+    min_choice and max_choice, the inc_choice is required
+  -->
+  <xs:element name="units">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="unit_element"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="unit_element">
+    <xs:complexType>
+      <xs:attribute name="std_unit_name">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="1"/>
+            <xs:enumeration value="m"/>
+            <xs:enumeration value="kg"/>
+            <xs:enumeration value="s"/>
+            <xs:enumeration value="Pa"/>
+            <xs:enumeration value="K"/>
+            <xs:enumeration value="W"/>
+            <xs:enumeration value="J"/>
+            <xs:enumeration value="degree"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="other_unit_name"/>
+      <xs:attribute name="exponent">
+        <xs:simpleType>
+          <xs:restriction base="xs:token">
+            <xs:enumeration value="-01"/>
+            <xs:enumeration value="-02"/>
+            <xs:enumeration value="-03"/>
+            <xs:enumeration value="01"/>
+            <xs:enumeration value="02"/>
+            <xs:enumeration value="03"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!--
+    I checked that the unit list covers 
+    http://www.knmi.nl/~velthove/PRISM/CF/PRISM_standard_names_V1.0.html
+  -->
+  <xs:element name="file">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="name"/>
+        <xs:element ref="set"/>
+        <xs:element ref="format"/>
+        <xs:element ref="packing"/>
+        <xs:element minOccurs="0" ref="scaling"/>
+        <xs:element minOccurs="0" ref="adding"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="set" type="xs:string"/>
+  <!-- PRISM choices are single | multiple -->
+  <xs:element name="format" type="xs:string"/>
+  <!-- PRISM choices are binary | netCDF -->
+  <xs:element name="packing">
+    <xs:complexType mixed="true">
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- PRISM choices are  1 | 2 | 4 | 8 -->
+  <xs:element name="scaling">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- scaling is 1.0 by default -->
+  <xs:element name="adding">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:float">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:float"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <!-- adding is 0.0 by default -->
+  <xs:element name="nbr_years">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_months">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_days">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_hours">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_mins">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_secs">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="nbr_msecs">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="date">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="year"/>
+        <xs:element ref="month"/>
+        <xs:element ref="day"/>
+        <xs:element ref="hour"/>
+        <xs:element ref="minutes"/>
+        <xs:element ref="seconds"/>
+        <xs:element ref="milliseconds"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="year">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="month">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="day">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="hour">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="minutes">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="seconds">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="milliseconds">
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="configurable"/>
+      </xs:sequence>
+      <xs:attribute name="type" default="xs:integer">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="xs:integer"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/XMLSchema.dtd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/XMLSchema.dtd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/XMLSchema.dtd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,402 @@
+<!-- DTD for XML Schemas: Part 1: Structures
+     Public Identifier: "-//W3C//DTD XMLSCHEMA 200102//EN"
+     Official Location: http://www.w3.org/2001/XMLSchema.dtd -->
+<!-- $Id: XMLSchema.dtd,v 1.31 2001/10/24 15:50:16 ht Exp $ -->
+<!-- Note this DTD is NOT normative, or even definitive. -->           <!--d-->
+<!-- prose copy in the structures REC is the definitive version -->    <!--d-->
+<!-- (which shouldn't differ from this one except for this -->         <!--d-->
+<!-- comment and entity expansions, but just in case) -->              <!--d-->
+<!-- With the exception of cases with multiple namespace
+     prefixes for the XML Schema namespace, any XML document which is
+     not valid per this DTD given redefinitions in its internal subset of the
+     'p' and 's' parameter entities below appropriate to its namespace
+     declaration of the XML Schema namespace is almost certainly not
+     a valid schema. -->
+
+<!-- The simpleType element and its constituent parts
+     are defined in XML Schema: Part 2: Datatypes -->
+<!ENTITY % xs-datatypes PUBLIC 'datatypes' 'datatypes.dtd' >
+
+<!ENTITY % p 'xs:'> <!-- can be overriden in the internal subset of a
+                         schema document to establish a different
+                         namespace prefix -->
+<!ENTITY % s ':xs'> <!-- if %p is defined (e.g. as foo:) then you must
+                         also define %s as the suffix for the appropriate
+                         namespace declaration (e.g. :foo) -->
+<!ENTITY % nds 'xmlns%s;'>
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % schema "%p;schema">
+<!ENTITY % complexType "%p;complexType">
+<!ENTITY % complexContent "%p;complexContent">
+<!ENTITY % simpleContent "%p;simpleContent">
+<!ENTITY % extension "%p;extension">
+<!ENTITY % element "%p;element">
+<!ENTITY % unique "%p;unique">
+<!ENTITY % key "%p;key">
+<!ENTITY % keyref "%p;keyref">
+<!ENTITY % selector "%p;selector">
+<!ENTITY % field "%p;field">
+<!ENTITY % group "%p;group">
+<!ENTITY % all "%p;all">
+<!ENTITY % choice "%p;choice">
+<!ENTITY % sequence "%p;sequence">
+<!ENTITY % any "%p;any">
+<!ENTITY % anyAttribute "%p;anyAttribute">
+<!ENTITY % attribute "%p;attribute">
+<!ENTITY % attributeGroup "%p;attributeGroup">
+<!ENTITY % include "%p;include">
+<!ENTITY % import "%p;import">
+<!ENTITY % redefine "%p;redefine">
+<!ENTITY % notation "%p;notation">
+
+<!-- annotation elements -->
+<!ENTITY % annotation "%p;annotation">
+<!ENTITY % appinfo "%p;appinfo">
+<!ENTITY % documentation "%p;documentation">
+
+<!-- Customisation entities for the ATTLIST of each element type.
+     Define one of these if your schema takes advantage of the
+     anyAttribute='##other' in the schema for schemas -->
+
+<!ENTITY % schemaAttrs ''>
+<!ENTITY % complexTypeAttrs ''>
+<!ENTITY % complexContentAttrs ''>
+<!ENTITY % simpleContentAttrs ''>
+<!ENTITY % extensionAttrs ''>
+<!ENTITY % elementAttrs ''>
+<!ENTITY % groupAttrs ''>
+<!ENTITY % allAttrs ''>
+<!ENTITY % choiceAttrs ''>
+<!ENTITY % sequenceAttrs ''>
+<!ENTITY % anyAttrs ''>
+<!ENTITY % anyAttributeAttrs ''>
+<!ENTITY % attributeAttrs ''>
+<!ENTITY % attributeGroupAttrs ''>
+<!ENTITY % uniqueAttrs ''>
+<!ENTITY % keyAttrs ''>
+<!ENTITY % keyrefAttrs ''>
+<!ENTITY % selectorAttrs ''>
+<!ENTITY % fieldAttrs ''>
+<!ENTITY % includeAttrs ''>
+<!ENTITY % importAttrs ''>
+<!ENTITY % redefineAttrs ''>
+<!ENTITY % notationAttrs ''>
+<!ENTITY % annotationAttrs ''>
+<!ENTITY % appinfoAttrs ''>
+<!ENTITY % documentationAttrs ''>
+
+<!ENTITY % complexDerivationSet "CDATA">
+      <!-- #all or space-separated list drawn from derivationChoice -->
+<!ENTITY % blockSet "CDATA">
+      <!-- #all or space-separated list drawn from
+                      derivationChoice + 'substitution' -->
+
+<!ENTITY % mgs '%all; | %choice; | %sequence;'>
+<!ENTITY % cs '%choice; | %sequence;'>
+<!ENTITY % formValues '(qualified|unqualified)'>
+
+
+<!ENTITY % attrDecls    '((%attribute;| %attributeGroup;)*,(%anyAttribute;)?)'>
+
+<!ENTITY % particleAndAttrs '((%mgs; | %group;)?, %attrDecls;)'>
+
+<!-- This is used in part2 -->
+<!ENTITY % restriction1 '((%mgs; | %group;)?)'>
+
+%xs-datatypes;
+
+<!-- the duplication below is to produce an unambiguous content model
+     which allows annotation everywhere -->
+<!ELEMENT %schema; ((%include; | %import; | %redefine; | %annotation;)*,
+                    ((%simpleType; | %complexType;
+                      | %element; | %attribute;
+                      | %attributeGroup; | %group;
+                      | %notation; ),
+                     (%annotation;)*)* )>
+<!ATTLIST %schema;
+   targetNamespace      %URIref;               #IMPLIED
+   version              CDATA                  #IMPLIED
+   %nds;                %URIref;               #FIXED 'http://www.w3.org/2001/XMLSchema'
+   xmlns                CDATA                  #IMPLIED
+   finalDefault         %complexDerivationSet; ''
+   blockDefault         %blockSet;             ''
+   id                   ID                     #IMPLIED
+   elementFormDefault   %formValues;           'unqualified'
+   attributeFormDefault %formValues;           'unqualified'
+   xml:lang             CDATA                  #IMPLIED
+   %schemaAttrs;>
+<!-- Note the xmlns declaration is NOT in the Schema for Schemas,
+     because at the Infoset level where schemas operate,
+     xmlns(:prefix) is NOT an attribute! -->
+<!-- The declaration of xmlns is a convenience for schema authors -->
+ 
+<!-- The id attribute here and below is for use in external references
+     from non-schemas using simple fragment identifiers.
+     It is NOT used for schema-to-schema reference, internal or
+     external. -->
+
+<!-- a type is a named content type specification which allows attribute
+     declarations-->
+<!-- -->
+
+<!ELEMENT %complexType; ((%annotation;)?,
+                         (%simpleContent;|%complexContent;|
+                          %particleAndAttrs;))>
+
+<!ATTLIST %complexType;
+          name      %NCName;                        #IMPLIED
+          id        ID                              #IMPLIED
+          abstract  %boolean;                       #IMPLIED
+          final     %complexDerivationSet;          #IMPLIED
+          block     %complexDerivationSet;          #IMPLIED
+          mixed (true|false) 'false'
+          %complexTypeAttrs;>
+
+<!-- particleAndAttrs is shorthand for a root type -->
+<!-- mixed is disallowed if simpleContent, overriden if complexContent
+     has one too. -->
+
+<!-- If anyAttribute appears in one or more referenced attributeGroups
+     and/or explicitly, the intersection of the permissions is used -->
+
+<!ELEMENT %complexContent; ((%annotation;)?, (%restriction;|%extension;))>
+<!ATTLIST %complexContent;
+          mixed (true|false) #IMPLIED
+          id    ID           #IMPLIED
+          %complexContentAttrs;>
+
+<!-- restriction should use the branch defined above, not the simple
+     one from part2; extension should use the full model  -->
+
+<!ELEMENT %simpleContent; ((%annotation;)?, (%restriction;|%extension;))>
+<!ATTLIST %simpleContent;
+          id    ID           #IMPLIED
+          %simpleContentAttrs;>
+
+<!-- restriction should use the simple branch from part2, not the 
+     one defined above; extension should have no particle  -->
+
+<!ELEMENT %extension; ((%annotation;)?, (%particleAndAttrs;))>
+<!ATTLIST %extension;
+          base  %QName;      #REQUIRED
+          id    ID           #IMPLIED
+          %extensionAttrs;>
+
+<!-- an element is declared by either:
+ a name and a type (either nested or referenced via the type attribute)
+ or a ref to an existing element declaration -->
+
+<!ELEMENT %element; ((%annotation;)?, (%complexType;| %simpleType;)?,
+                     (%unique; | %key; | %keyref;)*)>
+<!-- simpleType or complexType only if no type|ref attribute -->
+<!-- ref not allowed at top level -->
+<!ATTLIST %element;
+            name               %NCName;               #IMPLIED
+            id                 ID                     #IMPLIED
+            ref                %QName;                #IMPLIED
+            type               %QName;                #IMPLIED
+            minOccurs          %nonNegativeInteger;   #IMPLIED
+            maxOccurs          CDATA                  #IMPLIED
+            nillable           %boolean;              #IMPLIED
+            substitutionGroup  %QName;                #IMPLIED
+            abstract           %boolean;              #IMPLIED
+            final              %complexDerivationSet; #IMPLIED
+            block              %blockSet;             #IMPLIED
+            default            CDATA                  #IMPLIED
+            fixed              CDATA                  #IMPLIED
+            form               %formValues;           #IMPLIED
+            %elementAttrs;>
+<!-- type and ref are mutually exclusive.
+     name and ref are mutually exclusive, one is required -->
+<!-- In the absence of type AND ref, type defaults to type of
+     substitutionGroup, if any, else the ur-type, i.e. unconstrained -->
+<!-- default and fixed are mutually exclusive -->
+
+<!ELEMENT %group; ((%annotation;)?,(%mgs;)?)>
+<!ATTLIST %group; 
+          name        %NCName;               #IMPLIED
+          ref         %QName;                #IMPLIED
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %groupAttrs;>
+
+<!ELEMENT %all; ((%annotation;)?, (%element;)*)>
+<!ATTLIST %all;
+          minOccurs   (1)                    #IMPLIED
+          maxOccurs   (1)                    #IMPLIED
+          id          ID                     #IMPLIED
+          %allAttrs;>
+
+<!ELEMENT %choice; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
+<!ATTLIST %choice;
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %choiceAttrs;>
+
+<!ELEMENT %sequence; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
+<!ATTLIST %sequence;
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %sequenceAttrs;>
+
+<!-- an anonymous grouping in a model, or
+     a top-level named group definition, or a reference to same -->
+
+<!-- Note that if order is 'all', group is not allowed inside.
+     If order is 'all' THIS group must be alone (or referenced alone) at
+     the top level of a content model -->
+<!-- If order is 'all', minOccurs==maxOccurs==1 on element/any inside -->
+<!-- Should allow minOccurs=0 inside order='all' . . . -->
+
+<!ELEMENT %any; (%annotation;)?>
+<!ATTLIST %any;
+            namespace       CDATA                  '##any'
+            processContents (skip|lax|strict)      'strict'
+            minOccurs       %nonNegativeInteger;   '1'
+            maxOccurs       CDATA                  '1'
+            id              ID                     #IMPLIED
+            %anyAttrs;>
+
+<!-- namespace is interpreted as follows:
+                  ##any      - - any non-conflicting WFXML at all
+
+                  ##other    - - any non-conflicting WFXML from namespace other
+                                  than targetNamespace
+
+                  ##local    - - any unqualified non-conflicting WFXML/attribute
+                  one or     - - any non-conflicting WFXML from
+                  more URI        the listed namespaces
+                  references
+
+                  ##targetNamespace ##local may appear in the above list,
+                    with the obvious meaning -->
+
+<!ELEMENT %anyAttribute; (%annotation;)?>
+<!ATTLIST %anyAttribute;
+            namespace       CDATA              '##any'
+            processContents (skip|lax|strict)  'strict'
+            id              ID                 #IMPLIED
+            %anyAttributeAttrs;>
+<!-- namespace is interpreted as for 'any' above -->
+
+<!-- simpleType only if no type|ref attribute -->
+<!-- ref not allowed at top level, name iff at top level -->
+<!ELEMENT %attribute; ((%annotation;)?, (%simpleType;)?)>
+<!ATTLIST %attribute;
+          name      %NCName;      #IMPLIED
+          id        ID            #IMPLIED
+          ref       %QName;       #IMPLIED
+          type      %QName;       #IMPLIED
+          use       (prohibited|optional|required) #IMPLIED
+          default   CDATA         #IMPLIED
+          fixed     CDATA         #IMPLIED
+          form      %formValues;  #IMPLIED
+          %attributeAttrs;>
+<!-- type and ref are mutually exclusive.
+     name and ref are mutually exclusive, one is required -->
+<!-- default for use is optional when nested, none otherwise -->
+<!-- default and fixed are mutually exclusive -->
+<!-- type attr and simpleType content are mutually exclusive -->
+
+<!-- an attributeGroup is a named collection of attribute decls, or a
+     reference thereto -->
+<!ELEMENT %attributeGroup; ((%annotation;)?,
+                       (%attribute; | %attributeGroup;)*,
+                       (%anyAttribute;)?) >
+<!ATTLIST %attributeGroup;
+                 name       %NCName;       #IMPLIED
+                 id         ID             #IMPLIED
+                 ref        %QName;        #IMPLIED
+                 %attributeGroupAttrs;>
+
+<!-- ref iff no content, no name.  ref iff not top level -->
+
+<!-- better reference mechanisms -->
+<!ELEMENT %unique; ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %unique;
+          name     %NCName;       #REQUIRED
+	  id       ID             #IMPLIED
+	  %uniqueAttrs;>
+
+<!ELEMENT %key;    ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %key;
+          name     %NCName;       #REQUIRED
+	  id       ID             #IMPLIED
+	  %keyAttrs;>
+
+<!ELEMENT %keyref; ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %keyref;
+          name     %NCName;       #REQUIRED
+	  refer    %QName;        #REQUIRED
+	  id       ID             #IMPLIED
+	  %keyrefAttrs;>
+
+<!ELEMENT %selector; ((%annotation;)?)>
+<!ATTLIST %selector;
+          xpath %XPathExpr; #REQUIRED
+          id    ID          #IMPLIED
+          %selectorAttrs;>
+<!ELEMENT %field; ((%annotation;)?)>
+<!ATTLIST %field;
+          xpath %XPathExpr; #REQUIRED
+          id    ID          #IMPLIED
+          %fieldAttrs;>
+
+<!-- Schema combination mechanisms -->
+<!ELEMENT %include; (%annotation;)?>
+<!ATTLIST %include;
+          schemaLocation %URIref; #REQUIRED
+          id             ID       #IMPLIED
+          %includeAttrs;>
+
+<!ELEMENT %import; (%annotation;)?>
+<!ATTLIST %import;
+          namespace      %URIref; #IMPLIED
+          schemaLocation %URIref; #IMPLIED
+          id             ID       #IMPLIED
+          %importAttrs;>
+
+<!ELEMENT %redefine; (%annotation; | %simpleType; | %complexType; |
+                      %attributeGroup; | %group;)*>
+<!ATTLIST %redefine;
+          schemaLocation %URIref; #REQUIRED
+          id             ID       #IMPLIED
+          %redefineAttrs;>
+
+<!ELEMENT %notation; (%annotation;)?>
+<!ATTLIST %notation;
+	  name        %NCName;    #REQUIRED
+	  id          ID          #IMPLIED
+	  public      CDATA       #REQUIRED
+	  system      %URIref;    #IMPLIED
+	  %notationAttrs;>
+
+<!-- Annotation is either application information or documentation -->
+<!-- By having these here they are available for datatypes as well
+     as all the structures elements -->
+
+<!ELEMENT %annotation; (%appinfo; | %documentation;)*>
+<!ATTLIST %annotation; %annotationAttrs;>
+
+<!-- User must define annotation elements in internal subset for this
+     to work -->
+<!ELEMENT %appinfo; ANY>   <!-- too restrictive -->
+<!ATTLIST %appinfo;
+          source     %URIref;      #IMPLIED
+          id         ID         #IMPLIED
+          %appinfoAttrs;>
+<!ELEMENT %documentation; ANY>   <!-- too restrictive -->
+<!ATTLIST %documentation;
+          source     %URIref;   #IMPLIED
+          id         ID         #IMPLIED
+          xml:lang   CDATA      #IMPLIED
+          %documentationAttrs;>
+
+<!NOTATION XMLSchemaStructures PUBLIC
+           'structures' 'http://www.w3.org/2001/XMLSchema.xsd' >
+<!NOTATION XML PUBLIC
+           'REC-xml-1998-0210' 'http://www.w3.org/TR/1998/REC-xml-19980210' >

Added: branches/jaxme/upstream/0.5.1/examples/xs/datatypes.dtd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/datatypes.dtd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/datatypes.dtd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,203 @@
+<!--
+        DTD for XML Schemas: Part 2: Datatypes
+        $Id: datatypes.dtd,v 1.23 2001/03/16 17:36:30 ht Exp $
+        Note this DTD is NOT normative, or even definitive. - - the
+        prose copy in the datatypes REC is the definitive version
+        (which shouldn't differ from this one except for this comment
+        and entity expansions, but just in case)
+  -->
+
+<!--
+        This DTD cannot be used on its own, it is intended
+        only for incorporation in XMLSchema.dtd, q.v.
+  -->
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % simpleType "%p;simpleType">
+<!ENTITY % restriction "%p;restriction">
+<!ENTITY % list "%p;list">
+<!ENTITY % union "%p;union">
+<!ENTITY % maxExclusive "%p;maxExclusive">
+<!ENTITY % minExclusive "%p;minExclusive">
+<!ENTITY % maxInclusive "%p;maxInclusive">
+<!ENTITY % minInclusive "%p;minInclusive">
+<!ENTITY % totalDigits "%p;totalDigits">
+<!ENTITY % fractionDigits "%p;fractionDigits">
+<!ENTITY % length "%p;length">
+<!ENTITY % minLength "%p;minLength">
+<!ENTITY % maxLength "%p;maxLength">
+<!ENTITY % enumeration "%p;enumeration">
+<!ENTITY % whiteSpace "%p;whiteSpace">
+<!ENTITY % pattern "%p;pattern">
+
+<!--
+        Customisation entities for the ATTLIST of each element
+        type. Define one of these if your schema takes advantage
+        of the anyAttribute='##other' in the schema for schemas
+  -->
+
+<!ENTITY % simpleTypeAttrs "">
+<!ENTITY % restrictionAttrs "">
+<!ENTITY % listAttrs "">
+<!ENTITY % unionAttrs "">
+<!ENTITY % maxExclusiveAttrs "">
+<!ENTITY % minExclusiveAttrs "">
+<!ENTITY % maxInclusiveAttrs "">
+<!ENTITY % minInclusiveAttrs "">
+<!ENTITY % totalDigitsAttrs "">
+<!ENTITY % fractionDigitsAttrs "">
+<!ENTITY % lengthAttrs "">
+<!ENTITY % minLengthAttrs "">
+<!ENTITY % maxLengthAttrs "">
+<!ENTITY % enumerationAttrs "">
+<!ENTITY % whiteSpaceAttrs "">
+<!ENTITY % patternAttrs "">
+
+<!-- Define some entities for informative use as attribute
+        types -->
+<!ENTITY % URIref "CDATA">
+<!ENTITY % XPathExpr "CDATA">
+<!ENTITY % QName "NMTOKEN">
+<!ENTITY % QNames "NMTOKENS">
+<!ENTITY % NCName "NMTOKEN">
+<!ENTITY % nonNegativeInteger "NMTOKEN">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % simpleDerivationSet "CDATA">
+<!--
+        #all or space-separated list drawn from derivationChoice
+  -->
+
+<!--
+        Note that the use of 'facet' below is less restrictive
+        than is really intended:  There should in fact be no
+        more than one of each of minInclusive, minExclusive,
+        maxInclusive, maxExclusive, totalDigits, fractionDigits,
+        length, maxLength, minLength within datatype,
+        and the min- and max- variants of Inclusive and Exclusive
+        are mutually exclusive. On the other hand,  pattern and
+        enumeration may repeat.
+  -->
+<!ENTITY % minBound "(%minInclusive; | %minExclusive;)">
+<!ENTITY % maxBound "(%maxInclusive; | %maxExclusive;)">
+<!ENTITY % bounds "%minBound; | %maxBound;">
+<!ENTITY % numeric "%totalDigits; | %fractionDigits;">
+<!ENTITY % ordered "%bounds; | %numeric;">
+<!ENTITY % unordered
+   "%pattern; | %enumeration; | %whiteSpace; | %length; |
+   %maxLength; | %minLength;">
+<!ENTITY % facet "%ordered; | %unordered;">
+<!ENTITY % facetAttr 
+        "value CDATA #REQUIRED
+        id ID #IMPLIED">
+<!ENTITY % fixedAttr "fixed %boolean; #IMPLIED">
+<!ENTITY % facetModel "(%annotation;)?">
+<!ELEMENT %simpleType;
+        ((%annotation;)?, (%restriction; | %list; | %union;))>
+<!ATTLIST %simpleType;
+    name      %NCName; #IMPLIED
+    final     %simpleDerivationSet; #IMPLIED
+    id        ID       #IMPLIED
+    %simpleTypeAttrs;>
+<!-- name is required at top level -->
+<!ELEMENT %restriction; ((%annotation;)?,
+                         (%restriction1; |
+                          ((%simpleType;)?,(%facet;)*)),
+                         (%attrDecls;))>
+<!ATTLIST %restriction;
+    base      %QName;                  #IMPLIED
+    id        ID       #IMPLIED
+    %restrictionAttrs;>
+<!--
+        base and simpleType child are mutually exclusive,
+        one is required.
+
+        restriction is shared between simpleType and
+        simpleContent and complexContent (in XMLSchema.xsd).
+        restriction1 is for the latter cases, when this
+        is restricting a complex type, as is attrDecls.
+  -->
+<!ELEMENT %list; ((%annotation;)?,(%simpleType;)?)>
+<!ATTLIST %list;
+    itemType      %QName;             #IMPLIED
+    id        ID       #IMPLIED
+    %listAttrs;>
+<!--
+        itemType and simpleType child are mutually exclusive,
+        one is required
+  -->
+<!ELEMENT %union; ((%annotation;)?,(%simpleType;)*)>
+<!ATTLIST %union;
+    id            ID       #IMPLIED
+    memberTypes   %QNames;            #IMPLIED
+    %unionAttrs;>
+<!--
+        At least one item in memberTypes or one simpleType
+        child is required
+  -->
+
+<!ELEMENT %maxExclusive; %facetModel;>
+<!ATTLIST %maxExclusive;
+        %facetAttr;
+        %fixedAttr;
+        %maxExclusiveAttrs;>
+<!ELEMENT %minExclusive; %facetModel;>
+<!ATTLIST %minExclusive;
+        %facetAttr;
+        %fixedAttr;
+        %minExclusiveAttrs;>
+
+<!ELEMENT %maxInclusive; %facetModel;>
+<!ATTLIST %maxInclusive;
+        %facetAttr;
+        %fixedAttr;
+        %maxInclusiveAttrs;>
+<!ELEMENT %minInclusive; %facetModel;>
+<!ATTLIST %minInclusive;
+        %facetAttr;
+        %fixedAttr;
+        %minInclusiveAttrs;>
+
+<!ELEMENT %totalDigits; %facetModel;>
+<!ATTLIST %totalDigits;
+        %facetAttr;
+        %fixedAttr;
+        %totalDigitsAttrs;>
+<!ELEMENT %fractionDigits; %facetModel;>
+<!ATTLIST %fractionDigits;
+        %facetAttr;
+        %fixedAttr;
+        %fractionDigitsAttrs;>
+
+<!ELEMENT %length; %facetModel;>
+<!ATTLIST %length;
+        %facetAttr;
+        %fixedAttr;
+        %lengthAttrs;>
+<!ELEMENT %minLength; %facetModel;>
+<!ATTLIST %minLength;
+        %facetAttr;
+        %fixedAttr;
+        %minLengthAttrs;>
+<!ELEMENT %maxLength; %facetModel;>
+<!ATTLIST %maxLength;
+        %facetAttr;
+        %fixedAttr;
+        %maxLengthAttrs;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %enumeration; %facetModel;>
+<!ATTLIST %enumeration;
+        %facetAttr;
+        %enumerationAttrs;>
+
+<!ELEMENT %whiteSpace; %facetModel;>
+<!ATTLIST %whiteSpace;
+        %facetAttr;
+        %fixedAttr;
+        %whiteSpaceAttrs;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %pattern; %facetModel;>
+<!ATTLIST %pattern;
+        %facetAttr;
+        %patternAttrs;>

Added: branches/jaxme/upstream/0.5.1/examples/xs/datatypes.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/datatypes.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/datatypes.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1216 @@
+<?xml version='1.0'?>
+<!-- XML Schema schema for XML Schemas: Part 2: Datatypes -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+        targetNamespace="http://www.w3.org/2001/XMLSchema"
+        version="Id: datatypes.xsd,v 1.52 2001/04/27 11:49:21 ht Exp "
+        xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty"
+        elementFormDefault="qualified"
+        blockDefault="#all"
+        xml:lang="en"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.w3.org/2001/XMLSchema structures.xsd">
+
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes">
+      The schema corresponding to this document is normative,
+      with respect to the syntactic constraints it expresses in the
+      XML Schema language.  The documentation (within &lt;documentation>
+      elements) below, is not normative, but rather highlights important
+      aspects of the W3C Recommendation of which this is a part
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:annotation>
+    <xs:documentation>
+      First the built-in primitive datatypes.  These definitions are for
+      information only, the real built-in definitions are magic.  Note in
+      particular that there is no type named 'anySimpleType'.  The
+      primitives should really be derived from no type at all, and
+      anySimpleType should be derived as a union of all the primitives.
+    </xs:documentation>
+
+    <xs:documentation>
+      For each built-in datatype in this schema (both primitive and
+      derived) can be uniquely addressed via a URI constructed
+      as follows:
+        1) the base URI is the URI of the XML Schema namespace
+        2) the fragment identifier is the name of the datatype
+        
+      For example, to address the int datatype, the URI is:
+      
+        http://www.w3.org/2001/XMLSchema#int
+      
+      Additionally, each facet definition element can be uniquely
+      addressed via a URI constructed as follows:
+        1) the base URI is the URI of the XML Schema namespace
+        2) the fragment identifier is the name of the facet
+        
+      For example, to address the maxInclusive facet, the URI is:
+      
+        http://www.w3.org/2001/XMLSchema#maxInclusive
+
+      Additionally, each facet usage in a built-in datatype definition
+      can be uniquely addressed via a URI constructed as follows:
+        1) the base URI is the URI of the XML Schema namespace
+        2) the fragment identifier is the name of the datatype, followed
+           by a period (".") followed by the name of the facet
+        
+      For example, to address the usage of the maxInclusive facet in
+      the definition of int, the URI is:
+      
+        http://www.w3.org/2001/XMLSchema#int.maxInclusive
+        
+    </xs:documentation>
+  </xs:annotation>
+ 
+  <xs:simpleType name="string" id="string">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality" value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#string"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="preserve" id="string.preserve"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="boolean" id="boolean">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="boolean.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="float" id="float">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="total"/>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+        <hfp:hasProperty name="numeric" value="true"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#float"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="float.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="double" id="double">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="total"/>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+        <hfp:hasProperty name="numeric" value="true"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#double"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="double.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="decimal" id="decimal">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="totalDigits"/>
+        <hfp:hasFacet name="fractionDigits"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="total"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="true"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="decimal.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+   <xs:simpleType name="duration" id="duration">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="duration.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+    <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="dateTime.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="time" id="time">
+    <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#time"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="time.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="date" id="date">
+   <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#date"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="date.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="gYearMonth" id="gYearMonth">
+   <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="gYearMonth.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="gYear" id="gYear">
+    <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="gYear.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+       <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+         <xs:whiteSpace value="collapse" fixed="true"
+                id="gMonthDay.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="gDay" id="gDay">
+    <xs:annotation>
+  <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+         <xs:whiteSpace value="collapse"  fixed="true"
+                id="gDay.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+    <xs:annotation>
+  <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+         <xs:whiteSpace value="collapse"  fixed="true"
+                id="gMonth.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+   <xs:simpleType name="hexBinary" id="hexBinary">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="hexBinary.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+ 
+ <xs:simpleType name="base64Binary" id="base64Binary">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="base64Binary.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+   <xs:simpleType name="anyURI" id="anyURI">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="anyURI.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+  <xs:simpleType name="QName" id="QName">
+    <xs:annotation>
+        <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="QName.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+   <xs:simpleType name="NOTATION" id="NOTATION">
+    <xs:annotation>
+        <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+      <xs:documentation>
+        NOTATION cannot be used directly in a schema; rather a type
+        must be derived from it by specifying at least one enumeration
+        facet whose value is the name of a NOTATION declared in the
+        schema.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="NOTATION.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:annotation>
+    <xs:documentation>
+      Now the derived primitive types
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:simpleType name="normalizedString" id="normalizedString">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+    </xs:annotation>
+    <xs:restriction base="xs:string">
+      <xs:whiteSpace value="replace"
+        id="normalizedString.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+  
+  <xs:simpleType name="token" id="token">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#token"/>
+    </xs:annotation>
+    <xs:restriction base="xs:normalizedString">
+      <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+  
+  <xs:simpleType name="language" id="language">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#language"/>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:pattern
+        value="([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*"
+                id="language.pattern">
+        <xs:annotation>
+          <xs:documentation
+                source="http://www.w3.org/TR/REC-xml#NT-LanguageID">
+            pattern specifies the content of section 2.12 of XML 1.0e2
+            and RFC 1766
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="IDREFS" id="IDREFS">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+    </xs:annotation>
+    <xs:restriction>
+      <xs:simpleType>
+        <xs:list itemType="xs:IDREF"/>    
+      </xs:simpleType>
+        <xs:minLength value="1" id="IDREFS.minLength"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="ENTITIES" id="ENTITIES">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+    </xs:annotation>
+    <xs:restriction>
+      <xs:simpleType>
+        <xs:list itemType="xs:ENTITY"/>
+      </xs:simpleType>
+        <xs:minLength value="1" id="ENTITIES.minLength"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:pattern value="\c+" id="NMTOKEN.pattern">
+        <xs:annotation>
+          <xs:documentation
+                source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+            pattern matches production 7 from the XML spec
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+    </xs:annotation>
+    <xs:restriction>
+      <xs:simpleType>
+        <xs:list itemType="xs:NMTOKEN"/>
+      </xs:simpleType>
+        <xs:minLength value="1" id="NMTOKENS.minLength"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="Name" id="Name">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:pattern value="\i\c*" id="Name.pattern">
+        <xs:annotation>
+          <xs:documentation
+                        source="http://www.w3.org/TR/REC-xml#NT-Name">
+            pattern matches production 5 from the XML spec
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="NCName" id="NCName">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+    </xs:annotation>
+    <xs:restriction base="xs:Name">
+      <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+        <xs:annotation>
+          <xs:documentation
+                source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+            pattern matches production 4 from the Namespaces in XML spec
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+   <xs:simpleType name="ID" id="ID">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+    </xs:annotation>
+    <xs:restriction base="xs:NCName"/>
+   </xs:simpleType>
+
+   <xs:simpleType name="IDREF" id="IDREF">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+    </xs:annotation>
+    <xs:restriction base="xs:NCName"/>
+   </xs:simpleType>
+
+   <xs:simpleType name="ENTITY" id="ENTITY">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+    </xs:annotation>
+    <xs:restriction base="xs:NCName"/>
+   </xs:simpleType>
+
+  <xs:simpleType name="integer" id="integer">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+    </xs:annotation>
+    <xs:restriction base="xs:decimal">
+      <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:integer">
+      <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="negativeInteger" id="negativeInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:nonPositiveInteger">
+      <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="long" id="long">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#long"/>
+    </xs:annotation>
+    <xs:restriction base="xs:integer">
+      <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+      <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="int" id="int">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#int"/>
+    </xs:annotation>
+    <xs:restriction base="xs:long">
+      <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+      <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="short" id="short">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#short"/>
+    </xs:annotation>
+    <xs:restriction base="xs:int">
+      <xs:minInclusive value="-32768" id="short.minInclusive"/>
+      <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="byte" id="byte">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+    </xs:annotation>
+    <xs:restriction base="xs:short">
+      <xs:minInclusive value="-128" id="byte.minInclusive"/>
+      <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:integer">
+      <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedLong" id="unsignedLong">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+    </xs:annotation>
+    <xs:restriction base="xs:nonNegativeInteger">
+      <xs:maxInclusive value="18446744073709551615"
+        id="unsignedLong.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedInt" id="unsignedInt">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+    </xs:annotation>
+    <xs:restriction base="xs:unsignedLong">
+      <xs:maxInclusive value="4294967295"
+        id="unsignedInt.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedShort" id="unsignedShort">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+    </xs:annotation>
+    <xs:restriction base="xs:unsignedInt">
+      <xs:maxInclusive value="65535"
+        id="unsignedShort.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedByte" id="unsignedBtype">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+    </xs:annotation>
+    <xs:restriction base="xs:unsignedShort">
+      <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="positiveInteger" id="positiveInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:nonNegativeInteger">
+      <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:NMTOKEN">
+   <xs:enumeration value="substitution"/>
+   <xs:enumeration value="extension"/>
+   <xs:enumeration value="restriction"/>
+   <xs:enumeration value="list"/>
+   <xs:enumeration value="union"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+  <xs:choice>
+    <xs:element ref="xs:restriction"/>
+    <xs:element ref="xs:list"/>
+    <xs:element ref="xs:union"/>
+  </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+  <xs:annotation>
+   <xs:documentation>
+   #all or (possibly empty) subset of {restriction, union, list}
+   </xs:documentation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>    
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="#all"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:restriction base="xs:derivationControl">
+     <xs:enumeration value="list"/>
+     <xs:enumeration value="union"/>
+     <xs:enumeration value="restriction"/>
+    </xs:restriction>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+  <xs:complexType name="simpleType" abstract="true">
+    <xs:complexContent>
+      <xs:extension base="xs:annotated">
+        <xs:group ref="xs:simpleDerivation"/>
+        <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+        <xs:attribute name="name" type="xs:NCName">
+          <xs:annotation>
+            <xs:documentation>
+              Can be restricted to required or forbidden
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="topLevelSimpleType">
+    <xs:complexContent>
+      <xs:restriction base="xs:simpleType">
+        <xs:sequence>
+          <xs:element ref="xs:annotation" minOccurs="0"/>
+          <xs:group ref="xs:simpleDerivation"/>
+        </xs:sequence>
+        <xs:attribute name="name" use="required"
+             type="xs:NCName">
+          <xs:annotation>
+            <xs:documentation>
+              Required at the top level
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>   
+      </xs:restriction>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="localSimpleType">
+    <xs:complexContent>
+      <xs:restriction base="xs:simpleType">
+        <xs:sequence>
+          <xs:element ref="xs:annotation" minOccurs="0"/>
+          <xs:group ref="xs:simpleDerivation"/>
+        </xs:sequence>
+        <xs:attribute name="name" use="prohibited">
+          <xs:annotation>
+            <xs:documentation>
+              Forbidden when nested
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>   
+        <xs:attribute name="final" use="prohibited"/>
+      </xs:restriction>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:group name="facets">
+   <xs:annotation>
+    <xs:documentation>
+       We should use a substitution group for facets, but
+       that's ruled out because it would allow users to
+       add their own, which we're not ready for yet.
+    </xs:documentation>
+   </xs:annotation>
+   <xs:choice>
+    <xs:element ref="xs:minExclusive"/>
+    <xs:element ref="xs:minInclusive"/>
+    <xs:element ref="xs:maxExclusive"/>
+    <xs:element ref="xs:maxInclusive"/>
+    <xs:element ref="xs:totalDigits"/>
+    <xs:element ref="xs:fractionDigits"/>
+    <xs:element ref="xs:length"/>
+    <xs:element ref="xs:minLength"/>
+    <xs:element ref="xs:maxLength"/>
+    <xs:element ref="xs:enumeration"/>
+    <xs:element ref="xs:whiteSpace"/>
+    <xs:element ref="xs:pattern"/>
+   </xs:choice>
+  </xs:group>
+
+  <xs:group name="simpleRestrictionModel">
+   <xs:sequence>
+    <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+    <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+   </xs:sequence>
+  </xs:group>
+
+  <xs:element name="restriction" id="restriction">
+   <xs:complexType>
+    <xs:annotation>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+          base attribute and simpleType child are mutually
+          exclusive, but one or other is required
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexContent>
+        <xs:extension base="xs:annotated">
+         <xs:group ref="xs:simpleRestrictionModel"/>
+         <xs:attribute name="base" type="xs:QName" use="optional"/>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="list" id="list">
+   <xs:complexType>
+    <xs:annotation>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#element-list">
+          itemType attribute and simpleType child are mutually
+          exclusive, but one or other is required
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexContent>
+        <xs:extension base="xs:annotated">
+          <xs:sequence>
+            <xs:element name="simpleType" type="xs:localSimpleType"
+                minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="union" id="union">
+   <xs:complexType>
+    <xs:annotation>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#element-union">
+          memberTypes attribute must be non-empty or there must be
+          at least one simpleType child
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexContent>
+        <xs:extension base="xs:annotated">
+          <xs:sequence>
+            <xs:element name="simpleType" type="xs:localSimpleType"
+                minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+          <xs:attribute name="memberTypes" use="optional">
+            <xs:simpleType>
+              <xs:list itemType="xs:QName"/>
+            </xs:simpleType>
+          </xs:attribute>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:complexType name="facet">
+    <xs:complexContent>
+      <xs:extension base="xs:annotated">
+        <xs:attribute name="value" use="required"/>
+        <xs:attribute name="fixed" type="xs:boolean" use="optional"
+                      default="false"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+ 
+ <xs:complexType name="noFixedFacet">
+  <xs:complexContent>
+   <xs:restriction base="xs:facet">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="fixed" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+  <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:complexType name="numFacet">
+    <xs:complexContent>
+      <xs:restriction base="xs:facet">
+       <xs:sequence>
+         <xs:element ref="xs:annotation" minOccurs="0"/>
+       </xs:sequence>
+       <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+      </xs:restriction>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:element name="totalDigits" id="totalDigits">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:restriction base="xs:numFacet">
+          <xs:sequence>
+            <xs:element ref="xs:annotation" minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+        </xs:restriction>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="length" id="length" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="minLength" id="minLength" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+    </xs:annotation>
+  </xs:element>
+  
+  <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="whiteSpace" id="whiteSpace">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:restriction base="xs:facet">
+          <xs:sequence>
+            <xs:element ref="xs:annotation" minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="value" use="required">
+            <xs:simpleType>
+              <xs:restriction base="xs:NMTOKEN">
+                <xs:enumeration value="preserve"/>
+                <xs:enumeration value="replace"/>
+                <xs:enumeration value="collapse"/>
+              </xs:restriction>
+            </xs:simpleType>
+          </xs:attribute>
+        </xs:restriction>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="pattern" id="pattern" type="xs:noFixedFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+    </xs:annotation>
+  </xs:element>
+
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/primer/address.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/primer/address.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/primer/address.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+<schema targetNamespace="http://www.example.com/IPO"
+        xmlns="http://www.w3.org/2001/XMLSchema"
+        xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+  <documentation xml:lang="en">
+   Addresses for International Purchase order schema
+   Copyright 2000 Example.com. All rights reserved.
+  </documentation> 
+ </annotation>
+
+ <complexType name="Address">
+  <sequence>
+   <element name="name"   type="string"/>
+   <element name="street" type="string"/>
+   <element name="city"   type="string"/>
+  </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+  <complexContent>
+   <extension base="ipo:Address">
+    <sequence>
+     <element name="state" type="ipo:USState"/>
+     <element name="zip"   type="positiveInteger"/>
+    </sequence>
+   </extension>
+  </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+  <complexContent>
+   <extension base="ipo:Address">
+    <sequence>
+     <element name="postcode" type="ipo:UKPostcode"/>
+    </sequence>
+    <attribute name="exportCode" type="positiveInteger" fixed="1"/>
+   </extension>
+  </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries --> 
+
+ <simpleType name="USState">
+  <restriction base="string">
+   <enumeration value="AK"/>
+   <enumeration value="AL"/>
+   <enumeration value="AR"/>
+   <!-- and so on ... -->
+  </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+   <restriction base="string">
+     <length value="7" fixed="true"/>
+   </restriction>
+ </simpleType>
+
+ <!-- simple type definition for UKPostcode -->
+ <simpleType name="UKPostcode">
+   <restriction base="ipo:Postcode">
+     <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}"/>
+   </restriction>
+ </simpleType>
+</schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/primer/currency.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/primer/currency.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/primer/currency.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+<schema targetNamespace="http://www.example.com/Currency"
+        xmlns:c="http://www.example.com/Currency"
+        xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <annotation>
+  <documentation xml:lang="en">
+   Definition of Currency type based on ISO 4217
+  </documentation> 
+ </annotation>
+
+ <complexType name="Currency">
+  <simpleContent>
+   <extension base="decimal">
+    <attribute name="name">
+     <simpleType>
+      <restriction base="string">
+      
+        <enumeration value="AED">
+         <annotation>
+          <documentation xml:lang="en">
+           United Arab Emirates: Dirham (1 Dirham = 100 Fils)
+          </documentation>
+         </annotation>
+        </enumeration>
+      
+        <enumeration value="AFA">
+         <annotation>
+          <documentation xml:lang="en">
+           Afghanistan: Afghani (1 Afghani = 100 Puls)
+          </documentation>
+         </annotation>
+        </enumeration>
+      
+        <enumeration value="ALL">
+         <annotation>
+          <documentation xml:lang="en">
+           Albania, Lek (1 Lek = 100 Qindarka)
+          </documentation>
+         </annotation>
+        </enumeration>
+      
+        <!-- and other currencies -->
+
+      </restriction>      
+     </simpleType>
+    </attribute>
+   </extension>
+  </simpleContent>
+ </complexType>
+
+</schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/primer/ipo.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/primer/ipo.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/primer/ipo.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,59 @@
+<schema targetNamespace="http://www.example.com/IPO"
+        xmlns="http://www.w3.org/2001/XMLSchema"
+        xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+  <documentation xml:lang="en">
+   International Purchase order schema for Example.com
+   Copyright 2000 Example.com. All rights reserved.
+  </documentation> 
+ </annotation>
+
+ <!-- include address constructs -->
+ <include
+  schemaLocation="http://www.example.com/schemas/address.xsd"/>
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType"/>
+
+ <element name="comment" type="string"/>
+
+ <complexType name="PurchaseOrderType">
+  <sequence>
+   <element name="shipTo"     type="ipo:Address"/>
+   <element name="billTo"     type="ipo:Address"/>
+   <element ref="ipo:comment" minOccurs="0"/>
+   <element name="items"      type="ipo:Items"/>
+  </sequence>
+  <attribute name="orderDate" type="date"/>
+ </complexType>
+
+ <complexType name="Items">
+  <sequence>
+   <element name="item" minOccurs="0" maxOccurs="unbounded">
+    <complexType>
+     <sequence>
+      <element name="productName" type="string"/>
+      <element name="quantity">
+       <simpleType>
+        <restriction base="positiveInteger">
+         <maxExclusive value="100"/>
+        </restriction>
+       </simpleType>
+      </element>
+      <element name="USPrice"    type="decimal"/>
+      <element ref="ipo:comment" minOccurs="0"/>
+      <element name="shipDate"   type="date" minOccurs="0"/>
+     </sequence>
+     <attribute name="partNum" type="ipo:SKU" use="required"/>
+    </complexType>
+   </element>
+  </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+  <restriction base="string">
+   <pattern value="\d{3}-[A-Z]{2}"/>
+  </restriction>
+ </simpleType>
+
+</schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/primer/po.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/primer/po.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/primer/po.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,66 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:annotation>
+  <xsd:documentation xml:lang="en">
+   Purchase order schema for Example.com.
+   Copyright 2000 Example.com. All rights reserved.
+  </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
+
+ <xsd:element name="comment" type="xsd:string"/>
+
+ <xsd:complexType name="PurchaseOrderType">
+  <xsd:sequence>
+   <xsd:element name="shipTo" type="USAddress"/>
+   <xsd:element name="billTo" type="USAddress"/>
+   <xsd:element ref="comment" minOccurs="0"/>
+   <xsd:element name="items"  type="Items"/>
+  </xsd:sequence>
+  <xsd:attribute name="orderDate" type="xsd:date"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="USAddress">
+  <xsd:sequence>
+   <xsd:element name="name"   type="xsd:string"/>
+   <xsd:element name="street" type="xsd:string"/>
+   <xsd:element name="city"   type="xsd:string"/>
+   <xsd:element name="state"  type="xsd:string"/>
+   <xsd:element name="zip"    type="xsd:decimal"/>
+  </xsd:sequence>
+  <xsd:attribute name="country" type="xsd:NMTOKEN"
+     fixed="US"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Items">
+  <xsd:sequence>
+   <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
+    <xsd:complexType>
+     <xsd:sequence>
+      <xsd:element name="productName" type="xsd:string"/>
+      <xsd:element name="quantity">
+       <xsd:simpleType>
+        <xsd:restriction base="xsd:positiveInteger">
+         <xsd:maxExclusive value="100"/>
+        </xsd:restriction>
+       </xsd:simpleType>
+      </xsd:element>
+      <xsd:element name="USPrice"  type="xsd:decimal"/>
+      <xsd:element ref="comment"   minOccurs="0"/>
+      <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
+     </xsd:sequence>
+     <xsd:attribute name="partNum" type="SKU" use="required"/>
+    </xsd:complexType>
+   </xsd:element>
+  </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- Stock Keeping Unit, a code for identifying products -->
+ <xsd:simpleType name="SKU">
+  <xsd:restriction base="xsd:string">
+   <xsd:pattern value="\d{3}-[A-Z]{2}"/>
+  </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/primer/po1.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/primer/po1.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/primer/po1.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,59 @@
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+        xmlns:po="http://www.example.com/PO1"
+        targetNamespace="http://www.example.com/PO1"
+        elementFormDefault="unqualified"
+        attributeFormDefault="unqualified">
+
+ <element name="purchaseOrder" type="po:PurchaseOrderType"/>
+ <element name="comment"       type="string"/>
+
+ <complexType name="PurchaseOrderType">
+  <sequence>
+   <element name="shipTo"    type="po:USAddress"/>
+   <element name="billTo"    type="po:USAddress"/>
+   <element ref="po:comment" minOccurs="0"/>
+   <element name="items"  type="po:Items"/>
+  </sequence>
+  <attribute name="orderDate" type="xsd:date"/>
+ </complexType>
+
+ <complexType name="USAddress">
+  <sequence>
+   <element name="name"   type="string"/>
+   <element name="street" type="string"/>
+   <element name="city"   type="string"/>
+   <element name="state"  type="string"/>
+   <element name="zip"    type="decimal"/>
+  </sequence>
+ </complexType>
+
+ <complexType name="Items">
+  <sequence>
+   <element name="item" minOccurs="0" maxOccurs="unbounded">
+    <complexType>
+     <sequence>
+      <element name="productName" type="string"/>
+      <element name="quantity">
+       <simpleType>
+        <restriction base="positiveInteger">
+         <maxExclusive value="100"/>
+        </restriction>
+       </simpleType>
+      </element>
+      <element name="USPrice"  type="decimal"/>
+      <element ref="comment"   minOccurs="0"/>
+      <element name="shipDate" type="date" minOccurs="0"/>
+     </sequence>
+     <attribute name="partNum" type="po:SKU" use="required"/>
+    </complexType>
+   </element>
+  </sequence>
+ </complexType>
+
+ <!-- Stock Keeping Unit, a code for identifying products -->
+ <simpleType name="SKU">
+  <restriction base="string">
+   <pattern value="\d{3}-[A-Z]{2}"/>
+  </restriction>
+ </simpleType>
+</schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/primer/report.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/primer/report.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/primer/report.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,80 @@
+<schema targetNamespace="http://www.example.com/Report"
+        xmlns="http://www.w3.org/2001/XMLSchema"
+        xmlns:r="http://www.example.com/Report"
+        xmlns:xipo="http://www.example.com/IPO"
+        elementFormDefault="qualified">
+
+ <!-- for SKU -->
+ <import namespace="http://www.example.com/IPO"/>
+
+ <annotation>
+  <documentation xml:lang="en">
+   Report schema for Example.com
+   Copyright 2000 Example.com. All rights reserved.
+  </documentation> 
+ </annotation>
+
+ <element name="purchaseReport">
+  <complexType>
+   <sequence>
+    <element name="regions" type="r:RegionsType">
+     <keyref name="dummy2" refer="r:pNumKey">
+      <selector xpath="r:zip/r:part"/>
+      <field xpath="@number"/>
+     </keyref>
+    </element>
+
+    <element name="parts" type="r:PartsType"/>
+   </sequence>
+   <attribute name="period"       type="duration"/>
+   <attribute name="periodEnding" type="date"/>
+  </complexType>
+  
+  <unique name="dummy1">
+   <selector xpath="r:regions/r:zip"/>
+   <field xpath="@code"/>
+  </unique>
+
+  <key name="pNumKey">
+   <selector xpath="r:parts/r:part"/>
+   <field xpath="@number"/>
+  </key>
+ </element>
+
+ <complexType name="RegionsType">
+  <sequence>
+   <element name="zip" maxOccurs="unbounded">
+    <complexType>
+     <sequence>
+      <element name="part" maxOccurs="unbounded">
+       <complexType>
+        <complexContent>
+         <restriction base="anyType">
+          <attribute name="number"   type="xipo:SKU"/>
+          <attribute name="quantity" type="positiveInteger"/>
+         </restriction>
+        </complexContent>
+       </complexType>
+      </element>
+     </sequence>
+     <attribute name="code" type="positiveInteger"/>
+    </complexType>
+   </element>
+  </sequence>
+ </complexType>
+
+ <complexType name="PartsType">
+  <sequence>
+   <element name="part" maxOccurs="unbounded">
+    <complexType>
+     <simpleContent>
+      <extension base="string">
+       <attribute name="number" type="xipo:SKU"/>
+      </extension>
+     </simpleContent>
+    </complexType>
+   </element>
+  </sequence>
+ </complexType>
+
+</schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/structures.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/structures.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/structures.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1181 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" >
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all"
+  elementFormDefault="qualified" version="Id: XMLSchema.xsd,v 1.48 2001/04/24 18:56:39 ht Exp "
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.w3.org/2001/XMLSchema structures.xsd">
+
+ <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/structures.html">
+   The schema corresponding to this document is normative,
+   with respect to the syntactic constraints it expresses in the
+   XML Schema language.  The documentation (within &lt;documentation> elements)
+   below, is not normative, but rather highlights important aspects of
+   the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+   <xs:documentation>
+   The simpleType element and all of its members are defined
+   in datatypes.xsd</xs:documentation>
+ </xs:annotation>
+
+ <xs:include schemaLocation="datatypes.xsd"/>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd">
+   <xs:annotation>
+     <xs:documentation>
+       Get access to the xml: attribute groups for xml:lang
+       as declared on 'schema' and 'documentation' below
+     </xs:documentation>
+   </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+   <xs:annotation>
+     <xs:documentation>
+       This type is extended by almost all schema types
+       to allow attributes from other namespaces to be
+       added to user schemas.
+     </xs:documentation>
+   </xs:annotation>
+   <xs:complexContent>
+     <xs:restriction base="xs:anyType">
+       <xs:anyAttribute namespace="##other" processContents="lax"/>
+     </xs:restriction>
+   </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+   <xs:annotation>
+     <xs:documentation>
+       This type is extended by all types which allow annotation
+       other than &lt;schema&gt; itself
+     </xs:documentation>
+   </xs:annotation>
+   <xs:complexContent>
+     <xs:extension base="xs:openAttrs">
+       <xs:sequence>
+	 <xs:element ref="xs:annotation" minOccurs="0"/>
+       </xs:sequence>
+       <xs:attribute name="id" type="xs:ID"/>
+     </xs:extension>
+   </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+  <xs:annotation>
+   <xs:documentation>
+   This group is for the
+   elements which occur freely at the top level of schemas.
+   All of their types are based on the "annotated" type by extension.</xs:documentation>
+  </xs:annotation>
+  <xs:choice>
+   <xs:group ref="xs:redefinable"/>
+   <xs:element ref="xs:element"/>
+   <xs:element ref="xs:attribute"/>
+   <xs:element ref="xs:notation"/>
+  </xs:choice>
+ </xs:group>
+ 
+ <xs:group name="redefinable">
+  <xs:annotation>
+   <xs:documentation>
+   This group is for the
+   elements which can self-redefine (see &lt;redefine> below).</xs:documentation>
+  </xs:annotation>
+  <xs:choice>
+   <xs:element ref="xs:simpleType"/>
+   <xs:element ref="xs:complexType"/>
+   <xs:element ref="xs:group"/>
+   <xs:element ref="xs:attributeGroup"/>
+  </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:NMTOKEN">
+   <xs:enumeration value="qualified"/>
+   <xs:enumeration value="unqualified"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:derivationControl">
+   <xs:enumeration value="extension"/>
+   <xs:enumeration value="restriction"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+   <xs:documentation>
+   #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>    
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="#all"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:list itemType="xs:reducedDerivationControl"/>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+  <xs:annotation>
+    <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:openAttrs">
+     <xs:sequence>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+       <xs:element ref="xs:include"/>
+       <xs:element ref="xs:import"/>
+       <xs:element ref="xs:redefine"/>
+       <xs:element ref="xs:annotation"/>
+      </xs:choice>
+      <xs:sequence minOccurs="0" maxOccurs="unbounded">
+       <xs:group ref="xs:schemaTop"/>
+       <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+      </xs:sequence>
+     </xs:sequence>
+     <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+     <xs:attribute name="version" type="xs:token"/>
+     <xs:attribute name="finalDefault" type="xs:derivationSet" use="optional" default=""/>
+     <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+     <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+     <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+     <xs:attribute name="id" type="xs:ID"/>
+     <xs:attribute ref="xml:lang"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+
+  <xs:key name="element">
+   <xs:selector xpath="xs:element"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+  <xs:key name="attribute">
+   <xs:selector xpath="xs:attribute"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+  <xs:key name="type">
+   <xs:selector xpath="xs:complexType|xs:simpleType"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+ 
+  <xs:key name="group">
+   <xs:selector xpath="xs:group"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+ 
+  <xs:key name="attributeGroup">
+   <xs:selector xpath="xs:attributeGroup"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+ 
+  <xs:key name="notation">
+   <xs:selector xpath="xs:notation"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+  <xs:key name="identityConstraint">
+   <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+  <xs:annotation><xs:documentation>
+   for maxOccurs</xs:documentation></xs:annotation>
+  <xs:union memberTypes="xs:nonNegativeInteger">
+   <xs:simpleType>
+    <xs:restriction base="xs:NMTOKEN">
+     <xs:enumeration value="unbounded"/>
+    </xs:restriction>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+  <xs:annotation><xs:documentation>
+   for all particles</xs:documentation></xs:annotation>
+  <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+  <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+  <xs:annotation><xs:documentation>
+   for element, group and attributeGroup,
+   which both define and reference</xs:documentation></xs:annotation>
+  <xs:attribute name="name" type="xs:NCName"/>
+  <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+  <xs:annotation>
+    <xs:documentation>
+   'complexType' uses this</xs:documentation></xs:annotation>
+  <xs:choice>
+   <xs:element name="group" type="xs:groupRef"/>
+   <xs:element ref="xs:all"/>
+   <xs:element ref="xs:choice"/>
+   <xs:element ref="xs:sequence"/>
+  </xs:choice>
+ </xs:group>
+ 
+ 
+
+ <xs:group name="nestedParticle">
+  <xs:choice>
+   <xs:element name="element" type="xs:localElement"/>
+   <xs:element name="group" type="xs:groupRef"/>
+   <xs:element ref="xs:choice"/>
+   <xs:element ref="xs:sequence"/>
+   <xs:element ref="xs:any"/>
+  </xs:choice>
+ </xs:group>
+ 
+ <xs:group name="particle">
+  <xs:choice>
+   <xs:element name="element" type="xs:localElement"/>
+   <xs:element name="group" type="xs:groupRef"/>
+   <xs:element ref="xs:all"/>
+   <xs:element ref="xs:choice"/>
+   <xs:element ref="xs:sequence"/>
+   <xs:element ref="xs:any"/>
+  </xs:choice>
+ </xs:group>
+ 
+ <xs:complexType name="attribute">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+    </xs:sequence>
+    <xs:attributeGroup ref="xs:defRef"/>
+    <xs:attribute name="type" type="xs:QName"/>
+    <xs:attribute name="use" use="optional" default="optional">
+     <xs:simpleType>
+      <xs:restriction base="xs:NMTOKEN">
+       <xs:enumeration value="prohibited"/>
+       <xs:enumeration value="optional"/>
+       <xs:enumeration value="required"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:attribute>
+    <xs:attribute name="default" type="xs:string"/>
+    <xs:attribute name="fixed" type="xs:string"/>
+    <xs:attribute name="form" type="xs:formChoice"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="topLevelAttribute">
+  <xs:complexContent>
+   <xs:restriction base="xs:attribute">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:attribute name="form" use="prohibited"/>
+    <xs:attribute name="use" use="prohibited"/>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+  <xs:sequence>
+   <xs:choice minOccurs="0" maxOccurs="unbounded">
+    <xs:element name="attribute" type="xs:attribute"/>
+    <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+   </xs:choice>
+   <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+  </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+  <xs:choice>
+      <xs:element ref="xs:simpleContent"/>
+      <xs:element ref="xs:complexContent"/>
+      <xs:sequence>
+       <xs:annotation>
+        <xs:documentation>
+   This branch is short for
+   &lt;complexContent>
+   &lt;restriction base="xs:anyType">
+   ...
+   &lt;/restriction>
+   &lt;/complexContent></xs:documentation>
+       </xs:annotation>
+       <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+       <xs:group ref="xs:attrDecls"/>
+      </xs:sequence>
+  </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:group ref="xs:complexTypeModel"/>
+    <xs:attribute name="name" type="xs:NCName">
+     <xs:annotation>
+      <xs:documentation>
+      Will be restricted to required or forbidden</xs:documentation>
+     </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+     <xs:annotation>
+      <xs:documentation>
+      Not allowed if simpleContent child is chosen.
+      May be overriden by setting on complexContent child.</xs:documentation>
+    </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+    <xs:attribute name="final" type="xs:derivationSet"/>
+    <xs:attribute name="block" type="xs:derivationSet"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="topLevelComplexType">
+  <xs:complexContent>
+   <xs:restriction base="xs:complexType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:complexTypeModel"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:NCName" use="required"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="localComplexType">
+  <xs:complexContent>
+   <xs:restriction base="xs:complexType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:complexTypeModel"/>
+    </xs:sequence>
+    <xs:attribute name="name" use="prohibited"/>
+    <xs:attribute name="abstract" use="prohibited"/>
+    <xs:attribute name="final" use="prohibited"/>
+    <xs:attribute name="block" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="restrictionType">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:choice>
+      <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+      <xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/>
+     </xs:choice>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:attribute name="base" type="xs:QName" use="required"/>
+   </xs:extension>
+  </xs:complexContent>       
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+  <xs:complexContent>
+   <xs:restriction base="xs:restrictionType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+   </xs:restriction>
+  </xs:complexContent>       
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:attribute name="base" type="xs:QName" use="required"/>
+   </xs:extension>
+  </xs:complexContent>       
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:choice>
+      <xs:element name="restriction" type="xs:complexRestrictionType"/>
+      <xs:element name="extension" type="xs:extensionType"/>
+     </xs:choice>     
+     <xs:attribute name="mixed" type="xs:boolean">
+      <xs:annotation>
+       <xs:documentation>
+       Overrides any setting on complexType parent.</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+  <xs:complexContent>
+   <xs:restriction base="xs:restrictionType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+  <xs:complexContent>
+   <xs:restriction base="xs:extensionType">
+    <xs:sequence>
+     <xs:annotation>
+      <xs:documentation>
+      No typeDefParticle group reference</xs:documentation>
+     </xs:annotation>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:choice>
+      <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+      <xs:element name="extension" type="xs:simpleExtensionType"/>
+     </xs:choice>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+ 
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+  </xs:annotation>
+ </xs:element>
+
+
+  <xs:simpleType name="blockSet">
+   <xs:annotation>
+    <xs:documentation>
+    A utility type, not for public use</xs:documentation>
+    <xs:documentation>
+    #all or (possibly empty) subset of {substitution, extension,
+    restriction}</xs:documentation>
+   </xs:annotation>
+   <xs:union>
+    <xs:simpleType>    
+     <xs:restriction base="xs:token">
+      <xs:enumeration value="#all"/>
+     </xs:restriction>
+    </xs:simpleType>
+    <xs:simpleType>
+     <xs:list>
+      <xs:simpleType>
+       <xs:restriction base="xs:derivationControl">
+        <xs:enumeration value="extension"/>
+        <xs:enumeration value="restriction"/>
+        <xs:enumeration value="substitution"/>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:list>
+    </xs:simpleType>
+   </xs:union>  
+  </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+  <xs:annotation>
+   <xs:documentation>
+   The element element can be used either
+   at the top level to define an element-type binding globally,
+   or within a content model to either reference a globally-defined
+   element or type or declare an element-type binding locally.
+   The ref form is not allowed at the top level.</xs:documentation>
+  </xs:annotation>
+
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attributeGroup ref="xs:defRef"/>
+    <xs:attribute name="type" type="xs:QName"/>
+    <xs:attribute name="substitutionGroup" type="xs:QName"/>
+    <xs:attributeGroup ref="xs:occurs"/>
+    <xs:attribute name="default" type="xs:string"/>
+    <xs:attribute name="fixed" type="xs:string"/>
+    <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+    <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+    <xs:attribute name="final" type="xs:derivationSet"/>
+    <xs:attribute name="block" type="xs:blockSet"/>
+    <xs:attribute name="form" type="xs:formChoice"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="topLevelElement">
+  <xs:complexContent>
+   <xs:restriction base="xs:element">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:attribute name="form" use="prohibited"/>
+    <xs:attribute name="minOccurs" use="prohibited"/>
+    <xs:attribute name="maxOccurs" use="prohibited"/>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="localElement">
+  <xs:complexContent>
+   <xs:restriction base="xs:element">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="substitutionGroup" use="prohibited"/>
+    <xs:attribute name="final" use="prohibited"/>
+    <xs:attribute name="abstract" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+  <xs:annotation>
+   <xs:documentation>
+   group type for explicit groups, named top-level groups and
+   group references</xs:documentation>
+  </xs:annotation>
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+    <xs:attributeGroup ref="xs:defRef"/>
+    <xs:attributeGroup ref="xs:occurs"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="realGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:group">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0" maxOccurs="1">
+      <xs:element ref="xs:all"/>
+      <xs:element ref="xs:choice"/>
+      <xs:element ref="xs:sequence"/>
+     </xs:choice>
+    </xs:sequence>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+  <xs:annotation>
+   <xs:documentation>Should derive this from realGroup, but too complicated 
+                      for now</xs:documentation>
+  </xs:annotation>
+  <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="1" maxOccurs="1">
+      <xs:element name="all">
+       <xs:complexType>
+        <xs:complexContent>
+         <xs:restriction base="xs:all">
+          <xs:group ref="xs:allModel"/>
+          <xs:attribute name="minOccurs" use="prohibited"/>
+          <xs:attribute name="maxOccurs" use="prohibited"/>
+         </xs:restriction>
+        </xs:complexContent>
+       </xs:complexType>
+      </xs:element>
+      <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+      <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+     </xs:choice>
+    </xs:sequence>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:attribute name="minOccurs" use="prohibited"/>
+    <xs:attribute name="maxOccurs" use="prohibited"/>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+  <xs:complexContent>
+   <xs:restriction base="xs:realGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="required" type="xs:QName"/>
+    <xs:attribute name="name" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+  <xs:annotation>
+   <xs:documentation>
+   group type for the three kinds of group</xs:documentation>
+  </xs:annotation>
+  <xs:complexContent>
+   <xs:restriction base="xs:group">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+    <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="simpleExplicitGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:explicitGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="minOccurs" use="prohibited"/>
+    <xs:attribute name="maxOccurs" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:group name="allModel">
+  <xs:sequence>
+      <xs:element ref="xs:annotation" minOccurs="0"/>
+      <xs:element name="element" minOccurs="0" maxOccurs="unbounded">
+       <xs:complexType>
+        <xs:annotation>
+         <xs:documentation>restricted max/min</xs:documentation>
+        </xs:annotation>
+        <xs:complexContent>
+         <xs:restriction base="xs:localElement">
+          <xs:sequence>
+           <xs:element ref="xs:annotation" minOccurs="0"/>
+           <xs:choice minOccurs="0">
+            <xs:element name="simpleType" type="xs:localSimpleType"/>
+            <xs:element name="complexType" type="xs:localComplexType"/>
+           </xs:choice>
+           <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+          <xs:attribute name="minOccurs" use="optional" default="1">
+           <xs:simpleType>
+            <xs:restriction base="xs:nonNegativeInteger">
+             <xs:enumeration value="0"/>
+             <xs:enumeration value="1"/>
+            </xs:restriction>
+           </xs:simpleType>
+          </xs:attribute>
+          <xs:attribute name="maxOccurs" use="optional" default="1">
+           <xs:simpleType>
+            <xs:restriction base="xs:allNNI">
+             <xs:enumeration value="0"/>
+             <xs:enumeration value="1"/>
+            </xs:restriction>
+           </xs:simpleType>
+          </xs:attribute>
+         </xs:restriction>
+        </xs:complexContent>
+       </xs:complexType>    
+      </xs:element>
+     </xs:sequence>
+ </xs:group>
+
+  <xs:complexType name="all">
+   <xs:annotation>
+    <xs:documentation>
+   Only elements allowed inside</xs:documentation>
+   </xs:annotation>
+   <xs:complexContent>
+    <xs:restriction base="xs:explicitGroup">
+     <xs:group ref="xs:allModel"/>
+     <xs:attribute name="minOccurs" use="optional" default="1">
+      <xs:simpleType>
+       <xs:restriction base="xs:nonNegativeInteger">
+        <xs:enumeration value="0"/>
+        <xs:enumeration value="1"/>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+     <xs:attribute name="maxOccurs" use="optional" default="1">
+      <xs:simpleType>
+       <xs:restriction base="xs:allNNI">
+        <xs:enumeration value="1"/>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+    </xs:restriction>
+   </xs:complexContent>
+  </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+    <xs:attribute name="processContents" use="optional" default="strict">
+     <xs:simpleType>
+      <xs:restriction base="xs:NMTOKEN">
+       <xs:enumeration value="skip"/>
+       <xs:enumeration value="lax"/>
+       <xs:enumeration value="strict"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:attribute>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:wildcard">
+     <xs:attributeGroup ref="xs:occurs"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+  <xs:annotation>
+   <xs:documentation>
+   simple type for the value of the 'namespace' attr of
+   'any' and 'anyAttribute'</xs:documentation>
+  </xs:annotation>
+  <xs:annotation>
+   <xs:documentation>
+   Value is
+              ##any      - - any non-conflicting WFXML/attribute at all
+
+              ##other    - - any non-conflicting WFXML/attribute from
+                              namespace other than targetNS
+
+              ##local    - - any unqualified non-conflicting WFXML/attribute 
+
+              one or     - - any non-conflicting WFXML/attribute from
+              more URI        the listed namespaces
+              references
+              (space separated)
+
+    ##targetNamespace or ##local may appear in the above list, to
+        refer to the targetNamespace of the enclosing
+        schema or an absent targetNamespace respectively</xs:documentation>
+  </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="##any"/>
+     <xs:enumeration value="##other"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:list>
+     <xs:simpleType>
+      <xs:union memberTypes="xs:anyURI">
+       <xs:simpleType>
+        <xs:restriction base="xs:token">
+         <xs:enumeration value="##targetNamespace"/>
+         <xs:enumeration value="##local"/>
+        </xs:restriction>
+       </xs:simpleType>
+      </xs:union>
+     </xs:simpleType>
+    </xs:list>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:group ref="xs:attrDecls"/>
+    <xs:attributeGroup ref="xs:defRef"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="namedAttributeGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:attributeGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+    <xs:attribute name="ref" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+  <xs:complexContent>
+   <xs:restriction base="xs:attributeGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="required" type="xs:QName"/>
+    <xs:attribute name="name" use="prohibited"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:openAttrs">
+     <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element ref="xs:annotation"/>
+      <xs:group ref="xs:redefinable"/>
+     </xs:choice>
+     <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+     <xs:attribute name="id" type="xs:ID"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:attribute name="namespace" type="xs:anyURI"/>
+     <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+  </xs:annotation>
+  <xs:complexType>
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+     <xs:attribute name="xpath" use="required">
+      <xs:simpleType>
+       <xs:annotation>
+        <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+        <xs:documentation>A utility type, not for public
+use</xs:documentation>
+       </xs:annotation>
+       <xs:restriction base="xs:token">
+        <xs:annotation>
+         <xs:documentation>The following pattern is intended to allow XPath
+                           expressions per the following EBNF:
+	  Selector    ::=    Path ( '|' Path )*  
+	  Path    ::=    ('.//')? Step ( '/' Step )*  
+	  Step    ::=    '.' | NameTest  
+	  NameTest    ::=    QName | '*' | NCName ':' '*'  
+                           child:: is also allowed
+         </xs:documentation>
+        </xs:annotation>
+        <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+        </xs:pattern>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+  </xs:annotation>
+  <xs:complexType>
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+     <xs:attribute name="xpath" use="required">
+      <xs:simpleType>
+       <xs:annotation>
+        <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+        <xs:documentation>A utility type, not for public
+use</xs:documentation>
+       </xs:annotation>
+       <xs:restriction base="xs:token">
+        <xs:annotation>
+         <xs:documentation>The following pattern is intended to allow XPath
+                           expressions per the same EBNF as for selector,
+                           with the following change:
+          Path    ::=    ('.//')? ( Step '/' )* ( Step | '@' NameTest ) 
+         </xs:documentation>
+        </xs:annotation>
+        <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+        </xs:pattern>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:element ref="xs:selector"/>
+     <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:NCName" use="required"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+  <xs:annotation>
+   <xs:documentation>The three kinds of identity constraints, all with
+                     type of or derived from 'keybase'.
+   </xs:documentation>
+  </xs:annotation>
+  <xs:choice>
+   <xs:element ref="xs:unique"/>
+   <xs:element ref="xs:key"/>
+   <xs:element ref="xs:keyref"/>
+  </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+  </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+  </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:keybase">
+     <xs:attribute name="refer" type="xs:QName" use="required"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:attribute name="name" type="xs:NCName" use="required"/>
+     <xs:attribute name="public" type="xs:public" use="required"/>
+     <xs:attribute name="system" type="xs:anyURI"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+   <xs:documentation>
+   A public identifier, per ISO 8879</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+   <xs:annotation>
+     <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+   </xs:annotation>
+   <xs:complexType mixed="true">
+     <xs:sequence minOccurs="0" maxOccurs="unbounded">
+       <xs:any processContents="lax"/>
+     </xs:sequence>
+     <xs:attribute name="source" type="xs:anyURI"/>
+   </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+   <xs:annotation>
+     <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+   </xs:annotation>
+   <xs:complexType mixed="true">
+     <xs:sequence minOccurs="0" maxOccurs="unbounded">
+       <xs:any processContents="lax"/>
+     </xs:sequence>
+     <xs:attribute name="source" type="xs:anyURI"/>
+   <xs:attribute ref="xml:lang"/>
+   </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+   <xs:annotation>
+     <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+   </xs:annotation>
+   <xs:complexType>
+    <xs:complexContent>
+     <xs:extension base="xs:openAttrs">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+       <xs:element ref="xs:appinfo"/>
+       <xs:element ref="xs:documentation"/>
+      </xs:choice>
+      <xs:attribute name="id" type="xs:ID"/>
+     </xs:extension>
+    </xs:complexContent>
+   </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+  <xs:documentation>
+   notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+ 
+ <xs:complexType name="anyType" mixed="true">
+  <xs:annotation>
+   <xs:documentation>
+   Not the real urType, but as close an approximation as we can
+   get in the XML representation</xs:documentation>
+  </xs:annotation>
+  <xs:sequence>
+   <xs:any minOccurs="0" maxOccurs="unbounded"/>
+  </xs:sequence>
+  <xs:anyAttribute/>
+ </xs:complexType>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/examples/xs/xml.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/examples/xs/xml.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/examples/xs/xml.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,86 @@
+<?xml version='1.0'?>
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" >
+<xs:schema
+    targetNamespace="http://www.w3.org/XML/1998/namespace"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="en"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema structures.xsd">
+
+ <xs:annotation>
+  <xs:documentation>
+   See http://www.w3.org/XML/1998/namespace.html and
+   http://www.w3.org/TR/REC-xml for information about this namespace.
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+  <xs:documentation>This schema defines attributes and an attribute group
+        suitable for use by
+        schemas wishing to allow xml:base, xml:lang or xml:space attributes
+        on elements they define.
+
+        To enable this, such a schema must import this schema
+        for the XML namespace, e.g. as follows:
+        &lt;schema . . .>
+         . . .
+         &lt;import namespace="http://www.w3.org/XML/1998/namespace"
+                    schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
+
+        Subsequently, qualified reference to any of the attributes
+        or the group defined below will have the desired effect, e.g.
+
+        &lt;type . . .>
+         . . .
+         &lt;attributeGroup ref="xml:specialAttrs"/>
+ 
+         will define a type which will schema-validate an instance
+         element with any of those attributes</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+  <xs:documentation>In keeping with the XML Schema WG's standard versioning
+   policy, this schema document will persist at
+   http://www.w3.org/2001/03/xml.xsd.
+   At the date of issue it can also be found at
+   http://www.w3.org/2001/xml.xsd.
+   The schema document at that URI may however change in the future,
+   in order to remain compatible with the latest version of XML Schema
+   itself.  In other words, if the XML Schema namespace changes, the version
+   of this document at
+   http://www.w3.org/2001/xml.xsd will change
+   accordingly; the version at
+   http://www.w3.org/2001/03/xml.xsd will not change.
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang" type="xs:language">
+  <xs:annotation>
+   <xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter
+         codes as the enumerated possible values . . .</xs:documentation>
+  </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="space" default="preserve">
+  <xs:simpleType>
+   <xs:restriction base="xs:NCName">
+    <xs:enumeration value="default"/>
+    <xs:enumeration value="preserve"/>
+   </xs:restriction>
+  </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI">
+  <xs:annotation>
+   <xs:documentation>See http://www.w3.org/TR/xmlbase/ for
+                     information about this attribute.</xs:documentation>
+  </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+  <xs:attribute ref="xml:base"/>
+  <xs:attribute ref="xml:lang"/>
+  <xs:attribute ref="xml:space"/>
+ </xs:attributeGroup>
+
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/jaxme.properties.sample
===================================================================
--- branches/jaxme/upstream/0.5.1/jaxme.properties.sample	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/jaxme.properties.sample	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+############################################################################
+# Copyright 2002-2004  The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# 
+############################################################################
+#
+#   Sample property file
+#
+#   JaxMe's build system depends on some external applications, which
+#   cannot be added to CVS. Reasons include size (in the case of Apache
+#   Forrest approximately 11MB), or licensing restrictions (in the
+#   case of JAXB).
+#
+#   To customize these settings, rename this file to "jaxb.properties"
+#   and edit it. You may also copy this file to your home directory
+#   as ".jaxb.properties" (more precisely: ${user.home}/.jaxb.properties),
+#   which takes precedence, if both exist. Note, that you need to remove
+#   the hash signs in front of the variables being defined.
+#
+############################################################################
+#
+#   Location of the Java Web Services Developer Pack (JWSDP 1.4). The
+#   JWSDP is available from http://java.sun.com/webservices and is
+#   required to build the distribution.
+#
+#jaxb.home=C:/Prg/jwsdp-1.4
+#jaxb.home=/usr/local/jwsdp-1.4
+#
+############################################################################
+#
+#   Location of the Apache Forrest distribution (forrest 0.5.1). Forrest
+#   is available from http://xml.apache.org/forrest/ and is required to build
+#   the documentation.
+#
+#forrest.home=C:/Prg/apache-forrest-0.5.1-bin
+#forrest.home=/usr/local/apache-forrest-0.5.1-bin
+#
+############################################################################
+#
+#   Location of the DocBook XSL stylesheets (docbook-xsl 1.62.4).
+#   DocBook XSL is available from http://sourceforge.net/projects/docbook
+#   and required to build the documentation, because the manual is written
+#   in DocBook XML.
+#
+#docbookxsl.home=C:/Prg/docbook-xsl-1.66.1
+#docbookxsl.home=/usr/local/docbook-xsl-1.66.1
+#
+############################################################################
+#
+#   Location of the DocBook XML DTDs (docbook-xml 4.2)
+#   DocBook XML is available from http://www.oasis-open.org/docbook/xml
+#   and required to build the documentation of the manual.
+#
+#docbook.home=C:/Prg/docbook-xml-4.2
+#docbook.home=/usr/local/docbook-xml-4.2
+#docbook.home=${forrest.home}/context/resources/schema/docbook/4.2
+#
+############################################################################
+#
+#   When sitting behind a proxy and using a validating parser, you might
+#   need to set the following variables:
+#
+#http.proxySet=true
+#http.proxyHost=httpprox.software-ag.de
+#http.proxyPort=8080
+#

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-DOM.html
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-DOM.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-DOM.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,113 @@
+<!-- $Id: LICENSE-DOM.html 231575 2003-10-08 08:43:39Z jochen $ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+                      "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <title>W3C IPR SOFTWARE NOTICE</title>
+  </head>
+  <body bgcolor="#FFFFFF" text="#000000">
+    <p>
+      Document Object Model Level 2 Core is a platform and 
+      language-neutral interface that allows programs and scripts to
+      dynamically access and update the content and structure of 
+      documents. The Document Object Model Level 2 Core builds on 
+      the Document Object Model Level 1 Core.
+    </p>
+    <p>
+      The DOM Level 2 Core is made of a set of core interfaces to 
+      create and manipulate the structure and contents of a document. 
+      The Core also contains specialized interfaces dedicated to XML.
+    </p>
+    <h1>
+      W3C IPR SOFTWARE NOTICE
+    </h1>
+    <h3>
+      Copyright &copy; 2000 <loc href="http://www.w3.org/">World Wide Web
+      Consortium</loc>, (<loc href="http://www.lcs.mit.edu/">Massachusetts
+      Institute of Technology</loc>, <loc href="http://www.inria.fr/">Institut
+      National de Recherche en Informatique et en Automatique</loc>, <loc
+      href="http://www.keio.ac.jp/">Keio University</loc>). All Rights
+      Reserved.
+    </h3>
+    <p>
+      The DOM bindings are published under the W3C Software Copyright Notice
+      and License. The software license requires "Notice of any changes or
+      modifications to the W3C files, including the date changes were made."
+      Consequently, modified versions of the DOM bindings must document that
+      they do not conform to the W3C standard; in the case of the IDL binding,
+      the pragma prefix can no longer be 'w3c.org'; in the case of the Java
+      binding, the package names can no longer be in the 'org.w3c' package.
+    </p>
+    <p>
+      <b>Note:</b> The original version of the W3C Software Copyright Notice
+      and License could be found at <a
+      href='http://www.w3.org/Consortium/Legal/copyright-software-19980720'>http://www.w3.org/Consortium/Legal/copyright-software-19980720</a>
+    </p>
+    <h3>
+      Copyright &copy; 1994-2000 <a href="http://www.w3.org/">World Wide Web
+      Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
+      Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
+      National de Recherche en Informatique et en Automatique</a>, <a
+      href="http://www.keio.ac.jp/">Keio University</a>). All Rights
+      Reserved. http://www.w3.org/Consortium/Legal/
+    </h3>
+    <p>
+      This W3C work (including software, documents, or other related items) is
+      being provided by the copyright holders under the following license. By
+      obtaining, using and/or copying this work, you (the licensee) agree that
+      you have read, understood, and will comply with the following terms and
+      conditions:
+    </p>
+    <p>
+      Permission to use, copy, and modify this software and its documentation,
+      with or without modification,&nbsp; for any purpose and without fee or
+      royalty is hereby granted, provided that you include the following on ALL
+      copies of the software and documentation or portions thereof, including
+      modifications, that you make:
+    </p>
+    <ol>
+      <li>
+	The full text of this NOTICE in a location viewable to users of the
+	redistributed or derivative work.
+      </li>
+      <li>
+	Any pre-existing intellectual property disclaimers, notices, or terms
+	and conditions. If none exist, a short notice of the following form
+	(hypertext is preferred, text is permitted) should be used within the
+	body of any redistributed or derivative code: "Copyright &copy;
+	[$date-of-software] <a href="http://www.w3.org/">World Wide Web
+	Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
+	Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
+	National de Recherche en Informatique et en Automatique</a>, <a
+	href="http://www.keio.ac.jp/">Keio University</a>).  All Rights
+	Reserved. http://www.w3.org/Consortium/Legal/"
+      </li>
+      <li>
+	Notice of any changes or modifications to the W3C files, including the
+	date changes were made. (We recommend you provide URIs to the location
+	from which the code is derived.)
+      </li>
+    </ol>
+    <p>
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
+      HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
+      INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
+      FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
+      DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
+      TRADEMARKS OR OTHER RIGHTS.
+    </p>
+    <p>
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+      CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+      DOCUMENTATION.
+    </p>
+    <p>
+      The name and trademarks of copyright holders may NOT be used in
+      advertising or publicity pertaining to the software without specific,
+      written prior permission. Title to copyright in this software and any
+      associated documentation will at all times remain with copyright
+      holders.
+    </p>
+  </body>
+</html>

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-SAX.html
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-SAX.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-SAX.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,17 @@
+ <html>
+ <head>SAX LICENSE</head>
+ <body>
+ <p>This license applies to all interfaces and classes in the 
+ org/xml/sax hierarchy.
+ </p>
+ <p>
+ <blockquote>
+ <em>This module, both source code and documentation, is in the
+ Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+ for further information.
+ </blockquote>
+ </p>
+</body>
+</html>
+

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-ant.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-ant.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-ant.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * ============================================================================
+ *                   The Apache Software License, Version 1.1
+ * ============================================================================
+ * 
+ *    Copyright (C) 2000-2003 The Apache Software Foundation. All
+ *    rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of  source code must  retain the above copyright  notice,
+ *    this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 
+ * 3. The end-user documentation included with the redistribution, if any, must
+ *    include  the following  acknowledgment:  "This product includes  software
+ *    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+ *    Alternately, this  acknowledgment may  appear in the software itself,  if
+ *    and wherever such third-party acknowledgments normally appear.
+ * 
+ * 4. The names "Ant" and  "Apache Software Foundation"  must not be used to
+ *    endorse  or promote  products derived  from this  software without  prior
+ *    written permission. For written permission, please contact
+ *    apache at apache.org.
+ * 
+ * 5. Products  derived from this software may not  be called "Apache", nor may
+ *    "Apache" appear  in their name,  without prior written permission  of the
+ *    Apache Software Foundation.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ * APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ * ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ * (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * This software  consists of voluntary contributions made  by many individuals
+ * on behalf of the  Apache Software Foundation.  For more  information  on the 
+ * Apache Software Foundation, please see <http://www.apache.org/>.
+ *
+ */

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-antlr.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-antlr.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-antlr.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+
+SOFTWARE RIGHTS
+
+ANTLR 1989-2004 Developed by Terence Parr
+Partially supported by University of San Francisco & jGuru.com
+
+We reserve no legal rights to the ANTLR--it is fully in the
+public domain. An individual or company may do whatever
+they wish with source code distributed with ANTLR or the
+code generated by ANTLR, including the incorporation of
+ANTLR, or its output, into commerical software.
+
+We encourage users to develop software with ANTLR. However,
+we do ask that credit is given to us for developing
+ANTLR. By "credit", we mean that if you use ANTLR or
+incorporate any source code into one of your programs
+(commercial product, research project, or otherwise) that
+you acknowledge this fact somewhere in the documentation,
+research report, etc... If you like ANTLR and have
+developed a nice tool with the output, please mention that
+you developed it using ANTLR. In addition, we ask that the
+headers remain intact in our source code. As long as these
+guidelines are kept, we expect to continue enhancing this
+system and expect to make other tools available as they are
+completed.
+
+The primary ANTLR guy:
+
+Terence Parr
+parrt at cs.usfca.edu
+parrt at antlr.org

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hsqldb.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hsqldb.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hsqldb.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+/* Copyright (c) 2001-2002, The HSQL Development Group
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the HSQL Development Group nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hypersonic.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hypersonic.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-hypersonic.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/* Copyrights and Licenses
+ *
+ * This product includes Hypersonic SQL.
+ * Originally developed by Thomas Mueller and the Hypersonic SQL Group. 
+ *
+ * Copyright (c) 1995-2000 by the Hypersonic SQL Group. All rights reserved. 
+ * Redistribution and use in source and binary forms, with or without modification, are permitted
+ * provided that the following conditions are met: 
+ *     -  Redistributions of source code must retain the above copyright notice, this list of conditions
+ *         and the following disclaimer. 
+ *     -  Redistributions in binary form must reproduce the above copyright notice, this list of
+ *         conditions and the following disclaimer in the documentation and/or other materials
+ *         provided with the distribution. 
+ *     -  All advertising materials mentioning features or use of this software must display the
+ *        following acknowledgment: "This product includes Hypersonic SQL." 
+ *     -  Products derived from this software may not be called "Hypersonic SQL" nor may
+ *        "Hypersonic SQL" appear in their names without prior written permission of the
+ *         Hypersonic SQL Group. 
+ *     -  Redistributions of any form whatsoever must retain the following acknowledgment: "This
+ *          product includes Hypersonic SQL." 
+ * This software is provided "as is" and any expressed or implied warranties, including, but
+ * not limited to, the implied warranties of merchantability and fitness for a particular purpose are
+ * disclaimed. In no event shall the Hypersonic SQL Group or its contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential damages (including, but
+ * not limited to, procurement of substitute goods or services; loss of use, data, or profits;
+ * or business interruption). However caused any on any theory of liability, whether in contract,
+ * strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this
+ * software, even if advised of the possibility of such damage. 
+ * This software consists of voluntary contributions made by many individuals on behalf of the
+ * Hypersonic SQL Group.
+ *
+ *
+ * For work added by the HSQL Development Group:
+ *
+ * Copyright (c) 2001-2002, The HSQL Development Group
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer, including earlier
+ * license statements (above) and comply with all above license conditions.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution, including earlier
+ * license statements (above) and comply with all above license conditions.
+ *
+ * Neither the name of the HSQL Development Group nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-junit.html
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-junit.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-junit.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+<TITLE>Common Public License - v 1.0</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</HEAD>
+
+<BODY BGCOLOR="#FFFFFF" VLINK="#800000">
+
+
+<P ALIGN="CENTER"><B>Common Public License - v 1.0</B>
+<P><B></B><FONT SIZE="3"></FONT>
+<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT").  ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>1.  DEFINITIONS</B></FONT>
+<P><FONT SIZE="2">"Contribution" means:</FONT>
+
+<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT">
+b) in the case of each subsequent Contributor:</FONT></UL>
+
+
+<UL><FONT SIZE="2">i)	 	changes to the Program, and</FONT></UL>
+
+
+<UL><FONT SIZE="2">ii)		additions to the Program;</FONT></UL>
+
+
+<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.  </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf.  </FONT><FONT SIZE="2">Contributions do not include additions to the Program which:  (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.  </FONT></UL>
+
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.  </FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT>
+<P><FONT SIZE="2"><B></B></FONT>
+<P><FONT SIZE="2"><B>2.  GRANT OF RIGHTS</B></FONT>
+
+<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a)	</FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) 	Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form.  This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents.  The patent license shall not apply to any other combinations which include the Contribution.  No hardware per se is licensed hereunder.   </FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2">c)	Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity.  Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise.  As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any.  For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2">d)	Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+<P><FONT SIZE="2"><B>3.  REQUIREMENTS</B></FONT>
+<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT>
+
+<UL><FONT SIZE="2">a)	it complies with the terms and conditions of this Agreement; and</FONT></UL>
+
+
+<UL><FONT SIZE="2">b)	its license agreement:</FONT></UL>
+
+
+<UL><FONT SIZE="2">i)	effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL>
+
+
+<UL><FONT SIZE="2">ii) 	effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL>
+
+
+<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2">	states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL>
+
+
+<UL><FONT SIZE="2">iv)	states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL>
+
+
+<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL>
+
+<P><FONT SIZE="2">When the Program is made available in source code form:</FONT>
+
+<UL><FONT SIZE="2">a)	it must be made available under this Agreement; and </FONT></UL>
+
+
+<UL><FONT SIZE="2">b)	a copy of this Agreement must be included with each copy of the Program.  </FONT></UL>
+
+<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT>
+<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program.  </FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.  </FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>4.  COMMERCIAL DISTRIBUTION</B></FONT>
+<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like.  While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors.   Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering.  The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement.  In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations.  The Indemnified Contributor may participate in any such claim at its own expense.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X.  That Contributor is then a Commercial Contributor.  If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.  Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT>
+<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5.  NO WARRANTY</B></FONT>
+<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">.  </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6.  DISCLAIMER OF LIABILITY</B></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>7.  GENERAL</B></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed.  In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance.  If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable.  However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.  </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted  and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward.   IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity.  </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number.  The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version.  </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2">  All rights in the Program not expressly granted under this Agreement are reserved.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose.  Each party waives its rights to a jury trial in any resulting litigation.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+
+</BODY>
+
+</HTML>

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-log4j.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-log4j.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-log4j.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,48 @@
+/*
+ * ============================================================================
+ *                   The Apache Software License, Version 1.1
+ * ============================================================================
+ * 
+ *    Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of  source code must  retain the above copyright  notice,
+ *    this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 
+ * 3. The end-user documentation included with the redistribution, if any, must
+ *    include  the following  acknowledgment:  "This product includes  software
+ *    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+ *    Alternately, this  acknowledgment may  appear in the software itself,  if
+ *    and wherever such third-party acknowledgments normally appear.
+ * 
+ * 4. The names "log4j" and  "Apache Software Foundation"  must not be used to
+ *    endorse  or promote  products derived  from this  software without  prior
+ *    written permission. For written permission, please contact
+ *    apache at apache.org.
+ * 
+ * 5. Products  derived from this software may not  be called "Apache", nor may
+ *    "Apache" appear  in their name,  without prior written permission  of the
+ *    Apache Software Foundation.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ * APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ * ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ * (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * This software  consists of voluntary contributions made  by many individuals
+ * on  behalf of the Apache Software  Foundation.  For more  information on the 
+ * Apache Software Foundation, please see <http://www.apache.org/>.
+ *
+ */

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-tomcat.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-tomcat.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-tomcat.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,61 @@
+/* ========================================================================= *
+ *                                                                           *
+ *                 The Apache Software License,  Version 1.1                 *
+ *                                                                           *
+ *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
+ *                           All rights reserved.                            *
+ *                                                                           *
+ * ========================================================================= *
+ *                                                                           *
+ * Redistribution and use in source and binary forms,  with or without modi- *
+ * fication, are permitted provided that the following conditions are met:   *
+ *                                                                           *
+ * 1. Redistributions of source code  must retain the above copyright notice *
+ *    notice, this list of conditions and the following disclaimer.          *
+ *                                                                           *
+ * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
+ *    notice,  this list of conditions  and the following  disclaimer in the *
+ *    documentation and/or other materials provided with the distribution.   *
+ *                                                                           *
+ * 3. The end-user documentation  included with the redistribution,  if any, *
+ *    must include the following acknowlegement:                             *
+ *                                                                           *
+ *       "This product includes  software developed  by the Apache  Software *
+ *        Foundation <http://www.apache.org/>."                              *
+ *                                                                           *
+ *    Alternately, this acknowlegement may appear in the software itself, if *
+ *    and wherever such third-party acknowlegements normally appear.         *
+ *                                                                           *
+ * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
+ *    Foundation"  must not be used  to endorse or promote  products derived *
+ *    from this  software without  prior  written  permission.  For  written *
+ *    permission, please contact <apache at apache.org>.                        *
+ *                                                                           *
+ * 5. Products derived from this software may not be called "Apache" nor may *
+ *    "Apache" appear in their names without prior written permission of the *
+ *    Apache Software Foundation.                                            *
+ *                                                                           *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
+ * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
+ * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
+ * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
+ * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
+ * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
+ * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
+ * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
+ * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
+ * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
+ * POSSIBILITY OF SUCH DAMAGE.                                               *
+ *                                                                           *
+ * ========================================================================= *
+ *                                                                           *
+ * This software  consists of voluntary  contributions made  by many indivi- *
+ * duals on behalf of the  Apache Software Foundation.  For more information *
+ * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
+ *                                                                           *
+ * ========================================================================= */
+
+/* CVS information: $Revision: 231694 $ $Date: 2003-12-27 23:09:02 +0100 (Sa, 27 Dez 2003) $
+ * $Source$
+ * $Author: jochen $
+ */

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xerces.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xerces.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xerces.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:  
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xerces" and "Apache Software Foundation" must
+ *    not be used to endorse or promote products derived from this
+ *    software without prior written permission. For written 
+ *    permission, please contact apache at apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    nor may "Apache" appear in their name, without prior written
+ *    permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, International
+ * Business Machines, Inc., http://www.ibm.com.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */

Added: branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xmldb.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xmldb.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/LICENSE-xmldb.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+
+   The XML:DB Initiative Software License, Version 1.0
+ 
+ 
+  Copyright (c) 2000-2001 The XML:DB Initiative.  All rights
+  reserved.
+ 
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+ 
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+ 
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+ 
+  3. The end-user documentation included with the redistribution,
+     if any, must include the following acknowledgment:
+        "This product includes software developed by the
+         XML:DB Initiative (http://www.xmldb.org/)."
+     Alternately, this acknowledgment may appear in the software itself,
+     if and wherever such third-party acknowledgments normally appear.
+ 
+  4. The name "XML:DB Initiative" must not be used to endorse or
+     promote products derived from this software without prior written
+     permission. For written permission, please contact info at xmldb.org.
+ 
+  5. Products derived from this software may not be called "XML:DB",
+     nor may "XML:DB" appear in their name, without prior written
+     permission of the XML:DB Initiative.
+ 
+  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+  ====================================================================
+ 
+  This software consists of voluntary contributions made by many
+  individuals on behalf of the XML:DB Initiative. For more information
+  on the XML:DB Initiative, please see <http://www.xmldb.org/>.
+ 

Added: branches/jaxme/upstream/0.5.1/prerequisites/README
===================================================================
--- branches/jaxme/upstream/0.5.1/prerequisites/README	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/prerequisites/README	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+
+This directory contains files that are required to build and/or run
+JaxMe.
+
+Files required at run time and build time:
+
+xml-apis.jar     This is the Xerces XML Parser, as distributed with
+xercesImpl.jar   Xerces 2.6.2. At runtime, you may replace this XML
+                 parser with any JAXP 1.2 compliant XML Parser. At
+                 built time, you may choose to use another XML Parser
+                 as well, however, you need to adjust the build scripts
+                 in that case. See http://xml.apache.org/xerces-j
+                 for details on Xerces. Note, that parts of Xerces
+                 apply to the DOM and SAX license.
+
+Files required at build time:
+
+antlr.jar        This is the AntLR java parser generator. See
+                 http://www.antlr.org/ for details on AntLR.
+ant-1.5.4.jar	 This is the Ant build system, as distributed with
+                 Apache Ant 1.5.4. See http://ant.apache.org/ for
+                 details.
+junit.jar        This is the JUnit library, used for the JaxMe unit
+                 tests, as distributed with JUnit 3.8.1. See
+                 http://www.junit.org/ for details.
+log4j-1.2.8.jar  This is the Log4J logging library, as distributed
+                 with jakarta-log4j 1.2.8. See
+                 http://jakarta.apache.org/log4j for details.
+hsqldb-1.7.1.jar This is the HSQLDB database, an embeddable SQL engine
+                 for Java, as distributed with hsqldb 1.7.1. It is used
+                 for the Unit tests. Note, that parts of hsqldb apply
+                 to the Hypersonic license. See http://hsqldb.sf.net/
+                 for details.
+
+                 Note, that the hsqldb Jar file is *not* part of the
+                 JaxMe CVS, for licensing reasons. You need to copy
+                 the file from the native HSQLDB distribution.
+xmldb-api-sdk-20021118.jar
+		 		 This is the XML:DB API, as distributed with Xindice
+		 		 1.1b1. See http://xml.apache.org/xindice for details.
+servlet.jar	 This file contains the servlet API, required to build
+                 a web archive, as distributed with Tomcat 4.1.29.

Added: branches/jaxme/upstream/0.5.1/prerequisites/TaminoAPI4J.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/TaminoAPI4J.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/TaminoJCA.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/TaminoJCA.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/ant-1.5.4.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/ant-1.5.4.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/antlr.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/antlr.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/hsqldb-1.7.1.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/hsqldb-1.7.1.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/junit.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/junit.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/log4j-1.2.8.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/log4j-1.2.8.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/servlet.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/servlet.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/xercesImpl.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/xercesImpl.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/xml-apis.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/xml-apis.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/xmldb-api-20021118.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/xmldb-api-20021118.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/prerequisites/xmldb-api-sdk-20021118.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/prerequisites/xmldb-api-sdk-20021118.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/XMLConstants.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/XMLConstants.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/XMLConstants.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml;
+
+/** <p>This class contains a set of constants, as specified
+ * by various W3C and other standards.</p>
+ *
+ * @author JSR-31
+ * @since JAXB 1.0
+ */
+public class XMLConstants {
+  /** <p>This constant is used to represent the default
+   * namespace. Elements or attributes in the default
+   * namespace are sometimes also referred as "having no
+   * namespace". The constant value is "" (the empty
+   * string).</p>
+   * <p><em>Note</em>: The default namespace is used like this
+   * in SAX handlers. Note, that DOM uses <code>null</code>
+   * to represent the default namespace, hence a different
+   * value.</p> 
+   */
+  public static final String DEFAULT_NS_PREFIX = "";
+
+  /** <p>Constant holding the reserved "xml" prefix. This
+   * prefix is reserved by the XML namespace standard. Unlike
+   * other prefixes, this one is fixed and will always be
+   * associated with the same namespace, {@link #XML_NS_URI}.
+   * Namespace and prefix are reserved by the XML namespace
+   * standard for use by the XML specifications.</p>
+   * <p><em>Note</em>: Not only the prefix "xml" itself is
+   * reserved, but also any other prefix beginning with
+   * "xml". For example, a "new_prefix" may be declared in an
+   * XML instance by using the attribute "xmlns:new_prefix".</p>
+   */
+   public static final String XML_NS_PREFIX = "xml";
+
+  /** <p>Constant holding the reserved namespace URI associated
+   * with the "xml" prefix. Namespace and prefix are reserved
+   * by the XML namespace standard for use by the XML specifications.</p>
+   */
+  public static final java.lang.String XML_NS_URI =
+      "http://www.w3.org/XML/1998/namespace";
+
+  /** <p>Constant holding the attribute name for declaration
+   * of new prefixes. The constant value is "xmlns".</p>
+   * <p><em>Note</em>: This is both an attribute name
+   * and a namespace prefix: For example, to assign the empty
+   * prefix to a namespace, one would use
+   * <pre>
+   *   xmlns="http://my.namespace/..."
+   * </pre>
+   * But for assigning the prefix "pre" to the same namespace,
+   * one would use
+   * <pre>
+   *   xmlns:pre="http://my.namespace/..."
+   * </pre></p>
+   */
+  public static final java.lang.String XMLNS_ATTRIBUTE = "xmlns";
+
+  /** <p>Constant holding the namespace of the "xmlns" attribute:
+   * "http://www.w3.org/2000/xmlns/".</p>
+   * <p><em>Note</em>: This namespace will always be used for the
+   * attribute, regardless whether you used it as an attribute name
+   * (as in <code>xmlns="..."</code> or as an attribute prefix
+   * (as in <code>xmlns:pre="..."</code>).</p>
+   */
+  public static final java.lang.String XMLNS_ATTRIBUTE_NS_URI =
+      "http://www.w3.org/2000/xmlns/";
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,513 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+/** <p>This is a helper class for customized datatypes. It provides a
+ * set of static methods which may be useful in custom methods for
+ * parsing and printing values.</p>
+ * <p>The JAXB provider is responsible to initialize the
+ * <code>DatatypeConverter</code> class by invoking
+ * {@link #setDatatypeConverter(DatatypeConverterInterface)} as soon
+ * as possible.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public final class DatatypeConverter {
+  private static DatatypeConverterInterface converter;
+
+  /** <p>This method must be invoked by the JAXB provider to set the actual
+   * instance, which is invoked by the static methods. Subsequent
+   * invocations of the method are ignored: First come, first wins.</p>
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public static void setDatatypeConverter(DatatypeConverterInterface pConverter) {
+    if (pConverter == null) {
+      throw new IllegalArgumentException("The parameter must not be null.");
+    }
+    synchronized (DatatypeConverter.class) {
+      if (converter == null) {
+        converter = pConverter;
+      }
+    }
+  }
+
+  /** <p>Parses the lexical representation and converts it into a String.</p>
+   *
+   * @param pLexicalXSDString The input string being parsed.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static String parseString(String pLexicalXSDString) {
+    return converter.parseString(pLexicalXSDString);
+  }
+
+  /** <p>Parses the lexical representation of the given integer value
+   * (arbitrary precision) and converts it into an instance of
+   * {@link java.math.BigInteger}.</p>
+   * @param pLexicalXSDInteger The input string being parsed.
+   * @return The input string converted into an instance of {@link BigInteger}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static BigInteger parseInteger(String pLexicalXSDInteger) {
+    return converter.parseInteger(pLexicalXSDInteger);
+  }
+
+  /** <p>Parses the lexical representation of the given 32 bit integer value
+   * and converts it into a primitive <code>int</code> value.</p>
+   * @param pLexicalXSDInt The input string being parsed.
+   * @return The input string converted into a primitive <code>int</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static int parseInt(String pLexicalXSDInt) {
+    return converter.parseInt(pLexicalXSDInt);
+  }
+
+  /** <p>Parses the lexical representation of the given 64 bit integer value
+   * and converts it into a primitive <code>long</code> value.</p>
+   * @param pLexicalXSDLong The input string being parsed.
+   * @return The input string converted into a primitive <code>long</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static long parseLong(String pLexicalXSDLong) {
+    return converter.parseLong(pLexicalXSDLong);
+  }
+
+  /** <p>Parses the lexical representation of the given 16 bit integer value
+   * and converts it into a primitive <code>short</code> value.</p>
+   * @param pLexicalXSDShort The input string being parsed.
+   * @return The input string converted into a primitive <code>short</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static short parseShort(String pLexicalXSDShort) {
+    return converter.parseShort(pLexicalXSDShort);
+  }
+
+  /** <p>Parses the lexical representation of the given decimal value
+   * (arbitrary precision) and converts it into an instance of
+   * {@link java.math.BigDecimal}.</p>
+   * @param pLexicalXSDDecimal The input string being parsed.
+   * @return The input string converted into an instance of {@link java.math.BigDecimal}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static BigDecimal parseDecimal(String pLexicalXSDDecimal) {
+    return converter.parseDecimal(pLexicalXSDDecimal);
+  }
+
+  /** <p>Parses the lexical representation of the given 32 bit floating
+   * point value and converts it into a primitive <code>float</code> value.</p>
+   * @param pLexicalXSDFloat The input string being parsed.
+   * @return The input string converted into a primitive <code>float</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static float parseFloat(String pLexicalXSDFloat) {
+    return converter.parseFloat(pLexicalXSDFloat);
+  }
+
+  /** <p>Parses the lexical representation of the given 64 bit floating
+   * point value and converts it into a primitive <code>double</code> value.</p>
+   * @param pLexicalXSDDouble The input string being parsed.
+   * @return The input string converted into a primitive <code>double</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static double parseDouble(String pLexicalXSDDouble) {
+    return converter.parseDouble(pLexicalXSDDouble);
+  }
+
+  /** <p>Parses the lexical representation of the given boolean value
+   * and converts it into a primitive <code>boolean</code> value.</p>
+   * @param pLexicalXSDBoolean The input string being parsed.
+   * @return The input string converted into a primitive <code>boolean</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static boolean parseBoolean(String pLexicalXSDBoolean) {
+    return converter.parseBoolean(pLexicalXSDBoolean);
+  }
+
+  /** <p>Parses the lexical representation of the given 8 bit integer value
+   * and converts it into a primitive <code>byte</code> value.</p>
+   * @param pLexicalXSDByte The input string being parsed.
+   * @return The input string converted into a primitive <code>byte</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static byte parseByte(String pLexicalXSDByte) {
+    return converter.parseByte(pLexicalXSDByte);
+  }
+
+  /** <p>Parses the lexical representation of the given qualified name
+   * and converts it into an instance of {@link javax.xml.namespace.QName}.
+   * The {@link javax.xml.namespace.QName} consists of a namespace URI
+   * and a local name.</p>
+   * @param pLexicalXSDQName The input string being parsed, an optional
+   *   namespace prefix, followed by the local name, if any. If a prefix
+   *   is present, they are separated by a colon.
+   * @param pNamespaceContext The namespace context is used to query
+   *   mappings between prefixes and namespace URI's.
+   * @return The input string converted into an instance of
+   *   {@link javax.xml.namespace.QName}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static QName parseQName(String pLexicalXSDQName,
+                                  NamespaceContext pNamespaceContext) {
+    return converter.parseQName(pLexicalXSDQName, pNamespaceContext);                        
+  }
+
+  /** <p>Parses the lexical representation of the given dateTime value
+   * and converts it into an instance of {@link java.util.Calendar}.
+   * Valid lexical representations of a dateTime value include
+   * <pre>
+   *   YYYY-MM-DDThh:mm:ss
+   *   YYYY-MM-DDThh:mm:ss.sss
+   *   YYYY-MM-DDThh:mm:ssZ
+   *   YYYY-MM-DDThh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pLexicalXSDDateTime The input string being parsed.
+   * @return The input string converted into an instance of
+   *   {@link java.util.Calendar}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static Calendar parseDateTime(String pLexicalXSDDateTime) {
+    return converter.parseDateTime(pLexicalXSDDateTime);
+  }
+
+  /** <p>Parses the lexical representation of the given byte array, which
+   * is encoded in base 64.</p>
+   * @param pLexicalXSDBase64Binary The input string being parsed, a
+   *   base 64 encoded array of bytes.
+   * @return The decoded byte array.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static byte[] parseBase64Binary(String pLexicalXSDBase64Binary) {
+    return converter.parseBase64Binary(pLexicalXSDBase64Binary);
+  }
+
+  /** <p>Parses the lexical representation of the given byte array, which
+   * is encoded in hex digits.</p>
+   * @param pLexicalXSDHexBinary The input string being parsed, an
+   *    array of bytes encoded in hex digits.
+   * @return The decoded byte array.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static byte[] parseHexBinary(String pLexicalXSDHexBinary) {
+    return converter.parseHexBinary(pLexicalXSDHexBinary);
+  }
+
+  /** <p>Parses the lexical representation of the given 32 bit
+   * unsignet integer value and converts it into a primitive <code>long</code>
+   * value.</p>
+   * @param pLexicalXSDUnsignedInt The input string being parsed.
+   * @return The input string converted into a primitive <code>long</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static long parseUnsignedInt(String pLexicalXSDUnsignedInt) {
+    return converter.parseUnsignedInt(pLexicalXSDUnsignedInt);
+  }
+
+  /** <p>Parses the lexical representation of the given 16 bit
+   * unsignet integer value and converts it into a primitive <code>int</code>
+   * value.</p>
+   * @param pLexicalXSDUnsignedShort The input string being parsed.
+   * @return The input string conve
+   * rted into a primitive <code>int</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public static int parseUnsignedShort(String pLexicalXSDUnsignedShort) {
+    return converter.parseUnsignedShort(pLexicalXSDUnsignedShort);
+  }
+
+  /** <p>Parses the lexical representation of the given time value
+   * and converts it into an instance of {@link java.util.Calendar}.
+   * Valid lexical representations of a time value include
+   * <pre>
+   *   hh:mm:ss
+   *   hh:mm:ss.sss
+   *   hh:mm:ssZ
+   *   hh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pLexicalXSDTime The input string being parsed.
+   * @return The input string converted into an instance of
+   *   {@link java.util.Calendar}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static Calendar parseTime(String pLexicalXSDTime) {
+    return converter.parseTime(pLexicalXSDTime);
+  }
+
+  /** <p>Parses the lexical representation of the given date value
+   * and converts it into an instance of {@link java.util.Calendar}.
+   * Valid lexical representations of a date value include
+   * <pre>
+   *   YYYY-MM-DD
+   *   YYYY-MM-DDZ
+   *   YYYY-MM-DD-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pLexicalXSDDate The input string being parsed.
+   * @return The input string converted into an instance of
+   *   {@link java.util.Calendar}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static Calendar parseDate(String pLexicalXSDDate) {
+    return converter.parseDate(pLexicalXSDDate);
+  }
+
+  /** <p>Returns the lexical representation of the input string, which is
+   * the unmodified input string.</p>
+   * @param pLexicalXSDAnySimpleType An input string in lexical representation.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public static String parseAnySimpleType(String pLexicalXSDAnySimpleType) {
+    return converter.parseAnySimpleType(pLexicalXSDAnySimpleType);
+  }
+
+  /** <p>Returns a lexical representation of the given input string, which
+   * is the unmodified input string.</p>
+   * @param pValue The input string.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printString(String pValue) {
+    return converter.printString(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given instance of
+   * {@link BigInteger}, which is an integer in arbitrary precision.</p>
+   * @param pValue The integer value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printInteger(BigInteger pValue) {
+    return converter.printInteger(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 32 bit integer.</p>
+   * @param pValue The <code>int</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printInt(int pValue) {
+    return converter.printInt(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 64 bit integer.</p>
+   * @param pValue The <code>long</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printLong(long pValue) {
+    return converter.printLong(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 16 bit integer.</p>
+   * @param pValue The <code>short</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printShort(short pValue) {
+    return converter.printShort(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given instance of
+   * {@link BigDecimal}, which is a decimal number in arbitrary
+   * precision.</p>
+   * @param pValue The decimal value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printDecimal(BigDecimal pValue) {
+    return converter.printDecimal(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 32 bit floating point number.</p>
+   * @param pValue The <code>float</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printFloat(float pValue) {
+    return converter.printFloat(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 64 bit floating point number.</p>
+   * @param pValue The <code>double</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printDouble(double pValue) {
+    return converter.printDouble(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * boolean value.</p>
+   * @param pValue The <code>boolean</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printBoolean(boolean pValue) {
+    return converter.printBoolean(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 8 bit integer.</p>
+   * @param pValue The <code>byte</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printByte(byte pValue) {
+    return converter.printByte(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given qualified
+   * name, which is a combination of namespace URI and local name.
+   * The lexical representation is an optional prefix, which is
+   * currently mapped to namespace URI of the qualified name,
+   * followed by a colon and the local name. If the namespace URI
+   * is the current default namespace URI, then the prefix and
+   * the colon may be omitted.</p>
+   * @param pValue The qualified name being converted.
+   * @param pNamespaceContext A mapping of prefixes to namespace
+   *   URI's which may be used to determine a valid prefix.
+   * @return A lexical representation of the qualified name.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printQName(QName pValue,
+                                   NamespaceContext pNamespaceContext) {
+    return converter.printQName(pValue, pNamespaceContext);                            
+  }
+
+  /** <p>Returns a lexical representation of the given dateTime
+   * value. Valid lexical representations include:
+   * <pre>
+   *   YYYY-MM-DDThh:mm:ss
+   *   YYYY-MM-DDThh:mm:ss.sss
+   *   YYYY-MM-DDThh:mm:ssZ
+   *   YYYY-MM-DDThh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pValue The dateTime value being converted
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printDateTime(Calendar pValue) {
+    return converter.printDateTime(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given byte array.
+   * The lexical representation is obtained by application of the
+   * base 64 encoding.</p>
+   * @param pValue The byte array being converted.
+   * @return The converted byte array.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printBase64Binary(byte[] pValue) {
+    return converter.printBase64Binary(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given byte array.
+   * The lexical representation is obtained by encoding any byte
+   * as two hex digits.</p>
+   * @param pValue The byte array being converted.
+   * @return The converted byte array.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printHexBinary(byte[] pValue) {
+    return converter.printHexBinary(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive,
+   * unsigned 32 bit integer.</p>
+   * @param pValue The <code>long</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printUnsignedInt(long pValue) {
+    return converter.printUnsignedInt(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given primitive,
+   * unsigned 16 bit integer.</p>
+   * @param pValue The <code>short</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printUnsignedShort(int pValue) {
+    return converter.printUnsignedShort(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given time
+   * value. Valid lexical representations include:
+   * <pre>
+   *   hh:mm:ss
+   *   hh:mm:ss.sss
+   *   hh:mm:ssZ
+   *   hh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pValue The time value being converted
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printTime(Calendar pValue) {
+    return converter.printTime(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given date
+   * value. Valid lexical representations include:
+   * <pre>
+   *   YYYY-MM-DD
+   *   YYYY-MM-DDZ
+   *   YYYY-MM-DD-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pValue The date value being converted
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printDate(Calendar pValue) {
+    return converter.printDate(pValue);
+  }
+
+  /** <p>Returns a lexical representation of the given input
+   * string, which is the unmodified input string.</p>
+   * @param pValue The input string.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public static String printAnySimpleType(String pValue) {
+    return converter.printAnySimpleType(pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverterInterface.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverterInterface.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/DatatypeConverterInterface.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,435 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+
+/** <p>The <code>DatatypeConverterInterface</code> is a helper class for
+ * implementation of custom <code>print()</code> and <code>parse()</code>
+ * methods, as specified by <samp>jaxb:javaType/@printMethod</samp> and
+ * <samp>jaxb:javaType/@parseMethod</samp>. However, the JAXB user won't
+ * be accessing this class directly. The JAXB provider is required to
+ * create an instance of this class and pass it to the JAXB runtime by
+ * invoking
+ * {@link javax.xml.bind.DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface)}.
+ * The JAXB user may access this instance via the static methods of
+ * {@link javax.xml.bind.DatatypeConverter}.</p>
+ * <p>The interface provides methods <code>parseFoo()</code> and
+ * <code>printFoo()</code> for any XML Schema type <samp>foo</samp>.
+ * The <code>parseFoo()</code> method must accept any lexically valid
+ * value and convert it into the corresponding canonical value. An error
+ * in the conversion routine must be mapped to a
+ * {@link javax.xml.bind.ParseConversionEvent}.</p>
+ * <p>The <code>printFoo(foo pValue)</code> method must convert the value
+ * <samp>pValue</samp> into an arbitrary lexical representation. It is
+ * recommended to use the default representation.</p>
+ *  
+ * @author JSR-31
+ * @since JAXB 1.0
+ * @see javax.xml.bind.DatatypeConverter
+ * @see javax.xml.bind.ParseConversionEvent
+ * @see javax.xml.bind.PrintConversionEvent
+ */
+public interface DatatypeConverterInterface {
+  /** <p>Parses the lexical representation and converts it into a String.</p>
+   *
+   * @param pLexicalXSDString The input string being parsed.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public String parseString(String pLexicalXSDString);
+
+  /** <p>Parses the lexical representation of the given integer value
+   * (arbitrary precision) and converts it into an instance of
+   * {@link java.math.BigInteger}.</p>
+   * @param pLexicalXSDInteger The input string being parsed.
+   * @return The input string converted into an instance of {@link BigInteger}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public BigInteger parseInteger(String pLexicalXSDInteger);
+
+  /** <p>Parses the lexical representation of the given 32 bit integer value
+   * and converts it into a primitive <code>int</code> value.</p>
+   * @param pLexicalXSDInt The input string being parsed.
+   * @return The input string converted into a primitive <code>int</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public int parseInt(String pLexicalXSDInt);
+
+  /** <p>Parses the lexical representation of the given 64 bit integer value
+   * and converts it into a primitive <code>long</code> value.</p>
+   * @param pLexicalXSDLong The input string being parsed.
+   * @return The input string converted into a primitive <code>long</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public long parseLong(String pLexicalXSDLong);
+
+  /** <p>Parses the lexical representation of the given 16 bit integer value
+   * and converts it into a primitive <code>short</code> value.</p>
+   * @param pLexicalXSDShort The input string being parsed.
+   * @return The input string converted into a primitive <code>short</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public short parseShort(String pLexicalXSDShort);
+
+  /** <p>Parses the lexical representation of the given decimal value
+   * (arbitrary precision) and converts it into an instance of
+   * {@link java.math.BigDecimal}.</p>
+   * @param pLexicalXSDDecimal The input string being parsed.
+   * @return The input string converted into an instance of {@link java.math.BigDecimal}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public BigDecimal parseDecimal(String pLexicalXSDDecimal);
+
+  /** <p>Parses the lexical representation of the given 32 bit floating
+   * point value and converts it into a primitive <code>float</code> value.</p>
+   * @param pLexicalXSDFloat The input string being parsed.
+   * @return The input string converted into a primitive <code>float</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public float parseFloat(String pLexicalXSDFloat);
+
+  /** <p>Parses the lexical representation of the given 64 bit floating
+   * point value and converts it into a primitive <code>double</code> value.</p>
+   * @param pLexicalXSDDouble The input string being parsed.
+   * @return The input string converted into a primitive <code>double</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public double parseDouble(String pLexicalXSDDouble);
+
+  /** <p>Parses the lexical representation of the given boolean value
+   * and converts it into a primitive <code>boolean</code> value.</p>
+   * @param pLexicalXSDBoolean The input string being parsed.
+   * @return The input string converted into a primitive <code>boolean</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public boolean parseBoolean(String pLexicalXSDBoolean);
+
+  /** <p>Parses the lexical representation of the given 8 bit integer value
+   * and converts it into a primitive <code>byte</code> value.</p>
+   * @param pLexicalXSDByte The input string being parsed.
+   * @return The input string converted into a primitive <code>byte</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public byte parseByte(String pLexicalXSDByte);
+
+  /** <p>Parses the lexical representation of the given qualified name
+   * and converts it into an instance of {@link javax.xml.namespace.QName}.
+   * The {@link javax.xml.namespace.QName} consists of a namespace URI
+   * and a local name.</p>
+   * @param pLexicalXSDQName The input string being parsed, an optional
+   *   namespace prefix, followed by the local name, if any. If a prefix
+   *   is present, they are separated by a colon.
+   * @param pNamespaceContext The namespace context is used to query
+   *   mappings between prefixes and namespace URI's.
+   * @return The input string converted into an instance of
+   *   {@link javax.xml.namespace.QName}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public QName parseQName(String pLexicalXSDQName,
+                          NamespaceContext pNamespaceContext);
+
+  /** <p>Parses the lexical representation of the given dateTime value
+   * and converts it into an instance of {@link java.util.Calendar}.
+   * Valid lexical representations of a dateTime value include
+   * <pre>
+   *   YYYY-MM-DDThh:mm:ss
+   *   YYYY-MM-DDThh:mm:ss.sss
+   *   YYYY-MM-DDThh:mm:ssZ
+   *   YYYY-MM-DDThh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pLexicalXSDDateTime The input string being parsed.
+   * @return The input string converted into an instance of
+   *   {@link java.util.Calendar}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public Calendar parseDateTime(String pLexicalXSDDateTime);
+
+  /** <p>Parses the lexical representation of the given byte array, which
+   * is encoded in base 64.</p>
+   * @param pLexicalXSDBase64Binary The input string being parsed, a
+   *   base 64 encoded array of bytes.
+   * @return The decoded byte array.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public byte[] parseBase64Binary(String pLexicalXSDBase64Binary);
+
+  /** <p>Parses the lexical representation of the given byte array, which
+   * is encoded in hex digits.</p>
+   * @param pLexicalXSDHexBinary The input string being parsed, an
+   *    array of bytes encoded in hex digits.
+   * @return The decoded byte array.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public byte[] parseHexBinary(String pLexicalXSDHexBinary);
+
+  /** <p>Parses the lexical representation of the given 32 bit
+   * unsignet integer value and converts it into a primitive <code>long</code>
+   * value.</p>
+   * @param pLexicalXSDUnsignedInt The input string being parsed.
+   * @return The input string converted into a primitive <code>long</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public long parseUnsignedInt(String pLexicalXSDUnsignedInt);
+
+  /** <p>Parses the lexical representation of the given 16 bit
+   * unsignet integer value and converts it into a primitive <code>int</code>
+   * value.</p>
+   * @param pLexicalXSDUnsignedShort The input string being parsed.
+   * @return The input string conve
+   * rted into a primitive <code>int</code>.
+   * @see javax.xml.bind.ParseConversionEvent
+   */ 
+  public int parseUnsignedShort(String pLexicalXSDUnsignedShort);
+
+  /** <p>Parses the lexical representation of the given time value
+   * and converts it into an instance of {@link java.util.Calendar}.
+   * Valid lexical representations of a time value include
+   * <pre>
+   *   hh:mm:ss
+   *   hh:mm:ss.sss
+   *   hh:mm:ssZ
+   *   hh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pLexicalXSDTime The input string being parsed.
+   * @return The input string converted into an instance of
+   *   {@link java.util.Calendar}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public Calendar parseTime(String pLexicalXSDTime);
+
+  /** <p>Parses the lexical representation of the given date value
+   * and converts it into an instance of {@link java.util.Calendar}.
+   * Valid lexical representations of a date value include
+   * <pre>
+   *   YYYY-MM-DD
+   *   YYYY-MM-DDZ
+   *   YYYY-MM-DD-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pLexicalXSDDate The input string being parsed.
+   * @return The input string converted into an instance of
+   *   {@link java.util.Calendar}.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public Calendar parseDate(String pLexicalXSDDate);
+
+  /** <p>Returns the lexical representation of the input string, which is
+   * the unmodified input string.</p>
+   * @param pLexicalXSDAnySimpleType An input string in lexical representation.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.ParseConversionEvent
+   */
+  public String parseAnySimpleType(String pLexicalXSDAnySimpleType);
+
+  /** <p>Returns a lexical representation of the given input string, which
+   * is the unmodified input string.</p>
+   * @param pValue The input string.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printString(String pValue);
+
+  /** <p>Returns a lexical representation of the given instance of
+   * {@link BigInteger}, which is an integer in arbitrary precision.</p>
+   * @param pValue The integer value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printInteger(BigInteger pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 32 bit integer.</p>
+   * @param pValue The <code>int</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printInt(int pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 64 bit integer.</p>
+   * @param pValue The <code>long</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printLong(long pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 16 bit integer.</p>
+   * @param pValue The <code>short</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printShort(short pValue);
+
+  /** <p>Returns a lexical representation of the given instance of
+   * {@link BigDecimal}, which is a decimal number in arbitrary
+   * precision.</p>
+   * @param pValue The decimal value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printDecimal(BigDecimal pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 32 bit floating point number.</p>
+   * @param pValue The <code>float</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printFloat(float pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 64 bit floating point number.</p>
+   * @param pValue The <code>double</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printDouble(double pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * boolean value.</p>
+   * @param pValue The <code>boolean</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printBoolean(boolean pValue);
+
+  /** <p>Returns a lexical representation of the given primitive
+   * 8 bit integer.</p>
+   * @param pValue The <code>byte</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printByte(byte pValue);
+
+  /** <p>Returns a lexical representation of the given qualified
+   * name, which is a combination of namespace URI and local name.
+   * The lexical representation is an optional prefix, which is
+   * currently mapped to namespace URI of the qualified name,
+   * followed by a colon and the local name. If the namespace URI
+   * is the current default namespace URI, then the prefix and
+   * the colon may be omitted.</p>
+   * @param pValue The qualified name being converted.
+   * @param pNamespaceContext A mapping of prefixes to namespace
+   *   URI's which may be used to determine a valid prefix.
+   * @return A lexical representation of the qualified name.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printQName(QName pValue,
+                            NamespaceContext pNamespaceContext);
+
+  /** <p>Returns a lexical representation of the given dateTime
+   * value. Valid lexical representations include:
+   * <pre>
+   *   YYYY-MM-DDThh:mm:ss
+   *   YYYY-MM-DDThh:mm:ss.sss
+   *   YYYY-MM-DDThh:mm:ssZ
+   *   YYYY-MM-DDThh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pValue The dateTime value being converted
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printDateTime(Calendar pValue);
+
+  /** <p>Returns a lexical representation of the given byte array.
+   * The lexical representation is obtained by application of the
+   * base 64 encoding.</p>
+   * @param pValue The byte array being converted.
+   * @return The converted byte array.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printBase64Binary(byte[] pValue);
+
+  /** <p>Returns a lexical representation of the given byte array.
+   * The lexical representation is obtained by encoding any byte
+   * as two hex digits.</p>
+   * @param pValue The byte array being converted.
+   * @return The converted byte array.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printHexBinary(byte[] pValue);
+
+  /** <p>Returns a lexical representation of the given primitive,
+   * unsigned 32 bit integer.</p>
+   * @param pValue The <code>long</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public java.lang.String printUnsignedInt(long pValue);
+
+  /** <p>Returns a lexical representation of the given primitive,
+   * unsigned 16 bit integer.</p>
+   * @param pValue The <code>short</code> value being converted.
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public java.lang.String printUnsignedShort(int pValue);
+
+  /** <p>Returns a lexical representation of the given time
+   * value. Valid lexical representations include:
+   * <pre>
+   *   hh:mm:ss
+   *   hh:mm:ss.sss
+   *   hh:mm:ssZ
+   *   hh:mm:ss-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pValue The time value being converted
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printTime(Calendar pValue);
+
+  /** <p>Returns a lexical representation of the given date
+   * value. Valid lexical representations include:
+   * <pre>
+   *   YYYY-MM-DD
+   *   YYYY-MM-DDZ
+   *   YYYY-MM-DD-01:00
+   * </pre>
+   * The former examples are all specified in UTC time. The last example
+   * uses a negatice offset of one hour to UTC.</p>
+   * @param pValue The date value being converted
+   * @return A lexical representation of the input value.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printDate(Calendar pValue);
+
+  /** <p>Returns a lexical representation of the given input
+   * string, which is the unmodified input string.</p>
+   * @param pValue The input string.
+   * @return The unmodified input string.
+   * @see javax.xml.bind.PrintConversionEvent
+   */
+  public String printAnySimpleType(String pValue);
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Element.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Element.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Element.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>This interface doesn't expose any methods. Like
+ * {@link java.io.Serializable}, it is a marker interface with the
+ * single purpose of indicating what the implementation is.</p>
+ * <p>See section 5.7 "Element Declaration", and 5.7.1
+ * "Bind to Java Element Interface" of the JAXB specification
+ * for more details.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface Element {
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBContext.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBContext.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBContext.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+
+/** <p>The <code>JAXBContext</code> provides the JAXB users anchor to
+ * the implmentation and hos generated classes. A JAXBContext is used to
+ * obtain instances of {@link javax.xml.bind.Marshaller},
+ * {@link javax.xml.bind.Unmarshaller}, and
+ * {@link javax.xml.bind.Validator}. To obtain a JAXBContext, the
+ * application invokes
+ * <pre>
+ *   JAXBContext context = JAXBContext.newInstance("com.mycompany:com.mycompany.xml");
+ * </pre>
+ * The list of colon separated package names matches the list in the
+ * schemas used to generate classes. In other words: If you have a
+ * schema using package name "com.mycompany.xml", then this package
+ * name has to be part of the list.</p>
+ * <p>The <code>JAXBContext</code> class will scan the given list of packages
+ * for a file called <samp>jaxb.properties</samp>. This file contains the
+ * name of an instantiation class in the property
+ * {@link #JAXB_CONTEXT_FACTORY}. (See {@link #newInstance(String)} for
+ * details on how the class name is obtained.) Once such a file is found, the
+ * given class is loaded via {@link ClassLoader#loadClass(java.lang.String)}.
+ * The <code>JAXBContext</code> class demands, that the created object
+ * has a method
+ * <pre>
+ *   public static JAXBContext createContext(String pPath, ClassLoader pClassLoader)
+ *     throws JAXBException;
+ * </pre>
+ * This method is invoked with the same path and {@link ClassLoader} than
+ * above. See {@link #newInstance(String,ClassLoader)}} for details on the choice
+ * of the {@link ClassLoader}.</p>
+ * <p>The created context will scan the same package path for implementation
+ * specific configuration details (in the case of the <code>JaxMe</code>
+ * application a file called <samp>Configuration.xml</samp> in any of the
+ * packages) and do whatever else is required to initialize the runtime.
+ * In particular it will invoke
+ * {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface)}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ * @see Marshaller
+ * @see Unmarshaller
+ * @see Validator
+ */
+public abstract class JAXBContext {
+  private static final Class[] CONTEXT_CLASSES = new Class[]{String.class, ClassLoader.class};
+
+  /** <p>This is the name of the property used to determine the name
+   * of the initialization class: "javax.xml.bind.context.factory".
+   * The name is used by {@link #newInstance(String)} and
+   * {@link #newInstance(String,ClassLoader)}. It contains a class
+   * name. The class must contain a static method
+   * <pre>
+   *   public static JAXBContext createContext(String, ClassLoader) throws JAXBException;
+   * </pre>
+   * which is invoked to create the actual instance of JAXBContext.</p>
+   */
+  public static final java.lang.String JAXB_CONTEXT_FACTORY = "javax.xml.bind.context.factory";
+
+  /** <p>Creates a new instance of <code>JAXBContext</code> by applying
+   * the following algorithm:
+   * <ol>
+   *   <li>The first step is to determine the name of an initialization class.
+   *     For any of the package names in the list given by
+   *     <code>pPath</code> the <code>JAXBContext</code> class will try to find a file
+   *     called <samp>jaxb.properties</samp>. This file's got to be in
+   *     standard property file format. The <code>JAXBContext</code> class
+   *     will load the property file.</li>
+   *   <li>A property called "javax.xml.bind.context.factory" (see
+   *     {@link #JAXB_CONTEXT_FACTORY}) is evaluated. It must contain the
+   *     name of an initialization class. The initialization class is
+   *     loaded via
+   *     <code>Thread.currentThread().getContextClassLoader().loadClass(String)</code>.</li>
+   *   <li>The initialization class must contain a method
+   *     <pre>
+   *       public static JAXBContext createContext(String, ClassLoader) throws JAXBException;
+   *     </pre>
+   *     which is invoked with the <code>pPath</code> argument and the
+   *     {@link ClassLoader} of the <code>JAXBContext</class> class as
+   *     parameters. The result of this method is also used as the
+   *     result of the <code>newInstance(String)</code> method.</li>
+   * </ol>
+   * @param pPath A colon separated path of package names where to look for
+   *   <samp>jaxb.properties</samp> files. The package names must match the
+   *   generated classes which you are going to use in your application.
+   * @return An initialized instance of <code>JAXBContext</code>.
+   * @throws JAXBException An error occurred while creating the JAXBContext instance. 
+   */  
+  public static JAXBContext newInstance(java.lang.String pPath) throws JAXBException {
+    ClassLoader cl = Thread.currentThread().getContextClassLoader();
+    if (cl == null) {
+      cl = JAXBContext.class.getClassLoader();
+    }
+    return newInstance(pPath, cl);
+  }
+
+  /** <p>Creates a new instance of <code>JAXBContext</code> by applying
+   * the following algorithm:
+   * <ol>
+   *   <li>The first step is to determine the name of an initialization class.
+   *     For any of the package names in the list given by
+   *     <code>pPath</code> the <code>JAXBContext</code> class will try to find a file
+   *     called <samp>jaxb.properties</samp>. This file's got to be in
+   *     standard property file format. The <code>JAXBContext</code> class
+   *     will load the property file.</li>
+   *   <li>A property called "javax.xml.bind.context.factory" (see
+   *     {@link #JAXB_CONTEXT_FACTORY}) is evaluated. It must contain the
+   *     name of an initialization class. The initialization class is
+   *     loaded via
+   *     <code>pClassLoader.loadClass(String)</code>.</li>
+   *   <li>The initialization class must contain a method
+   *     <pre>
+   *       public static JAXBContext createContext(String, ClassLoader) throws JAXBException;
+   *     </pre>
+   *     which is invoked with the parameters <code>pPath</code> and
+   *     <code>pClassLoader</code>. The result of this method is also
+   *     used as the result of the <code>newInstance(String)</code>
+   *     method.</li>
+   * </ol>
+   * @param pPath A colon separated path of package names where to look for
+   *   <samp>jaxb.properties</samp> files. The package names must match the
+   *   generated classes which you are going to use in your application.
+   * @return An initialized instance of <code>JAXBContext</code>.
+   * @throws JAXBException An error occurred while creating the JAXBContext instance.
+   */
+  public static JAXBContext newInstance(String pPath, ClassLoader pClassLoader) throws JAXBException {
+    if (pPath == null) {
+      throw new JAXBException("The context path must not be null.");
+    }
+    if (pClassLoader == null) {
+      throw new JAXBException("The classloader must not be null.");
+    }
+    for (StringTokenizer st = new StringTokenizer(pPath, ":");  st.hasMoreTokens();  ) {
+      String packageName = st.nextToken();
+      String resourceName = packageName.replace('.', '/') + "/jaxb.properties";
+      URL resource = pClassLoader.getResource(resourceName);
+      if (resource == null) {
+        continue;
+      }
+      Properties props = new Properties();
+      InputStream istream = null;
+      try {
+        istream = resource.openStream();
+        props.load(istream);
+        istream.close();
+        istream = null;
+      } catch (IOException e) {
+        throw new JAXBException("Failed to load property file " + resource, e);
+      } finally {
+        if (istream != null) { try { istream.close(); } catch (Throwable ignore) {} }
+      }
+      String className = props.getProperty(JAXB_CONTEXT_FACTORY);
+      if (className == null) {
+        throw new JAXBException("The property " + JAXB_CONTEXT_FACTORY + " is not set in " + resource);
+      }
+      Class c;
+      try {
+        c = pClassLoader.loadClass(className);
+      } catch (ClassNotFoundException e) {
+        throw new JAXBException("The class " + className + ", referenced by property " +
+                                 JAXB_CONTEXT_FACTORY + " in " + resource + ", could not be loaded.");
+      }
+      Method m;
+      try {
+        m = c.getMethod("createContext", CONTEXT_CLASSES);
+      } catch (NoSuchMethodException e) {
+        throw new JAXBException("The class " + c + " does not have a method 'public static createContext(String, ClassLoader) throws JAXBException'");
+      }
+      int modifiers = m.getModifiers();
+      if (m == null  ||  !Modifier.isStatic(modifiers)  ||  !Modifier.isPublic(modifiers)) {
+        throw new JAXBException("The class " + c + " does not have a method 'public static createContext(String, ClassLoader) throws JAXBException'");
+      }
+      Object o;
+      try {
+        o = m.invoke(null, new Object[]{pPath, pClassLoader});
+      } catch (IllegalAccessException e) {
+        throw new JAXBException("Illegal access to method " + c.getName() +
+                                 ".createContext(String,ClassLoader).", e);
+      } catch (InvocationTargetException e) {
+        Throwable t = e.getTargetException();
+        throw new JAXBException(t.getClass().getName() + " in method " + c.getName() +
+                                 ".createContext(String,ClassLoader): " + t.getMessage(), t);
+      }
+      if (o == null) {
+        throw new JAXBException("The method " + c.getName() +
+                                 ".createContext(String,ClassLoader) returned null.");
+      }
+      try {
+        return (JAXBContext) o;
+      } catch (ClassCastException e) {
+        throw new JAXBException("The object created by " + c.getName() +
+                                 ".createContext(String,ClassLoader) cannot be casted to " +
+                                 JAXBContext.class.getName() + ".", e);
+      }
+    }
+    throw new JAXBException("Failed to resolve resource jaxb.properties via path " + pPath +
+                             " and ClassLoader " + pClassLoader);
+  }
+
+  /** <p>Creates a new instance of {@link Marshaller}. The
+   * {@link Marshaller} can be used
+   * to convert JAXB objects into XML data.</p>
+   * <p><em>Note</em>: Marshallers are reusable, but not reentrant (thread safe).</p>
+   */
+  public abstract Marshaller createMarshaller() throws JAXBException;
+
+  /** <p>Creates a new instance of {@link Unmarshaller}. The
+   * {@link Unmarshaller} can be used
+   * to convert XML data into JAXB objects.</p>
+   * <p><em>Note</em>: Unmarshallers are reusable, but not reentrant (thread safe).</p>
+   */
+  public abstract Unmarshaller createUnmarshaller() throws JAXBException;
+
+  /** <p>Creates a new instance of {@link Validator}. The
+   * {@link Validator} can be used to validate JAXB objects.</p>
+   */
+  public abstract Validator createValidator() throws JAXBException;
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/JAXBException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/** <p>This is the main exception class of JAXB. All other
+ * exception classes (except the {@link javax.xml.bind.TypeConstraintException},
+ * which is a {@link java.lang.RuntimeException} are derived from the
+ * <code>JAXBException</code>.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class JAXBException extends Exception {
+    private String errorCode;
+    private Throwable linkedException;
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message.</p>
+     * @param pMessage The detail message.
+     */
+    public JAXBException(String pMessage) {
+        super(pMessage);
+    }
+
+    private static String formatMessage(String pErrorCode, String pMessage, Throwable pThr) {
+    	String msg = null;
+        if (pMessage == null) {
+            if (pThr != null) {
+            	msg = pThr.getMessage();
+                if (msg == null) {
+                	msg = pThr.getClass().getName();
+                }
+            }
+        } else {
+        	msg = pMessage;
+        }
+        if (pErrorCode == null) {
+        	return msg;
+        } else {
+            if (msg == null) {
+            	return pErrorCode;
+            } else {
+            	return pErrorCode + ": " + msg;
+            }
+        }
+        
+    }
+
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message and vendor specific error code.</p>
+     * @param pMessage The detail message.
+     * @param pErrorCode The error code.
+     */
+    public JAXBException(String pMessage, String pErrorCode) {
+        this(pMessage, pErrorCode, null);
+    }
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * linked exception.</p>
+     * @param pLinkedException The linked exception.
+     */
+    public JAXBException(Throwable pLinkedException) {
+        this(null, null, pLinkedException);
+    }
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message and linked exception.</p>
+     * @param pMessage The detail message.
+     * @param pLinkedException The linked exception.
+     */
+    public JAXBException(String pMessage, Throwable pLinkedException) {
+        this(pMessage, null, pLinkedException);
+    }
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message, error code, and linked exception.</p>
+     * @param pMessage The detail message.
+     * @param pErrorCode The vendor specific error code.
+     * @param pLinkedException The linked exception.
+     */
+    public JAXBException(String pMessage, String pErrorCode,
+						 Throwable pLinkedException) {
+        super(formatMessage(pErrorCode, pMessage, pLinkedException));
+        errorCode = pErrorCode;
+        linkedException = pLinkedException;
+    }
+    
+    /** <p>Returns the vendor specific error code, if any, or null.</p>
+     */
+    public String getErrorCode() {
+        return errorCode;
+    }
+    
+    /** <p>Returns the linked exception, if any, or null.</p>
+     */
+    public Throwable getLinkedException() {
+        return linkedException;
+    }
+    
+    /** <p>Sets the linked exception.</p>
+     * @param pLinkedException The linked exception or null.
+     */
+    public void setLinkedException(Throwable pLinkedException) {
+        linkedException = pLinkedException;
+    }
+    
+    /** <p>Converts the linked exception into a String. Overridden,
+     * because the returned string should contain the vendor specific
+     * error code, if any.</p>
+     */
+    public String toString() {
+        if (errorCode == null  ||  errorCode.length() == 0) {
+            return super.toString();
+        } else {
+            return errorCode + ": " + super.toString();
+        }
+    }
+
+    public void printStackTrace() {
+        printStackTrace(System.err);
+    }
+
+    public void printStackTrace(PrintStream pStream) {
+        super.printStackTrace(pStream);
+        Throwable t = getLinkedException();
+        if (t != null) {
+            pStream.println("Caused by:");
+            t.printStackTrace(pStream);
+        }
+    }
+
+    public void printStackTrace(PrintWriter pWriter) {
+        super.printStackTrace(pWriter);
+        Throwable t = getLinkedException();
+        if (t != null) {
+            pWriter.println("Caused by:");
+            t.printStackTrace(pWriter);
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/MarshalException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/MarshalException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/MarshalException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>The <code>MarshalException</code> is a subclass of the
+ * {@link javax.xml.bind.JAXBException} being thrown if the
+ * marshalling of a JAXB object failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class MarshalException extends JAXBException {
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public MarshalException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public MarshalException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public MarshalException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public MarshalException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public MarshalException(String pMessage, String pErrorCode,
+                           Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Marshaller.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Marshaller.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Marshaller.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,274 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.transform.Result;
+
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+
+/** <p>An instance of <code>Marshaller</code> may be obtained by the
+ * JAXB user to serialize JAXB objects to various flavours of XML.
+ * The created XML may be:
+ * <table border="1">
+ *   <tr><th>A byte stream<br>{@link java.io.OutputStream}</th>
+ *     <td>{@link #marshal(Object, java.io.OutputStream)}</td>
+ *   </tr>
+ *   <tr><th>A character stream<br>{@link java.io.Writer}</th>
+ *     <td>{@link #marshal(Object, java.io.Writer)}</td>
+ *   </tr>
+ * </table>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface Marshaller {
+  /** <p>Name of the property that allows to choose the encoding.
+   * The encoding applies when marshalling to an
+   * {@link java.io.OutputStream}, to a {@link java.io.Writer},
+   * or to a {@link javax.xml.transform.stream.StreamResult}.
+   * It is ignored, if the target is a {@link org.xml.sax.ContentHandler},
+   * a DOM {@link org.w3c.dom.Node}, or another flavour of
+   * {@link javax.xml.transform.Result}.</p>
+   * <p>The encoding may be used both to choose the characters
+   * being escaped (as <samp>&amp;#ddd;</samp>) or to convert
+   * characters into byte sequences.</p>
+   * <p>The property value is the encoding name, for example
+   * <samp>UTF-8</samp>, which is the default. Note, that a
+   * JAXB implementation need not support other encodings than
+   * <samp>UTF-8</samp>, <samp>UTF-16</samp>, and <samp>US-ASCII</samp>.
+   * Usually you may expect that the encodings supported by the
+   * JVM itself will work for the <code>Marshaller</code> as well.</p>
+   *
+   * @see #marshal(Object, java.io.OutputStream)
+   * @see #marshal(Object, java.io.Writer)
+   * @see #marshal(Object, javax.xml.transform.Result)
+   */
+  public static final String JAXB_ENCODING = "jaxb.encoding";
+
+  /** <p>Name of the property that allows to choose whether the
+   * generated XML should be formatted (human readable, indented)
+   * or not. By default the generated XML is formatted.
+   * The property value is an instance of {@link Boolean},
+   * by default {@link Boolean#TRUE}.</p>
+   * <p>The formatting property is supported when marshalling to
+   * a character or byte stream. It is ignored, if the target is
+   * a {@link org.xml.sax.ContentHandler}, a DOM
+   * {@link org.w3c.dom.Node}, or an instance of
+   * {@link javax.xml.transform.Result}, the exception being a
+   * {@link javax.xml.transform.stream.StreamResult}, which is
+   * in fact a character or byte stream.</p>
+   *
+   * @see #marshal(Object, java.io.OutputStream)
+   * @see #marshal(Object, java.io.Writer)
+   * @see #marshal(Object, javax.xml.transform.Result)
+   */
+  public static final String JAXB_FORMATTED_OUTPUT = "jaxb.formatted.output";
+
+  /** <p>If this property is set to another value than null,
+   * then the <code>Marshaller</code> will create an attribute
+   * <samp>xsi:schemaLocation</samp>. The attribute value is
+   * the property value. By default the property is set to
+   * null and no such attribute is generated.</p>
+   *
+   * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   */
+  public static final String JAXB_SCHEMA_LOCATION = "jaxb.schemaLocation";
+
+  /** <p>If this property is set to another value than null,
+   * then the <code>Marshaller</code> will create an attribute
+   * <samp>xsi:noNamespaceSchemaLocation</samp>. The attribute
+   * value is the property value. By default the property is set to
+   * null and no such attribute is generated.</p>
+   *
+   * @see #JAXB_SCHEMA_LOCATION
+   */
+  public static final String JAXB_NO_NAMESPACE_SCHEMA_LOCATION = "jaxb.noNamespaceSchemaLocation";
+
+  /** <p>Marshals the given JAXB object <code>pObject</code> to the
+   * {@link javax.xml.transform.Result} <code>pTarget</code>. All
+   * JAXB provider must support {@link javax.xml.transform.dom.DOMResult},
+   * {@link javax.xml.transform.sax.SAXResult}, and
+   * {@link javax.xml.transform.stream.StreamResult}, which can easily
+   * be mapped to {@link #marshal(Object, org.w3c.dom.Node)},
+   * {@link #marshal(Object, org.xml.sax.ContentHandler)},
+   * {@link #marshal(Object,java.io.OutputStream)}, or
+   * {@link #marshal(Object,java.io.Writer)}. The use of a
+   * {@link javax.xml.transform.Result} as a target isn't
+   * portable beyond these subinterfaces.</p>
+   *
+   * @param pObject The JAXB object being marshalled.
+   * @param pTarget The {@link Result} being created.
+   * @throws JAXBException An unexcpected problem occurred. This may be used,
+   *   for example, to throw a nested {@link java.io.IOException}.
+   * @throws MarshalException Whereever possible, one should throw a
+   *   {@link MarshalException}, and not a {@link JAXBException}.
+   * @throws IllegalArgumentException Any of the parameters was null.
+   * @see #JAXB_SCHEMA_LOCATION
+   * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   */
+  public void marshal(Object pObject, Result pTarget) throws JAXBException;
+
+  /** <p>Marshals the given JAXB object <code>pObject</code> and
+   * serializes it into the byte stream <code>pTarget</code>. Note,
+   * that serialization into a byte stream demands the use of an
+   * encoding. It may be required to set the parameter
+   * {@link #JAXB_ENCODING}. By default the created output is
+   * formatted, which may be turned off using
+   * {@link #JAXB_FORMATTED_OUTPUT}.</p>
+   *
+   * @param pObject The JAXB object being marshalled.
+   * @param pTarget The output byte stream.
+   * @throws JAXBException An unexpected problem occurred. This may be used,
+   *   for example, to throw a nested {@link java.io.IOException}.
+   * @throws MarshalException Whereever possible, one should prefer the
+   *   {@link MarshalException} over the {@link JAXBException}.
+   * @throws IllegalArgumentException Any of the parameters was null.
+   * @see #JAXB_ENCODING
+   * @see #JAXB_FORMATTED_OUTPUT
+   * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   * @see #JAXB_SCHEMA_LOCATION
+   */
+  public void marshal(Object pObject, OutputStream pTarget) throws JAXBException;
+
+  /** <p>Marshals the given JAXB object <code>pObject</code> and
+   * serializes it into the character stream <code>pTarget</code>.
+   * Unlike serialization to a byte stream, an encoding is not
+   * required, but a <code>Marshaller</code> may use the encoding
+   * whether to escape a character or not. Use of the 
+   * {@link #JAXB_ENCODING} property is still recommended. By
+   * default the created output is
+   * formatted, which may be turned off using
+   * {@link #JAXB_FORMATTED_OUTPUT}.</p>
+   *
+   * @param pObject The JAXB object being marshalled.
+   * @param pTarget The output character stream.
+   * @throws JAXBException An unexpected problem occurred. This may be used,
+   *   for example, to throw a nested {@link java.io.IOException}.
+   * @throws MarshalException Whereever possible, one should prefer the
+   *   {@link MarshalException} over the {@link JAXBException}.
+   * @throws IllegalArgumentException Any of the parameters was null.
+   * @see #JAXB_ENCODING
+   * @see #JAXB_FORMATTED_OUTPUT
+   * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   * @see #JAXB_SCHEMA_LOCATION
+   */
+  public void marshal(Object pObject, Writer pTarget) throws JAXBException;
+
+  /** <p>Marshals the given JAXB object by emitting SAX events into
+   * into the given SAX {@link org.xml.sax.ContentHandler}. This
+   * includes the events {@link org.xml.sax.ContentHandler#startDocument()}
+   * and {@link org.xml.sax.ContentHandler#endDocument()}.</p>
+   *
+   * @param pObject The JAXB Object being marshalled.
+   * @param pTarget The target event handler.
+   * @throws JAXBException An unexpected problem occurred. This may be used,
+   *   for example, to throw a nested {@link org.xml.sax.SAXException}.
+   * @throws MarshalException Whereever possible, one should prefer the
+   *   {@link MarshalException} over the {@link JAXBException}.
+   * @throws IllegalArgumentException Any of the parameters was null.
+   * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   * @see #JAXB_SCHEMA_LOCATION
+   */
+  public void marshal(Object pObject, ContentHandler pTarget) throws JAXBException;
+
+  /** <p>Marshals the given JAXB object by creating a DOM tree below
+   * the given node.</p>
+   *
+   * @param pObject The JAXB object being marshalled.
+   * @param pTarget The target node. This node must be ready to accept a
+   *   child element. For example, it may be a {@link org.w3c.dom.Document},
+   *   a {@link org.w3c.dom.DocumentFragment}, or an
+   *   {@link org.w3c.dom.Element}.
+   * @throws JAXBException An unexpected problem occurred. This may be used,
+   *   for example, to throw a nested {@link org.w3c.dom.DOMException}.
+   * @throws MarshalException Whereever possible, one should prefer the
+   *   {@link MarshalException} over the {@link JAXBException}.
+   * @throws IllegalArgumentException Any of the parameters was null.
+   * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   * @see #JAXB_SCHEMA_LOCATION
+   */
+  public void marshal(Object pObject, Node pTarget) throws JAXBException;
+
+  /** <p>Returns a DOM view of the given JAXB object. This view is life
+   * in the sense that modifications of its DOM tree will trigger
+   * updates on the original JAXB object.</p>
+   * <p><em>Note</em>: This is an optional feature and not supported
+   * by all JAXB providers.</p>
+   * @param pObject The JAXB object being viewed.
+   * @throws UnsupportedOperationException The JAXB provider does not
+   *   support DOM views.
+   * @throws JAXBException An unexpected problem occurred. This may be used,
+   *   for example, to throw a nested {@link org.w3c.dom.DOMException}.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public Node getNode(Object pObject) throws JAXBException;
+
+  /** <p>Sets the marshaller property <code>pName</code> to the value
+   * <code>pValue</code>. Note, that the value type depends on the
+   * property being set. For example, the property
+   * {@link #JAXB_ENCODING} requires a string, but the property
+   * {@link #JAXB_FORMATTED_OUTPUT} requires a {@link Boolean}.</p>
+   * @param pName The property name.
+   * @throws PropertyException An error occurred while processing the property.
+   * @throws IllegalArgumentException The name parameter was null.
+   */
+  public void setProperty(String pName, Object pValue) throws PropertyException;
+
+  /** <p>Returns the value of the marshaller property <code>pName</code>.
+   * Note, that the value type depends on the
+   * property being set. For example, the property
+   * {@link #JAXB_ENCODING} requires a string, but the property
+   * {@link #JAXB_FORMATTED_OUTPUT} requires a {@link Boolean}.</p>
+   * @param pName The property name.
+   * @throws PropertyException An error occurred while processing the property.
+   * @throws IllegalArgumentException The name parameter was null.
+   */
+  public Object getProperty(String pName) throws PropertyException;
+
+  /** <p>Allows the application to set an event handler. The event handler
+   * will be invoked in case of a validation event.</p>
+   * <p><em>Note</em>: The ability to register an event handler does not
+   * indicate that a JAXB provider is required to validate the objects
+   * being marshalled. If you want to ensure, that only valid objects
+   * are marshalled, you should perform an explicit validation using a
+   * {@link javax.xml.bind.Validator}.</p>
+   * @param pHandler An application specific event handler or null to
+   *   revert to the default event handler. The default handler is
+   *   throwing an exception in case of errors.
+   */
+  public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException;
+
+  /** <p>Returns an event handler previously registered by the application.
+   * The event handler will be invoked in case of a validation event.</p>
+   * <p><em>Note</em>: The ability to register an event handler does not
+   * indicate that a JAXB provider is required to validate the objects
+   * being marshalled. If you want to ensure, that only valid objects
+   * are marshalled, you should perform an explicit validation using a
+   * {@link javax.xml.bind.Validator}.</p>
+   * @return An event handler previously set by the application or
+   *   the default event handler. The default handler is simply throwing
+   *   exceptions.
+   * @throws JAXBException An error occurred while getting the event
+   *   handler.
+   */
+  public ValidationEventHandler getEventHandler() throws JAXBException;
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/NotIdentifiableEvent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/NotIdentifiableEvent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/NotIdentifiableEvent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>This event is triggered by the various <code>printFoo()</code>
+ * methods of the {@link DatatypeConverterInterface}, if they are
+ * unable to create a lexical representation of their input.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface NotIdentifiableEvent extends ValidationEvent {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ParseConversionEvent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ParseConversionEvent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ParseConversionEvent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>This event indicates a problem while resolving an IDREF.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface ParseConversionEvent extends ValidationEvent {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PrintConversionEvent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PrintConversionEvent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PrintConversionEvent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>This event indicates a problem while resolving an IDREF.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface PrintConversionEvent extends ValidationEvent {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PropertyException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PropertyException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/PropertyException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>The <code>PropertyException</code> is a subclass of the
+ * {@link javax.xml.bind.JAXBException} being thrown if setting
+ * or getting a property failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class PropertyException extends JAXBException {
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public PropertyException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public PropertyException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public PropertyException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public PropertyException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public PropertyException(String pMessage, String pErrorCode,
+                           Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>PropertyException> by invoking
+   * {@link #PropertyException(String)} with a message derived from
+   * <code>pName</code> and <code>pValue.toString()</code>.</p>
+   * @param pName A Property name.
+   * @param pValue A property value.
+   */
+  public PropertyException(String pName, Object pValue) {
+    super("Property error: name=" + pName + ", value=" + pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/TypeConstraintException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/TypeConstraintException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/TypeConstraintException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>This is a runtime exception. The desired use is for
+ * generated set methods which would like to indicate that the
+ * specified value is invalid, for example, because a facet
+ * restriction wasn't met.</p>
+ * <p>If a generated setter throws a <code>TypeConstraintException</code>,
+ * then it is the JAXB providers task to ensure, that the object,
+ * on which the setter is invoked, remains unchanged.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class TypeConstraintException extends RuntimeException {
+  private String errorCode;
+  private Throwable linkedException;
+
+  /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public TypeConstraintException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public TypeConstraintException(String pMessage, String pErrorCode) {
+    super(pMessage);
+    errorCode = pErrorCode;
+  }
+
+  /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public TypeConstraintException(Throwable pLinkedException) {
+    linkedException = pLinkedException;
+  }
+
+  /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public TypeConstraintException(String pMessage, Throwable pLinkedException) {
+    super(pMessage);
+    linkedException = pLinkedException;
+  }
+
+  /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public TypeConstraintException(String pMessage, String pErrorCode,
+                       Throwable pLinkedException) {
+    super(pMessage);
+    errorCode = pErrorCode;
+    linkedException = pLinkedException;
+  }
+
+  /** <p>Returns the vendor specific error code, if any, or null.</p>
+   */
+  public String getErrorCode() {
+    return errorCode;
+  }
+
+  /** <p>Returns the linked exception, if any, or null.</p>
+   */
+  public Throwable getLinkedException() {
+    return linkedException;
+  }
+
+  /** <p>Sets the linked exception.</p>
+   * @param pLinkedException The linked exception or null.
+   */
+  public void setLinkedException(Throwable pLinkedException) {
+    linkedException = pLinkedException;
+  }
+
+  /** <p>Converts the linked exception into a String. Overridden,
+   * because the returned string should contain the vendor specific
+   * error code, if any.</p>
+   */
+  public String toString() {
+    if (errorCode == null  ||  errorCode.length() == 0) {
+      return super.toString();
+    } else {
+      return errorCode + ": " + super.toString();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshalException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshalException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshalException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>The <code>MarshalException</code> is a subclass of the
+ * {@link javax.xml.bind.JAXBException} being thrown if the
+ * unmarshalling of a JAXB object failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class UnmarshalException extends JAXBException {
+  /** <p>Creates a new <code>UnmarshalException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public UnmarshalException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>UnmarshalException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public UnmarshalException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new <code>UnmarshalException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public UnmarshalException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new <code>UnmarshalException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public UnmarshalException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>UnmarshalException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public UnmarshalException(String pMessage, String pErrorCode,
+                           Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Unmarshaller.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Unmarshaller.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Unmarshaller.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import javax.xml.transform.Source;
+
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/** <p>A <code>Unmarshaller</code> is the opposite of the {@link Marshaller}:
+ * It takes as input XML in either of several representations (byte or
+ * character stream, DOM node, or a series of SAX events) and returns
+ * a JAXB object with the same contents.</p>
+ * <p>If the JAXB user demands, the <code>Unmarshaller</code> may also
+ * validate the content tree that it sees.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ * @see JAXBContext
+ * @see Marshaller
+ * @see Validator
+ */
+public interface Unmarshaller {
+  /** <p>This method takes opens the given file <code>pFile</code>
+   * for input. The Unmarshaller reads the byte stream contained in
+   * the file and converts it into an equivalent JAXB object.</p>
+   * @param pFile The file being read.
+   * @return The JAXB object read from the file.
+   * @throws JAXBException An unexpected problem (for example an
+   *   IOException) occurred.
+   * @throws UnmarshalException The JAXB object is invalid or could
+   *   not be read from the byte stream for similar reasons.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object unmarshal(java.io.File pFile) throws JAXBException;
+
+  /** <p>The Unmarshaller reads the given byte stream
+   * and converts it into an equivalent JAXB object.</p>
+   * @param pStream The stream being read.
+   * @return The JAXB object read from the byte stream.
+   * @throws JAXBException An unexpected problem (for example an
+   *   IOException) occurred.
+   * @throws UnmarshalException The JAXB object is invalid or could
+   *   not be read from the byte stream for similar reasons.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object unmarshal(java.io.InputStream pStream) throws JAXBException;
+
+  /** <p>This method takes connects to the given <code>pURL</code>
+   * and opens a byte stream for input. The Unmarshaller reads the
+   * byte stream and converts it into an equivalent JAXB object.</p>
+   * @param pURL The URL being read.
+   * @return The JAXB object read from the URL.
+   * @throws JAXBException An unexpected problem (for example an
+   *   IOException) occurred.
+   * @throws UnmarshalException The JAXB object is invalid or could
+   *   not be read from the byte stream for similar reasons.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object unmarshal(java.net.URL pURL) throws JAXBException;
+
+  /** <p>The Unmarshaller reads the byte stream or character
+   * stream referred by the {@link org.xml.sax.InputSource}
+   * and converts it into an equivalent JAXB object.</p>
+   * @param pSource The {@link InputSource} referring to a byte or
+   *   character stream. It is recommended, that the system ID is
+   *   set. This may be required, if the XML in the stream refers
+   *   to external entities.
+   * @return The JAXB object read from the byte or character stream.
+   * @throws JAXBException An unexpected problem (for example an
+   *   IOException) occurred.
+   * @throws UnmarshalException The JAXB object is invalid or could
+   *   not be read from the byte stream for similar reasons.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object unmarshal(InputSource pSource) throws JAXBException;
+
+  /** <p>The Unmarshaller converts the given node into an equivalent
+   * JAXB object.</p>
+   * @param pNode The node to convert. The JAXB provider must support
+   *   documents and elements. Other node types may not work
+   *   (document fragments) or cannot work (attributes, text nodes,
+   *   and so on).
+   * @return The JAXB object read from the DOM node.
+   * @throws JAXBException An unexpected problem occurred.
+   * @throws UnmarshalException The JAXB object is invalid or could
+   *   not be read for similar reasons.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object unmarshal(Node pNode) throws JAXBException;
+
+  /** <p>The Unmarshaller reads the XML representation from the given
+   * {@link Source} and converts it into an equivalent JAXB object.</p>
+   * <p>The JAXB provider must support at least
+   * {@link javax.xml.transform.sax.SAXSource},
+   * {@link javax.xml.transform.dom.DOMSource}, and
+   * {@link javax.xml.transform.stream.StreamSource}. A possible
+   * implementation could validate whether the argument is actually
+   * an instance of these subinterfaces. If so, it might simply
+   * act like
+   * {@link #getUnmarshallerHandler()},
+   * {@link #unmarshal(org.w3c.dom.Node)},
+   * {@link #unmarshal(java.io.InputStream)}, or
+   * {@link #unmarshal(org.xml.sax.InputSource)}, respectively.</p>
+   * <p><em>Note</em>: If you are not using the standard JAXP
+   * mechanism for obtaining an {@link org.xml.sax.XMLReader},
+   * then you might create your own SAX parser and invoke the
+   * <code>pSource</code> arguments
+   * {@link javax.xml.transform.sax.SAXSource#setXMLReader(org.xml.sax.XMLReader)}.
+   * The JAXB provider will detect and use your SAX parser.</p>
+   *
+   * @return The JAXB object read from the DOM node.
+   * @param pSource The {@link Source} being read.
+   * @throws JAXBException An unexpected problem occurred.
+   * @throws UnmarshalException The JAXB object is invalid or could
+   *   not be read for similar reasons.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object unmarshal(Source pSource) throws JAXBException;
+
+  /** <p>Returns a SAX 2 {@link org.xml.sax.ContentHandler}, which is
+   * able to parse a SAX event stream and convert it into a JAXB
+   * object. This is particularly useful in a stack of SAX
+   * handlers. (Think of Apache Cocoon.)</p>
+   * <p><em>Note</em>: The JAXB provider may choose to return the
+   * same handler again, if the method is invoked more than once.
+   * In other words, if you need to have multiple handlers (for
+   * example, because you have multiple threads), then you should
+   * create multiple <code>Unmarshallers</code>.</p>
+   */
+  public UnmarshallerHandler getUnmarshallerHandler() throws JAXBException;
+
+  /** <p>Sets whether the <code>Unmarshaller</code> is validating
+   * the objects that it reads. The default is false.</p>
+   * <p><em>Note</em>: A validating unmarshaller will rarely use
+   * a validating SAX parser by default! It does so, because the
+   * SAX parsers validation and the Unmarshallers builtin
+   * validation would most probably validate the same things,
+   * resulting in no additional safety at the cost of wasting
+   * performance. Second, a SAX parser is not always in use.
+   * For example, you do not need a parser when
+   * converting a DOM Node. If you insist in a validating XML
+   * parser, then you should create your own
+   * {@link org.xml.sax.XMLReader} and use the method
+   * {@link #unmarshal(javax.xml.transform.Source)}.</p>
+   * @param pValidating Whether the <code>Unmarshaller</code> should validate
+   *   or not.
+   * @throws JAXBException Setting the property failed.
+   */
+  public void setValidating(boolean pValidating) throws JAXBException;
+
+  /** <p>Sets whether the <code>Unmarshaller</code> is validating
+   * the objects that it reads. The default is false.</p>
+   * @see #setValidating(boolean)
+   * @return True, if the <code>Unmarshaller</code> is validating the objects
+   *   that it reads, false otherwise.
+   * @throws JAXBException Fetching the property value failed.
+   */
+  public boolean isValidating() throws JAXBException;
+
+  /** <p>An application may customize the Unmarshallers behaviour
+   * in case of validation problems by supplying a custom handler
+   * for validation events. The default handler will trigger an
+   * exception in case of errors and fatal errors.</p>
+   * @param pHandler The custom event handler or null to restore
+   *   the default event handler.
+   * @throws JAXBException Setting the handler failed.
+   */
+  public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException;
+
+  /** <p>If the JAXB application has registered a custom handler
+   * for validation events, returns that handler. Otherwise returns
+   * the default handler, which is triggering an exception in case
+   * of errors and fatal errors.</p>
+   */
+  public ValidationEventHandler getEventHandler() throws JAXBException;
+
+  /** <p>Sets the unmarshaller property <code>pName</code> to the value
+   * <code>pValue</code>. Note, that the value type depends on the
+   * property being set.</p>
+   * @param pName The property name.
+   * @throws PropertyException An error occurred while processing the property.
+   * @throws IllegalArgumentException The name parameter was null.
+   */
+  public void setProperty(String pName, Object pValue) throws PropertyException;
+
+  /** <p>Returnss the unmarshaller property <code>pName</code> to the value
+   * <code>pValue</code>. Note, that the value type depends on the
+   * property being set.</p>
+   * @param pName The property name.
+   * @throws PropertyException An error occurred while processing the property.
+   * @throws IllegalArgumentException The name parameter was null.
+   */
+  public java.lang.Object getProperty(String pName) throws PropertyException;
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshallerHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshallerHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/UnmarshallerHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import org.xml.sax.ContentHandler;
+
+
+/** <p>This interface is the SAX {@link org.xml.sax.ContentHandler}
+ * representation of an {@link javax.xml.bind.Unmarshaller}, as
+ * returned by
+ * {@link javax.xml.bind.Unmarshaller#getUnmarshallerHandler()}.
+ * It can be embedded into a stack of SAX handlers, for example
+ * within Apache Cocoon.</p>
+ * <p>The <code>UnmarshallerHandler</code> is reusable: The
+ * <code>startDocument()</code> method is expected to perform
+ * a reinitialization. Like most other SAX handlers, the
+ * <code>UnmarshallerHandler</code> is never thread safe.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface UnmarshallerHandler extends ContentHandler {
+  /** <p>Returns the unmarshalled object. This method may be invoked
+   * after an <code>endDocument()</code> event only. An
+   * {@link IllegalStateException} is thrown otherwise.
+   * @return The unmarshalled object, never null. (An
+   *   {@link IllegalStateException} is thrown, if no data is
+   *   available.
+   * @throws JAXBException An error occurred. Note, that the
+   *   {@link UnmarshallerHandler} throws a
+   *   {@link org.xml.sax.SAXException} if an error occurs while
+   *   unmarshalling the object. In such cases the
+   *   {@link JAXBException} is typically nested within the
+   *   {@link org.xml.sax.SAXException}.
+   * @throws IllegalStateException An <code>endDocument()</code>
+   *   event has not yet been seen and no data is available.
+   */
+  public Object getResult() throws JAXBException, IllegalStateException;
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEvent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEvent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEvent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>An instance of <code>ValidationEvent</code> indicates some
+ * error condition, which occurred when validating a JAXB object.
+ * The purpose of the {@link ValidationEventHandler} is to
+ * customize the reply on instances of <code>ValidationEvent</code>.
+ * The default event handler will throw an exception in case of
+ * events, but application specific validation event handlers need
+ * not do the same.</p>
+ * 
+ * @see Validator
+ * @see ValidationEventHandler
+ * @since JAXB1.0
+ * @author JSR-31
+ */
+public interface ValidationEvent {
+  /** <p>In contrast to errors or fatal errors, this indicates an
+   * event which can possibly be ignored. This constant has the
+   * value 0. See section 1.2 of the W3C XML 1.0 Recommendation for
+   * details.</p>
+   * @see #ERROR
+   * @see #FATAL_ERROR
+   * @see #getSeverity()
+   */
+  public static final int WARNING = 0;
+
+  /** <p>This value indicates an "error", as specified by section
+   * 1.2 of the W3C XML 1.0 Recommendation. The constant value is
+   * 1.</p>
+   * @see #WARNING
+   * @see #FATAL_ERROR
+   * @see #getSeverity()
+   */
+  public static final int ERROR = 1;
+
+  /** <p>This value indicates a "fatal error", as specified by section
+   * 1.2 of the W3C XML 1.0 Recommendation. The constant value is
+   * 2.</p>
+   * @see #WARNING
+   * @see #ERROR
+   * @see #getSeverity()
+   */
+  public static final int FATAL_ERROR = 2;
+
+  /** <p>Returns the events severity: Either of
+   * {@link #WARNING}, {@link #ERROR}, or {@link #FATAL_ERROR}.</p>
+   * @return Returns the events severity.
+   */
+  public int getSeverity();
+
+  /** <p>Returns a textual description of the event.</p>
+   */
+  public java.lang.String getMessage();
+
+  /** <p>Returns a {@link Throwable} related to the event. In most cases
+   * an exception causing the event.</p>
+   */
+  public java.lang.Throwable getLinkedException();
+
+  /** <p>Returns a description of the location, where the event
+   * occurred.</p>
+   */
+  public ValidationEventLocator getLocator();
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>An instance of <code>ValidationEventHandler</code> allows
+ * to customize the reply to instances of
+ * {@link javax.xml.bind.ValidationEvent}. By default, there is
+ * a standard <code>ValidationEventHandler</code>, converting
+ * errors and fatal errors in Exceptions.</p>
+ * <p>The JAXB user creates instances of <code>ValidationEventHandler</code>
+ * and registers them with the {@link Marshaller}, {@link Unmarshaller},
+ * or {@link Validator}. The JAXB provider is required not to throw
+ * exceptions directly, but to convert all detected problems into events,
+ * which are fired on the <code>ValidationEventHandler</code>.</p>
+ *
+ * @since JAXB1.0
+ * @author JSR-31
+ * @see Marshaller
+ * @see Unmarshaller
+ * @see javax.xml.bind.ValidationEvent
+ */
+public interface ValidationEventHandler {
+   /** <p>The <code>handleEvent</code> method is invoked by the
+    * JAXB provider, if a problem was found. The events
+    * {@link javax.xml.bind.ValidationEventLocator} may be
+    * used to locate the source of the problem.</p>
+    *
+    * @param pEvent The event being reported to the JAXB user.
+    * @return True as an indicator that the JAXB provider should
+    *   attempt to continue its current operation. (Marshalling,
+    *   Unmarshalling, Validating) This will not always work.
+    *   In particular, you cannot expect that the operation
+    *   continues, if a fatal error was reported. False to
+    *   indicate that the JAXB provider should terminate the
+    *   operation and through an appropriate exception.
+    * @throws IllegalArgumentException The parameter is null.
+    */
+   public boolean handleEvent(ValidationEvent pEvent);
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventLocator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventLocator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationEventLocator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+import org.w3c.dom.Node;
+
+/** <p>The <code>ValidationEventLocator</code> is an abstract
+ * description of the place where a {@link javax.xml.bind.ValidationEvent}
+ * occurred.</p>
+ * <p>Depending on the source or target media (Unmarshalling, or Unmarshalling)
+ * or the object being validated, you will most probably find that different
+ * fields of the <code>ValidationEventHandler</code> are set. For example,
+ * if you are using a {@link org.xml.sax.ContentHandler}, you will most
+ * probably find that those fields are set, which are common to a
+ * {@link org.xml.sax.Locator}.</p>
+ *
+ * @see javax.xml.bind.ValidationEvent
+ * @since JAXB1.0
+ * @author JSR-31
+ */
+public interface ValidationEventLocator {
+  /** <p>Returns a URL related to the validation event, if available.
+   * For example, when parsing an {@link org.xml.sax.InputSource}, this
+   * might be the URL given by {@link org.xml.sax.InputSource#getSystemId()}.</p>
+   * @return The validation event URL, if available, or null.
+   */
+  public java.net.URL getURL();
+
+  /** <p>Returns a byte offset related to the validation event, if
+   * available. For example, when parsing an {@link java.io.InputStream},
+   * this might be the position where the event occurred.</p>
+   * @return Byte offset, if available, or -1.
+   */
+  public int getOffset();
+
+  /** <p>Returns a line number related to the validation event, if
+   * available. For example, when parsing an {@link java.io.InputStream},
+   * this might be the line, in which the event occurred.</p>
+   * @return Line number, if available, or -1.
+   */
+  public int getLineNumber();
+
+  /** <p>Returns a column number related to the validation event, if
+   * available. For example, when parsing an {@link java.io.InputStream},
+   * this might be the column, in which the event occurred.</p>
+   * @return Column number, if available, or -1.
+   */
+  public int getColumnNumber();
+
+  /** <p>Returns an object in the JAXB objects content tree related
+   * to the validation event. Usually this is the invalid object or
+   * child object.</p>
+   * @return Part of a JAXB object tree, if available, or null.
+   */
+  public java.lang.Object getObject();
+
+  /** <p>Returns a DOM node related to the validation event. For
+   * example, this might be an element node with a missing attribute.
+   * It might as well be an attribute node with an invalid value.</p>
+   * @return Invalid node, if available, or null.
+   */
+   public Node getNode();
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/ValidationException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+/** <p>The <code>MarshalException</code> is a subclass of the
+ * {@link javax.xml.bind.JAXBException} being thrown if the
+ * validation of a JAXB object failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationException extends JAXBException {
+  /** <p>Creates a new <code>ValidationException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public ValidationException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>ValidationException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public ValidationException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new <code>ValidationException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public ValidationException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new <code>ValidationException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public ValidationException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>ValidationException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public ValidationException(String pMessage, String pErrorCode,
+                           Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Validator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Validator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/Validator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind;
+
+
+/** <p>A <code>Validator</code> may be used to decide, whether
+ * a JAXB object is valid or not. If it is not, the JAXB user
+ * may decide to trigger an exception or not (via the
+ * {@link javax.xml.bind.ValidationEventHandler} and he may
+ * receive information on the problems location (via the
+ * event handlers {@link javax.xml.bind.ValidationEventLocator}.</p>
+ * <p>A Validator may be present implicitly, invoked by the
+ * Unmarshaller. See {@link javax.xml.bind.Unmarshaller#setValidating(boolean)} for
+ * more information on that.</p>
+ * @since JAXB1.0
+ * @author JSR-31
+ * @see ValidationEventHandler
+ * @see ValidationEvent
+ */
+public interface Validator {
+  /** <p>Registers an event handler that shall be invoked for
+   * notifications on problems detected by the <code>Validator</code>.
+   * If this method is not invoked, there is a default event handler.
+   * The default event handler will trigger an exception for
+   * errors and fatal errors.</p>
+   *
+   * @param pHandler The event handler being notified or null
+   *   to restore the default event handler.
+   * @throws JAXBException Setting the event handler failed.
+   */
+  public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException;
+
+  /** <p>Returns an event handler that shall be invoked for
+   * notifications on problems detected by the <code>Validator</code>.
+   * If no specific event handler was set, returns the default
+   * event handler. The default event handler will trigger an
+   * exception for errors and fatal errors.</p>
+   *
+   * @throws JAXBException Getting the event handler failed.
+   * @return The event handler previously set or the default
+   *   handler.
+   */
+  public ValidationEventHandler getEventHandler() throws JAXBException;
+
+  /** <p>Validates the given JAXB object, invoking its error handler
+   * for any problems it detects. Detected problems may cause exceptions,
+   * for example, if the event handlers
+   * {@link ValidationEventHandler#handleEvent(ValidationEvent)}
+   * method returns false.</p>
+   *
+   * @param pObject The JAXB object being validated.
+   * @throws JAXBException An unexpected problem occurred during
+   *   validation
+   * @throws ValidationException It was detected, that the
+   *   object is invalid.
+   * @throws IllegalArgumentException The parameter was null.
+   * @see #validateRoot(Object)
+   */
+  public boolean validate(Object pObject) throws JAXBException;
+
+  /** <p>Validates the given JAXB object, but not its child
+   * elements.</p>
+   *
+   * @param pObject The JAXB object being validated.
+   * @throws JAXBException An unexpected problem occurred during
+   *   validation
+   * @throws ValidationException It was detected, that the
+   *   object is invalid.
+   * @throws IllegalArgumentException The parameter was null.
+   * @see #validate(Object)
+   */ 
+  public boolean validateRoot(Object pObject) throws JAXBException;
+
+  /** <p>Sets the <code>Validator</code> property <code>pName</code>
+   * to <code>pValue</code>.</p>
+   * <p><em>Note</em>: The values type depends on the property name.</p>
+   *
+   * @param pName The property name.
+   * @param pValue The property value.
+   * @throws PropertyException Setting the property failed.
+   * @throws IllegalArgumentException The <code>pName</code> parameter was null.
+   */
+  public void setProperty(String pName, Object pValue) throws PropertyException;
+
+  /** <p>Returns the marshallers property <code>pName</code>.</p>
+   * <p><em>Note</em>: The values type depends on the property name.</p>
+   *
+   * @param pName The property name.
+   * @return The property value.
+   * @throws PropertyException Fetching the property failed.
+   * @throws IllegalArgumentException The parameter was null.
+   */
+  public java.lang.Object getProperty(String pName) throws PropertyException;
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractMarshallerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractMarshallerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractMarshallerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+
+/** <p>Default implementation of a Marshaller. The JAXB provider needs
+ * to implement only
+ * {@link javax.xml.bind.Marshaller#marshal(Object, javax.xml.transform.Result)}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ * @see javax.xml.bind.Marshaller 
+ */
+public abstract class AbstractMarshallerImpl implements Marshaller {
+  private String encoding = "UTF-8";
+  private String schemaLocation, noNSSchemaLocation;
+  private boolean isFormattedOutput = true;
+  private ValidationEventHandler eventHandler = DefaultValidationEventHandler.theInstance;
+
+  /** <p>Creates a new instance of <code>AbstractMarshallerImpl</code>.</p>
+   */
+  public AbstractMarshallerImpl() {
+  }
+
+  /* @see javax.xml.bind.Marshaller#setValidationEventHandler(javax.xml.bind.ValidationEventHandler)}
+   */
+  public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException {
+    eventHandler = pHandler;
+  }
+
+  /* @see javax.xml.bind.Marshaller#getValidationEventHandler()}
+   */
+  public ValidationEventHandler getEventHandler() throws JAXBException {
+    return eventHandler;
+  }
+
+  /** <p>Public interface to set the properties defined
+   * by the {@link javax.xml.bind.Marshaller} interface.
+   * Works by invocation of {@link #setEncoding(String)},
+   * {@link #setFormattedOutput(boolean)},
+   * {@link #setNoNSSchemaLocation(String)}, and
+   * {@link #setSchemaLocation(String)} internally.</p>
+   * <p>If you want to support additional properties,
+   * you have to override this method in a subclass.</p>
+   * @throws PropertyException Unknown property name
+   */
+  public void setProperty(String pName, Object pValue) throws PropertyException {
+    if (pName == null) {
+      throw new IllegalArgumentException("The property name must not be null.");
+    }
+    if (Marshaller.JAXB_ENCODING.equals(pName)) {
+      setEncoding((String) pValue);
+    } else if (Marshaller.JAXB_FORMATTED_OUTPUT.equals(pName)) {
+      if (pValue == null) {
+        setFormattedOutput(true);
+      } else {
+        setFormattedOutput(((Boolean) pValue).booleanValue());
+      }
+    } else if (Marshaller.JAXB_SCHEMA_LOCATION.equals(pName)) {
+      setSchemaLocation((String) pValue);
+    } else if (Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(pName)) {
+      setNoNSSchemaLocation((String) pValue);
+    } else {
+      throw new PropertyException("Unknown property name: " + pName);
+    }
+  }
+
+  /** <p>Public interface to get the properties defined
+   * by the {@link javax.xml.bind.Marshaller} interface.
+   * Works by invocation of {@link #getEncoding()},
+   * {@link #isFormattedOutput()},
+   * {@link #getNoNSSchemaLocation()}, and
+   * {@link #getSchemaLocation()} internally.</p>
+   * <p>If you want to support additional properties,
+   * you have to override this method in a subclass.</p>
+   * @throws PropertyException Unknown property name
+   */
+  public Object getProperty(String pName) throws PropertyException {
+    if (pName == null) {
+      throw new IllegalArgumentException("The property name must not be null.");
+    }
+    if (Marshaller.JAXB_ENCODING.equals(pName)) {
+      return getEncoding();
+    } else if (Marshaller.JAXB_FORMATTED_OUTPUT.equals(pName)) {
+      return isFormattedOutput() ? Boolean.TRUE : Boolean.FALSE;
+    } else if (Marshaller.JAXB_SCHEMA_LOCATION.equals(pName)) {
+      return getSchemaLocation();
+    } else if (Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(pName)) {
+      return getNoNSSchemaLocation();
+    } else {
+      throw new PropertyException("Unknown property name: " + pName);
+    }
+  }
+
+  /** <p>Returns the current output encoding.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_ENCODING
+   * @return The current encoding, by default "UTF-8".
+   */
+  protected String getEncoding() {
+    return encoding;
+  }
+
+  /** <p>Converts the given IANA encoding name into a Java encoding
+   * name. This is a helper method for derived subclasses.</p>
+   */
+  protected String getJavaEncoding(String pEncoding)
+        throws UnsupportedEncodingException {
+     "".getBytes(pEncoding);  // Throws an UnsupportedEncodingException,
+                              // if the encoding is unknown.
+     return pEncoding;
+  }
+
+  /** <p>Sets the current output encoding.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_ENCODING
+   */
+  protected void setEncoding(String pEncoding) {
+    encoding = pEncoding == null ? "UTF-8" : pEncoding;
+  }
+
+  /** <p>Sets the marshallers schema location.
+   * Defaults to null.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
+   */
+  protected void setSchemaLocation(String pSchemaLocation) {
+    schemaLocation = pSchemaLocation;
+  }
+
+  /** <p>Returns the marshallers schema location.
+   * Defaults to null.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
+   */
+  protected String getSchemaLocation() {
+    return schemaLocation;
+  }
+  
+  /** <p>Sets the marshallers "no namespace" schema location.
+   * Defaults to null.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   */
+  protected void setNoNSSchemaLocation(String pNoNSSchemaLocation) {
+    noNSSchemaLocation = pNoNSSchemaLocation;
+  }
+
+  /** <p>Returns the marshallers "no namespace" schema location.
+   * Defaults to null.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   */
+  protected String getNoNSSchemaLocation() {
+    return noNSSchemaLocation;
+  }
+
+  /** <p>Sets whether the marshaller will create formatted
+   * output or not. By default it does.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
+   */
+  protected void setFormattedOutput(boolean pFormattedOutput) {
+    isFormattedOutput = pFormattedOutput;
+  }
+
+  /** <p>Returns whether the marshaller will create formatted
+   * output or not. By default it does.</p>
+   * @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
+   */
+  protected boolean isFormattedOutput() {
+    return isFormattedOutput;
+  }
+
+  /* @see javax.xml.bind.Marshaller#marshal(Object, java.io.OutputStream)
+   */
+  public final void marshal(Object pObject, OutputStream pStream)
+        throws JAXBException {
+    StreamResult sr = new StreamResult();
+    sr.setOutputStream(pStream);
+    marshal(pObject, sr);
+  }
+
+  /* @see javax.xml.bind.Marshaller#marshal(Object, java.io.Writer)
+   */
+  public final void marshal(Object pObject, Writer pWriter)
+        throws JAXBException {
+    StreamResult sr = new StreamResult();
+    sr.setWriter(pWriter);
+    marshal(pObject, sr);
+  }
+
+  /* @see javax.xml.bind.Marshaller#marshal(Object, org.xml.sax.ContentHandler)
+   */
+  public final void marshal(Object pObject, ContentHandler pHandler)
+        throws JAXBException {
+    SAXResult sr = new SAXResult();
+    sr.setHandler(pHandler);
+    marshal(pObject, sr);
+  }
+
+  /* @see javax.xml.bind.Marshaller#marshal(Object, org.w3c.dom.Node)
+   */
+  public final void marshal(Object pObject, Node pNode)
+        throws JAXBException {
+    DOMResult dr = new DOMResult();
+    dr.setNode(pNode);
+    marshal(pObject, dr);
+  }
+
+  /** <p>This method is unsupported in the default implementation
+   * and throws an {@link UnsupportedOperationException}.</p>
+   * @throws UnsupportedOperationException This method is not available in the
+   *   default implementation.
+   */
+  public Node getNode(Object obj) throws JAXBException {
+    throw new UnsupportedOperationException("This operation is unsupported.");
+  }
+}
+

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.UnmarshalException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>This is an abstract default implementation of an
+ * {@link javax.xml.bind.Unmarshaller}. Subclasses only need to implement
+ * {@link javax.xml.bind.Unmarshaller#getUnmarshallerHandler()},
+ * {@link javax.xml.bind.Unmarshaller#unmarshal(org.w3c.dom.Node)}, and
+ * {@link #unmarshal(org.xml.sax.XMLReader, org.xml.sax.InputSource)}.</p>
+ * 
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public abstract class AbstractUnmarshallerImpl implements Unmarshaller {
+  private boolean isValidating;
+  private XMLReader xmlReader;
+  private static SAXParserFactory saxParserFactory;
+  private ValidationEventHandler validationEventHandler = DefaultValidationEventHandler.theInstance;
+
+  static {
+    saxParserFactory = SAXParserFactory.newInstance();
+    saxParserFactory.setNamespaceAware(true);
+    saxParserFactory.setValidating(false);
+  }
+
+  /** <p>Creates a new instance of AbstractUnmarshallerImpl.</p>
+   */
+  public AbstractUnmarshallerImpl() {
+  }
+
+  /** <p>Creates a configured {@link org.xml.sax.XMLReader}.
+   * Unmarshaller is not re-entrant, so we will use a single instance
+   * of {@link org.xml.sax.XMLReader}.</p>
+   * @throws JAXBException Encapsulates a
+   *   {@link javax.xml.parsers.ParserConfigurationException}
+   */
+  protected XMLReader getXMLReader() throws JAXBException {
+    if (xmlReader == null) {
+      try {
+        SAXParser sp = saxParserFactory.newSAXParser();
+        xmlReader = sp.getXMLReader();
+      } catch (ParserConfigurationException e) {
+        throw new JAXBException("Failed to create a JAXP compliant SAX parser.", e);
+      } catch (SAXException e) {
+        throw new JAXBException("Failed to create a JAXP compliant SAX parser.", e);
+      }
+    }
+    return xmlReader;
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#unmarshal(javax.xml.transform.Source)
+   */
+  public Object unmarshal(Source pSource) throws JAXBException {
+    if (pSource instanceof SAXSource) {
+      SAXSource ss = (SAXSource) pSource;
+      InputSource is = ss.getInputSource();
+      XMLReader xr = ss.getXMLReader();
+      if (xr == null) {
+        xr = getXMLReader();
+      }
+      return unmarshal(xr, is);
+    } else if (pSource instanceof StreamSource) {
+      StreamSource ss = (StreamSource) pSource;
+      InputSource is;
+      InputStream istream = ss.getInputStream();
+      if (istream == null) {
+        Reader r = ss.getReader();
+        if (r == null) {
+          throw new JAXBException("The specified StreamSource must have configured either of its InputStream or Reader.");
+        } else {
+          is = new InputSource(r);
+        }
+      } else {
+        is = new InputSource(istream);
+      }
+      is.setSystemId(ss.getSystemId());
+      is.setPublicId(ss.getPublicId());
+      return unmarshal(getXMLReader(), is);
+    } else if (pSource instanceof DOMSource) {
+      DOMSource ds = (DOMSource) pSource;
+      return unmarshal(ds.getNode());
+    } else {
+      throw new JAXBException("Unsupported type of " + Source.class.getName() +
+                              ", expected either of " +
+                              SAXSource.class.getName() + ", " +
+                              StreamSource.class.getName() + ", or " +
+                              DOMSource.class.getName());
+    }
+  }
+
+  /** <p>Unmarshals an object by using the given instance
+   * of {@link org.xml.sax.XMLReader} to parse the XML
+   * document read from the byte or character stream
+   * given by the {@link org.xml.sax.InputSource}
+   * <code>pSource</code>.</p>
+   * <p>The implementation should call the method
+   * {@link org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)}
+   * in order to pass errors provided by the SAX parser to the
+   * {@link javax.xml.bind.ValidationEventHandler} provided by
+   * the client.</p>
+   * @throws JAXBException An error occurred while unmarshalling
+   *   the JAXB object.
+   */
+  protected abstract java.lang.Object unmarshal(XMLReader pReader,
+                                                  InputSource pSource)
+      throws JAXBException;
+
+  /* @see javax.xml.bind.Unmarshaller#unmarshal(org.xml.sax.InputSource)
+   */
+  public final Object unmarshal(InputSource pSource) throws JAXBException {
+    return unmarshal(getXMLReader(), pSource);
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#unmarshal(java.net.URL)
+   */
+  public final java.lang.Object unmarshal(java.net.URL pURL) throws JAXBException {
+    InputSource isource;
+    try {
+      isource = new InputSource(pURL.openStream());
+    } catch (IOException e) {
+      throw new JAXBException("Failed to open URL " + pURL + ": " + e.getMessage(), e);
+    }
+    isource.setSystemId(pURL.toExternalForm());
+    return unmarshal(getXMLReader(), isource);
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#unmarshal(java.io.File)
+   */
+  public final java.lang.Object unmarshal(java.io.File pFile) throws JAXBException {
+    InputSource isource;
+    try {
+      isource = new InputSource(new FileInputStream(pFile));
+    } catch (IOException e) {
+      throw new JAXBException("Failed to open file " + pFile + ": " + e.getMessage(), e);
+    }
+    try {
+      isource.setSystemId(pFile.toURL().toExternalForm());
+    } catch (IOException e) {
+      throw new JAXBException("Malformed URL: " + pFile, e);
+    }
+    return unmarshal(getXMLReader(), isource);
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#unmarshal(java.io.InputStream)
+   */
+  public final java.lang.Object unmarshal(java.io.InputStream pSource)
+     throws JAXBException {
+    return unmarshal(getXMLReader(), new InputSource(pSource));
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#isValidating()
+   */
+  public boolean isValidating() throws JAXBException {
+    return isValidating;
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#setValidating(boolean)
+   */
+  public void setValidating(boolean pValidating) throws JAXBException {
+    isValidating = pValidating;
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#getEventHandler()
+   */
+  public ValidationEventHandler getEventHandler()
+      throws JAXBException {
+    return validationEventHandler;
+  }
+
+  /* @see javax.xml.bind.Unmarshaller#setEventHandler(javax.xml.bind.ValidationEventHandler)
+   */
+  public void setEventHandler(ValidationEventHandler pHandler)
+      throws JAXBException {
+    validationEventHandler = pHandler;
+  }
+
+  /** <p>Helper method to concert a {@link org.xml.sax.SAXException}
+   * into an {@link javax.xml.bind.UnmarshalException}.</p>
+   * @param pException If the parameter contains a nested instance of
+   *   {@link javax.xml.bind.UnmarshalException}, throws that instance.
+   *   Otherwise wraps the parameter in a new
+   *   {@link javax.xml.bind.UnmarshalException} and throws that.
+   */
+   protected UnmarshalException createUnmarshalException(SAXException pException) {
+     Exception ex = pException.getException();
+     if (ex != null  &&  ex instanceof UnmarshalException) {
+       return (UnmarshalException) ex;
+     } else {
+       return new UnmarshalException(pException);
+     }
+   }
+
+   /** <p>Always throws a {@link javax.xml.bind.PropertyException},
+    * because the default implementation does not support any
+    * properties. If you want to change this, override the class.</p>
+    * @throws IllegalArgumentException The property name was null.
+    * @throws PropertyException The name was not null. :-)
+    */
+   public void setProperty(String pName, Object pValue) throws PropertyException {
+     if (pName == null) {
+       throw new IllegalArgumentException("The property name must not be null.");
+     } else {
+       throw new PropertyException("Unsupported property name: " + pName);
+     }
+   }
+
+   /** <p>Always throws a {@link javax.xml.bind.PropertyException},
+    * because the default implementation does not support any
+    * properties. If you want to change this, override the class.</p>
+    * @throws IllegalArgumentException The property name was null.
+    * @throws PropertyException The name was not null. :-)
+    */
+   public Object getProperty(String pName) throws PropertyException {
+     if (pName == null) {
+       throw new IllegalArgumentException("The property name must not be null.");
+     } else {
+       throw new PropertyException("Unsupported property name: " + pName);
+     }
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/DefaultValidationEventHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/DefaultValidationEventHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/DefaultValidationEventHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+/** <p>Default implementation of a {@link javax.xml.bind.ValidationEventHandler}.
+ * Causes the validation to fail as soon as the first error or
+ * fatal error is encountered.</p>
+ * <p>This instance of {@link javax.xml.bind.ValidationEventHandler} is
+ * suitable for use of the unmarshallers or validators default event handler.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class DefaultValidationEventHandler implements ValidationEventHandler {
+  static final DefaultValidationEventHandler theInstance =
+    new DefaultValidationEventHandler();
+
+  /** <p>Creates a new instance of <code>DefaultValidationEventHandler</code>.</p>
+   */
+  public DefaultValidationEventHandler() {
+  }
+
+  public boolean handleEvent(ValidationEvent event) {
+    if (event.getSeverity() == ValidationEvent.WARNING) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/NotIdentifiableEventImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/NotIdentifiableEventImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/NotIdentifiableEventImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.NotIdentifiableEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class NotIdentifiableEventImpl extends ValidationEventImpl
+  implements javax.xml.bind.NotIdentifiableEvent {
+
+  /** <p>Creates a new instance of <code>NotIdentifiableEventImpl</code>.</p>
+   */
+  public NotIdentifiableEventImpl(int pSeverity, String pMessage,
+                                  ValidationEventLocator pLocator) {
+    super(pSeverity, pMessage, pLocator);
+  }
+
+  /** <p>Creates a new instance of <code>NotIdentifiableEventImpl</code>.</p>
+   */
+  public NotIdentifiableEventImpl(int pSeverity, String pMessage,
+                                  ValidationEventLocator pLocator,
+                                  Throwable pLinkedException) {
+    super(pSeverity, pMessage, pLocator, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ParseConversionEventImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ParseConversionEventImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ParseConversionEventImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.ParseConversionEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ParseConversionEventImpl extends ValidationEventImpl
+  implements javax.xml.bind.ParseConversionEvent {
+
+  /** <p>Creates a new instance of <code>ParseConversionEventImpl</code>.</p>
+   */
+  public ParseConversionEventImpl(int pSeverity, String pMessage,
+                                  ValidationEventLocator pLocator) {
+    super(pSeverity, pMessage, pLocator);
+  }
+
+  /** <p>Creates a new instance of <code>ParseConversionEventImpl</code>.</p>
+   */
+  public ParseConversionEventImpl(int pSeverity, String pMessage,
+                                  ValidationEventLocator pLocator,
+                                  Throwable pLinkedException) {
+    super(pSeverity, pMessage, pLocator, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/PrintConversionEventImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/PrintConversionEventImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/PrintConversionEventImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.PrintConversionEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class PrintConversionEventImpl extends ValidationEventImpl
+  implements javax.xml.bind.PrintConversionEvent {
+
+  /** <p>Creates a new instance of <code>PrintConversionEventImpl</code>.</p>
+   */
+  public PrintConversionEventImpl(int pSeverity, String pMessage,
+                                  ValidationEventLocator pLocator) {
+    super(pSeverity, pMessage, pLocator);
+  }
+
+  /** <p>Creates a new instance of <code>PrintConversionEventImpl</code>.</p>
+   */
+  public PrintConversionEventImpl(int pSeverity, String pMessage,
+                                  ValidationEventLocator pLocator,
+                                  Throwable pLinkedException) {
+    super(pSeverity, pMessage, pLocator, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.ValidationEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationEventImpl implements ValidationEvent {
+  private int severity;
+  private String message;
+  private Throwable linkedException;
+  private ValidationEventLocator locator;
+
+  /** <p>Creates a new instance of <code>ValidationEventImpl</code>.</p>
+   */
+  public ValidationEventImpl(int pSeverity, String pMessage,
+                             ValidationEventLocator pLocator) {
+    severity = pSeverity;
+    message = pMessage;
+    locator = pLocator;
+  }
+
+  /** <p>Creates a new instance of <code>ValidationEventImpl</code>.</p>
+   */
+  public ValidationEventImpl(int pSeverity, String pMessage,
+                             ValidationEventLocator pLocator,
+                             Throwable pLinkedException) {
+    severity = pSeverity;
+    message = pMessage;
+    linkedException = pLinkedException;
+    locator = pLocator;
+  }
+
+  /* @see javax.xml.bind.ValidationEvent#getSeverity()
+   */
+  public int getSeverity() {
+    return severity;
+  }
+
+  /** <p>Sets the events severity.</p>
+   * @param pSeverity The events severity, either of
+   * {@link javax.xml.bind.ValidationEvent#WARNING},
+   * {@link javax.xml.bind.ValidationEvent#ERROR}, or
+   * {@link javax.xml.bind.ValidationEvent#FATAL_ERROR}.</p> 
+   */
+  public void setSeverity(int pSeverity) {
+    severity = pSeverity;
+  }
+
+  /* @see javax.xml.bind.ValidationEvent#getMessage()
+   */
+  public String getMessage() {
+    return message;
+  }
+
+  /** <p>Sets the events message.</p>
+   */
+  public void setMessage(String pMessage) {
+    message = pMessage;
+  }
+
+  /* @see javax.xml.bind.ValidationEvent#getLinkedException()
+   */
+  public Throwable getLinkedException() {
+    return linkedException;
+  }
+
+  /** <p>Sets the exception, which is linked to the event.</p>
+   */
+  public void setLinkedException(Throwable pLinkedException) {
+    linkedException = pLinkedException;
+  }
+
+  /* @see javax.xml.bind.ValidationEvent#getLocator()
+   */
+  public ValidationEventLocator getLocator() {
+    return locator;
+  }
+
+  /** <p>Sets the events locator.</p>
+   */
+  public void setLocator(ValidationEventLocator pLocator) {
+    locator = pLocator;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventLocatorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventLocatorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/ValidationEventLocatorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.helpers;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.bind.ValidationEventLocator;
+
+import org.w3c.dom.Node;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+
+
+/** <p>Default implementation of a {@link javax.xml.bind.ValidationEventLocator}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationEventLocatorImpl implements ValidationEventLocator {
+  private URL url;
+  private int offset, lineNumber, columnNumber;
+  private Object object;
+  private Node node;
+
+  /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>.</p>
+   */
+  public ValidationEventLocatorImpl() {
+    offset = lineNumber = columnNumber = -1;
+  }
+
+  /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+   * by copying data from the given {@link org.xml.sax.Locator}.</p>
+   * @param pLocator The SAX locator where to copy from.
+   */
+  public ValidationEventLocatorImpl(Locator pLocator) {
+     if (pLocator == null) {
+       lineNumber = columnNumber = -1;
+     } else {
+       columnNumber = pLocator.getColumnNumber();
+       lineNumber = pLocator.getLineNumber();
+       String u = pLocator.getSystemId();
+       if (u != null) {
+         try {
+           url = new URL(pLocator.getSystemId());
+         } catch (MalformedURLException e) {
+         }
+       }
+     }
+     offset = -1;
+  }
+
+  /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+   * by setting the node property.</p>
+   * @param pNode The node being referenced.
+   */
+  public ValidationEventLocatorImpl(Node pNode) {
+    node = pNode;
+    offset = lineNumber = columnNumber = -1;
+  }
+
+  /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+   * by setting the object property.</p>
+   * @param pObject The object being referenced.
+   */
+  public ValidationEventLocatorImpl(Object pObject) {
+    object = pObject;
+    offset = lineNumber = columnNumber = -1;
+  }
+
+  /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+   * by copying data from the given {@link org.xml.sax.SAXParseException}.</p>
+   * @param pException The SAX exception where to copy from.
+   */
+  public ValidationEventLocatorImpl(SAXParseException pException) {
+     columnNumber = pException.getColumnNumber();
+     lineNumber = pException.getLineNumber();
+     String u = pException.getSystemId();
+     if (u != null) {
+       try {
+         url = new URL(pException.getSystemId());
+       } catch (MalformedURLException e) {
+       }
+     }
+     offset = -1;
+  }
+
+  /** <p>Sets the URL.</p>
+   */
+  public void setURL(URL pURL) {
+    url = pURL;
+  }
+
+  /* @see javax.xml.bind.ValidationEventLocator#getURL()
+   */
+  public URL getURL() {
+    return url;
+  }
+
+  /** <p>Sets the offset.</p>
+   */
+  public void setOffset(int pOffset) {
+    offset = pOffset;
+  }
+
+  /* @see javax.xml.bind.ValidationEventLocator#getOffset()
+   */
+  public int getOffset() {
+    return offset;
+  }
+
+  /** <p>Sets the line number.</p>
+   */
+  public void setLineNumber(int pLineNumber) {
+    lineNumber = pLineNumber;
+  }
+
+  /* @see javax.xml.bind.ValidationEventLocator#getLineNumber()
+   */
+  public int getLineNumber() {
+    return lineNumber;
+  }
+
+  /** <p>Sets the column number.</p>
+   */
+  public void setColumnNumber(int pColumnNumber) {
+    columnNumber = pColumnNumber;
+  }
+
+  /* @see javax.xml.bind.ValidationEventLocator#getColumnNumber()
+   */
+  public int getColumnNumber() {
+    return columnNumber;
+  }
+
+  /** <p>Sets the object.</p>
+   */
+  public void setObject(Object pObject) {
+    object = pObject;
+  }
+
+  /* @see javax.xml.bind.ValidationEventLocator#getObject()
+   */
+  public Object getObject() {
+    return object;
+  }
+
+  /** <p>Sets the node.</p>
+   */
+  public void setNode(Node pNode) {
+    node = pNode;
+  }
+
+  /* @see javax.xml.bind.ValidationEventLocator#getNode()
+   */
+  public Node getNode() {
+    return node;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/helpers/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for javax.xml.bind.helpers Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Helper classes for JAXB implementations. 
+Contains standard implementations for several important JAXB interfaces.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for javax.xml.bind Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Clean room implementation of the JAXB standard xml-binding API.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBResult.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBResult.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBResult.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.util;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.UnmarshallerHandler;
+import javax.xml.transform.sax.SAXResult;
+
+
+/** <p>Utility class that allows to catch the result of a
+ * stylesheet transformation in a JAXB object.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class JAXBResult extends SAXResult {
+  /** <p>Creates a new instance of <code>JAXBResult</code>.
+   * The instance will use the specified {@link javax.xml.bind.JAXBContext}
+   * to create an {@link javax.xml.bind.Unmarshaller}.</p>
+   */
+  public JAXBResult(javax.xml.bind.JAXBContext pContext) throws JAXBException {
+    this(pContext.createUnmarshaller());
+  }
+
+  /** <p>Creates a new instance of <code>JAXBResult</code>.
+   * The instance will use the given {@link javax.xml.bind.Unmarshaller}
+   * to create a {@link org.xml.sax.ContentHandler}.</p>
+   * <p>In most cases you will use the constructor taking a
+   * {@link javax.xml.bind.JAXBContext} as input. This additional
+   * constructor is required, if you want to configure the
+   * {@link javax.xml.bind.Unmarshaller}.</p>
+   * @param pUnmarshaller The Unmarshaller that may be queried for an
+   *   {@link UnmarshallerHandler}.
+   */
+  public JAXBResult(javax.xml.bind.Unmarshaller pUnmarshaller) throws JAXBException {
+    super(pUnmarshaller.getUnmarshallerHandler());
+  }
+
+  /** <p>Returns the result of a previous transformation.</p>
+   */
+  public Object getResult() throws JAXBException {
+    return ((UnmarshallerHandler) super.getHandler()).getResult();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBSource.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBSource.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/JAXBSource.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.util;
+
+import java.io.IOException;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.transform.sax.SAXSource;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+
+/** This utility class allows to use a JAXB object as the
+ * source of a stylesheet transformation.<br>
+ * If you depend on any methods from
+ * {@link javax.xml.transform.sax.SAXSource}, you should
+ * use this class. In particular, you must not use the
+ * methods
+ * {@link javax.xml.transform.sax.SAXSource#setInputSource(InputSource)},
+ * or
+ * {@link javax.xml.transform.sax.SAXSource#setXMLReader(XMLReader)}
+ * on an instance of <code>JAXBSource</code>.<br>
+ * If you depend on these methods, a replacement for the
+ * <code>JAXBSource</code> can be obtained as follows:
+ * <pre>
+ *     javax.xml.bind.JAXBContext context;
+ *     javax.xml.bind.Element object;
+ *     java.io.StringWriter sw = new java.io.StringWriter();
+ *     context.createMarshaller().marshal(object, sw);
+ *     org.xml.sax.InputSource isource = new org.xml.sax.InputSource(new java.io.StringReader(sw.toString()));
+ *     javax.xml.transform.sax.SAXSource source = new javax.xml.transform.sax.SAXSource(isource);
+ * </pre>
+ * 
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class JAXBSource extends SAXSource {
+    /** This private class basically wraps a marshaller and calls its marshal
+     * method when the parse methods are called on the XMLReader.
+     **/
+    private class JAXBSourceXMLReader implements XMLReader {
+        private EntityResolver resolver;
+        private DTDHandler dtdHandler;
+        private ErrorHandler errorHandler;
+        private XMLFilterImpl contentHandlerProxy = new XMLFilterImpl();
+        
+        public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+            if (name.equals("http://xml.org/sax/features/namespaces")
+                || name.equals("http://xml.org/sax/features/namespace-prefixes")) {
+                return true;
+            } else {
+                throw new SAXNotRecognizedException("Unknown feature: " + name);
+            }
+        }
+
+        public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
+            if(name.equals("http://xml.org/sax/features/namespaces")
+               || name.equals("http://xml.org/sax/features/namespace-prefixes")) {
+                if(!value) {
+                    throw new SAXNotSupportedException("The feature " + name + " cannot be disabled.");
+                }
+            } else {
+                throw new SAXNotRecognizedException("Unknown feature: " + name);
+            }
+        }
+        
+        public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+            throw new SAXNotRecognizedException("Unknown property: " + name);
+        }
+
+        public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+            throw new SAXNotRecognizedException("Unknown property: " + name);
+        }
+
+        public EntityResolver getEntityResolver() {
+            return resolver;
+        }
+
+        public void setEntityResolver(EntityResolver resolver) {
+            this.resolver = resolver;
+        }
+        
+        public DTDHandler getDTDHandler() {
+            return dtdHandler;
+        }
+
+        public void setDTDHandler(DTDHandler handler) {
+            this.dtdHandler = handler;
+        }
+        
+        public ContentHandler getContentHandler() {
+            return contentHandlerProxy.getContentHandler();
+        }
+
+        public void setContentHandler(ContentHandler handler) {
+            contentHandlerProxy.setContentHandler(handler);
+        }
+        
+        public ErrorHandler getErrorHandler() {
+            return errorHandler;
+        }
+
+        public void setErrorHandler(ErrorHandler handler) {
+        	errorHandler = handler;
+        }
+        
+        public void parse(String systemId) throws IOException, SAXException {
+            throw new IllegalStateException("The XMLReader created by a JAXBSource must not be used to parse a system ID.");
+        }
+
+		public void parse(InputSource pInput) throws IOException, SAXException {
+            if (pInput != inputSource) {
+            	throw new IllegalArgumentException("The XMLReader created by an instance of JAXBSource can only be used to parse the InputSource returned by the same JAXBSource.");
+            }
+            try {
+                marshaller.marshal(contentObject, contentHandlerProxy);
+            } catch(JAXBException e) {
+                SAXParseException spe = new SAXParseException(e.getMessage(), null, null, -1, -1, e);
+                if(errorHandler!=null) {
+                    errorHandler.fatalError(spe);
+                }
+                throw spe;
+            }
+		}
+    }
+
+    private final Marshaller marshaller;
+    private final Object contentObject;
+    private final InputSource inputSource;
+
+    /** <p>Creates a new instance of JAXBSource. The given
+     * {@link javax.xml.bind.JAXBContext} will be used to
+     * construct a {@link javax.xml.bind.Marshaller} and
+     * invoke the constructor
+     * {@link #JAXBSource(javax.xml.bind.Marshaller, Object)}.</p>
+     */
+    public JAXBSource(javax.xml.bind.JAXBContext pContext, Object pObject) throws JAXBException {
+    	this(pContext.createMarshaller(), pObject);
+    }
+    
+    /** <p>Creates a new instance of JAXBSource.</p>
+     */
+    public JAXBSource(javax.xml.bind.Marshaller pMarshaller, Object pObject) throws JAXBException {
+    	marshaller = pMarshaller;
+    	contentObject = pObject;
+        inputSource = new InputSource();
+        super.setInputSource(inputSource);
+        super.setXMLReader(new JAXBSourceXMLReader());
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/ValidationEventCollector.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/ValidationEventCollector.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/ValidationEventCollector.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.bind.util;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+
+/** <p>Simple implementation of a {@link javax.xml.bind.ValidationEventHandler},
+ * which simply collects all the events, regardless whether they
+ * are warnings, errors, or fatal errors. You may retrieve these events
+ * at a later time using {@link #getEvents()}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationEventCollector implements ValidationEventHandler {
+  private List events = new ArrayList();
+
+  /** <p>Creates a new instance of <code>ValidationEventCollector</code>.</p>
+   */
+  public ValidationEventCollector() {
+  }
+
+  /** <p>Returns the events collected so far. Empty array, if no
+   * events have been found.</p>
+   */
+  public ValidationEvent[] getEvents() {
+    return (ValidationEvent[]) events.toArray(new ValidationEvent[events.size()]);
+  }
+
+  /** <p>Clears the list of collected warnings, errors, and fatal errors.</p>
+   */
+  public void reset() {
+    events.clear();
+  }
+
+  /** <p>Returns whether any event has been collected.</p>
+   */
+  public boolean hasEvents() {
+    return !events.isEmpty();
+  }
+
+  /** <p>Will always return true.</p>
+   */
+  public boolean handleEvent(ValidationEvent pEvent) {
+    events.add(pEvent);
+    return true;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/bind/util/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for javax.xml.bind.util Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Utility classes used by the JAXB standard.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/NamespaceContext.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/NamespaceContext.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/NamespaceContext.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.namespace;
+
+/** <p>The <code>NamespaceContext</code> interface is a helper tool for
+ * XML parsing applications which need to know the mappings between XML
+ * namespace prefixes and namespace URI's. As such, it is closely related
+ * to the events
+ * {@link org.xml.sax.ContentHandler#startPrefixMapping(String,String)},
+ * and {@link org.xml.sax.ContentHandler#endPrefixMapping(String)} in
+ * {@link org.xml.sax.ContentHandler}.</p>
+ * <p>In what follows, it is important to note, that a single prefix
+ * can only be mapped to a single namespace URI at any time. However,
+ * the converse is not true: Multiple prefixes can be mapped to the
+ * same namespace URI's.</p>
+ * <p>For example, in the case of an XML Schema parser, an instance
+ * of <code>NamespaceContext</code> might be used to resolve the namespace
+ * URI's of referenced data types, and element or attribute names, which
+ * are typically given as qualified names, including a prefix and a local
+ * name.</p>
+ *
+ * @author JSR-31
+ * @since JAXB 1.0
+ */
+public interface NamespaceContext {
+  /** <p>Given a prefix, returns the namespace URI associated with the prefix.
+   * More precisely, the following rules apply:
+   * <table border="1">
+   *   <tr><th>Prefix (Input)</th><th>Namespace URI (Output)</th></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX} ("")</th>
+   *     <td>The current default namespace URI or null, if there is no
+   *       such default. (In which case the absence of a prefix indicates
+   *       the absence of a namespace URI.)</td></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#XML_NS_PREFIX} ("xml")</th>
+   *     <td>{@link javax.xml.XMLConstants#XML_NS_URI} ("http://www.w3.org/XML/1998/namespace")</td></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#XMLNS_ATTRIBUTE} ("xmlns")</th>
+   *     <td>{@link javax.xml.XMLConstants#XMLNS_ATTRIBUTE_NS_URI} ("http://www.w3.org/2000/xmlns/")</td>
+   *   </tr>
+   *   <tr><th>Any other prefix</th><td>The namespace URI currently mapped to the
+   *     prefix or null, if no such mapping is established.</td></tr>
+   * </table></p>
+   * @param pPrefix The prefix being looked up in the list of mappings.
+   * @return The Namespace URI to which the input prefix is currently mapped
+   *   or null, if there is no such mapping.
+   * @throws IllegalArgumentException The input prefix is null.
+   */
+  public String getNamespaceURI(String pPrefix);
+
+
+  /** <p>This method returns a prefix, which is currently mapped to the given
+   * namespace URI. Note, that multiple prefixes may be mapped to the namespace
+   * URI, in which case the returned prefix is undetermined. Do not make any
+   * assumptions on the order in such cases. It is a better choice to use
+   * {@link #getPrefixes(String)} instead, if you depend on some order
+   * <table border="1">
+   *   <tr><th>Namespace URI (Input)</th><th>Prefix (Output)</th></tr>
+   *   <tr><th>Current default namespace URI</th>
+   *     <td>{@link javax.xml.XMLConstants#DEFAULT_NS_PREFIX} ("")</td></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#XML_NS_URI} ("http://www.w3.org/XML/1998/namespace")</th>
+   *     <td>{@link javax.xml.XMLConstants#XML_NS_PREFIX} ("xml")</td></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#XMLNS_ATTRIBUTE_NS_URI} ("http://www.w3.org/2000/xmlns/")</th>
+   *     <td>{@link javax.xml.XMLConstants#XMLNS_ATTRIBUTE}</td></tr>
+   * </table></p>
+   *
+   * @param pNamespaceURI The namespace URI being looked up in the list of mappings.
+   * @return A prefix currently mapped to the given namespace URI or null, if there
+   *   is no such mapping
+   * @throws IllegalArgumentException The input URI is null
+   */
+  public java.lang.String getPrefix(java.lang.String pNamespaceURI);
+
+
+  /** <p>This method returns a collection of prefixes, which are currently mapped
+   * to the given namespace URI. Note, that the collection may contain more than
+   * one prefix, in which case the order is undetermined. If you do not depend
+   * on a certain order and any prefix will do, you may choose to use
+   * {@link #getPrefix(String)} instead. The following table describes the
+   * returned values in more details:
+   * <table border="1">
+   *   <tr><th>Namespace URI (Input)</th><th>Prefix collection (Output)</th></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#XML_NS_URI} ("http://www.w3.org/XML/1998/namespace")</th>
+   *     <td>Collection with a single element: {@link javax.xml.XMLConstants#XML_NS_PREFIX} ("xml")</td></tr>
+   *   <tr><th>{@link javax.xml.XMLConstants#XMLNS_ATTRIBUTE_NS_URI} ("http://www.w3.org/2000/xmlns/")</th>
+   *     <td>Collection with a single element: {@link javax.xml.XMLConstants#XMLNS_ATTRIBUTE}</td></tr>
+   * </table></p>
+   *
+   * @param pNamespaceURI The namespace URI being looked up in the list of
+   *   mappings or null, if there is no such mapping.
+   * @return An unmodifiable {@link java.util.Iterator}: Using it's
+   *   {@link java.util.Iterator#remove()} method throws an
+   *   {@link UnsupportedOperationException}.
+   * @throws IllegalStateException The input URI is null
+   */
+  public java.util.Iterator getPrefixes(java.lang.String pNamespaceURI);
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/QName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/QName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/QName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package javax.xml.namespace;
+
+import java.io.Serializable;
+
+
+/** <p>A <code>QName</code> is a qualified name, as specified by
+ * XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata.
+ * A qualified name is made up of a namespace URI, a local part, and a prefix.
+ * The prefix is not really a part of the <code>QName</code> and
+ * remains only to provide lexical information. It is <em>not</em>
+ * used in the {@link #equals(Object)} or {@link #hashCode()}
+ * methods.</p>
+ * <p>Namespace URI and prefix may be omitted, in which case the
+ * default value "" (empty string) is used.</p>
+ * <p>Instances of <code>QName</code> are immutable. You may safely
+ * store references.</p>
+ */
+public class QName implements Serializable {
+  private final String namespaceURI, localPart, prefix;
+
+  /** <p>Creates a new <code>QName</code> with the given
+   * <code>pNamespaceURI</code> and <code>pLocalPart</code>. The
+   * prefix is set to "" (empty string).</p>
+   * @param pNamespaceURI The namespace URI; may be null, in which case
+   *   the default value "" (empty string) is used.
+   * @param pLocalPart The local part.
+   * @throws IllegalArgumentException The local part was null.
+   */
+  public QName(String pNamespaceURI, String pLocalPart) {
+    if (pLocalPart == null) {
+      throw new IllegalArgumentException("The local part must not be null");
+    }
+    namespaceURI = pNamespaceURI == null ? "" : pNamespaceURI;
+    localPart = pLocalPart;
+    prefix = "";
+  }
+
+  /** <p>Creates a new <code>QName</code> with the given
+   * <code>pNamespaceURI</code>, <code>pLocalPart</code>, and
+   * <code>pPrefix</code>.</p>
+   * @param pNamespaceURI The namespace URI; may be null, in which case
+   *   the default value "" (empty string) is used.
+   * @param pLocalPart The local part.
+   * @param pPrefix The prefix. Must not be null. Use "" (empty string)
+   *   to indicate that no namespace URI is present or the namespace
+   *   URI is not relevant.
+   * @throws IllegalArgumentException The local part or the prefix was null.
+   */
+  public QName(String pNamespaceURI, String pLocalPart, java.lang.String pPrefix) {
+    if (pLocalPart == null) {
+      throw new IllegalArgumentException("The local part must not be null");
+    }
+    if (pPrefix == null) {
+      throw new IllegalArgumentException("The prefix must not be null");
+    }
+    namespaceURI = pNamespaceURI == null ? "" : pNamespaceURI;
+    localPart = pLocalPart;
+    prefix = pPrefix;
+  }
+
+  /** <p>Creates a new <code>QName</code> with the given
+   * <code>pLocalPart</code>, the namespace URI "" (empty string),
+   * and the prefix "" (empty string).</p>
+   * @param pLocalPart The local part.
+   * @throws IllegalArgumentException The local part or the prefix was null.
+   */
+  public QName(String pLocalPart) {
+    if (pLocalPart == null) {
+      throw new IllegalArgumentException("The local part must not be null");
+    }
+    namespaceURI = "";
+    localPart = pLocalPart;
+    prefix = "";
+  }
+
+  /** <p>Returns the namespace URI.</p>
+   * @return Namespace URI or "" (empty string) to indicate the absence
+   *   of a namespace.
+   */
+  public String getNamespaceURI() {
+    return namespaceURI;
+  }
+
+  /** <p>Returns the local part of the <code>QName</code>.</p>
+   * @return The local part.
+   */
+  public String getLocalPart() {
+    return localPart;
+  }
+
+  /** <p>Returns the namespace prefix.</p>
+   * @return The namespace prefix or "" (empty string) to indicate the
+   *   default namespace
+   */
+  public String getPrefix() {
+    return prefix;
+  }
+
+  /** <p>Returns true, if
+   * <ul>
+   *   <li><code>pOther</code> instanceof QName</li>
+   *   <li>getNamespaceURI().equals(pOther.getNamespaceURI())</li>
+   *   <li>getLocalPart().equals(pOther.getLocalPart())</li>
+   * </ul>
+   * <em>Note</em>: The prefix is ignored.</p>
+   */
+  public boolean equals(Object pOther) {
+    if (!(pOther instanceof QName)) {
+      return false;
+    }
+    QName other = (QName) pOther;
+    return namespaceURI.equals(other.namespaceURI)  &&  localPart.equals(other.localPart);
+  }
+
+  /** <p>Returns the <code>QName</code>'s hash code.
+   * The prefix is ignored when calculating the hash code.</p>
+   */
+  public int hashCode() {
+    return namespaceURI.hashCode() + localPart.hashCode();
+  }
+
+  /** <p>Converts the QName into a string representation. The current
+   * implementation returns the local part, if the namespace URI is
+   * "" (empty string). Otherwise returns "{" + namespaceURI + "}" + localPart.
+   * The prefix is ignored.</p>
+   * <p>The representation is subject to changes, as there is currently no
+   * standard representation for a <code>QName</code>. You should use this
+   * method for debugging or logging purposes only.</p>
+   */
+  public java.lang.String toString() {
+    return namespaceURI.length() == 0 ?
+      localPart : "{" + namespaceURI + "}" + localPart;
+  }
+
+  /** <p>Parses the given string representation of a <code>pQName</code>.
+   * The <code>QName</code> is expected to have the same representation
+   * than returned by {@link #toString()}.</p>
+   * <p>It is not possible to specify a prefix. The returned
+   * <code>QName</code> will always have the prefix "" (empty string).</p>
+   * @param pQName String representation of a QName, as generated by
+   *   {@link #toString()}.
+   * @return QName with the prefix "" (empty string)
+   * @throws IllegalArgumentException The given <code>pQName</code>
+   *   was null or empty.
+   */
+  public static QName valueOf(String pQName) {
+    if (pQName == null) {
+      throw new IllegalArgumentException("The string representation of a QName must not be null.");
+    }
+    if (pQName.charAt(0) == '{') {
+      int end = pQName.indexOf('}', 1);
+      if (end == -1) {
+        throw new IllegalArgumentException("Expected a terminator ('}') of the namespace URI.");
+      }
+      return new QName(pQName.substring(1, end), pQName.substring(end+1));
+    } else {
+      return new QName(pQName);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/namespace/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for javax.xml.namespace Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Clean room implementation of the JAXP standard namespace classes.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/api/javax/xml/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/api/javax/xml/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/api/javax/xml/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for javax.xml Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+This package contains the
+<a href='http://ws.apache.org/jaxme/api/index.html'>JaxMeAPI</a>,
+a clean room implementation of the JAXB API.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/README.txt
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/README.txt	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/README.txt	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+###########################################################################
+#
+# Copyright 2004 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+###########################################################################
+
+This is the base documentation directory. It usually contains two files:
+
+skinconf.xml     # This file customizes Forrest for your project. In it, you
+                 # tell forrest the project name, logo, copyright info, etc
+
+sitemap.xmap     # Optional. This sitemap overrides the default one bundled
+                 # with Forrest. Typically, one would copy a sitemap from
+                 # xml-forrest/src/resources/conf/sitemap.xmap, and customize
+                 # it.
+

Added: branches/jaxme/upstream/0.5.1/src/documentation/conf/cli.xconf
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/conf/cli.xconf	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/conf/cli.xconf	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,182 @@
+<?xml version="1.0"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!--+
+    |  This is the Apache Cocoon command line configuration file. 
+    |  Here you give the command line interface details of where
+    |  to find various aspects of your Cocoon installation.
+    |
+    |  If you wish, you can also use this file to specify the URIs
+    |  that you wish to generate.
+    |
+    |  The current configuration information in this file is for
+    |  building the Cocoon documentation. Therefore, all links here 
+    |  are relative to the build context dir, which, in the build.xml 
+    |  file, is set to ${build.context} 
+    |
+    |  Options:
+    |    verbose:            increase amount of information presented
+    |                        to standard output (default: false)
+    |    follow-links:       whether linked pages should also be 
+    |                        generated (default: true)
+    |    precompile-only:    precompile sitemaps and XSP pages, but 
+    |                        do not generate any pages (default: false)
+    |    confirm-extensions: check the mime type for the generated page
+    |                        and adjust filename and links extensions
+    |                        to match the mime type 
+    |                        (e.g. text/html->.html)
+    |
+    | CVS: $Id: cli.xconf,v 1.7.2.1 2003/09/27 11:47:03 jefft Exp $
+    +-->
+    
+<cocoon verbose="true"  
+        follow-links="true" 
+        precompile-only="false" 
+        confirm-extensions="false">
+
+   <!--+
+       | Broken link reporting options:
+       |   Report into a text file, one link per line:
+       |     <broken-links type="text" report="filename"/>
+       |   Report into an XML file:
+       |     <broken-links type="xml" report="filename"/>
+       |   Ignore broken links (default):
+       |     <broken-links type="none"/>
+       |   When a page includes an error, should a page be generated?
+       |     
+       |   Two attributes to this node specify whether a page should
+       |   be generated when an error occured. 'generate' specifies 
+       |   whether a page should be generated (default: true) and
+       |   extension specifies an extension that should be appended
+       |   to the generated page's filename (default: none)
+       |     <broken-links generate="true" extension=".error.txt"/>
+       |
+       +-->
+   <broken-links type="xml" 
+                 file="../brokenlinks.xml"
+                 generate="false"
+                 extension=".error"/>
+   
+   <!--+
+       |  Load classes at startup. This is necessary for generating
+       |  from sites that use SQL databases and JDBC.
+       |  The <load-class> element can be repeated if multiple classes
+       |  are needed.
+       +-->
+   <!--
+   <load-class>org.firebirdsql.jdbc.Driver</load-class>
+   -->
+
+   <!--+
+       |
+       +-->
+   <!-- <logging log-kit="WEB-INF/logkit.xconf" logger="cli" level="ERROR" /> -->
+
+   <!--+
+       |  The context directory is usually the webapp directory
+       |  containing the sitemap.xmap file.
+       |
+       |  The config file is the cocoon.xconf file.
+       |
+       |  The work directory is used by Cocoon to store temporary
+       |  files and cache files.
+       |  
+       |  The destination directory is where generated pages will
+       |  be written (assuming the 'simple' mapper is used)
+       +-->
+   <context-dir>.</context-dir>
+   <config-file>WEB-INF/cocoon.xconf</config-file>
+   <work-dir>../work</work-dir>
+   <!-- Unused static dest-dir, overridden in forrest.build.properties -->
+   <dest-dir>this-should-never-be-used</dest-dir>
+   <!-- Overridden in forrest.build.xml 
+   <dest-dir>../docs</dest-dir>
+   -->
+
+   <!--+
+       | Specifies the filename to be appended to URIs that
+       | refer to a directory (i.e. end with a forward slash).
+       +-->
+   <default-filename>index.html</default-filename>
+
+   <!--+
+       |  Specifies a user agent string to the sitemap when
+       |  generating the site.
+       +-->
+   <!--
+   <user-agent>xxx</user-agent>
+   -->
+
+   <!--+
+       |  Specifies an accept string to the sitemap when generating
+       |  the site.
+       +-->
+   <accept>*/*</accept>
+   
+   <!--+
+       |  Specifies the URIs that should be generated (using <uri>
+       |  elements, and (if necessary) what should be done with the
+       |  generated pages.
+       |
+       |  The old behaviour - appends uri to the specified destination
+       |  directory (as specified in <dest-dir>):
+       |
+       |   <uri>documents/index.html</uri>
+       |
+       |  Append: append the generated page's URI to the end of the 
+       |  source URI:
+       |
+       |   <uri type="append" src-prefix="documents/" src="index.html"
+       |   dest="build/dest/"/>
+       |
+       |  Replace: Completely ignore the generated page's URI - just 
+       |  use the destination URI:
+       |
+       |   <uri type="replace" src-prefix="documents/" src="index.html" 
+       |   dest="build/dest/docs.html"/>
+       |
+       |  Insert: Insert generated page's URI into the destination 
+       |  URI at the point marked with a * (example uses fictional 
+       |  zip protocol)
+       |
+       |   <uri type="insert" src-prefix="documents/" src="index.html" 
+       |   dest="zip://*.zip/page.html"/>
+       |
+       +-->
+
+   <!-- Includes and excludes can be used to limit which URLs are rendered -->
+   <exclude pattern="**/"/>
+   <exclude pattern="**apidocs**"/>
+<!--   <exclude pattern="api/**"/>  -->
+
+   <!-- Exclude tokens used in URLs to ASF mirrors (interpreted by a CGI) -->
+   <exclude pattern="[preferred]/**"/>
+   <exclude pattern="[location]"/>
+
+   <uri src="favicon.ico"/>
+
+   <!--+
+       |  File containing URIs (plain text, one per
+       |  line).
+       +-->
+   <!--
+   <uri-file></uri-file>
+   -->
+   
+</cocoon>
+

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/downloads.cgi
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/downloads.cgi	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/downloads.cgi	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Wrapper script around mirrors.cgi script
+# (we must change to that directory in order for python to pick up the
+#  python includes correctly)
+# Copied from Stefan's page on mirrors
+cd /www/www.apache.org/dyn/mirrors 
+/www/www.apache.org/dyn/mirrors/mirrors.cgi $*
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/book.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/book.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/book.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN"
+                      "http://apache.org/forrest/dtd/book-cocoon-v10.dtd">
+
+<!-- This file is responsible for generating the menu in the 'js' directory.
+  -->
+
+<book software="JaxMeAPI" title="JaxMeAPI"
+     copyright="@year@ The Apache Software Foundation"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <menu label="JaxMeAPI">
+	<menu-item label="Introduction" href="index.html"/>
+  </menu>
+</book>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/index.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/index.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/api/index.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>JaxMeAPI: A clean room implementation of the JAXB API</title> 
+  </header> 
+  <body> 
+      <p>
+        JaxMeAPI is clean room implementation of the JAXB API. Unlike the
+        <link href="ext:ri">reference implementation</link> this one
+        comes under a very moderate open source license, the
+        <link href="site:license">Apache License</link>.
+      </p>
+      <note>
+        The reference implementation is now distributed from 
+        <link href='ext:jaxb-si'>Java Dot Net</link>.
+        Though the source may be viewed, the license model used does not
+        really seem to be open source (in the usual sense of 
+        <link href='ext:open-source-definition'>
+        The Open Source Initiative</link> definition).
+        Our implementation (of the basic API)
+        is licensed under the Apache License
+        a truely open source license allowing easy redistribution.
+        Therefore, we continue to recommend our implementation.
+      </note>
+      <p>In terms of Jar files, the JaxMeAPI is equivalent to the following
+        Jar files from the reference implementation:</p>
+      <ol>
+        <li>jaxb-api.jar</li>
+        <li>jax-qname.jar</li>
+        <li>namespace.jar</li>
+      </ol>
+      <p>JaxMeAPI was written as a part of the <link href="site:jaxme2">JaxMe 2</link>
+        project. It is available as a separate module to be included in
+        source distributions of JAXB client applications. Perhaps other
+        JAXB provider implementations. might be interested too at some
+        point.</p>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/downloads.ehtml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/downloads.ehtml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/downloads.ehtml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,97 @@
+<html>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<body>
+   <h1>JaxMe Downloads</h1>
+
+   <a name="binaries"/>
+   <h3>Binaries</h3>
+   <p>JaxMe binaries are available from the <a href="#mirrors">Apache mirrors</a>.</p>
+
+   <a name="sources"/>
+   <h3>Sources</h3>
+   <p>The JaxMe sources are also available from the <a href="#mirrors">Apache mirrors</a>.
+     You may also use the <a href="#cvs">Apache CVS server</a> to download the bleeding
+     edge version. For a quick view, you may <a href="#cvsweb">browse</a> the CVS repository
+     online.
+   </p>
+
+   <a name="cvs"/>
+   <h3>CVS Access</h3>
+   <p>Anonymous access to the CVS goes like this:
+     <pre>
+       cvs -d :pserver:anoncvs at cvs.apache.org:/home/cvspublic login
+       cvs -z3 -d :pserver:anoncvs at cvs.apache.org:/home/cvspublic co ws-jaxme
+     </pre>
+     The anonymous users password is the same than the anonymous users login:
+     <code>anoncvs</code>.</p>
+   <p>
+     For developers, a different repository is available, which requires SSH access:
+     <pre>
+       set CVS_RSH=ssh
+       export CVS_RSH
+       cvs -d :pserver:userid at cvs.apache.org:/home/cvs co ws-jaxme
+     </pre>
+     Of course, you have to replace the <code>userid</code> with the name of your
+     committers account.
+   </p>
+
+   <a name="cvsweb"/>
+   <h3>CVS Web Access</h3>
+   <p>
+     The CVS repository may also be browsed online at
+     <a href="http://cvs.apache.org/viewcvs/ws-jaxme">http://cvs.apache.org/viewcvs/ws-jaxme</a>.
+   </p>
+
+   <a name="mirrors"/>
+   <h3>Apache Mirrors</h3>
+   <p>The preferred way to obtain JaxMe distributions is through the various
+     archive sites aroung the world. The links below will allow you to select
+     a suitable archive near you. You are still free to switch to another
+     mirror, of course.</p>
+   <p>You are currently using the <strong>[preferred]</strong> mirror.
+     If you encounter a problem with this mirror, please select another
+     mirror.  If all mirrors are failing, there are <em>backup</em>
+     mirrors (at the end of the mirrors list) that should be available.
+   </p>
+	
+   <form action="[location]" method="get" id="SelectMirror">
+     Other mirrors: 		
+<select name="Preferred">
+[if-any http]
+  [for http]<option value="[http]">[http]</option>[end]
+[end]  
+[if-any ftp]
+  [for ftp]<option value="[ftp]">[ftp]</option>[end]
+[end]
+[if-any backup]
+  [for backup]<option value="[backup]">[backup] (backup)</option>[end]
+[end]
+        </select>
+		 <input type="submit" value="Change"/> 	 </form>
+
+   JaxMe distributions: <a href="[preferred]/ws/jaxme">[preferred]/ws/jaxme</a>
+    <p>
+   Please check the MD5 sums for any releases you download from the mirrors:
+    </p>
+    <ul>
+        <li>ws-jaxme-0.5-bin.tar.gz: <strong>d9e3151576fee5fc4f8af907a71f9096</strong></li>
+        <li>ws-jaxme-0.5-src.tar.gz: <strong>59991a2ecdfada900ad836f9cc581a1e</strong></li>
+    </ul>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/features.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/features.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/features.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>TODO</title> 
+  </header> 
+  <body>
+    <p>This document describes a list of features missing in JaxMe and suggests
+      how to implement them. It aims to guide developers, which are new to JaxMe
+      development and would like to start working on one of these features.</p>
+
+    <section><title>Wildcard attributes</title>
+      <p>Wildcard attributes are attributes not explicitly mentioned in the
+        schema. A typical approach would be, to specify a certain namespaces
+        attributes explicitly in the schema and leave all others unspecified.
+        For example, XML Schema elements like "xs:schema", "xs:element",
+        "xs:complexType", and so on, are all accepting arbitrary attributes,
+        which are neither in the empty namespace (which is an attributes
+        default namespace, if a prefix is absent) nor in the XML Schema
+        namespace http://www.w3.org/2001/XMLSchema".</p>
+      <p>A wildcard attribute is specified like this:</p>
+      <source>
+         &lt;xs:anyAttribute namespace="##other" processContents="lax"/>
+      </source>
+      <p>To implement wildcard attributes in JaxMe, the following
+        procedure is suggested:</p>
+      <ol>
+        <li>Modify the class JAXBPropertySG and add a constructor taking
+          an instance of XSWildcard as input. Add a method to the
+          XSObjectFactory invoking the constructor. (Note that the
+          methods signature must be distinguishable from the
+          similar constructor required for xs:any elements.)</li>
+        <li>Call the constructor from within
+          JAXBComplexTypeSG.initAttributes().</li>
+        <li><p>The generated complex types are extended with an additional
+          Map. The keys of the Map are instances of javax.xml.namespace.QName.
+          The values might be instances of org.xml.sax.Attribute.</p>
+          <p>Such a Map is generated for any instance of xs:anyAttribute.
+            This is done in JAXBComplexTypeSG.generateProperties().</p></li>
+        <li>Change the method
+          JAXBComplexTypeSG.getXMLHandlersAddAttributeMethod() to
+          fill the Map.</li>
+        <li>Change the method
+          JAXBComplexTypeSG.generateXMLSerializersAttributes() to
+          create SAX events filling the attributes.</li>
+        <li>Write a Unit test verifying your implementation.</li>
+      </ol>
+    </section>
+
+	<section><title>xs:any elements</title>
+	  <p>JAXB specifies in detail, how support for wildcard elements ought to
+	    look like. For simplicity, we omit these details here, and assume,
+	    that a wildcard element is stored as a DOM document. (Note, that this
+	    is indeed supported by the JAXB RI as well.)</p>
+	  <p>Before working on the implementation, take the class
+	    build/jm/test/jaxme/src/org/apache/ws/jaxme/test/misc/address/impl/AddressTypeHandler
+	    as an example. In particular have a view at the methods
+	    startElement(String,String,String,Attributes) and
+	    endElement(String,String,String). Note that the startElement()
+	    method creates instances of JMHandler and the endElement()
+	    method processes the results by invoking the JMHandlers
+	    getResult() method.</p>
+	  <p>Likewise, see the method marshalChilds() from the same class
+	    to learn how serialization works. Note in particular, how the
+	    Data object is used for namespace handling.</p>
+	  <ol>
+	    <li>Create a generic implementation of JMHandler, which processes
+	      SAX events and creates a DOM document. This should be fairly
+	      simple by deriving a subclass from
+	      org/apache/ws/jaxme/util/DOMBuilder or using an instance of that
+	      class internally.</li>
+	    <li>Create a generic implementation of JMXmlSerializer that takes
+	      a DOM document as input and serializes it to SAX event. Most
+	      possibly you will need to copy code from
+	      org/apache/ws/jaxme/util/DOMSerializer, derive a subclass or
+	      do similar stuff. The important difference to this class is
+	      the proper handling of namespace prefixes by means of the
+	      Data object.</li>
+	    <li>Extend the class JAXBPropertySG by a constructor taking an instance
+	      of XSWildcard as an argument. Note, that the constructors signature
+	      must be distinguishable from the similar constructor required for
+	      wildcard attributes. Extend the XSObjectFactory with a method
+	      invoking the constructor.</li>
+	    <li>Change the class JAXBParticleSG to invoke this constructor.</li>
+	    <li>Change the methods extendXMLHandlersStartElementMethod() and
+	      extendXMLHandlersEndElementMethod() from JAXBGroupSG to create
+	      or process your instance of JMHandler.</li>
+	    <li>Change the method getXMLSerializersMarshalChildsMethod() from
+	      JAXBGroupSG to serialize the wildcard elements, if present. Use
+	      your generic JMXmlSerializer to achieve that.</li>
+	    <li>Write a Unit test that verifies your implementation.</li>
+	  </ol>
+	</section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/index.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/index.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/index.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>Welcome to JaxMe 2</title> 
+  </header> 
+  <body> 
+      <p>
+        JaxMe 2 is an open source implementation of
+        <link href="site:jaxb"><code>JAXB</code></link>, the specification for
+        Java/XML binding. 
+      </p>
+      <p>A Java/XML binding compiler takes as input a schema
+        description (in most cases an XML schema but it may be a DTD, a
+        RelaxNG schema, a Java class inspected via reflection or a database
+        schema). The output is a set of Java classes:
+      </p>
+        <ul>
+          <li>A Java bean class compatible with the schema description. (If the schema was
+            obtained via Java reflection, then the original Java bean class.)</li>
+          <li>An unmarshaller that converts a conforming XML document into the equivalent Java bean.</li>
+          <li>Vice versa, a marshaller that converts the Java bean back into the original XML document.</li>
+        </ul>
+      <p>
+        In the case of JaxMe, the generated classes may also
+      </p>
+        <ul>
+          <li>Store the Java bean into a database. Preferrably an XML database like
+            <link href="site:exist"><code>eXist</code></link>,
+            <link href="site:xindice"><code>Xindice</code></link>, or
+            <link href="site:tamino"><code>Tamino</code></link>, but it may also
+            be a relational database like <link href="site:mysql"><code>MySQL</code></link>.
+            (If the schema is sufficiently simple. :-)</li>
+          <li>Query the database for bean instances.</li>
+          <li>Implement an EJB entity or session bean with the same abilities.</li>
+        </ul>
+      <p>
+        In other words, by simply creating a schema and running the JaxMe binding
+        compiler,
+      </p>
+      <figure src="images/jaxme-compiler-workflow.png" alt="Running the JaxMe 2 compiler"/>
+      <p>
+        you have automatically generated classes that implement the complete
+        workflow of a typical web application:</p>
+      <figure src="images/jaxme-application-workflow.png" alt="Workflow of a JaxMe 2 application"/>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/book.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/book.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/book.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN"
+                      "http://apache.org/forrest/dtd/book-cocoon-v10.dtd">
+
+<!-- This file is responsible for generating the menu in the 'js' directory.
+  -->
+
+<book software="JaxMeJS" title="JaxMeJS"
+     copyright="@year@ The Apache Software Foundation"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <menu label="JaxMeJS">
+	<menu-item label="Introduction" href="../index.html"/>
+    <menu-item label="The JavaSource factory" href="../factory.html"/>
+    <menu-item label="Writing methods" href="../methods.html"/>
+    <menu-item label="Placeholders" href="../placeholders.html"/>
+    <menu-item label="Optimizations" href="../optimizations.html"/>
+    <menu-item label="Writing SQL" href="../sql.html"/>
+  </menu>
+
+  <menu label="Patterns">
+    <menu-item label="Proxy Objects" href="../patterns/proxy.html"/>
+    <menu-item label="Multiple Inheritance" href="../patterns/proxy.html#multiple_inheritance"/>
+    <menu-item label="Typesafe Enumerations" href="../patterns/typesafeenum.html"/>
+    <menu-item label="Proxy chains" href="../patterns/chains.html"/>
+    <menu-item label="Versioning" href="../patterns/versioning.html"/>
+  </menu>
+
+  <menu label="Applications">
+    <menu-item label="Apache XML-RPC Clients" href="xmlrpc.html"/>
+  </menu>
+</book>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/xmlrpc.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/xmlrpc.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/apps/xmlrpc.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Apache XML-RPC Clients</title></header>
+  <body>
+    <p>Apache XML-RPC is an implementation of XML-RPC: Remote procedure
+      calls are transmitted as XML documents and the results are returned
+      in the same way.</p>
+    <p>The most important feature of XML-RPC is portability: XML-RPC
+      implementations are available for almost any programming language.
+      The protocol is intentionally restricted to some typical data type,
+      including integers, strings, arrays, and maps.</p>
+    <p>Apache XML-RPC is based on Java reflection: You trade flexibility
+      for type safety and compiler control. But why take the disadvantage?
+      The client generator allows you to have both flexibility and
+      compiler control.</p>
+
+    <section><title>How it works</title>
+      <p>The client generator is roughly similar to the
+        <link href="../patterns/proxy.html">Proxy Generator</link>:
+        Assuming that you have classes A, B, and C on the server,
+        which are being called via XML-RPC, the generator creates
+        classes A', B', and C' with roughly the same set of public
+        methods. The difference is, that the latter classes have
+        every method implemented as an XML-RPC call. However, this
+        XML-RPC call is completely transparent!</p>
+      <p>More precisely, if you have the following class on the
+        server:</p>
+      <source>
+public class Calculator {
+    public int add(int i1, int i2) {
+		return i1 + i2;
+    }
+    public double multiply(double d1, double d2) {
+        return d1 * d2;
+    }
+}
+      </source>
+      <p>The generator will create a class for you, which is roughly
+        similar to:</p>
+      <source>
+public class Calculator {
+	private XmlRpcCaller caller;
+	public Calculator(caller) {
+		this.caller = caller;
+	}
+    public int add(int i1, int i2) {
+        Vector v = new Vector();
+        v.add(new Integer(i1));
+        v.add(new Integer(i2));
+        XmlRpcClient c = new XmlRpcClient(url);
+        Object o = caller.xmlRpcCall("Calculator.add", v);
+        return ((Integer) o).intValue();
+    }
+    public double add(double d1, double d2) {
+        Vector v = new Vector();
+        v.add(new Double(d1));
+        v.add(new Double(d2));
+        Object o = caller.xmlRpcCall("Calculator.add", v);
+        return ((Double) o).doubleValue();
+    }
+}
+      </source>
+      <p>In particular, note that the generated classes are
+        automatically converting from or to primitive types.
+        A basic implementation for the
+        <link href="../../apidocs/org/apache/ws/jaxme/js/apps/XmlRpcCaller.html">
+        XmlRpcCaller</link> would be:</p>
+      <source>
+public class MyCaller implements org.apache.ws.jaxme.js.apps.XmlRpcCaller {
+	private final URL url;
+	public MyCaller(URL url) {
+	    this.url = url;
+	}
+	public Object xmlRpcCall(String name, Vector params) throws Exception {
+	    return new XmlRpcClient(url).execute(name, params);
+	}
+}
+      </source>
+    </section>
+
+    <section><title>The dispatcher</title>
+      <p>The generator may create one additional class for you, which is
+        dedicated for the server: The dispatcher. In the above example,
+        a dispatcher would be:</p>
+      <source>
+public class Dispatcher implements org.apache.xmlrpc.XmlRpcHandler {
+    public Object execute(String pName, Vector pParams) throws Throwable {
+        if ("Calculator-add".equals(pName)) {
+        	int i1 = ((Integer) params.get(0)).intValue();
+        	int i2 = ((Integer) params.get(1)).intValue();
+        	return new Integer(new Calculator().add(i1, i2));
+        } else if ("Calculator-multiply".equals(pName)) {
+        	double d1 = ((Double) params.get(0)).doubleValue();
+        	double d2 = ((Double) params.get(1)).doubleValue();
+        	return new Double(new Calculator().multiply(d1, d2));
+        }
+    }
+}
+      </source>
+      <p>Note, that the dispatcher may very well be a static final instance
+        variable. It is quite easy, to embed the dispatcher into the server:</p>
+<source>
+        XmlRpcServer xmlrpc = new XmlRpcServer ();
+        xmlrpc.addHandler ("$default", new org.apache.xmlrpc.XmlRpcHandler() {
+            Dispatcher d = new Dispatcher();
+            public Object execute(String pName, Vector pVector) throws Exception {
+                try {
+                	return d.invoke(pName, pVector);
+                } catch (Exception e) {
+                    throw e;
+                } catch (Throwable t) {
+                    throw new UndeclaredThrowableException(t);
+                }
+            }
+        });
+        byte[] result = xmlrpc.execute (request.getInputStream ());
+        response.setContentType ("text/xml");
+        response.setContentLength (result.length());
+        OutputStream out = response.getOutputStream();
+        out.write (result);
+        out.flush ();
+</source>
+    </section>
+
+    <section><title>Using the generator</title>
+      <p>The generator is implemented as an Ant task. A typical invocation will
+        most probably look like this:</p>
+<source>
+    &lt;taskdef resource="org/apache/ws/jaxme/js/pattern/ant.properties"
+        classpathref="js.test.path"/&gt;
+    &lt;xmlRpcGenerator
+        targetPackage="com.foo.xmlrpc.client"
+                destDir="build/src">
+        &lt;dispatcher name="com.foo.xmlrpc.server.Dispatcher"/&gt;
+        &lt;serverClasses dir="src" includes="com/foo/xmlrpc/server/XmlRpc*.java"/&gt;
+    &lt;/xmlRpcGenerator&gt;   
+</source>
+     <p>The Ant task "xmlRpcGenerator" supports the following attributes:</p>
+     <table>
+       <tr><th>Name</th><th>Description</th><th>Required<br/>Default</th></tr>
+       <tr>
+         <td>classpathRef</td>
+         <td>Specifies a reference to a classpath. This classpath is used,
+           for loading the server classes, if they are passed in as
+           compiled classes and not Java sources.</td>
+         <td>No<br/>Ant path</td>
+       </tr>
+       <tr>
+         <td>destDir</td>
+         <td>Specifies the directory, where sources are being generated.
+           A package structure is created below the directory: If the
+           target package is "com.foo.xmlrpc.client", and the destination
+           directory is "src", then the generated classes will appear in
+           "src/com/foo/xmlrpc/client".</td>
+         <td>No<br/>Current directory</td>
+       </tr>
+       <tr>
+         <td>targetPackage</td>
+         <td>Specifies the package, in which the generated sources are
+           being placed.</td>
+         <td>No<br/>Root package</td>
+       </tr>
+     </table>
+     <p>The Ant task also supports the following nested elements:</p>
+     <table>
+       <tr><th>Name</th><th>Description</th><th>Required<br/>Default</th></tr>
+       <tr>
+         <td>classpath</td>
+         <td>An embedded class path, used as a replacement for the
+           'classpathref' attribute. Using this nested child element
+           is mutually exclusive with the attribute.</td>
+         <td>No<br/>Ant path</td>
+       </tr>
+       <tr>
+         <td>dispatcher</td>
+         <td>Specifies, that a dispatcher is being generated. The
+           'name' attribute specifies the dispatchers fully qualified
+           class name.<br/>By default, the dispatcher will implement
+           org.apache.xmlrpc.XmlRpcHandler. This may be suppressed
+           by setting the 'implementingXmlRpcHandler' attribute to
+           false. This is mainly usefull for the JaxMeJS test suite.
+         </td>
+         <td>No</td>
+       </tr>
+       <tr>
+         <td>serverClasses</td>
+         <td>One or more file sets specifying the server side classes,
+           for which clients are being generated. These classes may either
+           be specified as sources (in which case the
+           <link href="../../apidocs/org/apache/ws/jaxme/js/util/JavaParser.html">
+             Java parser</link> is used for scanning them, or as compiled classes,
+           in which case Java reflection is being used.</td>
+         <td>Yes</td>
+       </tr>
+     </table>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/book.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/book.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/book.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN"
+                      "http://apache.org/forrest/dtd/book-cocoon-v10.dtd">
+
+<!-- This file is responsible for generating the menu in the 'js' directory.
+  -->
+
+<book software="JaxMeJS" title="JaxMeJS"
+     copyright="@year@ The Apache Software Foundation"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <menu label="JaxMeJS">
+	<menu-item label="Introduction" href="index.html"/>
+    <menu-item label="The JavaSource factory" href="factory.html"/>
+    <menu-item label="Writing methods" href="methods.html"/>
+    <menu-item label="Placeholders" href="placeholders.html"/>
+    <menu-item label="Optimizations" href="optimizations.html"/>
+    <menu-item label="Writing SQL" href="sql.html"/>
+    <menu-item label="Java Source Reflection" href="jparser.html"/>
+  </menu>
+
+  <menu label="Patterns">
+    <menu-item label="Proxy Objects" href="patterns/proxy.html"/>
+    <menu-item label="Multiple Inheritance" href="patterns/proxy.html#multiple_inheritance"/>
+    <menu-item label="Typesafe Enumerations" href="patterns/typesafeenum.html"/>
+    <menu-item label="Proxy chains" href="patterns/chains.html"/>
+    <menu-item label="Versioning" href="patterns/versioning.html"/>
+  </menu>
+
+  <menu label="Applications">
+    <menu-item label="Apache XML-RPC Clients" href="apps/xmlrpc.html"/>
+  </menu>
+</book>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/factory.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/factory.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/factory.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Using the JavaSourceFactory</title></header>
+  <body>
+      <p>Using the JavaSource framework is using a
+        <link href="../apidocs/org/apache/ws/jaxme/js/JavaSourceFactory.html">JavaSourceFactory</link>.
+        This class is (directly or indirectly) the single access point to all other classes.
+        We demonstrate the basic use with the following example:</p>
+      <source>
+   import java.io.File;
+
+   import javax.xml.parsers.ParserConfigurationException;
+   import javax.xml.parsers.SAXParser;
+   import javax.xml.parsers.SAXParserFactory;
+
+   import org.apache.ws.jaxme.js.JavaMethod;
+   import org.apache.ws.jaxme.js.JavaQName;
+   import org.apache.ws.jaxme.js.JavaQNameImpl;
+   import org.apache.ws.jaxme.js.JavaSource;
+   import org.apache.ws.jaxme.js.JavaSourceFactory;
+
+   public class Test {
+      public static void main(String[] args) throws Exception {
+         // Create a factory
+  	     JavaSourceFactory factory = new JavaSourceFactory();
+  	     // Let the factory create a Java source class "com.mycompany.demo.Parser"
+		 JavaQName className = JavaQNameImpl.getInstance("com.mycompany.demo", "Parser");
+		 JavaSource js = factory.newJavaSource(className, "public");
+		 // Add a method "getParser", which instantiates a new SAXParser
+		 JavaMethod jm = js.newJavaMethod("getParser", SAXParser.class, "public");
+		 jm.setStatic(true);
+		 jm.addThrows(ParserConfigurationException.class);
+		 jm.addLine(SAXParserFactory.class, " sf = ", SAXParserFactory.class, ".newInstance();");
+		 jm.addLine("return sf.newSAXParser();");
+		 factory.write(null, factory.getLocation(js));
+      }
+   }
+      </source>
+      <p>The example creates a new class <code>com.mycompany.demo.Parser</code>. The class
+        has a single, static method <code>getParser</code>, which instantiates a new
+        SAX parser. Of couse, you could achieve the same effect much easier with</p>
+      <source>
+   import java.io.File;
+   import java.io.FileWriter;
+
+   public class Test {
+      public static void main(String[] args) throws Exception {
+         FileWriter fw = new FileWriter("com/mycompany/demo/Parser.java");
+         fw.write("package com.mycompany.demo;\n");
+         fw.write("\n");
+         fw.write("import javax.xml.parsers.ParserConfigurationException;\n");
+         fw.write("import javax.xml.parsers.SAXParser;\n");
+         fw.write("import javax.xml.parsers.SAXParserFactory;");
+         fw.write("\n");
+         fw.write("public class Parser {");
+         fw.write("  public SAXParser getParser() throws ParserConfigurationException {\n");
+         fw.write("    SAXParserFactory sf = SAXParserFactory.newInstance();");
+         fw.write("    return sf.newSAXParser();");
+         fw.write("  }");
+         fw.write("}");
+      }
+   }
+      </source>
+      <p>The second example has the obvious advantage that it looks better and simpler.
+        However, it is even larger and you've got to care for indentation,
+        imports and the like. You'll never have a chance to postprocess the generated
+        source, unless you are actually parsing it. That's what the JavaSource framework
+        gives you.</p>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/index.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/index.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/index.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The JaxMe JavaSource framework</title></header>
+  <body>
+    <section><title>The JaxMe JavaSource framework</title>
+      <p>This is a framework for generating Java sources. It is based on an
+        abstraction of the Java sources. For instance, there is an object called
+        <link href="../apidocs/org/apache/ws/jaxme/js/JavaSource.html"><code>JavaSource</code></link>.
+        This object can have embedded instances of
+        <link href="../apidocs/org/apache/ws/jaxme/js/JavaMethod.html"><code>JavaMethod</code></link> or
+        <link href="../apidocs/org/apache/ws/jaxme/js/JavaField.html"><code>JavaField</code></link>,
+        it can have inner classes, constructors, and so on. You get the idea.
+        Compared to a basic approach of just using <code>Writer.write(String)</code>,
+        the framework has the obvious disadvantage of additional complexity and
+        overhead. However, it also has some advantages:</p>
+      <ol>
+        <li>Your sources become more readable and simpler, for example by
+          automatically importing external classes, if required.</li>
+        <li>Postprocessing the generated sources is much easier. You get
+          the chance to generate sources in multiple steps, or in a pipeline
+          like this:
+          <table><caption>Sourge generation pipeline</caption>
+            <tr>
+              <td>If collection: Generate an iterator loop, otherwise: Skip</td>
+              <td>----&gt;</td>
+              <td>Handle the case of a single value</td>
+            </tr>
+          </table>
+          </li>
+        <li>Your generator is much more controlled by the compiler and
+          suitable for refactoring. This is best illustrated by looking at the
+          following example:
+		  <source>
+		    JavaMethod jm;
+		    jm.addLine(MyClass.class, " myInstance = new ", MyClass.class, "();");
+		  </source>
+          This example assumes the existance of a class "MyClass". The compiler
+          verifies the existance and a refactoring module might, for example,
+          rename this class.</li>
+        <li>It has a lot of nice shortcuts, for example:
+    <source>
+      addTry();
+      addLine("int i = Integer.parseInt(s);");
+      addCatch(NumberFormatException.class);
+      addThrowNew(IllegalArgumentException.class,
+                  JavaSource.getQuoted("Invalid integer argument: "), " + s");
+      addEndTry();
+    </source>
+        </li>
+      </ol>
+    </section>
+
+    <anchor id="history"/>
+    <section><title>History</title>
+    <p>The framework was originally part of the
+      <link href="ext:jaxme1">JaxMe 1</link> generator, the predecessor of
+      <link href="ext:jaxme2">JaxMe 2</link>.
+      It got greatly improved as part on the work of JaxMe 2.
+      Roughly in January 2003 it began to live a live of its own, because the framework
+      was picked up for other projects. So it made sense to separate JaxMeJS in an own
+      jar file and make JaxMe 2 based on it.</p>
+    <p>In a way, the JavaSource framework is still a part of JaxMe, because it lives
+      under the same Apache hat. The sources are located in the same
+      SVN server and the distribution comes from the same file server.
+      The administrators and developers are typically the same. We'll see, what the
+      future brings.</p>
+    </section>
+  </body>
+</document>
+

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/jparser.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/jparser.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/jparser.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Java Source Reflection</title></header>
+  <body>
+      <section><title>Why Source Reflection?</title>
+        <p>Java Source Generation is frequently based on reflection. For example,
+          the <link href="patterns/proxy.html">Proxy Generator</link> works
+          roughly like this: Class A is inspected using Java Reflection.
+          A new class B is created. For any public method in A, a method
+          in B is created, that invokes A.</p>
+        <p>This approach has a subtle inconvenience: To use Java reflection,
+          the class A must have already been compiled. As a consequence, the
+          use of generated sources typically happens in three stages:</p>
+        <ol>
+          <li>Compiling a part of the sources</li>
+          <li>Invoking the source generator</li>
+          <li>Compiling the remaining sources</li>
+        </ol>
+        <p>This can become rather nasty. In particular, you cannot reference
+          the second part of the sources from the first part. The build
+          scripts tend to be overly complex and difficult to maintain.</p>
+        <p>Java Source Reflection is a true simplification of the above
+          process: Required informations are gathered from the Java
+          source files, and not from the compiled classes.</p>
+        </section>
+
+      <section><title>How it works</title>
+        <p>Java Source Reflection is implemented by the class
+          <link href="../apidocs/org/apache/ws/jaxme/js/util/JavaParser.html">
+          JavaParser</link>. This class takes as input a Java source file and
+          converts it into an instance of
+          <link href="../apidocs/org/apache/ws/jaxme/js/JavaSource.html">
+          JavaSource</link>. The Java parser is internally based on an
+          <link href="ext:antlr">AntLR parser</link>. (AntLR is a public
+          domain parser generator.)</p>
+        <p>The created
+          <link href="../apidocs/org/apache/ws/jaxme/js/JavaSource.html">
+          JavaSource</link> instance contains instances of
+          <link href="../apidocs/org/apache/ws/jaxme/js/JavaMethod.html">
+          JavaMethod</link>,
+          <link href="../apidocs/org/apache/ws/jaxme/js/JavaField.html">
+          JavaField</link>,
+          <link href="../apidocs/org/apache/ws/jaxme/js/JavaInnerClass.html">
+          JavaInnerClass</link>, and so on. Obviously, these can be used to
+          replace classical Java reflection.</p>
+        </section>
+
+	  <section><title>Using the JavaParser</title>
+	    <p>To use the Java parser, your classpath must obviously contain
+	      the file jaxmejs.jar. However, because the actual parser is
+	      generated by <link href="ext:antlr">AntLR</link>, you need the
+	      file antlr.jar as well. Both files come to you as part of the
+	      JaxMe distribution. Besides, a current version of antlr.jar
+	      (2.7.4, as of this writing) can always be obtained from
+	      <link href="ext:antlr">www.antlr.org</link>. However, if you
+	      replace the AntLR parser, then you should probably use the
+	      JaxMe source distribution, and rebuild the binaries, thus
+	      creating a new parser.</p>
+	    <p>The following sample uses Java source reflection to print
+	      all public non-static methods of a certain Java class:</p>
+	    <source>
+   import org.apache.ws.jaxme.js.*;
+
+   public void printPublicInstanceMethods(File pFile) {
+     JavaSourceFactory jsf = new JavaSourceFactory();
+     JavaParser jp = new JavaParser(jsf);
+     jp.parse(pFile);
+     for (Iterator iter = jsf.getJavaSources();  iter.hasNext();  ) {
+       JavaSource js = (JavaSource) iter.next();
+       System.out.println("Public instance methods of class: " + js.getQName());
+       JavaMethod[] methods = js.getMethods();
+       for (int i = 0;  i &lt; methods.length;  i++) {
+         if (methods[i].getProtection().equals(JavaSource.PUBLIC)  &amp;&amp;
+             !methods[i].isPublic()) {
+           System.out.println("  " + methods[i].getName());
+         }
+       }
+       System.out.println(js.getQName());
+     }
+   }
+	      </source>
+	    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/methods.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/methods.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/methods.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Writing methods</title></header>
+  <body>
+    <section><title>Writing methods</title>
+      <p>Generating a method is supported through various shortcuts. These shortcuts and
+        their value are probably best demonstrated by examples.</p>
+    </section>
+
+    <anchor id="throwingExceptions"/>
+    <section><title>Throwing exceptions</title>
+      <p>Throwing exceptions using the standard method <code>addLine()</code>
+        works roughly like this:</p>
+      <source>
+  public JavaMethod getDifficultMethod(JavaSource pSource) {
+    JavaMethod jm = pSource.newJavaMethod("difficultMethod", "void", "public");
+    jm.addLine("throw new (", NotImplementedException.class, "(",
+               JavaSource.getQuoted("The method 'difficultMethod' is not yet implemented."),
+               ");");
+    return jm;
+  }
+      </source>
+      <p>Using the method <code>addThrowNew()</code>, this could be rewritten as follows:</p>
+      <source>
+  public JavaMethod getDifficultMethod(JavaSource pSource) {
+    JavaMethod jm = pSource.newJavaMethod("difficultMethod", "void", "public");
+    jm.addThrowNew(NotImplementedException.class,
+                  JavaSource.getQuoted("The method 'difficultMethod' is not yet implemented."));
+    return jm;
+  }
+      </source>
+    </section>
+
+    <anchor id="ifBlock"/>
+    <section><title>If .. elseif .. else .. blocks</title>
+      <p>Suggest the following example:</p>
+      <source>
+  public JavaMethod getValueOfMethod(JavaSource pSource) {
+    JavaMethod jm = pSource.newJavaMethod("valueOf", "int", "public");
+    jm.addParam(String.class, "s");
+    jm.addLine("if (", JavaSource.getQuoted("FOO"), ".equals(s)) {");
+    jm.indent();
+    jm.addLine("return foo;");
+    jm.unindent();
+    jm.addLine("} else if (", JavaSource.getQuoted("BAR"), ".equals(s)) {");
+    jm.indent();
+    jm.addLine("return bar;");
+    jm.unindent();
+    jm.addLine("} else {");
+    jm.indent();
+    jm.addThrowNew(IllegalArgumentException.class,
+                   JavaSource.getQuoted("Invalid value for s: "), " + s");
+    jm.unindent();
+    jm.addLine("}");
+    return jm;
+  }
+      </source>
+      <p>This example could also be written like this:</p>
+      <source>
+  public JavaMethod getValueOfMethod(JavaSource pSource) {
+    JavaMethod jm = pSource.newJavaMethod("valueOf", "int", "public");
+    jm.addParam(String.class, "s");
+    jm.addIf(JavaSource.getQuoted("FOO"), ".equals(s)");
+    jm.addLine("return foo;");
+    jm.addElseIf(JavaSource.getQuoted("BAR"), ".equals(s)");
+    jm.addLine("return bar;");
+    jm.addElse();
+    jm.addThrowNew(IllegalArgumentException.class,
+                   JavaSource.getQuoted("Invalid value for s: "), " + s");
+    jm.addEndIf();
+    return jm;
+  }
+      </source>
+      <p>The rewritten example is both shorter and more readable.</p>
+    </section>
+
+    <anchor id="catchBlock"/>
+    <section><title>Try .. catch .. finally .. blocks</title>
+      <p>A try .. catch block is typically written like this:</p>
+      <source>
+  public JavaMethod getAsIntMethod(JavaSource pSource) {
+    JavaMethod jm = pSource.newJavaMethod("asInt", "int", "public");
+    jm.addParam(String.class, "s");
+    jm.addLine("try {");
+    jm.indent();
+    jm.addLine("return Integer.toString(s);");
+    jm.unindent();
+    jm.addLine("} catch (", NumberFormatException.class, " e) {");
+    jm.indent();
+    jm.addLine("e.printStackTrace();");
+    jm.addLine("return 1;");
+    jm.unindent();
+    jm.addLine("}");
+    return jm;
+  }
+      </source>
+      <p>To simplify the example, use the <code>addTry()</code> and
+        <code>addCatch()</code> methods:</p>
+      <source>
+  public JavaMethod getAsIntMethod(JavaSource pSource) {
+    JavaMethod jm = pSource.newJavaMethod("asInt", "int", "public");
+    jm.addParam(String.class, "s");
+    jm.addTry();
+    jm.addLine("return Integer.toString(s);");
+    jm.addCatch(NumberFormatException.class, "e");
+    jm.addLine("e.printStackTrace();");
+    jm.addLine("return 1;");
+    jm.addEndTry();
+    return jm;
+  }
+      </source>
+      <p>An even shorter version would be to replace</p>
+      <source>
+    jm.addCatch(NumberFormatException.class, "e");
+      </source>
+      <p>with</p>
+      <source>
+    jm.addCatch(NumberFormatException.class);
+      </source>
+      <p>The method version with a single parameter generates a local variable name, which
+        is returned as a result by the <code>addCatch()</code> method.</p>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/optimizations.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/optimizations.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/optimizations.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Optimizations</title></header>
+  <body>
+    <section><title>Optimizations</title>
+      <p>Automatically generated code tends to become unnecessarily
+        complex and unreadable. This page summarizes some optimization
+        concepts offered by JaxMeJS and possible strategies to use them.</p>
+    </section>
+
+    <anchor id="directAccessible"/>
+    <section><title>The DirectAccessible interface</title>
+      <p>In general JaxMeJS deals with objects, in the most general sense.
+        An object can be almost everything: An array or collection containing
+        a piece of code, a variable, method, or class name or whatever else.
+        While this is fine for the most situations, it can become difficult
+        in the following example:</p>
+      <source>
+     Object value;
+     return new Object[]{"((", value, ") * (", value, "))"};
+      </source>
+      <p>The example computes the square of the given "value". This example
+        is obviously fine, if "value" contains a simple variable name or
+        something similar. But how about that:</p>
+      <source>
+     value = "Math.sin(x)";
+      </source>
+      <p>The computation of a sine can become relatively expensive, in particular,
+        if the same computation is performed twice. However, at least the example
+        works, which is no longer the case here:</p>
+      <source>
+     value = "i++";
+      </source>
+      <p>Filling this value in the above example would yield</p>
+      <source>
+     ((i++) * (i++))
+      </source>
+      <p>This is simply wrong, because the variable "i" is incremented twice.
+        The obvious solution is the use of a local Java field, as in the
+        following example:</p>
+      <source>
+     Object value;
+     JavaQName type;
+     LocalJavaField v = method.newJavaField(type);
+     v.setFinal(true);
+     v.addLine(value);
+     return new Object[]{"((", v, ") * (", v, "))"};
+      </source>
+      <p>This is obviously better, as it handles both the performance problem
+        caused by the sine computation and the logical problem caused by the
+        increment. However, if you start using such local fields, your code will
+        soon start to look like the following:</p>
+      <source>
+     String val;
+     String _1 = val;
+     String _2 = _1;
+      </source>
+      <p>Again, this is something we do not actually like to see. JaxMeJS suggests
+        the use of the
+        <link href="../apidocs/org/apache/ws/jaxme/js/DirectAccessible.html">DirectAccessible</link>
+        interface. This is an interface implemented by objects, which are accessible
+        immediately and fast: Class and instance fields, method parameters, and
+        local fields. This allows the following final example:</p>
+      <source>
+     Object value;
+     JavaQName type;
+     if (!(value instanceof DirectAccessible)) {
+       LocalJavaField v = method.newJavaField(type);
+       v.setFinal(true);
+       v.addLine(value);
+       value = v;
+     }
+     return new Object[]{"((", value, ") * (", value, "))"};
+      </source>
+    </section>
+
+    <anchor id="nullChecks"/>
+    <section><title>Avoiding unnecessary checks for null</title>
+      <p>The 
+        <link href="../apidocs/org/apache/ws/jaxme/js/DirectAccessible.html">DirectAccessible</link>
+        interface can also be used to avoid situations like this:</p>
+      <source>
+  public void doThis(JavaMethod pMethod, Object pValue) {
+    pMethod.addIf(pValue, " == null");
+    pMethod.addThrowNew(NullPointerException.class, "value must not be null");
+    pMethod.addEndIf();
+    addLine("// Do this here ...");
+    doThat(pMethod, pValue);
+  }
+  public void doThat(JavaMethod pMethod, Object pValue) {
+    pMethod.addIf(pValue, " == null");
+    pMethod.addThrowNew(NullPointerException.class, "value must not be null");
+    pMethod.addEndIf();
+    addLine("// Do that here ...");
+  }
+      </source>
+      <p>If we invoke the method <code>doThis(method, someVariable)</code>, it is
+      creates the following code:</p>
+      <source>
+  if (someVariable == null) {
+    throw new NullPointerException("value must not be null");
+  }
+  // Do this here ...
+  if (someVariable == null) {
+    throw new NullPointerException("value must not be null");
+  }
+  // Do that here ...
+      </source>
+      <p>A better approach would be:</p>
+      <source>
+  public void doThis(JavaMethod pMethod, Object pValue, JavaQName pType) {
+    DirectAccessible value;
+    if (pValue instanceof DirectAccessible) {
+      value = pValue;
+    } else {
+      LocalJavaField foo = pMethod.newJavaField(pType);
+      foo.addLine(pValue);
+      value = foo;
+    }
+    if (value.isNullable()) {
+      pMethod.addIf(pValue, " == null");
+      pMethod.addThrowNew(NullPointerException.class, "value must not be null");
+      pMethod.addEndIf();
+      value.setNullable(false);
+    }
+    addLine("// Do this here ...");
+    doThat(pMethod, pValue, pType);
+  }
+  public void doThat(JavaMethod pMethod, Object pValue, JavaQName pType) {
+    DirectAccessible value;
+    if (pValue instanceof DirectAccessible) {
+      value = pValue;
+    } else {
+      LocalJavaField foo = pMethod.newJavaField(pType);
+      foo.addLine(pValue);
+      value = foo;
+    }
+    if (value.isNullable()) {
+      pMethod.addIf(pValue, " == null");
+      pMethod.addThrowNew(NullPointerException.class, "value must not be null");
+      pMethod.addEndIf();
+      value.setNullable(false);
+    }
+    addLine("// Do that here ...");
+  }
+      </source>
+      <p>In the worst case, this will create the following code:</p>
+      <source>
+  if (someVariable == null) {
+    throw new NullPointerException("value must not be null");
+  }
+  // Do this here ...
+  // Do that here ...
+      </source>
+      <p>Note, that loop variables, as generated by <code>addForArray()</code>,
+        <code>addForIterator</code>, or <code>addForList</code>, will never be
+        nullable. In other words, the following code sequence will emit no checks
+        for null at all:</p>
+      <source>
+  DirectAccessible loopVar = pMethod.addForList(list);
+  pMethod.doThis();
+  pMethod.addEndFor();
+      </source>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/book.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/book.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/book.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN"
+                      "http://apache.org/forrest/dtd/book-cocoon-v10.dtd">
+
+<!-- This file is responsible for generating the menu in the 'js' directory.
+  -->
+
+<book software="JaxMeJS" title="JaxMeJS"
+     copyright="@year@ The Apache Software Foundation"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <menu label="JaxMeJS">
+	<menu-item label="Introduction" href="../index.html"/>
+    <menu-item label="The JavaSource factory" href="../factory.html"/>
+    <menu-item label="Writing methods" href="../methods.html"/>
+    <menu-item label="Placeholders" href="../placeholders.html"/>
+    <menu-item label="Optimizations" href="../optimizations.html"/>
+    <menu-item label="Writing SQL" href="../sql.html"/>
+  </menu>
+
+  <menu label="Patterns">
+    <menu-item label="Proxy Objects" href="proxy.html"/>
+    <menu-item label="Multiple Inheritance" href="proxy.html#multiple_inheritance"/>
+    <menu-item label="Typesafe Enumerations" href="typesafeenum.html"/>
+    <menu-item label="Proxy chains" href="chains.html"/>
+    <menu-item label="Versioning" href="versioning.html"/>
+  </menu>
+
+  <menu label="Applications">
+    <menu-item label="Apache XML-RPC Clients" href="../apps/xmlrpc.html"/>
+  </menu>
+</book>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/chains.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/chains.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/chains.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Proxy chains (also known as: Delegator pattern)</title></header>
+  <body>
+    <anchor id="chains"/>
+      <p>The proxy chain is best explained with the situation it was made for.
+        Suggest a really complex source generator with varying options. For example,
+        a child element of an object can have multiplicity zero, one or more: In
+        the latter case the child element will most probably be represented by a
+        list. Quite necessarily the source generator will sonner or later be
+        bloated with statements like</p>
+      <source>
+    if (child.isMultiple()) {
+        // Do something, working with a List
+        ...
+    } else {
+        // Do something else, working with a single element
+    }
+      </source>
+      <p>Even worse, the code will in both cases look quite similar: As soon as the
+        list item is fetched and casted to a proper type, this is just like working
+        with a single item. As time goes by, more and more similar options come into
+        play: Localization, varying datatypes, and so on. Soon you start to think of
+        better solutions.</p>
+      <p>The first attempt is typically subclassing. For example, if you have
+        a source generator for the case multiplicity zero or one, it can well
+        be expanded to the general case, with multiplicity two or more being
+        handled in the subclass. Localization is handled in the next subclass,
+        and so on. Your code looks much better now and becomes maintainable
+        again.</p>
+      <p>However, time goes by, and more options are added to the source generator:
+        Transaction handling, encoding issues, and so on. Soon you find yourself in
+        trouble again: The subclassing approach doesn't work so well anymore, because
+        in a subclass chain E -> D -> C -> B -> A (where B is a subclass of A, C is
+        a subclass of B, and so on) you sometimes want all of them, but sometimes
+        only D -> C -> A or E -> A. At that point of thinking a new approach was born:
+        The event chain.</p>
+      <p>The idea is replacing the subclasses with an event interface. For example,
+        suggest that the source generator might contain code like the following:</p>
+      <source>
+    public class FooGeneratorImpl implements FooGenerator {
+        public JavaSource getFooClass() {
+            JavaSource js = factory.newJavaSource(fooClassName, "public");
+            getXMethod(js);
+            getYMethod(js);
+            getZMethod(js);
+        }
+        ...
+    }
+      </source>
+      <p>The corresponding interface might look like this:</p>
+      <source>
+    public interface FooGenerator {
+        public JavaSource getFooClass();
+        public JavaMethod getXMethod(JavaSource js);
+        public JavaMethod getYMethod(JavaSource js);
+        public JavaMethod getZMethod(JavaSource js);
+    }
+      </source>
+      <p>If you take this methods as events, then you might well write a default
+        class A implementing the interface. The other classes are implemented as
+        subclasses of an automatically generated <link href="proxy.html">proxy class</link>.
+        For example, the class B might just add another method to the <code>Foo</code>.
+        This might look like the following:</p>
+      <source>
+    public class B extends FooGeneratorProxy {
+       // Override only the getFooClass() method, all other methods are
+       // passed to the base generator by the proxy.
+       public JavaSource getFooClass() {
+           JavaSource result = super.getFooClass();
+           JavaMethod bMethod = result.newJavaMethod("bMethod", "void", "public");
+           return result;
+       }
+    }
+      </source>
+      <p>Likewise, the C class might change the interface of method X, and so on.
+        Any feature is implemented by a single class, which you can optionally add
+        to the chain (turning the feature on) or remove from the chain (turning the
+        feature off).</p>
+      <p>However, there's still a problem left: When you are inside A (the topmost
+        class) and do a <code>getXMethod()</code>, then you call your own class and
+        not the chains bottom. This problem is fixed by the following design:</p>
+      <table>
+        <tr>
+          <td colspan="5">Controller</td><td>Implements FooGenerator</td>
+        </tr>
+        <tr>
+          <td>E</td><td>D</td><td>C</td><td>B</td><td>A</td>
+            <td>Implements ChainedFooGenerator</td></tr>
+      </table>
+      <p>The <code>ChainedFooGenerator</code> is exactly matching the
+        <code>FooGenerator</code> interface, the exception being an additional
+        parameter <code>FooGenerator pController</code> in all methods. The
+        FooGenerator interface can be created automatically, also an
+        implementation of FooGenerator calling the first element in the chain of
+        <code>ChainedFooGenerator</code> implementations. The manually created classes
+        have to be changed slightly, here's the updated <code>FooGeneratorImpl</code>:</p>
+      <source>
+    public class FooGeneratorImpl implements ChainedFooGenerator {
+        public JavaSource getFooClass(FooGenerator pController) {
+            JavaSource js = factory.newJavaSource(fooClassName, "public");
+            pController.getXMethod(js);
+            pController.getYMethod(js);
+            pController.getZMethod(js);
+        }
+        ...
+    }
+      </source>
+      <p>Likewise, here is the updated B class:</p>
+      <source>
+    public class B extends ChainedFooGeneratorProxy {
+       // Override only the getFooClass() method, all other methods are
+       // passed to the base generator by the proxy.
+       public JavaSource getFooClass(FooGenerator pController) {
+           JavaSource result = super.getFooClass(pController);
+           JavaMethod bMethod = result.newJavaMethod("bMethod", "void", "public");
+           return result;
+       }
+    }
+      </source>
+      <p>The proxy chain pattern is implemented by the
+        <link href="../../apidocs/org/apache/ws/jaxme/js/pattern/ChainGenerator.html">ChainGenerator</link>.
+        From within Ant, it looks like the following:</p>
+      <source>
+    &lt;chainGenerator destDir="src"&gt;
+	     &lt;chain
+	        controllerInterfaceName="com.dcx.sein.dbtk.generator.javasg.IModelSG"
+	        chainInterfaceName="com.dcx.sein.dbtk.generator.javasg.auto.IChainedModelSG"
+	        proxyClassName="com.dcx.sein.dbtk.generator.javasg.auto.ChainedModelSGProxy"
+	        implementationClassName="com.dcx.sein.dbtk.generator.javasg.auto.ModelSGImpl"/&gt;
+	     &lt;chain
+	        controllerInterfaceName="com.dcx.sein.dbtk.generator.javasg.IObjectSG"
+	        chainInterfaceName="com.dcx.sein.dbtk.generator.javasg.auto.IChainedObjectSG"
+	        proxyClassName="com.dcx.sein.dbtk.generator.javasg.auto.ChainedObjectSGProxy"
+	        implementationClassName="com.dcx.sein.dbtk.generator.javasg.auto.ObjectSGImpl"/&gt;
+    &lt;/chainGenerator&gt;	  
+      </source>
+      <p>The <code>controllerInterfaceName</code> is the name of the basic interface.
+        This is what you actually want to use from the outside. The controller interface
+        must be available as a compiled class, because it is inspected with Java reflection.
+        The other classes are generated: The <code>chainInterfaceName</code> is the interface
+        being implemented by the manually written classes. The <code>proxyClassName</code>
+        is an automatically generated implementation of the <code>chainInterface</code>,
+        which passes all events to the next element in the chain. And the
+        <code>implementationClassName</code> is an also automatically generated implementation
+        of <code>controllerInterface</code>, that works internally by passing all events
+        to the first element in the chain.</p>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/proxy.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/proxy.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/proxy.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Proxy objects</title></header>
+
+  <body>
+	<anchor id="proxy_objects"/>
+    <section><title>Proxy objects</title>
+      <p>A proxy class is a class that implements a list of interfaces specified at
+        compile time. The proxy object typically holds a reference to an internal
+        object that implements the same interfaces (or parts of them). The proxy
+        object is implemented by delegating method calls to the internal object.
+        This is the same principle as implemented by the class
+        <code>java.lang.reflect.Proxy</code>, which created proxy objects dynamically
+        at runtime using Java reflection.</p>
+      <p>Compared to the standard Proxy class, the generator has the obvious
+        disadvantage, that you have to specify the implemented interfaces at runtime.
+        On the other hand, it allows both to select the proxy objects super class and
+        the derivation of subclasses. In fact the derivation of a subclass is much
+        more obvious, simple and faster than the use of an InvocationHandler.</p>
+      <p>The proxy generator is implemented by the class
+        <link href="../../apidocs/org/apache/ws/jaxme/js/pattern/ProxyGenerator.html">ProxyGenerator</link>.
+        Use of the ProxyGenerator is demonstrated in the Ant target "generate.proxy".</p>
+      <p>The proxy generator Ant task supports the following attributes:</p>
+      <table>
+        <tr>
+          <th>Name</th>
+          <th>Description</th>
+          <th>Required<br/>Default</th>
+        </tr>
+        <tr>
+          <td>classpathRef</td>
+          <td>Reference to a class path, being used to load Java
+            classes or sources. See the "type" attribute in the
+            nested element "implementedInterface" below for details.
+            Use of the "classpathRef" attribute is mutually exclusive
+            with the nested element "classpath".
+          </td>
+          <td>No<br/>Ant's class path</td>
+        </tr>
+        <tr>
+          <td>destDir</td>
+          <td>Path of the directory, where the generated sources are
+            being created. A package structure will be created below.
+            In other words, if a class "org.apache.Foo" is generated,
+            then it will be found in the file ${destDir}/org/apache/Foo.class.
+          </td>
+          <td>No<br/>Current directory</td>
+        </tr>
+        <tr>
+          <td>extendedClass</td>
+          <td>Specifies the fully qualified name of a class, which is being
+            extended by the generated sources.</td>
+          <td>No<br/>java.lang.Object</td>
+        </tr>
+      </table>
+      <p>The proxy generator Ant task also supports the following nested elements:</p>
+      <table>
+        <tr>
+          <th>Name</th>
+          <th>Description</th>
+          <th>Required<br/>Default</th>
+        </tr>
+        <tr>
+          <td>classPath</td>
+          <td>Specifies a path, which is being used for loading
+            Java classes or sources. See the "type" attribute in
+            the nested element "implementedInterface" below for
+            details. The "classpath" element is mutually exclusive
+            with the "classpathRef" attribute.</td>
+          <td>No<br/>Ant's class path</td>
+        </tr>
+        <tr>
+          <td>implementedInterface</td>
+          <td>Specifies an additional interface being implemented.
+            This element must have an attribute "interface" with
+            the fully qualified name of a Java interface which is
+            being implemented by the generated classes.<br/>
+            The generator needs to determine the methods specified
+            by the interface.
+            If the element has an attribute "type" with the value
+            "Reflection", then the specified interface will be
+            loaded as a compiled Java class. Otherwise, if the
+            attribute "type" has the value "Source", then the
+            generator attempts to load a Java source file with
+            the same name from the class path and parse it.
+            Otherwise, if the "type" attribute is missing, it will
+            attempt both "Reflection" and "Source", in that order.
+          </td>
+          <td>
+            Yes, at least one
+          </td>
+        </tr>
+      </table>
+    </section>
+
+	<anchor id="multiple_inheritance"/>
+    <section><title>Multiple Inheritance</title>
+      <p>Multiple inheritance is a design pattern which is not so easy to implement
+        in Java - unless you use the
+        <link href="../../apidocs/org/apache/ws/jaxme/js/pattern/ProxyGenerator.html">ProxyGenerator</link>.
+        This is demonstrated by the JUnit test
+        <link href="../../apidocs/org/apache/ws/jaxme/js/junit/MultipleInheritanceTest.html">MultipleInheritanceTest</link>,
+        which creates a subclass of <code>java.util.Observable</code>, that also inherits
+        from <code>java.util.ArrayList</code>. The example implements a list, which
+        notifies its observers whenever the <code>add()</code> method is invoked.</p>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/typesafeenum.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/typesafeenum.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/typesafeenum.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Typesafe enumerations</title></header>
+
+  <body>
+      <p>Typesafe enumerations are classes with a private constructor and only
+        a few defined instances. Each instance does have a name and a value. As
+        of Java 1.5, they will be part of the Java language. For those of us,
+        who are still stuck with older versions, a source generator is a good
+        solution.</p>
+      <source>
+    &lt;enumGenerator targetClass="org.apache.ws.jaxme.js.junit.EnumExample"
+                   destDir="${build.src}"&gt;
+       &lt;item name="JOE" value="John Doe"/&gt;
+       &lt;item name="POPEYE" value="Olivia's Lover"/&gt;
+       &lt;item name="DONALD" value="The Duck King"/&gt;
+    &lt;/enumGenerator&gt;
+      </source>
+      <p>This will generate a class looking roughly like this:</p>
+      <source>
+    public class EnumExample {
+      private String name;
+      private String value;
+      private EnumExample(String pName, String pValue) {
+        name = pName;
+        value = pValue;
+      }
+      public String getName() { return name; }
+      public String getValue() { return value; }
+      public final static EnumExample JOE = new EnumExample("JOE", "John Doe");
+      public final static EnumExample POPEYE = new EnumExample("POPEYE", "Olivia's Lover");
+      public final static EnumExample DONALD = new EnumExample("DONALD", "The Duck King");
+    }
+      </source>
+      <p>The important thing with this enumeration is that there cannot be other
+        instances besides <code>JOE</code>, <code>POPEYE</code> and <code>DONALD</code>.</p>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/versioning.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/versioning.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/patterns/versioning.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The version generator</title></header>
+  <body>
+
+    <anchor id="introduction"/>
+    <section><title>The version generator</title>
+      <p>A versioned object is an object with a composed primary key:
+        We call the first part the version ID and the second part the version number.
+        Objects with the same ID are called versions of the object. If the versioned
+        object is stored in a single SQL table, a new version can obviously be derived
+        as follows:</p>
+      <ol>
+        <li>Read the row containing the base version.</li>
+        <li>Create a copy of the row in memory.</li>
+        <li>Update the version number in the in-memory clone.</li>
+        <li>Insert the clone into the database.</li>
+      </ol>
+      <p>There is nothing special. Things look quite different, if we have multiple
+        tables. For example, suggest that we have a database with the tables
+        "Organization", "Person", and "Email Address". Any organization might have
+        associated persons as contacts. Organizations and persons, however, might
+        have an unlimited number of email addresses. Foreign keys are used to
+        join the different tables. The organization can be viewed as a collection
+        of a row in "Organization" and zero or more rows in "Person". How about
+        creating a new version of an organization? This is not so convenient:</p>
+      <ol>
+        <li>Read the row containing the organization and clone it,
+          following the above steps.</li>
+        <li>The cloned row doesn't have any associated email addresses,
+          but the base organization probably does. In other words, we need
+          to read the relevant email addresses into memory, update the
+          organization reference and create new instances of the in-memory
+          email addresses, possibly creating a new ID.</li>
+        <li>The cloned organization doesn't have any associated persons,
+          but the base organization probably does. You guess the following:
+          We need to clone the persons as well, updating references and
+          assigning new ID's.</li>
+        <li>We are not yet done: The persons might be referenced by email
+          adresses. So we continue ... you guess.</li>
+      </ol>
+      <p>The version generator is able to create Java code for you, which is
+        doing exactly the above. It takes as input a list of tables and an
+        ID generation procedure for any table, and that's it.</p>
+    </section>
+
+    <anchor id="limitations"/>
+    <section><title>Limitations</title>
+      <p>The current version of the version generator has some restrictions. In
+        particular the following rules apply:</p>
+      <ol>
+        <li>Let <code>T1</code>, <code>T2</code>, <code>T3</code>, ... be the
+          tables being cloned.</li>
+        <li>No table may reference itself. For example, <code>T3</code> must
+          not have a reference to <code>T3</code>.</li>
+        <li>No table may have forward references. A forward reference is a
+          foreign key to another table, which is positioned behind itself
+          in the table. For example, <code>T2</code> and <code>T3</code>
+          may reference <code>T1</code>, but neither <code>T2</code> nor
+          <code>T3</code> may reference <code>T1</code> nor may <code>T3</code>
+          reference <code>T2</code>.</li>
+        <li>All foreign keys must reference the primary key. As a consequence,
+          each referenced table must have a primary key.</li>
+      </ol>
+      <p>In essence, the requirements are, that there are no direct or indirect
+        circular references and that there is a set of columns that allow to
+        remember, which rows already have been cloned.</p>
+    </section>
+
+    <anchor id="columnUpdaters"/>
+    <section><title>Column updaters</title>
+      <p>Column updaters are used to perform the required modifications for the
+        in-memory rows. For example, there is a column updater that updates a
+        foreign keys value from an object that has already been cloned to its
+        clone. Column updaters are implementing the interface
+        <link href="../../apidocs/org/apache/ws/jaxme/js/pattern/VersionGenerator.ColumnUpdater.html">
+          VersionGenerator.ColumnUpdater</link>.</p>
+      <p>The main thing to understand when writing a column updater is that it
+        is not invoked at runtime, but as a part of the source generation stage.
+        It emits Java code taking an object array as input and modifying the
+        array. As an example, we demonstrate a very basic column updater,
+        which is simply incrementing the version number. We assume that the
+        version number is an integer, stored in the tables second column:</p>
+      <source>
+    public class VerNumIncrementer implements VersionGenerator.ColumnUpdater {
+      public void update(JavaMethod pMethod,
+                         VersionGenerator.TableInfo pTableInfo,
+                         DirectAccessible pConnection,
+                         DirectAccessible pMap,
+                         DirectAccessible pRow) {
+        pMethod.addLine(pRow, "[2] = new Integer(((Integer) ",
+                        pRow, "[2]).intValue()+1);");
+      }
+    }
+      </source>
+      <p>The column updaters arguments are as follows:</p>
+      <dl>
+        <dt>pMethod</dt><dd>The method being generated.</dd>
+        <dt>pTableInfo</dt><dd>Holds the generators view of the table being
+          cloned by the method <code>pMethod</code>. The most important property
+          is the <code>table</code> property, which returns an instance of
+          <link href="../../apidocs/org/apache/ws/jaxme/sqls/Table.html">Table</link> with the table name
+          and column list.</dd>
+        <dt>pConnection</dt><dd>A variable name which is holding an open
+          database connection in the generated source.</dd>
+        <dt>pMap</dt><dd>A variable name with a map used to note the column
+          which have already been cloned. The tables keys are the primary keys before cloning,
+          and the tables values are the keys after cloning. The map is used
+          to adjust foreign key references.</dd>
+        <dt>pRow</dt><dd>A variable name representing an array of objects,
+          one for any column in the table. The object types correspond to the
+          column data types: For example, a VARCHAR or CHAR column is mapped
+          to a String, INT, or BIGINT, columns are mapped to Integer and
+          Long, respectively, and so on.</dd>
+      </dl>
+    </section>
+
+    <anchor id="use"/>
+    <section><title>Using the version generator</title>
+      <p>To use the version generator, you need a set of tables (subject to the
+        limitations described <link href="#limitations">above</link>). For any table,
+        you also need a ColumnUpdater. If you have that, the generator is invoked
+        like this:</p>
+      <source><![CDATA[
+  import org.apache.ws.jaxme.js.JavaQNameImpl;
+  import org.apache.ws.jaxme.js.JavaSource;
+  import org.apache.ws.jaxme.js.JavaSourceFactory;
+  import org.apache.ws.jaxme.js.pattern.VersionGenerator;
+  import org.apache.ws.jaxme.js.pattern.VersionGenerator.ColumnUpdater;
+  import org.apache.ws.jaxme.sqls.Table;
+
+  Table[] tables;             // Supplied by you
+  ColumnUpdater updaters;     // Supplied by you, same length than tables array
+
+  JavaSourceFactory factory = new JavaSourceFactory();
+  VersionGenerator vgen = new VersionGenerator();
+  vgen.setGeneratingLogging(true);
+  for (int i = 0;  i < tables.length;  i++) {
+    vgen.addTable(tables[i], updaters[i]);
+  }
+  JavaSource js = factory.newJavaSource(JavaQNameImpl.getInstance("com.foo", "Bar"),
+                                        JavaSource.PUBLIC);
+  vgen.getCloneMethod(js);
+]]>   </source>
+      <p>You might replace the VersionGenerator with a subclass, because the above
+        code would emit logging statements using the 
+        <link href="../../apidocs/org/apache/ws/jaxme/logging/package-summary.html">
+          org.apache.ws.jaxme.logging package</link>.
+        If you do not favour this, replace the methods <code>logEntering</code>,
+        <code>logExiting</code>, <code>logFinest</code>, <code>logFinestEntering</code>,
+        and <code>logFinestEntering</code> with your own implementations.</p>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/placeholders.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/placeholders.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/placeholders.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Placeholders</title></header>
+  <body>
+    <section><title>Placeholders</title>
+      <p>Before describing what JaxMeJS placeholders are, we recall the use of
+      placeholders in JDBC: By preparing a statement like</p>
+      <source>
+  INSERT INTO someTable VALUES (?, ?, ?)
+      </source>
+      <p>you create the statement at one point. At some other point (typically immediately
+        after creating the statement, but not necessarily so) you add parameters to the
+        statement. For example, you tell the JDBC driver: "Replace the first question mark
+        (the first placeholder) with the string 'foo'". Likewise, you would say: "Replace
+        the second question mark with the integer 5".</p>
+      <p>A JaxMeJS placeholder is quite comparable to a JDBC placeholder. The main idea
+        is that you create one part of a method at some place and another part elsewhere.
+        The method creating the other part must know where to add code. It finds the right
+        place by using the placeholder, which the first part has set.</p>
+    </section>
+
+    <anchor id="creating"/>
+    <section><title>Creating a placeholder</title>
+      <p>A placeholder is created by invoking the method
+        <link href="../apidocs/org/apache/ws/jaxme/js/IndentationEngine.html#newPlaceHolder(String,boolean)">
+          newPlaceHolder(String,boolean)</link>. For example:</p>
+      <source>
+    JavaMethod jm;
+    PlaceHolder p = jm.newPaceHolder("MyPlaceholder", true);
+      </source>
+      <p>The method takes two arguments:</p>
+      <dl>
+        <dt>pName</dt>
+        <dd>Any placeholder has got a name. The name is the identifier by which you find the
+          placeholder. (See the <link href="#using">next section</link> for details.)</dd>
+        <dt>pAutoRemovable</dt>
+        <dd>The boolean argument indicates whether you expect to use the placeholder in
+          either case. If so, you set the "autoRemovable" argument to false. In that case,
+          you <em>must</em> remove the placeholder before serializing the method. An
+          IllegalStateException is thrown otherwise. However, if you set the "pAutoRemovable"
+          argument to true, then an existing placeholder is simply ignored while serializing
+          the method.</dd>
+      </dl>
+    </section>
+
+    <anchor id="using"/>
+    <section><title>Using the placeholder</title>
+      <p>To insert code after the placeholder, simply find it. For example:</p>
+      <source>
+    JavaMethod jm;
+    PlaceHolder p = jm.getPlaceHolder("MyPlaceholder");
+    jm.addLine("// This line follows immediately after the placeholder.");
+      </source>
+      <p>Do not forget to remove the placeholder, if the "pAutoRemovable" flag was set
+        to false while creating it:</p>
+      <source>
+    p.remove();
+        </source>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/sql.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/sql.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/js/sql.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Working with SQL</title></header>
+  <body>
+    <section><title>Working with SQL</title>
+      <warning>As of this writing, the SQL support is in early stages.
+        Some things described here are hardly more than planned and the API
+        will probably change rapidly.</warning>
+      <p>Quite many Java applications working with source generators are also
+        working with SQL. It seems natural to develop a generic SQL generation
+        framework, because it can make the actual generator much more simple and
+        readable.</p>
+      <p>The basic concepts are comparable to the Java source generation framework:
+        There is a factory, which allows you to create schema, table, column,
+        index, statement objects and the like. And there is also an API which
+        allows to manipulate these objects on a certain level of abstraction.</p>
+      <p>In what follows we describe the concept of the SQL generator by means
+        of some examples. The generator has the same objects that the actual
+        database will have: A schema, tables, columns, statements, and so on.</p>
+    </section>
+
+	<anchor id="schema"/>
+	<section><title>Creating a schema</title>
+      <p>The SQL generator assumes that any table belongs to a schema.
+      In other words, before creating a table, you have to create a schema:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.Schema;
+  import org.apache.ws.jaxme.sqls.SQLFactory;
+  import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+  
+  SQLFactory factory = new SQLFactoryImpl();
+  Schema schema = factory.newSchema("myschemaname");
+  System.out.println(schema.getName().toString()); // Prints myschemaname
+      </source>
+      <p>However, it is not unusual to avoid the schema. Even more, there are
+        SQL databases like <link href="ext:mysql">MySQL</link> which do not
+        even support a schema. In that case you simply use the so-called default
+        schema. The only difference between the default schema and other schemas
+        is that the former doesn't have a name.</p>
+      <source>
+  Schema schema = factory.getDefaultSchema();
+  System.out.println(schema.getName().toString()); // Prints null
+      </source>
+	</section>
+
+    <anchor id="table"/>
+    <section><title>Creating a table</title>
+      <p>Now that we have a schema, we may populate it with tables
+        and the tables with columns. Suggest the following statement:</p>
+      <source>
+  CREATE TABLE mytable (
+    id INTEGER NOT NULL PRIMARY KEY,
+    name VARCHAR(40) NOT NULL,
+    price DOUBLE,
+    UNIQUE(name));
+      </source>
+      <p>In the framework this looks like the following:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.Table;
+  import org.apache.ws.jaxme.sqls.Column;
+
+  Table mytable = schema.newTable("mytable");
+  Column id = table.newColumn("id", Column.Type.INTEGER);
+  id.setNullable(false);
+  mytable.newPrimaryKey().addColumn(id);
+  Column name = table.newColumn("name", Column.Type.VARCHAR);
+  name.setLength(40);
+  name.setNullable(false);
+  mytable.newKey().addColumn(name);
+  Column price = table.newColumn("price", Column.Type.DOUBLE);
+      </source>
+    </section>
+
+    <anchor id="insert"/>
+    <section><title>Creating an INSERT statement</title>
+      <p>Now that we have our tables, we probably want to create an
+        INSERT statement like</p>
+      <source>
+  INSERT INTO mytable (id, name, price) VALUES (?, ?, 0.0)
+      </source>
+      <p>Here's how we do this:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.InsertStatement;
+  import org.apache.ws.jaxme.sqls.SQLGenerator;
+  import org.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl;
+
+  SQLGenerator generator = new SQLGeneratorImpl();
+  InsertStatement stmt = table.getInsertStatement();
+  System.out.println(generator.getQuery(stmt));
+      </source>
+      <p>The <code>getInsertStatement()</code> method is a shortcut
+        for the following:</p>
+      <source>
+  InsertStatement stmt = factory.newInsertStatement();
+  stmt.setTable(mytable);
+  stmt.addSet(id);
+  stmt.addSet(name);
+  stmt.addSet(price, (double) 0.0);
+      </source>
+    </section>
+
+    <anchor id="select"/>
+    <section><title>Creating a SELECT statement</title>
+      <p>Quite similar to the above is the creation of a SELECT statement:</p>
+      <source>
+  SELECT id, name, price FROM mytable
+      </source>
+      <p>A shortcut for the above would be:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.SelectStatement;
+
+  SelectStatement stmt = table.getSelectStatement();
+  System.out.println(generator.getQuery(stmt));
+      </source>
+      <p>The longer version goes like this:</p>
+      <source>
+  SelectStatement stmt = factory.newSelectStatement();
+  stmt.setTable(mytable);
+  stmt.addResultColumn(id);
+  stmt.addResultColumn(name);
+  stmt.addResultColumn(price);
+      </source>
+      <p>However, we possible want to add a WHERE clause like</p>
+      <source>
+  WHERE id=? AND price > 1.0
+      </source>
+      <p>This can be done like the following:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.CombinedConstraint;
+
+  CombinedConstraint whereClause = stmt.getWhere();
+  BooleanConstraint idClause = whereClause.createEQ();
+  idClause.addPart(id);
+  idClause.addPlaceHolder();
+  BooleanConstraint priceClause = whereClause.createEQ();
+  priceClause.addPart(price);
+  priceClause.addPart((double) 1.0);
+  System.out.println("SELECT statement with WHERE clause: " +
+                     generator.getQuery(stmt));
+      </source>
+    </section>
+
+    <anchor id="update"/>
+    <section><title>Creating an UPDATE statement</title>
+      <p>A typical UPDATE statement for <code>mytable</code> would be</p>
+      <source>
+  UPDATE mytable SET name = 'foo', price = ? WHERE id = ?
+      </source>
+      <p>The SQL generator allows to do that in the following manner:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.UpdateStatement;
+
+  UpdateStatement stmt = schema.newUpdateStatement();
+  stmt.setTable(table);
+  stmt.addSet("name", "foo");
+  stmt.addSet("price");
+  CombinedConstraint whereClause = stmt.getWhere();
+  BooleanConstraint idClause ) whereClause.createEQ();
+  idClause.addPart(id);
+  idClause.addPlaceHolder();
+  System.out.println("UPDATE statement: " +
+                     generator.getQuery(stmt));
+      </source>
+      <p>For this particular <code>UPDATE</code> query, there also
+        is a shortcut:</p>
+      <source>
+  UpdateStatement stmt = table.getUpdateStatement();
+  System.out.println("UPDATE statement: " +
+                     generator.getQuery(stmt));
+      </source>
+    </section>
+
+    <anchor id="delete"/>
+    <section><title>Creating a DELETE statement</title>
+      <p>Most probably you already guess how to create the following
+        <code>DELETE</code> statement:</p>
+      <source>
+  DELETE FROM mytable WHERE id = ?
+      </source>
+      <p>The shortcut is:</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.DeleteStatement;
+
+  DeleteStatement stmt = table.getDeleteStatement();
+  System.out.println("DELETE statement: " +
+                     generator.getQuery(stmt));
+      </source>
+      <p>And here is the longer version:</p>
+      <source>
+  DeleteStatement stmt = schema.newDeleteStatement();
+  stmt.setTable(table);
+  CombinedConstraint whereClause = stmt.getWhere();
+  BooleanConstraint idClause ) whereClause.createEQ();
+  idClause.addPart(id);
+  idClause.addPlaceHolder();
+  System.out.println("DELETE statement: " +
+                     generator.getQuery(stmt));
+      </source>
+    </section>
+
+    <anchor id="create"/>
+    <section><title>Creating one or more CREATE TABLE statements</title>
+      <p>Is it possible to recreate the above CREATE TABLE statement from
+        the above <code>table</code> variable? Of course it is:</p>
+        <source>
+  Collection c = generator.getCreate(table);
+  for (Iterator iter = c.iterator();  iter.hasNext();  ) {
+    String s = (String) iter.next();
+    System.out.println("Statement: " + s);
+  }
+        </source>
+      <p>You probably wonder why the <code>getCreate(Table)</code> method
+        returns a collection? And you are mostly right, as the above collection
+        will typically contain a single statement. However, it is not unusual
+        that an index must be created in a separate statement. In this case
+        it might happen, that the collection returns multiple strings.</p>
+      <p>It is also possible to create a schema:</p>
+      <source>
+  Collection c = generator.getCreate(schema);
+  for (Iterator iter = c.iterator();  iter.hasNext();  ) {
+    String s = (String) iter.next();
+    System.out.println("Statement: " + s);
+  }
+      </source>
+      <p>However, you possibly want to create not only the schema, but
+        the tables as well. Voila:</p>
+      <source>
+  Collection c = generator.getCreate(schema, true);
+  for (Iterator iter = c.iterator();  iter.hasNext();  ) {
+    String s = (String) iter.next();
+    System.out.println("Statement: " + s);
+  }
+      </source>
+    </section>
+
+    <anchor id="extensions"/>
+    <section><title>Vendor specific extensions</title>
+      <p>Vendor specific extensions and vendor specific SQL dialects are available
+        through subclasses of <code>SQLFactoryImpl</code>. As of this writing, the
+        only available subclass is <code>DB2SQLFactoryImpl</code>. To use it,
+        simply replace</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.SQLFactory;
+  import org.apache.ws.jaxme.sqls.SQLFactoryImpl;
+
+  SQLFactory factory = new SQLFactoryImpl();
+      </source>
+      <p>with</p>
+      <source>
+  import org.apache.ws.jaxme.sqls.db2.DB2SQLFactory;
+  import org.apache.ws.jaxme.sqls.db2.DB2SQLFactoryImpl;
+
+  SQLFactory factory = new SQLFactoryImpl();
+      </source>
+      <p>In the special case of DB2 this will soon enable access to features like
+        table spaces or buffer pools.</p>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/license.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/license.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/license.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>The Apache License, Version 2.0</title> 
+  </header> 
+  <body> 
+    <p>
+      JaxMe, and all of its components, come to you under the
+      terms of the Apache Software License.
+    </p>
+    <section>
+      <title>The Apache Software License, Version 2.0</title>
+      <p xml:space="preserve">
+                Apache License<br/>
+          Version 2.0, January 2004<br/>
+       <link href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</link>
+     </p>
+
+	  <section><title>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</title>
+	  <ol>
+	  	<li>
+	  	  <p>Definitions</p>
+	  	  <p>"License" shall mean the terms and conditions for use, reproduction,
+            and distribution as defined by Sections 1 through 9 of this document.
+		  </p>
+		  <p>"Licensor" shall mean the copyright owner or entity authorized by
+      		the copyright owner that is granting the License.
+      	  </p>
+      	  <p>"Legal Entity" shall mean the union of the acting entity and all
+      		other entities that control, are controlled by, or are under common
+      		control with that entity. For the purposes of this definition,
+      		"control" means (i) the power, direct or indirect, to cause the
+      		direction or management of such entity, whether by contract or
+      		otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      		outstanding shares, or (iii) beneficial ownership of such entity.
+      	  </p>
+      	  <p>"You" (or "Your") shall mean an individual or Legal Entity
+      		exercising permissions granted by this License.
+      	  </p>
+      	  <p>"Source" form shall mean the preferred form for making modifications,
+      		including but not limited to software source code, documentation
+      		source, and configuration files.
+      	  </p>
+      	  <p>"Object" form shall mean any form resulting from mechanical
+      		transformation or translation of a Source form, including but
+      		not limited to compiled object code, generated documentation,
+      		and conversions to other media types.
+      	  </p>
+      	  <p>"Work" shall mean the work of authorship, whether in Source or
+      		Object form, made available under the License, as indicated by a
+      		copyright notice that is included in or attached to the work
+      		(an example is provided in the Appendix below).
+      	  </p>
+      	  <p>"Derivative Works" shall mean any work, whether in Source or Object
+      		form, that is based on (or derived from) the Work and for which the
+      		editorial revisions, annotations, elaborations, or other modifications
+      		represent, as a whole, an original work of authorship. For the purposes
+      		of this License, Derivative Works shall not include works that remain
+      		separable from, or merely link (or bind by name) to the interfaces of,
+      		the Work and Derivative Works thereof.
+      	  </p>
+      	  <p>"Contribution" shall mean any work of authorship, including
+      		the original version of the Work and any modifications or additions
+      		to that Work or Derivative Works thereof, that is intentionally
+      		submitted to Licensor for inclusion in the Work by the copyright owner
+      		or by an individual or Legal Entity authorized to submit on behalf of
+      		the copyright owner. For the purposes of this definition, "submitted"
+  			means any form of electronic, verbal, or written communication sent
+      		to the Licensor or its representatives, including but not limited to
+      		communication on electronic mailing lists, source code control systems,
+      		and issue tracking systems that are managed by, or on behalf of, the
+      		Licensor for the purpose of discussing and improving the Work, but
+      		excluding communication that is conspicuously marked or otherwise
+      		designated in writing by the copyright owner as "Not a Contribution."
+      	  </p>
+      	  <p>"Contributor" shall mean Licensor and any individual or Legal Entity
+      		on behalf of whom a Contribution has been received by Licensor and
+      		subsequently incorporated within the Work.
+	  	  </p>
+	  	</li>
+	  	<li>Grant of Copyright License. Subject to the terms and conditions of
+      	  this License, each Contributor hereby grants to You a perpetual,
+      	  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      	  copyright license to reproduce, prepare Derivative Works of,
+      	  publicly display, publicly perform, sublicense, and distribute the
+      	  Work and such Derivative Works in Source or Object form.
+      	</li>
+      	<li>Grant of Patent License. Subject to the terms and conditions of
+      	  this License, each Contributor hereby grants to You a perpetual,
+      	  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      	  (except as stated in this section) patent license to make, have made,
+      	  use, offer to sell, sell, import, and otherwise transfer the Work,
+      	  where such license applies only to those patent claims licensable
+      	  by such Contributor that are necessarily infringed by their
+      	  Contribution(s) alone or by combination of their Contribution(s)
+      	  with the Work to which such Contribution(s) was submitted. If You
+      	  institute patent litigation against any entity (including a
+      	  cross-claim or counterclaim in a lawsuit) alleging that the Work
+      	  or a Contribution incorporated within the Work constitutes direct
+      	  or contributory patent infringement, then any patent licenses
+      	  granted to You under this License for that Work shall terminate
+      	  as of the date such litigation is filed.
+      	</li>
+		<li>
+		  <p>Redistribution. You may reproduce and distribute copies of the
+      	  Work or Derivative Works thereof in any medium, with or without
+      	  modifications, and in Source or Object form, provided that You
+      	  meet the following conditions:</p>
+      	  <dl>
+      	    <dt>(a)</dt>
+      	    <dd>You must give any other recipients of the Work or
+          	  Derivative Works a copy of this License; and
+          	</dd>
+          	<dt>(b)</dt>
+          	<dd>You must cause any modified files to carry prominent notices
+          	  stating that You changed the files; and
+          	</dd>
+          	<dt>(c)</dt>
+          	<dd>You must retain, in the Source form of any Derivative Works
+              that You distribute, all copyright, patent, trademark, and
+              attribution notices from the Source form of the Work,
+              excluding those notices that do not pertain to any part of
+              the Derivative Works; and
+            </dd>
+            <dt>(d)</dt>
+            <dd>If the Work includes a "NOTICE" text file as part of its
+          	  distribution, then any Derivative Works that You distribute must
+          	  include a readable copy of the attribution notices contained
+          	  within such NOTICE file, excluding those notices that do not
+          	  pertain to any part of the Derivative Works, in at least one
+          	  of the following places: within a NOTICE text file distributed
+          	  as part of the Derivative Works; within the Source form or
+          	  documentation, if provided along with the Derivative Works; or,
+          	  within a display generated by the Derivative Works, if and
+          	  wherever such third-party notices normally appear. The contents
+          	  of the NOTICE file are for informational purposes only and
+          	  do not modify the License. You may add Your own attribution
+          	  notices within Derivative Works that You distribute, alongside
+          	  or as an addendum to the NOTICE text from the Work, provided
+          	  that such additional attribution notices cannot be construed
+          	  as modifying the License.
+          	</dd>
+      	  </dl>
+      	  <p>You may add Your own copyright statement to Your modifications and
+      		may provide additional or different license terms and conditions
+      		for use, reproduction, or distribution of Your modifications, or
+      		for any such Derivative Works as a whole, provided Your use,
+      		reproduction, and distribution of the Work otherwise complies with
+      		the conditions stated in this License.
+      	  </p>
+		</li>
+		<li>Submission of Contributions. Unless You explicitly state otherwise,
+		  any Contribution intentionally submitted for inclusion in the Work
+      	  by You to the Licensor shall be under the terms and conditions of
+      	  this License, without any additional terms or conditions.
+      	  Notwithstanding the above, nothing herein shall supersede or modify
+      	  the terms of any separate license agreement you may have executed
+      	  with Licensor regarding such Contributions.
+		</li>
+		<li>Trademarks. This License does not grant permission to use the trade
+      	  names, trademarks, service marks, or product names of the Licensor,
+      	  except as required for reasonable and customary use in describing the
+      	  origin of the Work and reproducing the content of the NOTICE file.
+      	</li>
+      	<li>Disclaimer of Warranty. Unless required by applicable law or
+      	  agreed to in writing, Licensor provides the Work (and each
+      	  Contributor provides its Contributions) on an "AS IS" BASIS,
+      	  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      	  implied, including, without limitation, any warranties or conditions
+      	  of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      	  PARTICULAR PURPOSE. You are solely responsible for determining the
+      	  appropriateness of using or redistributing the Work and assume any
+      	  risks associated with Your exercise of permissions under this License.
+      	</li>
+      	<li>Limitation of Liability. In no event and under no legal theory,
+      	  whether in tort (including negligence), contract, or otherwise,
+      	  unless required by applicable law (such as deliberate and grossly
+      	  negligent acts) or agreed to in writing, shall any Contributor be
+      	  liable to You for damages, including any direct, indirect, special,
+      	  incidental, or consequential damages of any character arising as a
+      	  result of this License or out of the use or inability to use the
+      	  Work (including but not limited to damages for loss of goodwill,
+      	  work stoppage, computer failure or malfunction, or any and all
+      	  other commercial damages or losses), even if such Contributor
+      	  has been advised of the possibility of such damages.
+      	</li>
+      	<li>Accepting Warranty or Additional Liability. While redistributing
+      	  the Work or Derivative Works thereof, You may choose to offer,
+      	  and charge a fee for, acceptance of support, warranty, indemnity,
+      	  or other liability obligations and/or rights consistent with this
+      	  License. However, in accepting such obligations, You may act only
+      	  on Your own behalf and on Your sole responsibility, not on behalf
+      	  of any other Contributor, and only if You agree to indemnify,
+      	  defend, and hold each Contributor harmless for any liability
+      	  incurred by, or claims asserted against, such Contributor by reason
+      	  of your accepting any such warranty or additional liability.
+      	</li>
+	  </ol>
+	  <p>END OF TERMS AND CONDITIONS</p>
+	  </section>
+
+	  <section><title>APPENDIX: How to apply the Apache License to your work.</title>
+        <p>To apply the Apache License to your work, attach the following
+      	  boilerplate notice, with the fields enclosed by brackets "[]"
+      	  replaced with your own identifying information. (Don't include
+      	  the brackets!)  The text should be enclosed in the appropriate
+      	  comment syntax for the file format. We also recommend that a
+      	  file or class name and description of purpose be included on the
+      	  same "printed page" as the copyright notice for easier
+      	  identification within third-party archives.
+      	</p>
+      	<source>
+   		  Copyright [yyyy] [name of copyright owner]
+   		</source>
+   		<p>Licensed under the Apache License, Version 2.0 (the "License");
+   		  you may not use this file except in compliance with the License.
+   		  You may obtain a copy of the License at
+   		</p>
+   		<p><link href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</link></p>
+		<p>Unless required by applicable law or agreed to in writing, software
+   		  distributed under the License is distributed on an "AS IS" BASIS,
+   		  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   		  See the License for the specific language governing permissions and
+   		  limitations under the License.
+   		</p>
+	  </section>
+	</section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/mailinglists.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/mailinglists.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/mailinglists.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>JaxMe 2 Mailing Lists</title> 
+  </header>
+  <body>
+    <p>JaxMe 2 is supported through mailing lists</p>
+	<anchor id="developers"/>
+    <section><title>JaxMe Developers</title>
+      <p>Currently this is the only mailing list. As there is not too much traffic,
+        it is shared by both JaxMe users and developers. If traffic grows, we'll create
+        a separate list jaxme-user in the future. The mailing list address is
+        <link href="site:mailtojaxmedev">jaxme-dev at ws.apache.org</link>. Subscribing and unsubscribing
+        works by sending mail to
+        <link href="mailto:jaxme-dev-subscribe at ws.apache.org">jaxme-dev-subscribe at ws.apache.org</link>,
+        or <link href="mailto:jaxme-dev-unsubscribe at ws.apache.org">jaxme-dev-unsubscribe at ws.apache.org</link>,
+        respectively. This list is receiving SVN notifications.</p>
+      <p>Searchable archives of this list can be found on
+        <link href="http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=172">
+          http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=172
+        </link> and
+        <link href="http://marc.theaimsgroup.com/?l=jaxme-dev">http://marc.theaimsgroup.com/?l=jaxme-dev</link>.</p>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/misc.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/misc.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/misc.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>Miscellaneous</title> 
+  </header> 
+  <body>
+    <p>This page contains miscellaneous informations for developers.</p>
+
+    <section><title>Clover</title>
+      <p><link href="site:clover">Clover</link> is a tool that allows to trace the
+      	coverage of a test suite. In short, you compile your classes using clover,
+      	run the unit tests and finally receive a report which tells you, which
+      	methods and lines are covered by the unit tests and, more important,
+      	which aren't.</p>
+      <p>The nice thing with Clover is, that it is available at no cost for
+      	open source projects like JaxMe. In other words, one can use it to
+        determine the coverage of JaxMe's test suite. Here's how to do that:</p>
+      <ol>
+      	<li>To obtain a copy of Clover, you have to use the
+      	  <link href="site:cloverkey">JaxMe license key</link>. After accepting
+      	  the Clover license, you may download a ZIP file with "Clover for Ant".
+      	  Extract the file and copy the file lib\clover.jar to the lib folder
+      	  in your Ant home directory.</li>
+      	<li>Choose a temporary directory. In what follows, I will assume /tmp/cloverdb.</li>
+      	<li>Invoke the following Ant targets, in the same order</li>
+      </ol>
+      <source>
+      	ant clean
+      	ant -Dbuild.clover.db=/tmp/cloverdb all
+      	ant -Dbuild.clover.db=/tmp/cloverdb test
+      	ant -Dbuild.clover.db=/tmp/cloverdb test
+      	ant -Dbuild.clover.db=/tmp/cloverdb clover.swing
+      </source>
+      <p>Don't ask me, why we have to call the "test" target twice. Alternatively
+      	you may replace "clover.swing" with "clover.html": This will create a
+      	set of HTML files with the same report.</p>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/news.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/news.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/news.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>JaxMe News</title> 
+  </header> 
+  <body>
+    <dl>
+      <dt>2006-Jan-06: JaxMe 0.5.1 released</dt>
+      <dd>Patch release, adding preliminary support for external binding files.</dd>
+      <dt>2005-Aug-09: JaxMe 0.5 released</dt>
+      <dd>Compared to 0.5beta, several bugs have been fixed.</dd>
+      <dt>2005-Jul-13: JaxMe 0.5beta released</dt>
+      <dd>This release introduces support for mixed content and
+        proper inheritance of the code generated for xs:extension.</dd>
+      <dt>2005-May-19: JaxMe 0.4 released</dt>
+      <dd>Compared to the beta version, no new features have been introduced.
+        A few bugs have been fixed, mainly concerning the nested group support.</dd>
+      <dt>2005-Apr-12: JaxMe 0.4beta released</dt>
+      <dd>This release introduces support for nested groups with multiplicity &lt;= 1.
+        In particular, xs:extension is supported now.</dd>
+      <dt>2004-Sep-03: JaxMe 0.3.1 released</dt>
+      <dd>This is a bug fix release, driven mostly by user input and feedback.
+        In particular, recursive schemas are now supported.</dd>
+      <dt>2004-Jul-25: JaxMe 0.3 released</dt>
+      <dd>The JaxMe team are proud to present the first release since 
+      leaving the incubator.</dd>
+	  <dt>2004-Mar-09: JaxMe has graduated to become a subproject of Apache WS</dt>
+	  <dd>The <link href="ext:incubator">Apache Incubator PMC</link> has voted
+	    for JaxMe to become a true subproject of the
+	    <link href="ext:ws">Apache Webservices</link>.</dd>
+      <dt>2003-Nov-18: incubated-jaxme 0.2 has been released.</dt>
+      <dd>Compared to the previous release from sf.net, there haven't been
+        too many updates. This release is mainly to allow using the updated
+        package names. Besides, JaxMePM has been introduced.</dd>
+      <dt>2003-Sep-25: The JaxMe site is online</dt>
+      <dd>The new JaxMe site is online at <link href="site:jaxme">http://ws.apache.org/jaxme/</link>.</dd>
+    </dl>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/book.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/book.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/book.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN"
+                      "http://apache.org/forrest/dtd/book-cocoon-v10.dtd">
+
+<!-- This file is responsible for generating the menu in the 'js' directory.
+  -->
+
+<book software="JaxMePM" title="JaxMePM"
+     copyright="@year@ The Apache Software Foundation"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <menu label="JaxMePM">
+	<menu-item label="Introduction" href="index.html"/>
+	<menu-item label="JDBC" href="jdbc.html"/>
+	<menu-item label="Tamino" href="ino.html"/>
+  </menu>
+</book>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/index.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/index.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/index.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The JaxMe Persistence Management</title></header>
+  <body>
+    <section><title>The JaxMe Persistence Management</title>
+      <p>JaxMe Persistence Management means the ability to read JaxMe objects from,
+        insert them into, update them in, or delete them from the database.
+        These operations are supported by JaxMe's
+        <link href="../apidocs/org/apache/ws/jaxme/pm/PM.html">persistence managers</link>.
+        </p>
+      <p>The word database has a very broad meaning. The PM layer restricts
+        itself to the most basic operations. As a result, almost arbitrary
+        types of databases may be used:</p>
+      <ul>
+        <li>Relational databases via JDBC; the
+          <link href="../apidocs/org/apache/ws/jaxme/pm/generator/jdbc/JaxMeJdbcSG.html">JaxMeJdbcSG</link>
+          may be used to read an existing database schema via JDBC metadata and converts
+          the tables into JaxMe objects. For any table, it also creates a specific
+          persistence manager, which is a subclass of
+          <link href="../apidocs/org/apache/ws/jaxme/pm/jdbc/PMJdbcImpl.html">PMJdbcImpl</link>.</li>
+        <li>Native XML databases via XML:DB, a database independent API, much like
+          JDBC; native XML databases include <link href="ext:exist"/>,
+          <link href="ext:xindice"/>, or <link href="ext:tamino"/>. The most important
+          difference between native XML and relational databases is, that the formers
+          have no limitations on the structure of XML documents being stored.
+          <!-- TODO: Link to xmldn.org -->
+          As a consequence, there is no need for specific support in the schema
+          and <link href="../apidocs/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.html">XmlDbPM</link>,
+          the persistence manager for XML:DB, is generic.</li>
+        <li>Native XML databases via proprietary API's or protocols; currently this
+          only includes <link href="ext:tamino">Tamino</link>
+          via the
+          <link href="../apidocs/org/apache/ws/pm/ino/InoManager.html">InoManager</link>.</li>
+      </ul>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/ino.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/ino.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/ino.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Accessing a Tamino database</title></header>
+  <body>
+  	<p><link href="ext:tamino">Tamino</link> is a native XML database by
+      <link href="ext:sag">Software AG</link>. Compared to a relational
+  	  database, it has the disadvantage of being not very popular.
+  	  However, if your data is structured (more structured than
+  	  conveniently expressible by relational data structures, that is)
+  	  you will soon find a lot of advantages and possibly prefer it
+  	  over a traditional SQL database engine. From within JaxMe, Tamino
+  	  may be accessed in either of three ways:</p>
+  	<ul>
+  	  <li>Via the XML:DB API, implemented by the
+  	  	<link href="../apidocs/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.html">XmlDbPM</link>.
+  	  	This is the recommended way if you want your application to be
+  	  	portable amongst various XML databases. The XML:DB API is
+  	  	being described in a separate document. (To be done.)</li>
+  	  <li>Via native HTTP, implemented by the
+  	  	<link href="../apidocs/org/apache/ws/jaxme/pm/ino/InoManager.html">InoManager</link>.
+  	    This solution is recommended, if you need a very low memory
+  	    profile, even for processing a large result set. In particular
+  	    it offers a true streaming mode.</li>
+  	  <li>Via the official Tamino Java API, called TaminoAPI4J.
+  	  	This is recommended for enterprise applications, as it
+  	  	allows to embed Tamino into the transactional context of
+  	  	an EJB container.</li>
+  	</ul>
+
+	<section><title>Preparations</title>
+		<p>Tamino is accessible via two different query languages.
+		  The elder variant is called <em>X-Query</em> and is best
+		  compared with <em>XPath</em>. The newer language is based
+		  on <em>XQuery</em>.
+		</p>
+		<p>XPath and X-Query share an important problem when using
+		  namespaces: They have no mapping between namespace prefixes
+		  and namespace URIs. In other words, if you perform a query
+		  like</p>
+		<source>
+			_xql=ad:Address
+		</source>
+		<p>then the database <em>must know</em>, that the prefix
+		  <code>ad</code> is mapped to the namespace URI
+		  <code>http://ws.apache.org/jaxme/test/misc/address</code>.
+		  </p>
+		<p>Tamino and the JaxMe managers overcome the absence of a
+		  mapping in the query by storing the mapping from the
+		  schema and using that. In other words, if you are
+		  using namespaces, then you should:</p>
+		<ol>
+			<li>Specify a prefix for the namespace in the schema.</li>
+			<li>Use the same schema (and thus the same prefix) for
+				the database schema as well as the JaxMe generator.
+				(Obviously this is recommended anyways.)</li>
+			<li>Use the same prefix for specifying queries.</li>
+		</ol>
+	</section>
+
+	<section><title>Preparing the Tamino Resource Adapter</title>
+		<p>If you are not using the Tamino Resource Adapter (which
+		  is typically the case, if you are <em>not</em> using
+		  an EJB container like JBoss, WebSphere, or the like.
+		  In that case you may very well skip this section and
+		  proceed to the next section, which is about creating
+		  the schema file.</p>
+		<p>Adding the Tamino Resource Adapter is covered in the
+		  documentation of the TaminoAPI4J. However, we'll provide
+		  specific details for JBoss 3.2 here, because the docs
+		  are for JBoss 3.0 only and because we disagree with
+		  the recommendation to add the Tamino jar files to the
+		  JBoss lib directory. So here's what we've done, step
+		  by step:
+		</p>
+		<ul>
+		  <li>Add the jar file <code>TaminoAPI4J.jar</code>
+		  	to the rar file, for example
+		  	<code>TaminoJCA_localTx.rar</code>. Copy the
+		  	RAR file to the JBoss deploy directory.
+		  </li>
+		  <li>Create a deployment descriptor file <code>tamino-service.xml</code>
+		  	with the following contents and copy it to the
+		  	JBoss deploy directory. (Of course you should adapt
+		  	the database URL, user and password to your local
+		  	settings. Most probably you would also want to change
+		  	the JNDI name <code>MyTaminoLocalTxConnector</code>.
+		  </li>
+		</ul>
+		<source><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <!-- ==================================================================== -->
+  <!-- New ConnectionManager setup for Tamino -->
+  <!-- ==================================================================== -->
+  <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager"
+         name="jboss.jca:service=LocalTxCM,name=MyTaminoLocalTxConnector">
+    <attribute name="JndiName">MyTaminoLocalTxConnector</attribute>
+
+    <depends optional-attribute-name="ManagedConnectionPool">
+      <!--embedded mbean-->
+      <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
+             name="jboss.jca:service=LocalTxPool,name=MyTaminoLocalTxConnector">
+	    <attribute name="MinSize">0</attribute>
+        <attribute name="MaxSize">50</attribute>
+	    <attribute name="BlockingTimeoutMillis">5000</attribute>
+	    <attribute name="IdleTimeoutMinutes">15</attribute>
+	    <!-- criteria indicates if Subject (from security domain) or app supplied
+		     parameters (such as from getConnection(user, pw)) are used to distinguish
+		     connections in the pool. Choices are
+		     ByContainerAndApplication (use both),
+		     ByContainer (use Subject),
+		     ByApplication (use app supplied params only),
+		     ByNothing (all connections are equivalent, usually if adapter supports
+		     reauthentication)-->
+	    <attribute name="Criteria">ByContainer</attribute>
+
+	    <depends optional-attribute-name="ManagedConnectionFactoryName">
+	      <!--embedded mbean-->
+		  <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
+			     name="jboss.jca:service=LocalTxDS,name=MyTaminoLocalTxConnector">
+		    <attribute name="ManagedConnectionFactoryProperties">
+		      <properties>
+			    <config-property name="TaminoURL" type="java.lang.String">http://localhost/tamino/test</config-property>
+			    <config-property name="UserName" type="java.lang.String">ejb</config-property>
+			    <config-property name="Password" type="java.lang.String">xxx</config-property>
+		      </properties>
+		    </attribute>
+
+		    <!--Below here are advanced properties -->
+		    <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Tamino Resource Adapter for local transactions</depends>
+		  </mbean>
+	    </depends>
+	  </mbean>
+    </depends>
+    <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
+    <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>
+    <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+
+    <!--make the rar deploy! hack till better deployment-->
+    <depends>jboss.jca:service=RARDeployer</depends>
+  </mbean>
+</server>
+]]>   	</source>
+		<ul>
+			<li>The Tamino driver is internally using the method
+			  <code>XMLReaderFactory.createXMLReader()</code>. Unfortunately
+			  this method is using <code>Class.forName(String)</code>
+			  internally to load the SAX driver class. This won't work
+			  in an environment with complex class loaders. In order to
+			  make sure, that the latest SAX version is used, I did the
+			  following:
+			  <ol>
+			  	<li>Downloaded the jar file <code>sax2r2.jar</code> and
+			  	  extracted the jar file <code>sax.jar</code> from it.</li>
+			  	<li>Moved that file to the directory
+			  	  <code>jre/lib/endorsed</code> in my Java SDK directory.</li>
+			  </ol>
+			</li>
+		</ul>
+	</section>
+
+	<section><title>An example schema for TaminoAPI4J</title>
+	  <p>As an example, we'll reuse the schema from the marshaller
+		examples, <code>Address.xsd</code>:</p>
+	  <source><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:ad="http://ws.apache.org/jaxme/test/misc/address"
+    xmlns:inoapi="http://ws.apache.org/jaxme/namespaces/jaxme2/TaminoAPI4J"
+    xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition"
+    jaxb:extensionBindingPrefixes="xjc inoapi"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/address"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:annotation>
+    <xs:documentation>
+      A simple JaxMe example: Personal address collection.
+    </xs:documentation>
+    <xs:appinfo>
+      <jaxb:globalBindings>
+        <xjc:serializable/>
+        <inoapi:raDetails collection="adr" jndiReference="java:MyTaminoLocalTxConnector"/>
+        <!-- If you are not using the Tamino Resource Adapter, then the following
+             will fit for you:
+          <inoapi:dbDetails collection="adr" url="http://127.0.0.1/tamino/adrDb"
+            user="me" password="MySecretPassword"/>
+        -->
+      </jaxb:globalBindings>
+      <tsd:schemaInfo name="Address">
+        <tsd:collection name="adr"></tsd:collection>
+      </tsd:schemaInfo>
+    </xs:appinfo>
+  </xs:annotation>
+
+  <xs:element name="Address">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Name">
+		  ...
+		</xs:element>
+	  </xs:sequence>
+	</xs:complexType>
+  </xs:element>
+</xs:schema>
+]]>   	</source>
+	    <p>Ignoring the details of the actual <code>Address</code> type,
+	      we only note the differences in the schema header:
+	    </p>
+	    <ul>
+	      <li>A namespace prefix <code>ad</code> is specified for the
+	      	target namespace. In the previous section we have discussed,
+	      	that this is a precondition.</li>
+	      <li>The element <code>xjc:serializable</code> element requests,
+	      	that the generated classes implement the interface
+	      	<code>java.io.Serializable</code>. This is required for
+	      	use within an EJB container, as the objects wouldn't be
+	      	serializable otherwise. The <code>xjc:serializable</code>
+	      	is a vendor extension from the JAXB RI and supported
+	      	by JaxMe too.</li>
+	      <li>The element <code>tsd:schemaInfo</code> fixes the
+	      	schema and collection name. This element is read by
+	      	Tamino when creating the schema. It is ignored by
+	      	JaxMe.</li>
+	      <li>The element <code>inoapi:raDetails</code> specifies
+	      	the same collection name and a JNDI name. The latter
+	      	name is used to lookup the Tamino resource adapter.</li>
+	      <li>The JAXB specification requires, that the element
+	      	<code>jaxb:globalBindings</code> contains no elements
+	      	from other namespace than <code>jaxb</code>. To add
+	      	vendor extensions like <code>xjc:serializable</code>
+	      	and <code>inoapi:raDetails</code>, we need to add
+	      	the attribute
+	      	<code>jaxb:extensionBindingPrefixes="jaxb inoapi"</code>
+	      	to <code>xs:schema</code>.</li>
+	    </ul>
+	</section>
+
+	<section><title>Build your own JaxMe distribution</title>
+		<p>For licensing reasons, we cannot add the files
+		  <code>TaminoAPI4J.jar</code> and
+		  <code>TaminoJCA.jar</code> to the JaxMe SVN repository.
+		  In particular we cannot offer compiled classes based
+		  on these files in the JaxMe distribution. Unfortunately
+		  that means, that you have to build your own distribution.
+		  Fortunately, this is quite simple:</p>
+		<ul>
+		  <li>Download the JaxMe source distribution (to be
+		  	distinguished from the JaxMe binary distributon)
+		  	and extract it.</li>
+		  <li>Download the TaminoAPI4J distribution and install
+		  	it. Copy the files <code>TaminoAPI4J.jar</code>
+		  	and <code>TaminoJCA.jar</code> to the subdirectory
+		  	<code>prerequisites</code> in the JaxMe directory.</li>
+		  <li>Change to the JaxMe directory and run <code>ant</code>.
+		  	The build script will automatically detect the presence
+		  	of the Tamino API files.</li>
+		</ul>
+		<note>
+		  As of this writing, there is no official JaxMe distribution
+		  available, which includes the Tamino support. In other words,
+		  rather than downloading the sources you have to extract them
+		  from the JaxMe SVN repository.
+		</note>
+	</section>
+
+	<section><title>Creating an Ant task</title>
+		<p>To invoke the JaxMe generator, use an Ant task like
+		  the following:</p>
+		<source><![CDATA[
+	<target name="generate">
+      <taskdef name="xjc" classname="org.apache.ws.jaxme.generator.XJCTask">
+        <classpath>
+		  <fileset dir="lib" includes="jaxme*.jar"/>
+		  <fileset dir="lib" includes="log4j-1.2.8.jar"/>
+        </classpath>
+      </taskdef>
+	  <mkdir dir="${build.src}"/>
+      <xjc target="${build.src}">
+        <schema dir="${etc}" includes="*.xsd"/>
+        <produces dir="${build.src}" includes="org/apache/ws/jaxme/test/misc/address/**/*"/>
+        <sgFactoryChain className="org.apache.ws.jaxme.generator.ino.api4j.TaminoAPI4JSG"/>
+        <schemaReader className="org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader"/>
+      </xjc>
+	</target>
+]]>   	</source>
+	</section>
+
+	<section><title>Using the native HTTP API</title>
+		<p>Not yet documented. (To be done.)</p>
+	</section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/jdbc.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/jdbc.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/pm/jdbc.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Accessing databases via JDBC</title></header>
+  <body>
+    <p>Using a relational database via JDBC has a major disadvantage:
+      For obvious reasons, you are limited to a flat XML structure.
+      In other words, you may choose an XML element, and map its
+      atomic child elements and/or attributes to the columns of a table.
+      Of course, you are free to extend the XML structure with
+      additional attributes or child elements, even complex child
+      elements. However, these cannot be saved or read by the
+      generated persistence managers (PM's). To overcome this problem,
+      you might like to use manually written subclasses of the
+      generated PM's.</p>
+    <section><title>Creating a schema</title>
+      <p>The first step when working with JDBC is to read the database
+        schema. The database details must be specified in the schema.
+        As an example, we quote the file session.xsd from the
+        JaxMe distribution:</p>
+      <source><![CDATA[
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://ws.apache.org/jaxme/test/pm/session"
+    xmlns:jm="http://ws.apache.org/jaxme/namespaces/jaxme2/schema"
+    xmlns:jdm="http://ws.apache.org/jaxme/namespaces/jaxme2/jdbc-mapping"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:element name="Session">
+    <xs:complexType>
+      <xs:annotation><xs:appinfo>
+        <jdm:table name="httpSession"/>
+      </xs:appinfo></xs:annotation>
+      <xs:sequence>
+        <xs:element name="IpAddress" type="xs:string">
+          <xs:annotation>
+            <xs:documentation>
+              A default for the spelling of "IpAddress". Without this default,
+              the spelling would be choosen as provided by JDBC, typically
+              uppercased.
+            </xs:documentation>
+          </xs:annotation>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute name="Cookie">
+        <xs:annotation>
+          <xs:documentation>
+            Just to demonstrate, that a database column can also
+            be mapped to an attribute.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
+]]>   </source>
+      <p>The most important thing to note is the element jdm:table
+        below xs:schema/xs:element/xs:complexType/xs:annotation/xs:appinfo:
+        It contains the name of a table. The JDBC generator takes this as
+        an advice to do the following:</p>
+      <ol>
+        <li>Connect to the database via JDBC and read the tables columns
+          via JDBC metadata.</li>
+        <li>For any column in the table: If there already exists an atomic
+          child element or attribute with the same name, create a mapping
+          between this column and the element or attribute. Note, that
+          matching of the column name is case insensitive.</li>
+        <li>For any column in the table: A new attribute is created,
+          if there was no matching child element or attribute.</li>
+      </ol>
+      <note>
+        Column names are mostly in upper case letters when returned by
+        JDBC. In other words: If your column is called "NAME", then
+        your generated methods will be called getNAME() and setNAME(),
+        which is typically not what you want. To get rid of the uppercase
+        letters, either create an explicit attribute called "name" or
+        use a syntax like CREATE TABLE "Address" ("name" VARCHAR(20) ...)
+      </note>
+    </section>
+
+	<section><title>Running the JDBC generator</title>
+	  <p>As usual, the schema reader must be used to read your schema
+	    and create sources. However, in this case the invocation looks
+	    slightly different:</p>
+	  <source><![CDATA[
+    <xjc target="${build.src}">
+      <schema dir="src/test/pm" includes="*.xsd"/>
+      <sgFactoryChain className="org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG"/>
+      <schemaReader className="org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader"/>
+      <produces dir="${build.src}" includes="org/apache/ws/jaxme/test/pm/session/*"/>
+      <property name="jdbc.driver" value="${jdbc.driver}"/>
+      <property name="jdbc.url" value="${jdbc.url}"/>
+      <property name="jdbc.user" value="${jdbc.user}"/>
+      <property name="jdbc.password" value="${jdbc.password}"/>
+    </xjc>
+]]>	  </source>
+      <p>The differences to the usual schema reader invocation are:</p>
+      <ul>
+        <li>A so-called
+          <link href="../apidocs/org/apache/ws/jaxme/generator/sg/SGFactoryChain.html">SGFactoryChain</link>
+          is used to customize the schema binding. In this particular case it is an
+          instance of
+          <link href="../apidocs/org/apache/ws/jaxme/pm/generator/jdbc/JaxMeJdbcSG.html">JaxMeJdbcSG</link>.
+          This object will connect to the database and populate the original schema
+          with columns read from the database. It will also create specific persistence
+          managers, one for any table.</li>
+        <li>Some parameters are required to connect to the database.
+          In our case they are specified as properties. The required parameters are:
+          <dl>
+            <dt>jdbc.driver</dt>
+            <dd>The JDBC driver class, for example org.hsqldb.jdbcDriver</dd>
+            <dt>jdbc.url</dt>
+            <dd>The JDBC URL, for example jdbc:hsqldb:directoryname/filename</dd>
+            <dt>jdbc.user</dt>
+            <dd>The database user name, for example sa</dd>
+            <dt>jdbc.password</dt>
+            <dd>The users password</dd>
+          </dl>
+          Driver and JDBC URL are required, user name and password are optional.
+        </li>
+      </ul>
+      <p>If you do not like to specify the connection details on the command line,
+        you may instead choose to specify them as a part of the jdm:table element,
+        like this:</p>
+      <source><![CDATA[
+        <jdm:table name="httpSession" driver="org.hsqldb.jdbcDriver"
+                   url="jdbc:hsqldb:directoryname/filename" user="sa"
+                   password=""/>
+]]>   </source>
+      <p>This approach has the obvious advantage, that you may specify different
+        parameters for any table, combining tables from various databases.
+        The obvious disadvantage is, that you must specify parameters for any
+        table. :-)</p>
+      <p>To omit the disadvantage, you have a third option: Specifying the
+        database details as a part of the schema bindings, like this:</p> 
+      <source><![CDATA[
+        <xs:schema
+            xmlns:xs="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://ws.apache.org/jaxme/test/pm/session"
+            xmlns:jm="http://ws.apache.org/jaxme/namespaces/jaxme2/schema"
+            xmlns:jdm="http://ws.apache.org/jaxme/namespaces/jaxme2/jdbc-mapping"
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified">
+          <xs:annotation><xs:appinfo>
+            <jdm:connection driver="org.hsqldb.jdbcDriver"
+                   url="jdbc:hsqldb:directoryname/filename" user="sa"
+                   password=""/>
+          </xs:appinfo></xs:annotation>
+          ...
+        </xs:schema>
+]]>   </source>
+      <note>The order of precedence is as follows: Parameters specified on
+        the command line will always win. If a parameter is not specified on
+        the command line, then it will be read from a jdm:table element.
+        If such an element is missing or the respective attribute is missing,
+        then the jdm:connection element will be consulted. 
+      </note>
+	</section>
+
+	<section><title>Inserting objects into the database</title>
+	  <p>To insert an object into the database, you might like to
+	    use the following code:</p>
+	  <source><![CDATA[
+	    import javax.xml.bind.JAXBContext;
+	    import org.apache.ws.jaxme.PM;
+	    import org.apache.ws.jaxme.impl.JAXBContextImpl;
+	    import org.apache.ws.jaxme.test.pm.session.ObjectFactory;
+	    import org.apache.ws.jaxme.test.pm.session.Session;
+
+        Session session = new ObjectFactory().createSession();
+        session.setIpAddress("127.0.0.1");
+        session.setCookie("56ghs2398723sjkjl");
+        JAXBContextImpl factory = (JAXBContextImpl)
+          JAXBContext.newInstance("org.apache.ws.jaxme.test.pm.session");
+        PM pm = factory.getJMPM();
+        pm.insert(session);
+]]>	  </source>
+      <p>It really is that simple!</p>
+      <p>The question arises: What magic tells the persistence manager
+        to what database it should be connect? This is specified in the
+        file Configuration.xml, which was also generated by the JDBC
+        generator in the directory org/apache/ws/jaxme/test/pm/session:</p>
+	  <source><![CDATA[
+        <Configuration xmlns="http://ws.apache.org/jaxme/namespaces/jaxme2/configuration">
+          <Manager validatorClass="org.apache.ws.jaxme.test.pm.session.impl.SessionTypeValidator"
+                   qName="{http://ws.apache.org/jaxme/test/pm/session}Session"
+                   pmClass="org.apache.ws.jaxme.test.pm.session.impl.SessionTypePM"
+                   marshallerClass="org.apache.ws.jaxme.test.pm.session.impl.SessionTypeSerializer"
+                   handlerClass="org.apache.ws.jaxme.test.pm.session.impl.SessionHandler"
+                   elementInterface="org.apache.ws.jaxme.test.pm.session.Session"
+                   elementClass="org.apache.ws.jaxme.test.pm.session.impl.SessionImpl">
+            <Property value="org.hsqldb.jdbcDriver" name="jdbc.driver" /> 
+            <Property value="jdbc:hsqldb:directoryname/filename" name="jdbc.url" /> 
+            <Property value="sa" name="jdbc.user" /> 
+            <Property value="" name="jdbc.password" /> 
+          </Manager>
+        </Configuration>
+]]>   </source>
+      <note>If you have different databases for production and development,
+        then you have to edit the generated file Configuration.xml. The
+        recommended way to do so is using the Ant task "filter".
+      </note>
+      <note>As of this writing, the insert method cannot generate a primary
+        key for you. The recommended way to do so is via identity or
+        autoincrement columns. However, there is still no way to
+        return the primary key. We'll look into that as soon as possible.
+      </note>
+	</section>
+
+	<section><title>Reading objects from the database</title>
+	  <p>Reading objects from the database is also straightforward.
+	    Assume for now, that we want to fetch the HTTP session with
+	    Cookie "56ghs2398723sjkjl". Here's how we do that:</p>
+	  <source><![CDATA[
+	    import javax.xml.bind.JAXBContext;
+	    import org.apache.ws.jaxme.PM;
+	    import org.apache.ws.jaxme.PMParams;
+	    import org.apache.ws.jaxme.impl.JAXBContextImpl;
+	    import org.apache.ws.jaxme.test.pm.session.Session;
+
+		JAXBContextImpl factory = (JAXBContextImpl)
+          JAXBContext.newInstance("org.apache.ws.jaxme.test.pm.session");
+        PM pm = factory.getJMPM();
+        String whereClause = "COOKIE = ?";
+        PMParams params = new PMParams();
+        params.addParam("56ghs2398723sjkjl");
+        Iterator iter = pm.select(whereClause, params);
+        if (!iter.hasNext()) {
+          throw new NullPointerException("No matching cookie found");
+        }
+        Session session = (Session) iter.next();
+]]>   </source>
+	</section>
+
+	<section><title>Deleting objects from the database</title>
+	  <p>Deleting an object requires the objects primary key.
+	    Assuming that the cookie attribute is an HTTP sessions
+	    primary key, one might do the following:</p>
+	  <source><![CDATA[
+	    import javax.xml.bind.JAXBContext;
+	    import org.apache.ws.jaxme.PM;
+	    import org.apache.ws.jaxme.PMParams;
+	    import org.apache.ws.jaxme.impl.JAXBContextImpl;
+	    import org.apache.ws.jaxme.test.pm.session.Session;
+
+        Session session = new ObjectFactory().createSession();
+        session.setCookie("56ghs2398723sjkjl");
+		JAXBContextImpl factory = (JAXBContextImpl)
+          JAXBContext.newInstance("org.apache.ws.jaxme.test.pm.session");
+        PM pm = factory.getJMPM();
+        pm.delete(session);
+]]>   </source>
+	</section>
+
+    <section><title>Updating objects in the database</title>
+      <p>Updating an object works much like deleting it.
+        In particular it requires the presence of a primary
+        key. In other words, the following example would
+        change an HTTP sessions IP address:</p>
+	  <source><![CDATA[
+	    import javax.xml.bind.JAXBContext;
+	    import org.apache.ws.jaxme.PM;
+	    import org.apache.ws.jaxme.PMParams;
+	    import org.apache.ws.jaxme.impl.JAXBContextImpl;
+	    import org.apache.ws.jaxme.test.pm.session.Session;
+
+		JAXBContextImpl factory = (JAXBContextImpl)
+          JAXBContext.newInstance("org.apache.ws.jaxme.test.pm.session");
+        PM pm = factory.getJMPM();
+        String whereClause = "COOKIE = ?";
+        PMParams params = new PMParams();
+        params.addParam("56ghs2398723sjkjl");
+        Iterator iter = pm.select(whereClause, params);
+        if (!iter.hasNext()) {
+          throw new NullPointerException("No matching cookie found");
+        }
+        Session session = (Session) iter.next();
+        session.setIpAddress("192.168.1.1");
+        pm.update(session);
+]]>   </source>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/related.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/related.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/related.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>Related projects</title></header>
+  <body>
+    <p>If you are interested in JaxMe 2, you may also want to take a look
+      at the following related open source projects:</p>
+
+    <anchor id="jaxme1"/>
+    <section><title>JaxMe 1</title>
+      <p><link href="ext:jaxme1">JaxMe 1</link> is the predecessor
+      of JaxMe 2. It has a limited support of XML structures (mainly sequences
+      and choices), but includes an integrated persistency framework that
+      allows to read the objects from or write them into the database. The
+      persistence framework includes support for JDBC mapping, XML:DB, the
+      Tamino XML database, and EJB. The framework has the additional
+      advantage of being quite mature and stable.</p>
+    </section>
+
+
+    <anchor id="jaxmexs"/>
+    <section><title>JaxMeXS</title>
+      <p><link href="site:jaxmexs">JaxMeXS</link>, the JaxMe parser
+      for XML schema, is internally used by JaxMe 2. It is written to be
+      extensible, but not necessarily strict.</p>
+      </section>
+
+    <section><title>JaxMeJS</title>
+      <p><link href="site:jaxmejs">JaxMeJS</link>, the
+      JaxMe Java source framework is a generic framework for writing
+      Java source  generators. It used to be a part of JaxMe 1, but grew
+      up to  be useful in itself and finally was moved to a separate
+      distribution. JaxMe 2 is still based on the latest version, which
+      also includes an SQL generator.</p>
+      </section>
+
+    <section><title>eXist</title>
+      <p><link href="site:exist">eXist</link> is a native XML database
+      engine written in Java. It can be used standalone (via a dedicated
+      TCP port), as part of a servlet engine (accessible via HTTP),
+      or embedded into a Java application. This last approach is
+      particularly useful for JUnit testing. JaxMe 1 uses eXist for
+      testing its xml:db API.</p>
+      </section>
+
+    <section><title>hsqldb</title>
+      <p><link href="site:hsqldb">hsqldb</link> is an SQL database
+      and also written in Java. Like eXist, it can be used in embedded
+      mode and it is also used by JaxMe 1, JaxMe 2, and JaxMeJS for JUnit
+      tests.</p>
+      </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/release.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/release.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/release.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>Creating a JaxMe release</title> 
+  </header> 
+  <body>
+    <p>This page provides information about the steps required to create a
+      JaxMe release.</p>
+    <section><title>Creating a release</title>
+    <ol>
+      <li>Update the "version" property in "build.xml".</li>
+      <li>Make sure that you have the file jimi-1.0.jar in src/documentation/lib.
+        This file is required for generating PDF's including PNG images.
+        Unfortunately it cannot be added to the repository, due to licensing
+        issues. See the Forrest FAQ on how to obtain the file.</li>
+      <li>Update the file src/documentation/content/xdocs/news.xml in the
+        ws-jaxme repository.</li>
+      <li>Make sure that you have gpg or a similar tool installed. The
+        easiest way is via the CygWin installer (Windows) or using a
+        RPM package provided by your vendor (Linux). If you
+        haven't yet created a secret key, do so using "gpg --gen-key".
+        Also, create a KEYS file using
+        "gpg --list-sigs jochen at apache.org" >>KEYS"
+        "gpg --armor --export jochen at apache.org" >> KEYS.
+        Add the contents of the KEYS file to "etc/KEYS" in the SVN
+        directory.</li>
+      <li>In src/documentation/content/xdocs/site.xml: Make sure, that
+        the section build.online.site=true is commented out and the
+        section build.online.site=false is active.</li>
+      <li>Create the distribution files using "ant dist". This will create,
+        for example, four files called "ws-jaxme-0.3-bin.tar.gz",
+        "ws-jaxme-0.3-bin.tar.gz.md5",
+        "ws-jaxme-0.3-src.tar.gz", and
+        "ws-jaxme-0.3-src.tar.gz.md5". The extension .MD5 indicates
+        that these are no true distribution files, but simply contain
+        an MD5 checksum over the others.<br/>
+        As of this writing, Java 5.0.4 with Xalan 2.6.0 in Ant's lib
+        directory was required to build the site. Other configurations
+        failed, due to problems in fop, or jimi.</li>
+      <li>Sign all distribution files, creating additional files with the
+        same names and an ending ".asc". For example:
+        "gpg --output ws-jaxme-0.3-bin.tar.gz.asc --detach-sig
+        --armor ws-jaxme-0.3-bin.tar.gz"</li>
+      <li>Upload all the files to minotaur.apache.org using scp. For
+        example:
+        "scp etc/KEYS dist/ws-jaxme-0.3* jochen at minotaur.apache.org:"</li>
+      <li>Move the files to the directory /www/www.apache.org/dist/ws/jaxme
+        and ensure proper permissions:
+        "chgrp ws KEYS ws-jaxme-0.3*"
+        "chmod 664 KEYS ws-jaxme-0.3*"
+        "mv KEYS ws-jaxme-0.3* /www/www.apache.org/dist/ws/jaxme"</li>
+      <li>Update the file "/www/www.apache.org/dist/ws/jaxme/README.html".</li>
+      <li>Upload numbered versions of the jars released to the Apache Java Repository
+        together with md5 sums and signatures. At the moment, this should be done by
+        uploading to your home directory on www.apache.org and then moving them into the
+        /www/www.apache.org/dist/java-repository/jaxme/jars/. Finally, update the 
+        SNAPSHOT symlinks in that directory. Note that the processes for the repository
+        are still under development so it would probably be a good idea to 
+        contact the repository team (subscribe to repository at apache.org).</li>
+      <li>In src/documentation/content/xdocs/downloads.ehtml: Add the new
+        version and the checksums.</li>
+      <li>Build a new version of the online site. See the separate section
+        below.</li>
+      <li>Wait one day, until the Apache mirrors are in sync.</li>
+      <li>Update the files mirrors.ehtml and news.xml in the directory
+        src/documentation/content/xdocs of the ws-site repository.</li>
+      <li>Announce the new release on <link href="ext:freshmeat">FreshMeat</link>.
+        There are three projects that might need notifications: JaxMe, JaxMeJS, and
+        JaxMeXS. Creating an announcement on freshmeat requires that you have an
+        account and be administrator for the respective projects. If you aren't
+        yet, contact <link href="mailto:jochen at apache.org">Jochen Wiedmann</link>.</li>
+      <li>Announce the new release on all Apache appropriate mailing lists. This should include
+      the JaxMe list and the announcement lists for the WebServices and Xml projects.
+      Note that it is important to include a description of JaxMe when posting 
+      announcements to project level lists. Note that you should post from your apache
+      email address and you will need to subscribe.</li>
+    </ol>
+    </section>
+
+	<section><title>Creating the online site</title>
+	  <p>The online site is created like this:</p>
+	  <ol>
+        <li>In src/documentation/content/xdocs/site.xml: Make sure, that
+          the section build.online.site=false is commented out and the
+          section build.online.site=true is active.</li>
+        <li>Run the build script: "ant -Dbuild.online.site=true clean Docs.all".</li>
+        <li>To export the contents of build/docs/build/site to the ws-site
+          directory, extract the CVS module ws-site/targets/jaxme (for example,
+          to /tmp/jaxme and run "ant -Dws.site.dir=/tmp/jaxme export.site".
+          After checking in this directory, everything should work well.</li>
+	  </ol>
+	</section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/resources.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/resources.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/resources.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document> 
+  <header> 
+    <title>Resources</title> 
+  </header> 
+  <body> 
+    <anchor id="jira"/>
+    <section><title>Bug tracking system</title>
+        <p>To file a bug report or search for known bugs, use
+          <link href="ext:jira">Jira</link>.</p>
+    </section>
+
+    <anchor id="view-svn"/>
+    <section><title>Browse the JaxMe sources</title>    
+        <p>
+Thanks to Subversion, the contents of the JaxMe SVN project 
+can be <link href='ext:jaxmerepo'>browsed online</link>.
+        </p>
+    </section>
+
+    <anchor id="jelly-jaxme"/>
+    <section><title>JaxMe Jelly Tag Library</title>
+        <p>
+<link href='ext:jelly'>Jelly</link> is a tool for turning XML into executable code.
+One common use is to drive complex build scripts typically embedding ant but Jelly's
+flexibility is it's strength. There are many uses to which Jelly can be put.
+        </p>
+        <p>
+Jelly is extensible. The principle way that Jelly can be extended is through jelly
+tag libraries. If you know JSP custom tags, then this idea should be pretty familiar.
+        </p>
+        <p>
+(Basic) Jelly tag libraries for JaxMe can be found  
+<link href='ext:jaxme-jelly-tag-library'>here</link> and a list of tags
+<link href='ext:jaxme-jelly-tags'>here</link>.
+        </p>
+    </section>
+
+    <anchor id="Wiki"/>
+    <section><title>The JaxMe Wiki</title>
+        <p>The <link href="ext:wiki">JaxMe Wiki</link> allows
+          you to add notes, opinions, suggestions, or whatever
+          else may make sense for others to know. And, of course,
+          you may also view other peoples notes, opinions, etc.
+          there. :-)</p>
+    </section>
+
+    <anchor id="FAQ"/>
+    <section><title>The JaxMe FAQ</title>
+        <p>A <link href="ext:faq">JaxMe FAQ</link> is available
+          as part of the <link href="ext:wiki">JaxMe Wiki</link>.
+          Note, that you are able to add questions or modify answers
+          in the Wiki.</p>
+    </section>
+
+	<anchor id="External"/>
+	<section><title>External links</title>
+	    <p><link href="mailto:brett at oreilly.com">Brett McLaughlin</link>,
+	      author of <link href="http://www.oreilly.com/catalog/javaxml2/index.html">
+	      Java &amp; XML</link>, and
+	      <link href="http://www.oreilly.com/catalog/javaxmldatabind/index.html">
+	      Java &amp; XML Data Binding</link>, and
+	      <link href='ext:zeus'>Zeus</link>, wrote a very nice article on JaxMe:
+	      <link href="http://www-106.ibm.com/developerworks/xml/library/x-pracdb4/">
+	      Practical data binding: JaxMe - The new kid on the block</link>.
+	      The second part is
+	      <link href="http://www-106.ibm.com/developerworks/library-combined/x-pracdb5.html">
+	      Practical data binding: Converting to and from XML with JaxMe</link>.</p>	      
+	</section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/site.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/site.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/site.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!--
+Forrest site.xml
+
+This file contains an outline of the site's information content.  It is used to:
+- Generate the website menus (though these can be overridden - see docs)
+- Provide semantic, location-independent aliases for internal 'site:' URIs, eg
+<link href="site:changes"> links to changes.html (or ../changes.html if in
+  subdir).
+- Provide aliases for external URLs in the external-refs section.  Eg, <link
+  href="ext:cocoon"> links to http://xml.apache.org/cocoon/ 
+
+See http://xml.apache.org/forrest/linking.html for more info
+-->
+
+<site label="JaxMe2" href="" xmlns="http://apache.org/forrest/linkmap/1.0">
+
+  <about label="Project">
+    <index label="About" href="index.html"/>
+    <news label="News" href="news.html"/>
+    <downloads label="Downloads" href="downloads.html"/>
+    <support label="Mailing Lists" href="mailinglists.html"/>
+    <license label="License" href="license.html"/>
+    <related label="Resources" href="resources.html"/>
+    <related label="Related projects" href="related.html"/>
+  </about>
+
+  <docs label="Documentation">
+<!-- build.online.site=false -->
+    <manual label="Manual" href="manual/index.html"/>
+    <javadoc label="Javadocs" href="apidocs/index.html"/>    
+<!-- build.online.site -->
+<!-- build.online.site=true
+    <manual label="Manual">
+        <manual label="Current" href="manual/index.html"/>
+        <manual label="0.4" href="release-0.4/manual/index.html"/>
+        <manual label="0.3" href="release-0.3/manual/index.html"/>
+    </manual>
+    <javadoc label="Javadocs">
+        <javadoc label="Current" href="apidocs/index.html"/>    
+        <javadoc label="0.4" href="release-0.4/apidocs/index.html"/>
+        <javadoc label="0.3" href="release-0.3/apidocs/index.html"/>
+    </javadoc>
+-->
+  </docs>
+
+  <developers label="Developer Resources">
+    <release label="How to create a release" href="release.html"/>
+    <todo label="Missing features" href="features.html"/>
+    <misc label="Miscellaneous" href="misc.html"/>
+  </developers>
+
+  <external-refs>
+    <ant.apache.org href="http://ant.apache.org/">
+      <ant href=""/>
+      <antwritingowntask href="manual/develop.html#writingowntask"/>
+    </ant.apache.org>
+    <incubator href="http://incubator.apache.org/"/>
+    <cocoon.apache.org href="http://cocoon.apache.org/">
+      <cocoon href=""/>
+    </cocoon.apache.org>
+    <cvs.sourceforge.net href="http://cvs.sourceforge.net/">
+      <jaxmecvsweb href="cgi-bin/viewcvs.cgi/jaxme/"/>
+    </cvs.sourceforge.net>
+    <exist.sf.net href="http://exist.sf.net/">
+      <exist href=""/>
+    </exist.sf.net>
+    <hsqldb.sf.net href="http://hsqldb.sf.net/">
+       <hsqldb href=""/>
+    </hsqldb.sf.net>
+    <jaxb.dev.java.net href='https://jaxb.dev.java.net/'>
+       <jaxb-si href=''/>
+    </jaxb.dev.java.net>
+    <java.sun.com href="http://java.sun.com/">
+      <jaxb href="xml/jaxb/"/>
+      <ri href="webservices/downloads/webservicespack.html"/>
+    </java.sun.com>
+    <www.apache.org href="http://www.apache.org/">
+      <foundation href="foundation/"/>
+    </www.apache.org>
+    <jaxme.sf.net href="http://jaxme.sf.net/">
+      <jaxme1 href="JaxMe1/"/>
+    </jaxme.sf.net>
+    <lists.sourceforge.net href="http://lists.sourceforge.net/">
+      <jaxmeuserslist href="lists/listinfo/jaxme-users"/>
+      <jaxmejaxbdevlist href="lists/listinfo/jaxme-jaxb-dev"/>
+      <jaxmecvslist href="lists/listinfo/jaxme-cvs"/>
+    </lists.sourceforge.net>
+    <mailto href="mailto:">
+      <mailtojaxmeuser href="jaxme-user at ws.apache.org"/>
+      <mailtojaxmedev href="jaxme-dev at ws.apache.org"/>
+    </mailto>
+    <marc.theaimsgroup.com href="http://marc.theaimsgroup.com/">
+      <jaxme-dev-marc href="?l=jaxme-dev"/>
+    </marc.theaimsgroup.com>
+    <issues.apache.org href="http://issues.apache.org/">
+      <jira href="jira/secure/Dashboard.jspa"/>
+    </issues.apache.org>
+    <opensource.org href='http://www.opensource.org/'>
+        <open-source-definition href='docs/definition.php'/>
+    </opensource.org>
+    <ws.apache.org href="http://ws.apache.org/">
+      <ws href=""/>
+      <jaxme href="jaxme/"/>
+      <jaxme2 href="jaxme/"/>
+      <jaxmejs href="jaxme/js/"/>
+      <jaxmexs href="jaxme/xs/"/>
+      <jaxmeapi href="jaxme/api/"/>
+      <jaxmedownloads href="jaxme/downloads.cgi"/>
+    </ws.apache.org>
+    <jakarta.apache.org href='http://jakarta.apache.org/'>
+        <commons href='commons/'>
+            <jelly href='jelly/'>
+                <jaxme-jelly-tag-library href='libs/jaxme/index.html'/>
+                <jaxme-jelly-tags href='libs/jaxme/tags.html'/>
+            </jelly>
+        </commons>
+    </jakarta.apache.org>
+    <www.freshmeat.net href="http://freshmeat.net/">
+      <freshmeat href=""/>
+    </www.freshmeat.net>
+    <www.mail-archive.com href="http://www.mail-archive.com">
+      <jaxmeusersarchive2 href="jaxme-users%40lists.sourceforge.net"/>
+      <jaxmejaxbdevarchive2 href="jaxme-jaxb-dev%40lists.sourceforge.net"/>
+    </www.mail-archive.com>
+    <www.mysql.com href="http://www.mysql.com/">
+      <mysql href=""/>
+    </www.mysql.com>
+    <www.softwareag.com href="http://www.softwareag.com/">
+      <sag href=""/>
+      <tamino href="tamino/"/>
+    </www.softwareag.com>
+    <www.antlr.org href="http://www.antlr.org/">
+      <antlr href=""/>
+    </www.antlr.org>
+    <www.thecortex.net href="http://www.thecortex.net/">
+      <clover href="clover/"/>
+      <cloverkey href="clover/dl.jsp?key=0e65b4c0eea09ff233b124771"/>
+    </www.thecortex.net>
+    <sourceforge.net href="http://sourceforge.net/">
+      <jaxmeproject href="projects/jaxme/"/>
+      <jaxmedownloads href="project/showfiles.php?group_id=42590"/>
+      <jaxmecvs href="cvs/?group_id=42590"/>
+      <jaxmeusersarchive href="mailarchive/forum.php?forum_id=7699"/>
+      <jaxmejaxbdevarchive href="mailarchive/forum.php?forum_id=11443"/>
+    </sourceforge.net>
+    <xml.apache.org href="http://xml.apache.org/">
+      <forrest href="forrest/">
+        <validation href="validation.html"/>
+        <webapp href="your-project.html#webapp"/>
+      </forrest>
+      <xindice href="xindice/"/>
+    </xml.apache.org>
+    <cvs.apache.org href='http://cvs.apache.org/'>
+        <viewcvs href='viewcvs.cgi'>
+            <jaxme-viewcvs href='/ws-jaxme/'/>
+        </viewcvs>
+    </cvs.apache.org>
+    <svn.apache.org href='http://svn.apache.org/'>
+    	<asfrepo href='repos/asf/'>
+    		<jaxmerepo href='webservices/jaxme'/>
+    	</asfrepo>
+    </svn.apache.org>
+    <wiki.apache.org href='http://wiki.apache.org/'>
+        <wiki href='ws/JaxMe'>
+            <faq href='/FrequentlyAskedQuestions'/>
+        </wiki>
+    </wiki.apache.org>
+    <zeus.objectweb.org href='http://zeus.objectweb.org/'>
+        <zeus href=''/>
+    </zeus.objectweb.org>
+  </external-refs>
+</site>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/tabs.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/tabs.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/tabs.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.0//EN" "tab-cocoon-v10.dtd">
+
+<tabs software="JaxMe 2"
+  title="JaxMe 2"
+  copyright="The JaxMe project"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <!-- The rules are:
+    @dir will always have /index.html added.
+    @href is not modified unless it is root-relative and obviously specifies a
+    directory (ends in '/'), in which case /index.html will be added
+  -->
+
+
+  <tab label="JaxMe 2" dir=""/>
+  <tab label="JAXB API" dir="api"/>
+  <tab label="JaxMeJS" dir="js"/>
+  <tab label="JaxMeXS" dir="xs"/>
+  <tab label="JaxMePM" dir="pm"/>
+</tabs>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/book.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/book.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/book.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN"
+                      "http://apache.org/forrest/dtd/book-cocoon-v10.dtd">
+
+<!-- This file is responsible for generating the menu in the 'js' directory.
+  -->
+
+<book software="JaxMeJS" title="JaxMeJS"
+     copyright="@year@ The Apache Software Foundation"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <menu label="JaxMeXS">
+	<menu-item label="Introduction" href="index.html"/>
+    <menu-item label="Generic XML Parser" href="generic.html"/>
+    <menu-item label="Syntax Parser" href="syntax.html"/>
+    <menu-item label="Logical Parser" href="logical.html"/>
+  </menu>
+</book>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/generic.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/generic.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/generic.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The generic parser</title></header>
+  <body>
+    <section><title>The generic parser</title>
+      <p>The most basic part of JaxMeXS is its generic parser. This part is suited
+        for arbitrary XML document types, for example configuration files and the
+        like. The actual XML Schema parsers (the
+        <link href="syntax.html">syntax parser</link> and the
+        <link href="logical.html">logical parser</link>) are sitting on top of
+        the generic parser. If you aren't interested in the generic part, you may
+        safely skip to the <link href="syntax.html">next section</link>, which is basically
+        self contained. However, some details are best described here.</p>
+      <p>The generic parser follows an idea from the
+        <link href="ext:ant">Ant</link> project: A SAX parser is responsible for the
+        configuration of a bean. Any XML element is mapped to a Java bean. The XML
+        elements attributes are mapped to properties of the bean and the child
+        elements are mapped to other beans, which are part of the parent bean. If
+        you know <link href="ext:antwritingowntask">how to write an Ant task</link>,
+        you know how the generic parser works.</p>
+      <p>The generic parser is specified by the interface
+        <link href="../apidocs/org/apache/ws/jaxme/xs/parser/XsSAXParser.html">XsSAXParser</link> and
+        implemented by the class
+        <link href="../apidocs/org/apache/ws/jaxme/xs/parser/XsSAXParserImpl.html">XsSAXParserImpl</link>.
+        There's few things to know about that. The most important parts are some other
+        interfaces and classes which you might like to implement or extend:</p>
+      <ol>
+        <li>The <link href="#AttributeSetter">AttributeSetter</link>
+          interface is responsible for mapping XML attributes to bean properties.</li>
+        <li>The <link href="#TextSetter">TextSetter</link> handles character data contained
+          in elements.</li>
+        <li>And, finally, the <link href="#ChildSetter">ChildSetter</link> creates new beans
+          for any child element.</li>
+      </ol>
+    </section>
+
+    <anchor id="AttributeSetter"/>
+    <section><title>The AttributeSetter interface</title>
+      <p>The <link href="../apidocs/org/apache/ws/jaxme/xs/parser/AttributeSetter.html">AttributeSetter</link>
+        interface consists of a single method:</p>
+      <source>
+  public void setAttribute(String pQName, String pNamespaceURI,
+                           String pLocalName, String pValue) throws SAXException;
+      </source>
+      <p>This method is invoked for any attribute that the SAX parser finds.</p>
+      <p>The AttributeSetters main idea is as follows: Suggest, that the attributes local
+        name is <code>foo</code>. A method <code>setFoo(SomeClass pValue)</code> is searched.
+        f such a method is found, the attribute value is converted into an instance of
+        <code>SomeClass</code> and the method is invoked. More formally, the default
+        implementation <link href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/AttributeSetterImpl.html">
+        AttributeSetterImpl</link> behaves as follows:</p>
+      <ol>
+        <li>If the bean has a method <code>setAttribute(String, String, String, String)</code>,
+          it is invoked with the same arguments <code>pQName</code>, <code>pNamespaceURI</code>,
+          <code>pLocalName</code>, <code>pValue</code>. If this method does not have
+          the result types <code>boolean</code> or <code>Boolean</code>, or if the result
+          is <code>true</code>, then the <code>AttributeSetterImpl</code> assumes that the
+          property is set.</li>
+        <li>If the property is not set, and the bean has a method
+          <code>setProperty(String)</code>, then this method is invoked
+          with the attribute value.</li>
+        <li>Otherwise, if the bean has a method <code>setProperty(T)</code>, and
+          the class <code>T</code> has either of a method
+          <code>public static T valueOf(String)</code> or a constructor
+          <code>public T(String)</code> (in that order), then the method
+          <code>setProperty(T)</code> is invoked with the value obtained
+          by an invocation of the method <code>valueOf()</code>, or
+          the constructor, respectively. Note, that this applies in
+          particular to the classes Long, Integer, Short, Byte, Double,
+          Float, java.math.BigInteger, java.math.BigDecimal,
+          java.io.File, and StringBuffer.</li>
+        <li>If the bean has a method <code>setProperty(boolean)</code>,
+          the method will be invoked with the value <code>true</code>
+          (the value specified in the XML file is either of
+          <code>true</code>, or <code>1</code>) or <code>false</code>
+          (the attribute has any other value).</li>
+       <li>If the bean has a method <code>setProperty(char)</code>,
+         or <code>setProperty(Character)</code>, the method will be
+         invoked with the first character of the value specified in
+         the XML file. If the value contains zero or multiple characters,
+         an IllegalArgumentException is thrown.</li>
+       <li>If the bean has either of the following methods, in that order:
+         <ul>
+           <li><code>setProperty(long)</code></li>
+           <li><code>setProperty(int)</code></li>
+           <li><code>setProperty(short)</code></li>
+           <li><code>setProperty(byte)</code></li>
+           <li><code>setProperty(double)</code></li>
+           <li><code>setProperty(float)</code></li>
+         </ul>
+         then the attribute value is converted into the respective type
+         and the method is invoked. An IllegalArgumentException
+         is thrown, if the conversion fails.</li>
+       <li>If the bean has a method <code>java.lang.Class</code>, the
+         <code>XsSAXParser</code> will interpret the value given in the
+         XML file as a Java class name and load the named class from its
+         class loader. If the class cannot be loaded, it will also try
+         to use the current threads context class loader. An
+         exception is thrown, if neither of the class loaders can
+         load the class.</li>
+      </ol>
+    </section>
+
+    <anchor id="TextSetter"/>
+    <section><title>The TextSetter interface</title>
+      <p>The <link href="../apidocs/org/apache/ws/jaxme/xs/parser/TextSetter.html">TextSetter</link>
+        interface is invoked from within the SAX ContentHandlers method
+        <code>characters(char[] pBuffer, int pOffset, int pLen)</code>.
+        It's task is to fill the bean with character data. Note, that the latter
+        method may very well be called multiple times, even for a single
+        character sequence in the XML file. For example, if the XML reader
+        loads the XML file in blocks of 1024 characters and a block stops
+        right within an elements character data, then it is valid behaviour
+        to call the <code>character(char[], int, int)</code> method twice:
+        Once for the first part, which sits at the end of the 1024 characters
+        and once for the remaining part. The same holds for the <code>addText()</code>
+        method:</p>
+      <source>
+  public void addText(String pValue) throws SAXException;
+      </source>
+      <p>The default implementation is
+        <link href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/TextSetterImpl.html">
+          TextSetterImpl</link>, which behaves as follows:</p>
+      <ol>
+        <li>If the bean has a method with the same signature
+          <code>public void addText(String)</code>, then the method is invoked.</li>
+        <li>If the bean doesn't have such a method and the supplied text is
+          all whitespace, then the text is ignored. Otherwise an exception
+          is thrown.</li>
+      </ol>
+    </section>
+
+    <anchor id="ChildSetter"/>
+    <section><title>Handling child elements</title>
+      <p>Embedded child elements are handled by the interface
+        <link href="../apidocs/org/apache/ws/jaxme/xs/parser/ChildSetter.html">ChildSetter</link> and
+        its default implementation
+        <link href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/ChildSetterImpl.html">ChildSetterImpl</link>.
+        The interface exposes a single method:</p>
+      <source>
+  public ContentHandler getChildHandler(String pQName, String pNamespaceURI,
+                                        String pLocalName) throws SAXException;
+        </source>
+      <p>The purpose of the method is to create a SAX handler for this element.
+        If such a handler is returned, then it receives the SAX events generated
+        for the element. The default implementation works as follows:</p>
+      <ol>
+        <li>If the bean has a method with the same signature
+          <code>public ContentHandler getChildHandler(String, String, String, String)</code>,
+          then this method is invoked. A non-null result will be used as a ContentHandler
+          for the child element.</li>
+        <li>If the bean doesn't have such a method or if the method returned null,
+          and the local name is <code>foo</code>, then a method
+          <code>public T createFoo()</code> is searched, with an arbitrary result type T.
+          If there is such a method it is invoked and a new instance of
+          <link href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/XsSAXParserImpl.html">XsSAXParserImpl</link>
+          is created to configure the bean.</li>
+        <li>An exception is thrown otherwise.</li>
+      </ol>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/index.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/index.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/index.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The JaxMe parser for XML Schema</title></header>
+  <body>
+    <section><title>The JaxMe parser for XML Schema</title>
+      <p>This is JaxMeXS, a parser for XML schema. Yet another one, to be precise. As there
+        are a lot of other parsers around, the question arises: What makes it different?
+        What advantages does it have?</p>
+      <p>Let's begin with a disadvantage: This one is not a strict parser. In other words,
+        it was not written to detect any possible invalid schema. Strictness is a secondary
+        goal.</p>
+
+      <p>The main purpose of JaxMeXS is being extensible. It is written with XML languages
+        in mind, that extend XML schema. The best example is <link href="ext:jaxb">JAXB</link>,
+        the XML binding specification for Java. It extends XML schema by adding some more tags,
+        for example like this:</p>
+      <source>
+  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+      targetNamespace="http://ws.apache.org/jaxme/examples/misc/jaxb"
+      xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"&gt;
+    &lt;xs:annotation&gt;
+      &lt;xs:appinfo&gt;
+        &lt;jaxb:schemaBindings&gt;
+          &lt;jaxb:package name="com.mycompany.xml"/&gt;
+        &lt;/jaxb:schemaBindings&gt;
+      &lt;/xs:appinfo&gt;
+    &lt;/xs:annotation&gt;
+    ...
+      </source>
+      <p>JAXB is a Java source generator, which converts an XML schema into Java classes.
+        These Java classes have the ability to read an XML document conforming to the
+        original schema and return its information. As usual for Java classes, they
+        have to be located in some package, <code>com.mycompany.xml</code> in our case.
+        The above example demonstrates how JAXB uses an additional tag
+        <code>jaxb:package</code> to specify it.</p>
+      <p>This is exactly where JaxMeXS fits in. Quite unsurprising, because it was
+        written as the XML schema parser for <link href="ext:jaxme">JaxMe</link>,
+        which aims to be a JAXB implementation and extends the JAXB language by even
+        more tags. The main idea of JaxMeXS is:</p>
+      <ul>
+        <li>Write a parser for XML schema.</li>
+        <li>Extend the parser with the JAXB tags. This is simple: Any additional
+          element is implemented by a standard Java bean. The attributes are
+          mapped to properties and the property setters are called almost automagically.</li>
+        <li>Extend the JAXB parser with the JaxMe tags by adding more beans.</li>
+      </ul>
+    </section>
+  </body>
+</document>

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/logical.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/logical.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/logical.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The logical parser</title></header>
+  <body>
+    <section><title>The logical parser</title>
+      <p>As we have <link href="syntax.html">already said</link>, the JaxMe
+        parser for XML Schema, is an application of multiple layers. There is a
+        <link href="generic.html">generic parser</link>,
+        which is mostly independent of a certain XML language. The second layer
+        is the <link href="syntax.html">syntax parser</link>, which you typically
+        do not want to use. Most probably you are mainly interested in the topmost
+        layer: The logical parser.</p>
+      <p>The logical parser presents the XML Schema in a way, which you will
+        definitely like, because it is easy to use and frees you from the burden
+        to understand XML Schema. It handles groups, restrictions, extensions,
+        redefinitions and all that kind of stuff for you. Ideally you do not even
+        notice, that they are in use.</p>
+      <ul>
+        <li><link href="#use">Using</link> the logical parser</li>
+        <li>Accessing locical <link href="#context">context information</link></li>
+      </ul>
+    </section>
+
+    <section><title>Using the logical parser</title>
+      <p>The logical parser is used as follows:</p>
+      <source><![CDATA[
+    import java.io.File;
+    import java.io.FileInputStream;
+    import org.apache.ws.jaxme.xs.XSElement;
+    import org.apache.ws.jaxme.xs.XSParser;
+    import org.apache.ws.jaxme.xs.XSSchema;
+    import org.xml.sax.InputSource;
+
+    XSParser xsp = new XSParser();
+    // xsp.setValidating(false);  // In case your schema does not contain a schema declaration
+	File f = new File("myschema.xsd");
+    InputSource isource = new InputSource(new FileInputStream(f));
+    isource.setSystemId(f.toURL().toString());
+    XSSchema schema = xsp.parse(isource);  
+
+    // Print the names of all global elements:
+    XSElement[] elements = schema.getElements();
+    for (int i = 0;  i < elements.length;  i++) {
+      System.out.println(elements[i].getName());
+    }
+]]>   </source>
+    </section>
+
+	<anchor id="context"/>
+    <section><title>Accessing logical context information</title>
+      <p>Within your own beans or bean methods, it might be interesting from
+        time to time, whether you are currently within an imported or included
+        schema. If so, you might also want to know about the outer schemas.
+        Access to these items is provided through</p>
+      <source>
+	getXSSchema().getContext().getXSLogicalParser().getSyntaxSchemas()
+      </source>
+    </section>
+  </body>
+</document>
+

Added: branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/syntax.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/syntax.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/content/xdocs/xs/syntax.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" "document-v12.dtd">
+<document>
+  <header><title>The syntax parser</title></header>
+  <body>
+    <section><title>The syntax parser</title>
+      <p>JaxMeXS mainly consists of three parts: A
+        <link href="generic.html">generic parser</link>, which is by no means
+        restricted to XML schema, a syntax parser, which is is dedicated to the
+        syntactical aspects of XML schema, and a structure parser, which understands
+        the logic. Extending JaxMeXS will always imply extending the syntax parser. In the
+        most cases this will even be sufficient: Who's interested in creating a language as
+        complex as XML schema?</p>
+      <p>The syntax parser is an application of the
+        <link href="generic.html">generic parser</link>. This means, that it converts
+        any element in the XML schema into a Java bean. The attributes and elements are
+        mapped to bean properties. Attributes have simple values like strings or integers,
+        but a child element is yet another bean. In what follows, we'll discuss the following
+        aspects:</p>
+      <ol>
+        <li><link href="#using">Using</link> the syntax parser.</li>
+        <li>Making the schema parser to use <link href="#objectFactory">your own beans</link>.</li>
+        <li>Adding new <link href="#attributes">attributes</link> to an existing schema element.</li>
+        <li>Handling <link href="#namespaces">different namespaces</link>.</li>
+        <li>Adding new <link href="#childElements">child elements</link>.</li>
+      </ol>
+    </section>
+
+    <anchor id="using"/>
+    <section><title>Using the syntax parser</title>
+	  <p>To use the syntax parser, instantiate the class
+	    <link href="../apidocs/org/apache/ws/jaxme/xs/XSParser.html">XSParser</link> and invoke
+	    its <code>parse()</code> method, for example like this:</p>
+	  <source>
+  import java.io.FileInputStream;
+  import org.xml.sax.InputSource;
+  import org.apache.ws.jaxme.xs.XSParser:
+
+  public class MyParser {
+    public static void main(String[] args) throws Exception {
+      FileInputStream fs = new FileInputStream(args[0]);
+      InputSource is = new InputSource(fs);
+      is.setSystemId(fs.toURL().toString()); // This is important, if you use a DTD,
+                                             // external entities, schema validation, ...
+                                             // in other words: Other files
+      XSParser parser = new XSParser();
+      XsESchema schema = parser.parseSyntax(is);
+    }
+  }
+      </source>
+      <p>That's it! The returned instance of
+        <link href="../apidocs/org/apache/ws/jaxme/xs/xml/XsESchema.html">XsESchema</link> is a
+        standard schema with methods like <code>getTargetNamespace()</code> or
+        <code>getChilds()</code>. For example, the list of global types can be retrieved
+        as follows:</p>
+      <source><![CDATA[
+  Object[] childs = schema.getChilds();
+  for (int i = 0;  i < childs.length;  i++) {
+    Object o = childs[i];
+    if (o instanceof XsETopLevelSimpleType) {
+      XsETopLevelSimpleType t = (XsETopLevelSimpleType) o;
+      System.out.println("Simple type: " + t.getName());
+    } else if (o instanceof XsTComplexType) {
+      XsTComplexType t = (XsTComplexType) o;
+      System.out.println("Complex type: " + t.getName());
+    }
+  }
+]]>   </source>
+      <p>This is not very comfortable, but the intent of the syntax parser is simplicity,
+        and not comfort.</p>
+    </section>
+
+    <anchor id="XsObjectFactory"/>
+    <section><title>Forcing the schema parser to use your own beans</title>
+      <p>The beans returned by the schema parser are instances of
+        <link href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.html">XsObjectImpl</link>,
+        implementing the interface
+        <link href="../apidocs/org/apache/ws/jaxme/xs/xml/XsObject.html">XsObject</link>.
+        The <code>XsObject</code> interface allows access to the SAX location.</p>
+      <p>However, you might replace these completely with own implementations:
+        The <link href="../apidocs/org/apache/ws/jaxme/xs/xml/XsObjectFactory.html">object factory</link>
+        makes it possible.</p>
+      <p>Any of the standard XML schema beans is created by the object factory.
+        For example, the method <code>newXSESchema()</code> is invoked to create
+        the schema bean. We take this bean as an example and change the behaviour
+        of its attribute <code>targetNamespace</code>. For compatibility reasons
+        we want to replace the namespace <code>http://company.com/namespaces/version1</code>
+        with <code>http://company.com/namespaces/version2</code>. To achieve that,
+        we have to create three classes:</p>
+      <ol>
+        <li>A subclass of
+          <link href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.html">XsESchemaImpl</link>
+          with a modified <code>setTargetNamespace()</code> method,</li>
+        <li>an updated object factory, that doesn't create an instance of the base class,
+          but an instance of our subclass,</li>
+        <li>and, finally, a parser that uses our own object factory.</li>
+      </ol>
+      <p>Let's begin with the first task:</p>
+      <source>
+  import org.xml.sax.Locator;
+  import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+  import org.apache.ws.jaxme.xs.xml.impl.XsESchemaImpl;
+
+  public class MySchema extends XsESchemaImpl {
+    protected MySchema(XsObjectFactory pFactory, Locator pLocator) {
+      super(pFactory, pLocator);
+    }
+    public void setTargetNamespace(XsAnyURI pURI) {
+      if (pURI.equals("http://company.com/namespaces/version1")) {
+        pURI = "http://company.com/namespaces/version2";
+      }
+      super.setTargetNamespace(pURI);
+    }
+  }
+      </source>
+      <p>Neat, isn't it? Now, here's the object factory:</p>
+      <source>
+  import org.apache.ws.jaxme.xs.xml.XsESchema;
+  import org.apache.ws.jaxme.xs.xml.impl.XsObjectFactoryImpl;
+
+  public class MyXsObjectFactory extends XsObjectFactoryImpl {
+    public XsESchema newXsESchema() {
+      return new MySchema(this, getLocator());
+    }
+  }
+      </source>
+      <p>You probably already guess how the parser looks like:</p>
+      <source>
+  import org.apache.ws.jaxme.xs.XSParser;
+
+  public class MyParser extends XSParser {
+    public MyParser() {
+      getData().setXsObjectFactory(new MyXsObjectFactory());
+    }
+  }
+      </source>
+      <p>Now we have a parser, which does no longer distinguish between
+        <code>http://company.com/namespaces/version2</code> and
+        <code>http://company.com/namespaces/version1</code> in the
+        target namespace.</p>
+    </section>
+
+    <anchor id="attributes"/>
+    <section><title>Adding new attributes to an existing schema element.</title>
+      <p>We already know how to extend the parser.This knowledge will be
+        applied in the following example: We'll have an an additional
+        attribute "ignore" in the element definition. It ought to have a
+        boolean value. (For example, the attribute might indicate that
+        a custom program should ignore the element.)</p>
+      <p>The attribute is introduced by adding a property "ignore" to
+        the "element" bean. This might look like this:</p>
+      <source>
+  import org.xml.sax.Locator;
+  import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+  import org.apache.ws.jaxme.xs.xml.impl.XsTElementImpl;
+
+  public class MyElement extends XsTElementImpl {
+    private boolean ignoreMe;
+
+    protected MyElement(XsObjectFactory pFactory, Locator pLocator) {
+      super(pFactory, pLocator);
+    }
+    public void setIgnore(boolean pIgnore) {
+      ignoreMe = pIgnore;
+    }
+    public boolean getIgnore() {
+      return ignoreMe;
+    }
+  }
+      </source>
+      <p>We are not yet done. As we are using an own bean, we have to extend
+        the object factory to return this bean, if the method
+        <code>newXsTElementImpl()</code> is invoked. We also have to extend
+        the parser to use the extended object factory. These steps have already
+        been described in the <link href="#XsObjectFactory">previous section</link>,
+        so we omit it here.</p>
+    </section>
+
+    <anchor id="namespaces"/>
+    <section><title>Handling different namespaces</title>
+      <p>What we did in the <link href="#attributes">previous</link> section on
+        <link href="#attributes">adding attributes</link>, wasn't really conforming
+        to XML Schema. Our attribute had the default namespace, as the standard
+        XML Schema attributes do. Any other namespace had been a better choice.
+        XML Schema allows to include arbitrary attributes into a schema, as long
+        as they do not have the XML schema namespace. Surprisingly, the default
+        namespace isn't implicitly forbidden. Anyways, such behaviour cannot be
+        recommended.</p>
+      <p>To support attributes from other namespaces, we'll have to add another
+        method to our bean. The method is called</p>
+      <source>
+  public boolean setAttribute(String pQName, String pNamespaceURI,
+                              String pLocalName, String pValue)
+    throws SAXException;
+      </source>
+      <p>The boolean return value allows the method a decision to handle an
+        attribute (for example, if it is defined in a particular additional
+        namespace) by returning <code>true</code> or to leave the attribute
+        to the standard mechanisms by returning <code>false</code>. A typical
+        implementation might look like this:</p>
+      <source>
+    if (!"http://company.com/namespaces/mynamespace".equals(pNamespaceURI)) {
+      return false;
+    }
+    if ("ignore".equals(pLocalName)) {
+      setIgnore(Boolean.valueOf(pValue).booleanValue());
+    } else {
+      throw new SaxParseException("Invalid attribute: " + pValue, getLocation());
+    }
+      </source>
+      <p>The meaning is obvious: We feel responsible for the namespace
+        <code>http://company.com/namespaces/mynamespace</code>. If the attributes
+        namespace is different, we simply return false. If the namespace matches,
+        we accept the attribute "ignore", and refuse all others by throwing a
+        <code>SAXException</code>.</p>
+    </section>
+
+    <anchor id="childElements"/>
+    <section><title>Adding new child elements</title>
+      <p>The handling of a new child is no more complex than the handling of
+        attributes. In fact, it works quite the same. Basically one creates a
+        new bean and adds a bean property to the parent element, as in the following
+        example:</p>
+      <source>
+  MyChildBean childBean;
+
+  public MyChildBean createMyChild() {
+    if (childBean != null) {
+      throw new IllegalStateException("Multiple 'myChild' elements are forbidden.");
+    }
+    childBean = new MyChildBean();
+  }
+
+  public MyChildBean getMyChild() {
+    return childBean;
+  }
+      </source>
+      <p>This code is added to the parent bean. For example, if we want to have a new
+        element <code>xs:schema/xs:myChild</code>, we could create a new subclass of
+        <link href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.html">XsESchemaImpl</link>
+        with the above code. By extending the object factory to use our updated schema
+        bean and extending the parser to use our private object factory, we would be
+        done. (The latter steps are as in the first example section on
+        <link href="#XsObjectFactory">using our own beans</link>.)</p>
+      <p>There are two possible reasons, why the above code might be insufficient:
+        First of all, the example obviously doesn't care for namespaces. Second,
+        there's a chance that we do not want to create a simple bean. For example,
+        the standard behaviour of
+        <link href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsEAppinfoImpl.html">XsEAppinfo</link>
+        is to convert child elements into DOM documents.</p>
+      <p>Both becomes possible by the following example:</p>
+      <source>
+  import org.xml.sax.ContentHandler;
+  import org.apache.ws.jaxme.xs.parser.impl.XsSAXParserImpl;
+
+  MyChildBean childBean;
+
+  public ContentHandler getChildHandler(String pQName, String pNamespaceURI,
+                                        String pLocalName) throws SAXException {
+    if (!"http://company.com/namespaces/mynamespace".equals(pNamespaceURI)) {
+      return null;
+    }
+    if ("myChild".equals(pLocalName)) {
+	  if (childBean != null) {
+	    throw new IllegalStateException("Multiple 'myChild' child elements are forbidden.");
+	  }
+	  childBean = new MyChildBean();
+	  return new XsSAXParserImpl(childBean);
+    } else {
+      throw new IllegalStateException("Unknown child element: " + pQName);
+    }
+  }
+
+  public MyChildBean getMyChild() {
+    return childBean;
+  }
+      </source>
+      <p>Besides the different namespace, the example is functionally equivalent to
+        the previous example.</p>
+    </section>
+  </body>
+</document>
+

Added: branches/jaxme/upstream/0.5.1/src/documentation/lib/jimi-1.0.jar
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/lib/jimi-1.0.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/address.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/address.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/address.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<programlisting>
+&lt;?xml version="1.0"?&gt;
+&lt;!-- A sample document for the Address.xsd schema. This
+     sample document is used in the docs, see
+     docs/GenerateJava.html. --&gt;
+<![CDATA[
+<Address xmlns="http://ws.apache.org/jaxme/examples/misc/address">
+  <Name>
+    <First>Jane</First>
+    <Middle>Lee</Middle>
+    <Middle>Chris</Middle>
+    <Last>Doe</Last>
+    <Initials>(JD)</Initials>
+  </Name>
+  ... further details omitted for brevity ...
+</Address>
+]]>
+</programlisting>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/addressxsd.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/addressxsd.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/addressxsd.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<programlisting>
+<![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/examples/misc/address"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:element name="Address">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Name">
+          <xs:annotation><xs:documentation>
+              A name consists of two required (first and last name)
+              and two optional parts (middle name and initials).
+          </xs:documentation></xs:annotation>
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="First" type="xs:string"/>
+              <xs:element name="Middle" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+              <xs:element name="Last" type="xs:string"/>
+              <xs:element name="Initials" minOccurs="0" type="xs:string"/>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        ... further details omitted for brevity ...
+      </xs:sequence>
+      <xs:attribute name="id"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
+]]></programlisting>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/faq.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/faq.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/faq.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<appendix><title>FAQ</title>
+  <para>This section contains a list of frequently asked questions. And, of course, their answers. :-)</para>
+  <qandaset defaultlabel="qanda">
+    <qandadiv><title>General questions</title>
+      <para>This subsection contains questions concerning the whole project as such.</para>
+      <qandaentry>
+        <question><para>What is it?</para></question>
+        <answer><para>
+          JaxMe 2 is an implementation of JAXB, the specification for Java/XML binding. In short you can
+          describe JaxMe as a source generator that takes various sources as input (for example, an XML schema,
+          a DTD, a Java bean class) and creates sources that allow you to convert a matching XML document into
+          a Java object or vice versa, convert the Java object into XML. JaxMe extends JAXB with a lot of features.
+          See the next question on that topic.</para>
+        </answer>
+      </qandaentry>
+
+	  <qandaentry>
+	    <question><para>Why should I choose JaxMe and not JAXB?</para></question>
+	    <answer>
+	      <para>That's definitely a question you should ask yourself. The JAXB reference implementation is
+            implemented by a team of excellent technicians who have a vision. It is supported by Sun and other
+            large vendors.</para>
+          <para>On the other hand, you should understand that JAXB has a limited scope. As a reference
+            implementation, it has to follow the specification, but can hardly do a step beyond. And in
+            some sense the scope can be described as the lowest common denominator of Sun and the other
+            vendors. JaxMe is (at least as of this writing) definitely less tested, less stable, less
+            mature and all that stuff you don't want. On the other hand, it has some nice features which
+            you possibly really want:
+            <orderedlist>
+              <listitem>JaxMe is much, much more extensible and customizable than JAXB: It was written
+                from the ground up for that. And you have the source. The main problem of source generators
+                has always been whether you have the source or not. If you do, then a source generator can
+                do everything for you that you want and become really, really useful, grow with your
+                abilities and the project. On the other hand, without the source you will almost definitely
+                at some point ask yourself why you didn't implement all the stuff manually.</listitem>
+              <listitem>
+                <para>It includes a persistency layer. The persistency layer is a database abstraction
+                  and allows you to read XML from a database or store it into the database with just a few
+                  instructions. You do not care for the hazzle of low level API's like xml:db or JDBC, you
+                  just say "save it" and it does. The most important advantage of a persistency framework
+                  is that you become more independent from the database. With JaxMe 1 projects have been
+                  developed on an SQL database, for example MySQL and later on moved to Tamino, an XML
+                  database. It also happened vice versa, where it makes sense.</para>
+                <para>Even more, you aren't restricted to a single database. You can mix data sources,
+                  depending on the document type, and choose for any document type whichever suites the
+                  most.</para>
+              </listitem>
+              <listitem>We definitely recommend the use of an XML database. After all, why not use the
+                features that XML gives you? Normalization definitely has its goods and should still be
+                applied where it makes sense. However, in the real life, this is not always the case.
+                Besides, some of us (in particular the developers) are still stuck in the relational world.
+                JaxMe can create a mapping between Java objects and SQL databases for you. The persistency
+                layer translates "create", "update", "delete" or "read" operations into a set of SQL
+                instructions. These SQL instructions are performed by JaxMe on your demand. There is almost
+                no difference (besides the structural limitations, of course) between working with an SQL
+                database and an XML database.</listitem>
+            </orderedlist></para>
+          </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>Why the name "JaxMe"?</para></question>
+        <answer>
+          <para>After working with JAXP, JAXB, JAXM and all the other stuff for quite some time I began to
+            automatically associate "JAXsomethingE" with anything related to Java and XML. So this is "Me"
+            JAX or JaxMe.</para>
+          <para>The name is ridiculous. I know. Sometimes we'll probably find something better. (And, who
+            knows, perhaps we even find someone changing the sources then ... :-)</para>
+        </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>Are there any reference projects?</para></question>
+        <answer>
+          <para>As of this writing, JaxMe 2 isn't sufficiently mature for large projects.
+            However, JaxMe 1 has been used for really serious issues:
+            <itemizedlist>
+              <listitem>FleetBoard (http://www.fleetboard.com/) is a telematics and logistics solution.
+                Large parts of it are realized with the JaxMe EJB generator and a DB2 database as the
+                backend. Other parts are based on a JaxMe predecessor and Tamino.</listitem>
+              <listitem>Justus II (http://www.softwareag.com/germany/referenzen/PDF/CR_Justus_D.pdf) is
+                a large XML application running on Tomcat and an Oracle database as the backend. It is
+                built from the ground up using JaxMe.</listitem>
+            </itemizedlist>
+          </para>
+          <para>If you know of other projects, please let us know.</para>
+        </answer>
+      </qandaentry>
+    </qandadiv>
+
+    <qandadiv><title>The Generator</title>
+      <para>The following questions are related to the JaxMe generator</para>
+
+      <qandaentry>
+        <question><para>What is the supported subset of XML Schema?</para></question>
+        <answer>
+          <para>As of this writing, the following is supported:
+            <itemizedlist>
+              <listitem>All simple datatypes, excluding time intervals (minor issue, some hours work,
+                if anyone needs it)</listitem>
+              <listitem>Atomic elements, with and without attributes</listitem>
+              <listitem>Complex elements with content type empty, sequence, choice, or all.</listitem>
+              <listitem>Groups (but not nested groups)</listitem>
+            </itemizedlist></para>
+          <para>The following is not yet supported:
+            <itemizedlist>
+              <listitem>Complex elements with simple content (minor issue, mainly requires writing a
+                test suite)</listitem>
+              <listitem>Mixed content</listitem>
+              <listitem>Wildcards</listitem>
+              <listitem>Key specifications</listitem>
+              <listitem>Recursion (Minor issue, mainly requires writing a test suite)</listitem>
+            </itemizedlist></para>
+        </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>What is the supported subset of JAXB?</para></question>
+        <answer>
+          <para>Lots of features are missing, in particular:
+          <itemizedlist>
+            <listitem>External schema binding (requires writing a stylesheet generator)</listitem>
+            <listitem>Model group binding</listitem>
+            <listitem>Mixed content</listitem>
+          </itemizedlist></para>
+        </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>How is the EJB support working?</para></question>
+        <answer>
+          <para>As of this writing, the following applies for JaxMe 1 only.
+            EJB support is not yet included in JaxMe 2. This will hopefully change soon.</para>
+          <para>JaxMe 1 contains a generator for entity beans with bean managed persistence.
+            In short these can very well be compared with CMP entity beans, only you use JaxMe
+            to create it and the query language is unavailable. On the other hand, they are
+            typically faster, because they follow the design pattern of value objects.</para>
+          <para>The bean generator also supports the generation of stateless session beans that perform
+            queries and return XML data. (So called list methods.)</para>
+        </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>What are JaxMe's "find methods" and "list methods"?</para></question>
+        <answer>
+          <para>As of this writing, the following applies for JaxMe 1 only.
+            EJB support is not yet included in JaxMe 2. This will hopefully change soon.</para>
+          <para>You know what an SQL view is? Forgetting updateable views, one could describe them as a
+            stored query, that returns some data in a fixed format. In essence this is what JaxMe's find
+            and list methods are: You specify a query that is compiled by the source code generator. The
+            result are Java sources that can perform the specified query, possibly configured with some
+            parameters that you specify as well.</para>
+          <para>The difference between find and list methods is that the former return objects which you
+            may modify and store back. So find methods are somewhat closer to updateable views, because
+            they are bound to a specific table.</para>
+        </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>Why are the field names uppercased when using the JaxMeJdbcSG?</para></question>
+        <answer>
+          <para>Field names are built from column names, which are in turn read via JDBC metadata.
+            However, most databases are storing column names uppercased internally.</para>
+          <para>As a workaround, you may specify an alternative field name. See the IPADDRESS column
+            in the Session example for how to do that.</para>
+        </answer>
+      </qandaentry>
+    </qandadiv>
+
+    <qandadiv><title>The runtime</title>
+      <para>The following questions are related to the JaxMe runtime.</para>
+
+      <qandaentry>
+        <question><para>How is Tamino supported?</para></question>
+        <answer>
+          <para>Software AG, the vendor of Tamino, is the employer of Jochen Wiedmann (JaxMe's head
+            developer). Jochen uses Tamino in his daily work, so support for Tamino is essential. He
+            considers work with Tamino as definitely much more fun than using DB2, Oracle, or
+            whatsoever.</para>
+          <para>The current Tamino manager is a simple thing implementing native HTTP access to Tamino.
+            It is a generic manager, not a specific manager per document type. (Working with XML databases
+            is much simpler for an XML application than using JDBC.) However, the following is not yet
+            supported, although it really should:
+            <itemizedlist>
+              <listitem>Tamino transactions</listitem>
+              <listitem>Find and list methods (truly important for the XQuery language)</listitem>
+              <listitem>Use of the official TaminoAPI4J (the current manager is based on a simple SAX handler)</listitem>
+            </itemizedlist></para>
+        </answer>
+      </qandaentry>
+
+      <qandaentry>
+        <question><para>How is XML:DB supported?</para></question>
+        <answer>
+          <para>There is a generic XmlDbManager, which is tested in a JUnit test against eXist. It
+            is a generic manager, not a specific manager per document type. (Working with XML databases
+            is much simpler for an XML application than using JDBC.) However, so far no productive use
+            is known.</para>
+        </answer>
+      </qandaentry>
+    </qandadiv>
+  </qandaset>
+</appendix>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/firststeps.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/firststeps.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/firststeps.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<chapter><title>First steps</title>
+  <para>This chapter introduces the first steps of using JaxMe. In what follows,
+    we will create some simple examples. All examples deal with addresses
+    stored in XML documents like the following (quoted from the file
+    <filename>examples/misc/address.xml</filename> in the JaxMe 2 distribution):
+    &address;
+    </para>
+  <para>Our target is to convert this into convenient, standard Java bean code, much like the
+    following:
+    <programlisting>
+      Address address = new Address();
+      Name name = new Name();
+      address.setName(name);
+      name.setFirst("Jane");
+      name.addMiddle("Lee");
+      name.addMiddle("Chris");
+      name.setSur("Doe");
+      name.setInitials("JD");
+      ...
+    </programlisting></para>
+
+  <sect1><title>Generating Java Code</title>
+    <para>After you've downloaded JaxMe, you're ready to use it. In this section
+      we will demonstrate how to generate sources.</para>
+
+    <sect2><title>Creating a JaxMe Schema</title>
+      <para>
+        The usual way to use JaxMe is to start from a schema and generate source code
+        from that schema. So (with the address example in mind) we create an XML Schema
+        from which the sources will be generated. When using JaxMe in the wild sometimes
+        the schema will already exist, in other cases the application developer will
+        develop the schema as the application develops. In either case, the way
+        that JaxMe is used is very similar.</para>
+      <para>
+        The schema can
+        be regarded as a description of compliant document instances (in our case
+        addresses). For example 
+        (<filename>examples/misc/address.xsd</filename> in the JaxMe 2 distribution): &addressxsd;
+        You will easily note that <token>xs:element</token> is used to define elements.
+        An attribute is added using <token>xs:attribute</token>, and so on. XML schema
+        are very expressive (which is why they support source generation so well) but
+        with this expressiveness comes complexity. Getting to grips with the XML schema
+        standard is worth the effort but some users may choose to use one of the numerous tools
+        that help with XML schema generation.</para>
+      </sect2>
+
+    <sect2><title>Running The Generator</title>
+      <para>The easiest way to run the generator is by invoking an Ant task. Here is a typical ant target:
+        <programlisting><![CDATA[
+    <target name="taskdef">
+      <!--
+      Set up the classpath for the generation task.
+      Include all the standard jaxme jars.
+      -->
+      <path id="generate.class.path">
+        <pathelement location="jaxme2.jar"/>
+        <pathelement location="jaxmejs.jar"/>
+        <pathelement location="jaxmexs.jar"/>
+        <pathelement location="jaxmeapi.jar"/>
+      </path>
+      <!--
+      Defines the generation task using that classpath.
+      -->
+      <taskdef name="xjc"
+        classname="org.apache.ws.jaxme.generator.XJCTask"
+        classpathref="generate.class.path"/>
+      <!--
+      Generate source code.
+      The 'schema' attribute gives the path to the schema the sources
+      will be generated from.
+      The 'target' attribute specifies the base directory that the source
+      will be generated into. Sources will be created in subdirectories
+      corresponding to the package structure.
+      -->
+      <xjc 
+        schema="examples/misc/address.xsd" 
+        target="build/src">
+            <!--
+            The source files being created. The xjc task uses these for
+            a check, whether they are uptodate. If so, the generation is
+            skipped, for improved speed.
+            Specifying the package isn't necessary, unless you have other
+            files in the target directory as well, for example manually
+            written files or files created by another generator or xjc call.
+            If so, these need to be excluded from the uptodate check.
+            -->
+            <produces includes="org/apache/ws/jaxme/examples/misc/address/*.java"/>
+      </xjc>
+    </target>
+]]></programlisting></para>
+      <para>The example demonstrates how a classpath called <token>generate.class.path</token> is
+        created and used to define a new ant task called "xjc". 
+        This new task is used to compile a schema file called <filename>examples/misc/address.xsd</filename>.
+        The generated sources will reside in the directory <filename>build/src</filename>. The target
+        package is <token>org.apache.ws.jaxme.examples.misc.address</token>, hence the effective location is
+        <filename>build/src/org/apache/ws/jaxme/examples/misc/address</filename>.</para>
+      <para>After running the task, looking into that directory, we find that the 
+      following files have been created:
+        <variablelist><title>Files Generated by the JaxMe Binding Compiler</title>
+          <varlistentry><term><filename>Address.java</filename></term>
+            <listitem><para>Contains the Java interface describing the document type
+              <token>Address</token>. This interface extends the interface
+              specified by <filename>AddressType.java</filename>.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>AddressType.java</filename></term>
+            <listitem><para>Contains the Java interface describing the inner contents
+              of the document type <token>Address</token>. The best way to think of it is
+              to assume that they are the same, except that the latter is anonymous and
+              doesn't have an element name.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>Configuration.xml</filename></term>
+            <listitem><para>This file is used by the JaxMe runtime internally. Typically
+              you'll never notice that it is even there (though you will need to ensure that it remains 
+              on the classpath). The main task of the file is a mapping
+              between XML element names (like <token>Address</token> in namespace
+              <token>http://ws.apache.org/jaxme/examples/misc/address</token>) and Java classes.</para>
+            <tip><para>In theory you are able to replace the implementations generated by
+              <application>JaxMe</application>
+              with your own classes. This is particularly useful, if you want to modify a certain
+              behaviour by deriving a subclass.</para></tip></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>jaxb.properties</filename></term>
+            <listitem><para>The <acronym>JAXB</acronym> standard uses this file. Typically you'll
+              never even notice that it exists (though again, it must be found on the classpath). 
+              The task of the file is to ensure that
+              the <acronym>JAXB</acronym> runtime correctly initializes the <application>JaxMe</application>
+              runtime.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>impl/AddressHandler.java</filename></term>
+            <listitem><para>A <acronym>SAX2</acronym> <classname>ContentHandler</classname>, which can
+              convert XML documents of type <token>Address</token> into implementations of the Java
+              interface <classname>Address</classname>. This is rarely called directly. Usually it will be
+              created and invoked automatically by the <acronym>JAXB</acronym>
+              <classname>Marshaller</classname>.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>impl/AddressImpl.java</filename></term>
+            <listitem><para>Default implementation of the <classname>Address</classname> interface.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>impl/AddressType.java</filename></term>
+            <listitem><para>Default implementation of the <classname>AddressType</classname>
+              interface.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>impl/AddressTypeHandler.java</filename></term>
+            <listitem><para>Similar to its subclass <classname>AddressHandler</classname>,
+              this is a <acronym>SAX2</acronym> <classname>ContentHandler</classname> for reading
+              instances of <classname>AddressType</classname>. The
+              main difference to the subclass is that the subclass doesn't have a fixed
+              element name.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>impl/AddressTypeImpl.java</filename></term>
+            <listitem><para>Default implementation of <classname>AddressType</classname>.</para></listitem>
+            </varlistentry>
+          <varlistentry><term><filename>impl/AddressTypeSerializer.java</filename></term>
+            <listitem><para>Converts instances of <classname>AddressType</classname>
+            into XML documents. It is also used to convert instances of <classname>Address</classname>.</para>
+            </listitem></varlistentry>
+          </variablelist>
+        </para>
+      </sect2>
+  </sect1>
+
+  <sect1><title>Working with XML</title>
+    <para>In this section we'll show how to create XML from the beans generated earlier. 
+      XML (or better an XML document) exists in various
+      flavours: you might want to have it serialized into a String or you may prefer character or
+      byte streams (typically instances of <classname>Writer</classname> or <classname>OutputStream</classname>).
+      In other cases, a DOM representation is more useful. Feeding SAX events to a pipeline may be more
+      efficient on other occasions.</para>
+    <para>  
+      The important questions are: how do I
+      create a serialized XML document (a String, a character or byte stream)? And, vice versa, how
+      do I read such a document and convert it back into Java objects?</para>
+    <sect2><title>Writing XML Documents</title>
+    <para>In the case of JaxMe, you'll start from simple Java beans whose source has typically
+      been generated. An address implementation is constructed by instantiating
+      an <classname>AddressImpl</classname> (which implements <classname>Address</classname>).
+      For example:
+      <programlisting><![CDATA[
+import java.io.FileWriter;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.apache.ws.jaxme.examples.misc.address.Address;
+import org.apache.ws.jaxme.examples.misc.address.AddressType.EmailDetailsType.EmailType;
+import org.apache.ws.jaxme.examples.misc.address.AddressType.PhoneDetailsType.PhoneType;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressImpl;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressTypeImpl.EmailDetailsTypeImpl;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressTypeImpl.EmailDetailsTypeImpl.EmailTypeImpl;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressTypeImpl.PhoneDetailsTypeImpl;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressTypeImpl.PhoneDetailsTypeImpl.PhoneTypeImpl;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressTypeImpl.NameTypeImpl;
+import org.apache.ws.jaxme.examples.misc.address.impl.AddressTypeImpl.PostalTypeImpl;
+
+public class AddressCreator {
+
+  public static void writeAddress(Writer pWriter) throws JAXBException {
+    // Create the element:
+    Address addr = new AddressImpl();
+    addr.setName(new NameTypeImpl());
+    addr.getName().setFirst("Jane");
+    addr.getName().setLast("Doe");
+    addr.setPostal(new PostalTypeImpl());
+    addr.getPostal().setStreet("34 Main Street");
+    addr.getPostal().setCity("Boston");
+    addr.getPostal().setState("MA");
+    addr.getPostal().setZIP("02215");
+    addr.setEmailDetails(new EmailDetailsTypeImpl());
+
+    /* Lots of similar lines omitted for brevity ...
+     * ...
+     */
+
+    // And save it into the file "Address.xml"
+    JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.examples.misc.address");
+    Marshaller marshaller = context.createMarshaller();
+    marshaller.marshal(addr, pWriter);
+  }
+
+  public static void main(String[] args) throws Exception {
+    FileWriter fw = new FileWriter("Address.xml");
+    writeAddress(fw);
+    fw.close();
+  }
+}
+        ]]></programlisting>
+        The complete example code can be found in the JaxMe distribution 
+        (<filename>src/java/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java</filename>).
+      </para>
+      <para>There are several things you should note here:
+        <itemizedlist>
+          <listitem>The class and property names directly correspond to element and
+            attribute names.</listitem>
+          <listitem>Although the <token>Address</token> document uses namespaces, attributes,
+            and child elements, the example does not require that the developers have extensive
+            knowledge of XML. For example, you do not need to care for character escaping.
+            This is particularly useful when those without great knowledge of xml wish to develop 
+            code against an existing schema.</listitem>
+          <listitem>Complex child elements are java beans themselves, like the <token>Address</token>
+            element. For example, this means that the <token>Name</token> element has to be instantiated.
+            </listitem>
+          <listitem>To convert the object into an XML string, the <classname>JAXBContext</classname>
+            and <classname>Marshaller</classname> are used. These objects are specified by
+            <acronym>JAXB</acronym>. The example uses no JaxMe specific
+            features and should run with any compliant JAXB implementation.</listitem>
+        </itemizedlist>
+      </para>
+      </sect2>
+
+      <sect2><title>Reading XML</title>
+        <para>The example on writing XML was surprisingly simple. In fact, the only
+          nasty part was creating the object, which requires invocation of lots of
+          setters and getters. Quite opposed to the marshalling, which took place in
+          three lines. And, as we soon will see: unmarshalling (the process of reading
+          a document) is by no means more complex.</para>
+        <para>To demonstrate the unmarshalling process, we'll quote an example from
+          the JaxMe distribution again. This time it's the file
+          <filename>src/java/org/apache/ws/jaxme/examples/misc/address/AddressPrinter.java</filename>:
+          <programlisting><![CDATA[
+package org.apache.ws.jaxme.examples.misc.address;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ws.jaxme.examples.misc.address.Address;
+import org.xml.sax.InputSource;
+
+
+public class AddressPrinter {
+  public static Address getAddress(InputSource pSource) throws JAXBException {
+    JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.examples.misc.address");
+    Unmarshaller unmarshaller = context.createUnmarshaller();
+    return (Address) unmarshaller.unmarshal(pSource);
+  }
+
+  public static String getAddressAsString(Address pAddress) throws JAXBException {
+    StringWriter sw = new StringWriter();
+    JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.examples.misc.address");
+    Marshaller marshaller = context.createMarshaller();
+    marshaller.marshal(pAddress, sw);
+    return sw.toString();
+  }
+
+  public static void main(String[] args) throws Exception {
+    File f = new File("Address.xml");
+    InputSource isource = new InputSource(new FileInputStream(f));
+    isource.setSystemId(f.toURL().toString());
+    Address addr = getAddress(isource);
+
+    // A simpler variant might be:
+    // Address addr = unmarshaller.unmarshal(f);
+
+    if (addr.getName() == null) {
+      System.out.println("Loaded address without name.");
+    } else {
+      System.out.println("Loaded address " + addr.getName().getLast() +
+                         ", " + addr.getName().getFirst() + ".");
+    }
+    System.out.println("Details:" + getAddressAsString(addr));
+  }
+}
+          ]]></programlisting></para>
+        <para>How this example works:
+          <orderedlist>
+            <listitem>It reads the file <filename>Address.xml</filename>. This is the
+              very same file created in the first example. JaxMe supports true round-tripping.</listitem>
+            <listitem>An instance of <classname>InputSource</classname> is constructed. The
+              <classname>InputSource</classname> is part of the <acronym>SAX</acronym>
+              API and can be viewed as an abstract data source from which XML can be read.
+              Typically, the <classname>InputSource</classname> will be backed by 
+              an <classname>InputStream</classname> or a <classname>Writer</classname>.</listitem>
+            <listitem>The method <function>getAddress()</function> is invoked
+              to convert the XML document into an instance of <token>Address</token>.
+              These are the promised three lines, again using classes and methods
+              specified by <acronym>JAXB</acronym>.</listitem>
+            <listitem>Finally the method <function>getAddressAsString</function>
+              is invoked to convert the <token>Address</token> instance back into a
+              printable String, which we may use to verify that everything went fine.
+              (It is always nice to see a result being displayed on the screen. :-)</listitem>
+          </orderedlist></para>
+      </sect2>
+    </sect1>
+</chapter>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/glossary.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/glossary.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/glossary.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<glossary><title>Glossary</title>
+  <glossentry id="BSDLicense">
+    <glossterm>BSD License</glossterm>
+    <glossdef>
+      <para>One of the worlds most important open source licenses, originally developed
+	    for BSD Unix. It is very liberal: Basically it allows you to redistribute both sources and binaries,
+	    as you want. Unlike the GPL you may even sell derivated works. See also
+	    <ulink url="http://www.opensource.org/licenses/bsd-license.php">
+	      http://www.opensource.org/licenses/bsd-license.php</ulink>.</para>
+    </glossdef>
+  </glossentry>
+
+  <glossentry id="JAXB">
+    <glossterm>Java specification for XML Binding</glossterm>
+    <acronym>JAXB</acronym>
+    <glossdef>
+      <para>
+        JAXB (<ulink url="http://java.sun.com/xml/jaxb/">http://java.sun.com/xml/jaxb/</ulink>)
+        is the SUN specification for Java/XML binding.
+        It is also available as a reference implementation. JaxMe aims to become another
+        JAXB implementation at some time. However, full JAXB support is far from complete.
+      </para>
+    </glossdef>
+  </glossentry>
+</glossary>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/jaxme2.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/jaxme2.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/jaxme2.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
+  <!ENTITY address SYSTEM "address.xml">
+  <!ENTITY addressxsd SYSTEM "addressxsd.xml">
+  <!ENTITY faq SYSTEM "faq.xml">
+  <!ENTITY firststeps SYSTEM "firststeps.xml">
+  <!ENTITY glossary SYSTEM "glossary.xml">
+  <!ENTITY license SYSTEM "license.xml">
+  <!ENTITY marshalling SYSTEM "marshalling.xml">
+  <!ENTITY xjctask SYSTEM "xjctask.xml">
+]>
+
+<book>
+<bookinfo>
+  <title>The JaxMe 2 manual</title>
+  <author><firstname>Jochen</firstname><surname>Wiedmann</surname></author>
+  <copyright><year>2003-2004</year><holder>The Apache Software Foundation</holder></copyright>
+</bookinfo>
+<preface><title>Introduction</title>
+<para>JaxMe 2 is a Java source generator. It is used as the base of XML
+application frameworks. Using JaxMe can generate code that can:
+<itemizedlist>
+  <listitem>Convert XML documents into Java beans and back to XML documents again.</listitem>
+  <listitem>Persist those Java beans into a datastore. It is recommended to use
+    an XML database as a backend, but relational databases are supported
+    through an object-relational mapper. (If your XML documents are
+    sufficiently simple, that is ;) It is even possible to mix different
+    database engines, depending on the document type.
+    JaxMePM (the JaxMe persistence management framework) is design to be extensible.
+    Developers can create new implementations to add support for datastores
+    that JaxMe does not support out-of-the-box.
+    </listitem>
+  <listitem>Query the database for previously stored data and convert
+    this data into Java beans.</listitem>
+  <listitem>The database can be accessed directly or by EJB entity or
+    session beans. These beans may be generated by JaxMe.</listitem>
+</itemizedlist>
+So, the complete workflow
+of a typical application is supported: gathering, storing, processing,
+and presenting data.</para>
+<para>JaxMe is an open source project: You may redistribute sources, or
+binaries, as you like. JaxMe comes to you under The Apache Software Foundation 
+License, a very liberal license: you are even allowed to redistribute derived works
+under a modified license. This is in contrast to the GPL, which requires
+that derived works are GPL'ed again.</para>
+</preface>
+
+&firststeps;
+
+<chapter><title>Reference</title>
+<para>This chapter is more formal and can be assumed to be the JaxMe reference documentation.</para>
+
+&xjctask;
+&marshalling;
+</chapter>
+
+&license;
+&faq;
+&glossary;
+
+</book>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/license.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/license.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/license.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<appendix><title>License</title>
+ <para>JaxMe comes to you under the terms of The Apache Software License:</para>
+
+ <para>Apache License</para>
+ <para>Version 2.0, January 2004</para>
+ <para><ulink url="http://www.apache.org/licenses/">http://www.apache.org/licenses/</ulink></para>
+
+  <simplesect><title>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</title>
+    <orderedlist>
+      <listitem>
+        <para>Definitions.</para>
+        <para>"License" shall mean the terms and conditions for use, reproduction,
+          and distribution as defined by Sections 1 through 9 of this document.
+        </para>
+        <para>"Licensor" shall mean the copyright owner or entity authorized by
+      	  the copyright owner that is granting the License.
+      	</para>
+      	<para>"Legal Entity" shall mean the union of the acting entity and all
+          other entities that control, are controlled by, or are under common
+          control with that entity. For the purposes of this definition,
+          "control" means (i) the power, direct or indirect, to cause the
+          direction or management of such entity, whether by contract or
+          otherwise, or (ii) ownership of fifty percent (50%) or more of the
+          outstanding shares, or (iii) beneficial ownership of such entity.
+        </para>
+        <para>"You" (or "Your") shall mean an individual or Legal Entity
+          exercising permissions granted by this License.
+        </para>
+        <para>"Source" form shall mean the preferred form for making modifications,
+          including but not limited to software source code, documentation
+          source, and configuration files.
+        </para>
+		<para>"Object" form shall mean any form resulting from mechanical
+          transformation or translation of a Source form, including but
+          not limited to compiled object code, generated documentation,
+          and conversions to other media types.
+        </para>
+		<para>"Work" shall mean the work of authorship, whether in Source or
+          Object form, made available under the License, as indicated by a
+          copyright notice that is included in or attached to the work
+          (an example is provided in the Appendix below).
+        </para>
+		<para>"Derivative Works" shall mean any work, whether in Source or Object
+          form, that is based on (or derived from) the Work and for which the
+          editorial revisions, annotations, elaborations, or other modifications
+          represent, as a whole, an original work of authorship. For the purposes
+          of this License, Derivative Works shall not include works that remain
+          separable from, or merely link (or bind by name) to the interfaces of,
+          the Work and Derivative Works thereof.
+        </para>
+		<para>"Contribution" shall mean any work of authorship, including
+          the original version of the Work and any modifications or additions
+          to that Work or Derivative Works thereof, that is intentionally
+          submitted to Licensor for inclusion in the Work by the copyright owner
+          or by an individual or Legal Entity authorized to submit on behalf of
+          the copyright owner. For the purposes of this definition, "submitted"
+          means any form of electronic, verbal, or written communication sent
+          to the Licensor or its representatives, including but not limited to
+          communication on electronic mailing lists, source code control systems,
+          and issue tracking systems that are managed by, or on behalf of, the
+          Licensor for the purpose of discussing and improving the Work, but
+          excluding communication that is conspicuously marked or otherwise
+          designated in writing by the copyright owner as "Not a Contribution."
+        </para>
+        <para>"Contributor" shall mean Licensor and any individual or Legal Entity
+          on behalf of whom a Contribution has been received by Licensor and
+          subsequently incorporated within the Work.
+        </para>
+      </listitem>
+      <listitem>
+        <para>Grant of Copyright License. Subject to the terms and conditions of
+          this License, each Contributor hereby grants to You a perpetual,
+          worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+          copyright license to reproduce, prepare Derivative Works of,
+          publicly display, publicly perform, sublicense, and distribute the
+          Work and such Derivative Works in Source or Object form.
+        </para>
+      </listitem>
+      <listitem>Grant of Patent License. Subject to the terms and conditions of
+        this License, each Contributor hereby grants to You a perpetual,
+        worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+        (except as stated in this section) patent license to make, have made,
+        use, offer to sell, sell, import, and otherwise transfer the Work,
+        where such license applies only to those patent claims licensable
+        by such Contributor that are necessarily infringed by their
+        Contribution(s) alone or by combination of their Contribution(s)
+        with the Work to which such Contribution(s) was submitted. If You
+        institute patent litigation against any entity (including a
+        cross-claim or counterclaim in a lawsuit) alleging that the Work
+        or a Contribution incorporated within the Work constitutes direct
+        or contributory patent infringement, then any patent licenses
+        granted to You under this License for that Work shall terminate
+        as of the date such litigation is filed.
+      </listitem>
+      <listitem>Redistribution. You may reproduce and distribute copies of the
+        Work or Derivative Works thereof in any medium, with or without
+        modifications, and in Source or Object form, provided that You
+        meet the following conditions:
+        <orderedlist numeration="lowerroman">
+          <listitem>You must give any other recipients of the Work or
+            Derivative Works a copy of this License; and
+          </listitem>
+          <listitem>You must cause any modified files to carry prominent notices
+            stating that You changed the files; and
+          </listitem>
+          <listitem>You must retain, in the Source form of any Derivative Works
+            that You distribute, all copyright, patent, trademark, and
+            attribution notices from the Source form of the Work,
+            excluding those notices that do not pertain to any part of
+            the Derivative Works; and
+          </listitem>
+          <listitem>If the Work includes a "NOTICE" text file as part of its
+            distribution, then any Derivative Works that You distribute must
+            include a readable copy of the attribution notices contained
+            within such NOTICE file, excluding those notices that do not
+            pertain to any part of the Derivative Works, in at least one
+            of the following places: within a NOTICE text file distributed
+            as part of the Derivative Works; within the Source form or
+            documentation, if provided along with the Derivative Works; or,
+            within a display generated by the Derivative Works, if and
+            wherever such third-party notices normally appear. The contents
+            of the NOTICE file are for informational purposes only and
+            do not modify the License. You may add Your own attribution
+            notices within Derivative Works that You distribute, alongside
+            or as an addendum to the NOTICE text from the Work, provided
+            that such additional attribution notices cannot be construed
+            as modifying the License.
+          </listitem>
+		  <listitem>You may add Your own copyright statement to Your modifications and
+            may provide additional or different license terms and conditions
+            for use, reproduction, or distribution of Your modifications, or
+            for any such Derivative Works as a whole, provided Your use,
+            reproduction, and distribution of the Work otherwise complies with
+            the conditions stated in this License.
+          </listitem>
+        </orderedlist>
+      </listitem>
+      <listitem>Submission of Contributions. Unless You explicitly state otherwise,
+        any Contribution intentionally submitted for inclusion in the Work
+        by You to the Licensor shall be under the terms and conditions of
+        this License, without any additional terms or conditions.
+        Notwithstanding the above, nothing herein shall supersede or modify
+        the terms of any separate license agreement you may have executed
+        with Licensor regarding such Contributions.
+      </listitem>
+      <listitem>Trademarks. This License does not grant permission to use the trade
+        names, trademarks, service marks, or product names of the Licensor,
+        except as required for reasonable and customary use in describing the
+        origin of the Work and reproducing the content of the NOTICE file.
+      </listitem>
+      <listitem>Disclaimer of Warranty. Unless required by applicable law or
+        agreed to in writing, Licensor provides the Work (and each
+        Contributor provides its Contributions) on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+        implied, including, without limitation, any warranties or conditions
+        of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+        PARTICULAR PURPOSE. You are solely responsible for determining the
+        appropriateness of using or redistributing the Work and assume any
+        risks associated with Your exercise of permissions under this License.
+      </listitem>
+      <listitem>Limitation of Liability. In no event and under no legal theory,
+        whether in tort (including negligence), contract, or otherwise,
+        unless required by applicable law (such as deliberate and grossly
+        negligent acts) or agreed to in writing, shall any Contributor be
+        liable to You for damages, including any direct, indirect, special,
+        incidental, or consequential damages of any character arising as a
+        result of this License or out of the use or inability to use the
+        Work (including but not limited to damages for loss of goodwill,
+        work stoppage, computer failure or malfunction, or any and all
+        other commercial damages or losses), even if such Contributor
+        has been advised of the possibility of such damages.
+      </listitem>
+      <listitem>Accepting Warranty or Additional Liability. While redistributing
+        the Work or Derivative Works thereof, You may choose to offer,
+        and charge a fee for, acceptance of support, warranty, indemnity,
+        or other liability obligations and/or rights consistent with this
+        License. However, in accepting such obligations, You may act only
+        on Your own behalf and on Your sole responsibility, not on behalf
+        of any other Contributor, and only if You agree to indemnify,
+        defend, and hold each Contributor harmless for any liability
+        incurred by, or claims asserted against, such Contributor by reason
+        of your accepting any such warranty or additional liability.
+      </listitem>
+    </orderedlist>
+    <para>END OF TERMS AND CONDITIONS</para>
+  </simplesect>
+  <simplesect><title>APPENDIX: How to apply the Apache License to your work.</title>
+    <para>To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+    </para>
+    <example>
+      <para>Copyright [yyyy] [name of copyright owner]</para>
+      <para>Licensed under the Apache License, Version 2.0 (the "License");
+        you may not use this file except in compliance with the License.
+        You may obtain a copy of the License at
+        <ulink url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>
+		Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+      </para>
+    </example>
+  </simplesect>
+</appendix>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/marshalling.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/marshalling.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/marshalling.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,672 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<sect1><title>Marshalling objects</title>
+<para>This section describes the various ways of marshalling JaxMe objects and
+  how to configure the marshalling process. Note, that this section uses both
+  methods and features, which are specified by JAXB and others, which are
+  proprietary to JaxMe. Explicit remarks will tell you about the latter,
+  so that you are still able to write 100% portable code.</para>
+
+  <sect2><title>Marshaller methods</title>
+    <para>The following methods are specified by JAXB. We'll present each method,
+      followed by a small piece of example code.</para>
+      <variablelist><title>Marshaller methods</title>
+        <varlistentry><term><function>public void marshal(Object, OutputStream) throws JAXBException</function></term>
+          <listitem>
+          	<para>Marshals the object into the given <classname>java.io.OutputStream</classname>.</para>
+          	<example><title>Marshalling into an OutputStream</title>
+          	  <programlisting>
+    public void writeToFile(
+                            JAXBContext pContext, 
+                            Object pObject, 
+                            String pFileName)
+                                throws  JAXBException, 
+                                        IOException {
+        
+        java.io.FileOutputStream fos = new FileOutputStream(pFileName);
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.marshal(pObject, fos);
+
+        fos.close();
+    }
+          	  </programlisting>
+          	</example>
+          	<para>The important thing to note in our case is the use of an encoding.
+          	  Depending on the encoding, the <classname>Marshaller</classname> will convert
+          	  characters (16 bit entities) into bytes (8 bit entities). The encoding may
+          	  also have influence on the marshallers decision, which characters to escape
+          	  using <token>&amp;#ddd;</token> or not.</para> 
+          </listitem>
+        </varlistentry>
+
+        <varlistentry><term><function>public void marshal(Object, Writer) throws JAXBException</function></term>
+          <listitem>
+          	<para>Marshals the object into the given <classname>java.io.Writer</classname>.</para>
+          	<example><title>Marshalling into a Writer</title>
+          	  <programlisting>
+    public void writeToFile(
+                            JAXBContext pContext, 
+                            Object pObject, 
+                            String pFileName)
+                                throws 
+                                        JAXBException, 
+                                        IOException {
+                                        
+        java.io.FileWriter fw = new FileWriter(pFileName);
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.marshal(pObject, fw);
+
+        fw.close();
+    }
+          	  </programlisting>
+          	</example>
+          	<para>This example is almost equivalent to the previous example with an <classname>OutputStream</classname>
+          	  as the target. In practice, the result may be slightly different anyways, for example, because the
+          	  <classname>Marshaller</classname> may choose a different set of characters to escape.</para> 
+          	<example><title>Marshalling into a <classname>String</classname></title>
+          	  <programlisting>
+    public String asString(
+                            JAXBContext pContext, 
+                            Object pObject)
+                                throws 
+                                    JAXBException {
+                                    
+        java.io.StringWriter sw = new StringWriter();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.marshal(pObject, sw);
+        
+        return sw.toString();
+    }
+          	  </programlisting>
+          	</example>
+          	<para>The example shows, how to convert a JaxMe object into a <classname>String</classname>. Note
+          	  that the use of an encoding still applies, although there occurs no conversion from characters into
+          	  bytes. (In the former example using the <classname>FileWriter</classname> there has been an implicit
+          	  conversion, because any file is in fact a byte stream.) However, the <classname>Marshaller</classname>
+          	  may still choose to escape characters or not.</para>
+          </listitem>
+        </varlistentry>
+
+        <varlistentry><term><function>public void marshal(Object, org.w3c.dom.Node) throws JAXBException</function></term>
+          <listitem>
+            <para>This method is used to convert a JaxMe object into a DOM tree. An instance
+              of <classname>org.w3c.dom.Element</classname> will be created and appended to the given node.
+              <note>The <classname>node</classname> must be ready to accept an element as a child.
+                Suitable nodes are, for example, documents, document fragments, or elements.</note>
+              As an example, we'll demonstrate how to convert the JaxMe object into an instance
+              of <classname>org.w3c.dom.Document</classname>.</para>
+            <example>
+              <programlisting>
+    public Document asDOMDocument(
+                                    JAXBContext pContext, 
+                                    Object pObject,
+                                    javax.xml.parsers.DocumentBuilderFactory pFactory)
+                                        throws 
+                                            JAXBException, 
+                                            javax.xml.parsers.ParserConfigurationException {
+                                            
+        org.w3c.dom.Document result = pFactory.newDocumentBuild().newDocument();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.marshal(pObject, result);
+        
+        return result;
+    }
+              </programlisting>
+            </example>
+            <para>Note, that no encoding issues arise in this example, because the DOM tree
+              is an abstract representation of the XML documents, much like JaxMe objects.
+              However, the same issues are still to be applied, if you serialize the DOM tree
+              into an <classname>OutputStream</classname> or <classname>Writer</classname>.</para>
+          </listitem>
+        </varlistentry>
+
+		<varlistentry><term><function>public void marshal(Object, org.xml.sax.ContentHandler) throws JAXBException</function></term>
+		  <listitem>
+		    <para>This method is by far the most powerfull of all the marshaller methods: A ContentHandler
+		      is in fact just a generic XML processor, implemented as an event handler. In the case of
+		      JaxMe all the other marshalling methods are just thin wrappers around this one: XML serialization
+		      is implemented by the <classname>XMLWriter</classname>, which is just an extension of the
+		      <classname>ContentHandler</classname>. As an example, we'll demonstrate how to transform a
+		      JaxMe object using an XSL stylesheet, writing the result into an <classname>OutputStream</classname>:
+		      </para>
+		    <example><title>Transformation of a JaxMe object using an XSL stylesheet</title>
+		      <programlisting>
+	public void transformToFile(JAXBContext pContext, 
+                                Object pObject,
+	                            TransformerFactory pFactory, 
+                                String pStylesheetFileName,
+	                            String pOutputFileName)
+                                    throws 
+                                        JAXBException, 
+                                        TransformerConfigurationException {
+                                        
+          javax.xml.transform.Source stylesheetSource =
+                        new javax.xml.transform.StreamSource(
+                                    new java.io.File(pStylesheetFileName));
+                                    
+          javax.xml.transform.Result outputResult =
+                        new javax.xml.transform.StreamResult(
+                                    new java.io.File(pOutputFileName));
+                                    
+          javax.xml.transform.sax.TransformerHandler handler =
+                    ((SAXTransformerFactory) pFactory).newTransformerHandler(stylesheetSource);
+                    
+          handler.setResult(outputResult);
+          handler.getTransformer().setOutputProperty("output.encoding", "UTF-8");
+          
+          Marshaller marshaller = pContext.createMarshaller();
+          marshaller.marshal(pObject, handler);
+    }
+		      </programlisting>
+		    </example>
+		    <note>
+		      <para>The SAX ContentHandler receives an abstract representation of the JaxMe object. So there's no
+		        need to set the <classname>Marshaller</classname>'s encoding. This is the same as in the
+		        DOM example.</para>
+		      <para>However, the above example contains in fact two transformations: The first one is the
+		        stylesheet transformation, performed by the <varname>transformerHandler</varname>.
+		        But there is another, implicit, transformation, which the
+		        <varname>transformerHandler</varname> also performs, because we have choosen an
+		        instance of <classname>StreamResult</classname> as the transformers destination. In other
+		        words, its the <classname>Transformer</classname> who needs to know the desired encoding and not the
+		        <classname>Marshaller</classname>. That's why we set the stylesheet parameter
+		        <token>output.encoding</token>.</para>
+		    </note>
+		  </listitem>
+		</varlistentry>
+
+        <varlistentry><term><function>public void marshal(Object, javax.xml.transform.Result) throws JAXBException</function></term>
+          <listitem>
+            <para>This marshalling method is a generalization of the methods we've seen so far. An instance
+              of <classname>Result</classname> is an abstraction of the marshalling destination. Concrete
+              implementations are the <classname>StreamResult</classname> (writing to an
+              <classname>OutputStream</classname> or <classname>Writer</classname>), the
+              <classname>DOMResult</classname> (creating a DOM tree), and the <classname>SAXResult</classname>,
+              which fires <acronym>SAX</acronym> events into a <classname>ContentHandler</classname>.</para>
+            <para>In theory, a <classname>Result</classname> can encapsulate arbitrary destinations. In
+              practice one is restricted to the above standard cases, because the <classname>Result</classname>
+              has no useful methods at all. In other words, a new implementation can only be used, if all
+              users of the <classname>Result</classname> know how to deal with it. In our case the users
+              include <application>JaxMe</application>.</para>
+            <para>The above limitations are best described, if we use the <application>JaxMe</application>
+              implementation of the method as an example:</para>
+            <example><title><application>JaxMe</application>'s implementation of the <classname>Result</classname>
+              destination</title>
+              <programlisting>
+    public void marshal(Object pObject, Result pResult) 
+                            throws JAXBException {
+                            
+        if (pResult instanceof SAXResult) {
+        
+            ContentHandler ch = ((SAXResult) pResult).getHandler();
+            if (ch == null) {
+            
+                throw new MarshalException("The SAXResult doesn't have its ContentHandler set.");
+            }
+            marshal(pObject, ch);
+            
+        } else if (pResult instanceof StreamResult) {
+        
+            StreamResult sr = (StreamResult) pResult;
+            Writer w = sr.getWriter();
+            if (w == null) {
+            
+                OutputStream s = sr.getOutputStream();
+                if (s == null) {
+                
+                    throw new MarshalException(
+                        "The StreamResult doesn't have its Writer or OutputStream set.");
+                }
+                marshal(pObject, s);
+                
+            } else {
+            
+                marshal(pObject, w);
+            }
+        } else if (pResult instanceof DOMResult) {
+        
+            Node node = ((DOMResult) pResult).getNode();
+            if (node == null) {
+            
+                throw new MarshalException("The DOMResult doesn't have its Node set.");
+            }
+            marshal(pObject, node);
+    
+        } else {
+        
+            throw new MarshalException(
+                "Unknown type of Result: " + pResult.getClass().getName() +
+                ", only SAXResult, StreamResult and DOMResult are supported.");
+        }
+    }
+              </programlisting>
+              </example>
+            <para>In other words, the method is implemented as a thin wrapper around the
+              others we've seen so far. (Funny enough, it would have been possible to go the
+              other way and implement all others as wrappers around this one. However, that
+              would require the presence of an XSLT implementation at runtime and most
+              possibly quite inefficient.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+  </sect2>
+
+  <sect2><title>Marshaller properties</title>
+    <para>In the previous section we've already seen how to configure the <classname>Marshaller</classname>'s
+      encoding by setting a <token>property</token>. In this section we'll present a complete list of all
+      the properties supported by the <application>JaxMe</application> <classname>Marshaller</classname>.
+      </para>
+	<sect3><title><acronym>JAXB</acronym> standard <classname>Marshaller</classname> properties</title>
+	  <para>The following properties are part by the <acronym>JAXB</acronym> specification. In other
+	    words: You are safe to use them with any <acronym>JAXB</acronym> compliant implementation,
+	    including <application>JaxMe</application>. Whenever possible, we recommend to use only this
+	    properties and no others.</para>
+	  <variablelist><title><acronym>JAXB</acronym> standard <classname>Marshaller</classname> properties</title>
+	    <varlistentry>
+	      <term><token>jaxb.encoding</token></term>
+	      <term><classname>Marshaller</classname>.<constant>JAXB_ENCODING</constant></term>
+	      <listitem>
+	        <para>As we have already seen, this property specifies the encoding used by the
+	          <classname>Marshaller</classname>, if applicable. The encoding is used to determine
+	          <itemizedlist>
+	            <listitem>when a character will be escaped using the notation &amp;#ddd; and</listitem>
+	            <listitem>if the method <function>marshal(Object, OutputStream)</function> is used,
+	              how the character is converted into bytes</listitem>
+	          </itemizedlist></para>
+	        <para>For example, if we have the encoding <constant>ISO-8859-1</constant> (also known as
+	          <token>Latin-1</token>), which is mainly used in the U.S. and western europe (Great
+	          Britain, France, Germany, ...) then the <classname>Marshaller</classname> knows, that
+	          no other characters that the character set should be limited to the Unicode points
+	          0..255. In other words, all other characters will be escaped. The <token>Latin-1</token>
+	          characters, however, will be passed through to the <classname>Writer</classname>, or
+	          <classname>OutputStream</classname>, because they are immediately mapped to the
+	          corresponding bytes.</para>
+	      </listitem>
+	    </varlistentry>
+
+	    <varlistentry>
+	      <term><token>jaxb.formatted.output</token></term>
+	      <term><classname>Marshaller</classname>.<constant>JAXB_FORMATTED_OUTPUT</constant></term>
+	      <listitem>
+	        <para>By default, any <classname>Marshaller</classname> will create formatted output,
+	          when marshalling to an <classname>OutputStream</classname> or <classname>Writer</classname>.
+	          In other words, the created output will look roughly like the following:
+	        <programlisting>
+<![CDATA[
+<Person>
+  <FullName>
+    <FirstName>Jochen</FirstName>
+    <SurName>Wiedmann</SurName>
+  </FullName>
+</Person>
+]]>
+	        </programlisting>
+	        As opposed to unformatted output:
+	        <programlisting>
+<![CDATA[
+<Person><FullName><FirstName>Jochen</FirstName><SurName>Wiedmann</SurName></FullName></Person>
+]]>
+	        </programlisting>
+	        The following example turns off the default handling and creates a String containing
+	        unformatted XML:</para>
+	        <example><title>Creating unformatted XML</title>
+              <programlisting>
+    public String asUnformattedString(
+                                JAXBContext pContext, 
+                                Object pObject, 
+                                String pFileName)
+                                    throws 
+                                        JAXBException {
+                                        
+        java.io.StringWriter sw = new StringWriter();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+        marshaller.marshal(pObject, sw);
+        
+        return sw.toString();
+    }
+                </programlisting>
+	          </example>
+	      </listitem>
+	    </varlistentry>
+	  </variablelist>
+	  </sect3>
+
+	  <sect3><title><application>JaxMe</application> specific <classname>Marshaller</classname>properties</title>
+	    <warning>The following properties must not be used for portable applications, because they are
+	      proprietary to <application>JaxMe</application>.</warning>
+		<variablelist><title><application>JaxMe</application> specific <classname>Marshaller</classname>properties</title>
+          <varlistentry>
+            <term><token>jaxme.datatype.converter</token></term>
+            <term><classname>JMControllerImpl</classname>.<constant>JAXME_DATATYPE_CONVERTER</constant></term>
+            <listitem>
+              <para>The <classname>javax.xml.bind.DatatypeConverterInterface</classname> is used by
+                <acronym>JAXB</acronym> implementations to convert various data types into strings
+                and vice versa. For example, there is a method <function>parseInt(String)</function>,
+                converting the given string into a primitive integer. Likewise, there is a reverse
+                method <function>printInt(int)</function>, converting the same integer back into a
+                string. The various "parse" methods are used by the <classname>Unmarshaller</classname>
+                and the "print" methods are used by the <classname>Marshaller</classname>.</para>
+              <para>The datatype converter is accessible for two reasons: First of all, you need one
+                when writing custom parse and print methods (as specified by the
+                <token>jaxb:property/jaxb:conversion</token> tags in the schema). In that case you
+                can use a datatype converter by invoking the static methods of the class
+                <classname>DatatypeConverter</classname>, which is internally using a single, global
+                instance of <classname>DatatypeConverterInterface</classname>.</para>
+              <para>In the special case of <application>JaxMe</application>, however, you are by no
+                means restricted to the global instance. In contrary, any <application>JaxMe</application>
+                <classname>Marshaller</classname> or <classname>Unmarshaller</classname> holds an
+                internal instance, by default the global instance from
+                <classname>DatatypeConverter</classname>.</para>
+              <para>The advantage is, that you may customize how documents marshalled by JaxMe may
+                look like. As an example, we'll show how to customize the look of the data type
+                <token>xs:datetime</token>. The XML Schema specification requests, that timestamps
+                are marshalled as <token>yyyy-MM-ddThh:mm:ss</token>, which only few people will
+                like. Additionally the specification requires that timestamps are given in UTC
+                time, not local time.</para>
+              <para>The specification does so for good reason: Timezone and Locale issues are eliminated.
+                If your XML instances conform to the XML Schema format, it is most likely that you won't
+                have interoperability problems with foreign software. Fact is, however, that
+                not all of us are working in a multinational environment and prefer human readable
+                formats and local time.</para>
+              <example><title>Using a custom datatype converter</title>
+                <programlisting>
+    // Create a subclass of the JaxMe datatype converter, overriding its parseDateTime() and
+    // printDateTime() methods.
+    public class MyDatatypeConverter extends org.apache.ws.jaxme.impl.DatatypeConverterImpl {
+
+        public Calendar parseDateTime(String arg0) {
+        
+            DateFormat df = DateFormat.getDateTimeInstance();
+            Calendar cal = Calendar.getInstance();
+            try {
+            
+                cal.setTime(df.parse(arg0));
+                
+            } catch (ParseException e) {
+            
+                if (df instanceof SimpleDateFormat) {
+                
+                    SimpleDateFormat sdf = (SimpleDateFormat) df;
+                    throw new IllegalArgumentException(
+                        "Failed to parse dateTime " + arg0 +
+                        " with pattern " + sdf.toPattern());
+                } else {
+            
+                    throw new IllegalArgumentException("Failed to parse dateTime " + arg0);
+                }
+            }
+            return cal;
+        }
+        
+        public String printDateTime(Calendar arg0) {
+        
+            return DateFormat.getDateTimeInstance().format(arg0.getTime());
+        }
+    }
+
+
+    // Convert a JaxMe object into a String, using the above converter
+    public String asString(JAXBContext pContext, Object pObject)
+                                throws JAXBException {
+                                                
+        java.io.StringWriter sw = new StringWriter();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.setProperty(
+                                JMControllerImpl.JAXME_DATATYPE_CONVERTER, 
+                                new MyDatatypeConverter());
+        marshaller.marshal(pObject, sw);
+        
+        return sw.toString();
+    }
+                </programlisting>
+              </example>
+              <warning>The above example may cause problems, because it depends on a suitable implementation
+                of the local date format. For example, in some asiatic locales, the default format will
+                contain local characters. The effect is, that you'll need to specify a proper encoding.
+                <token>UTF-8</token> is always the recommended choice.
+              </warning>
+            </listitem>
+          </varlistentry>
+
+          <varlistentry>
+		    <term><token>jaxme.indentation.separator</token></term>
+		    <term><classname>JMMarshallerImpl</classname>.<constant>JAXME_INDENTATION_SEPARATOR</constant></term>
+		    <listitem>
+		      <para>This property is used in conjunction with formatted output. If formatted output is
+		        turned on, it contains the string which is used as a line terminator. The property is
+		        ignored, if formatted output is turned off or marshalling to a <acronym>DOM</acronym>
+		        tree or <acronym>SAX</acronym> <classname>ContentHander</classname> occurs.</para>
+		      <para>The default property value is <token>Line Feed</token> (<acronym>ASCII</acronym> 10,
+		        or <token>\n</token>), which is
+		        the standard on Linux or Unix. On Windows the standard is <token>Carriage Return</token>,
+		        followed by a <token>Line Feed</token> (<acronym>ASCII</acronym> 13 and 10, or
+		        <token>\r\n</token>). Rumours are, they are even using a single <token>Carriage Return</token>
+		        on some Apple Macintosh boxes.</para>
+		      <para>If you want to see the problem live, just take a file with Unix line terminators
+		        and open it in the Windows application <application>Notepad</application>. No matter,
+		        which version of Windows you choose, it remains the same after 20 years of development:
+		        You'll see a text file containing a single line and where you'd expect the lines being
+		        splitted, the editor will show you black boxes only. But rumbling doesn't help, we've got
+		        to live with it.</para>
+		      <para>The following example shows how to turn on Windows line terminators:</para>
+	        <example><title>Turning on Windows line terminators</title>
+              <programlisting>
+    public String asUnformattedString(
+                                        JAXBContext pContext, 
+                                        Object pObject, 
+                                        String pFileName)
+                                            throws JAXBException {
+                                            
+        java.io.StringWriter sw = new StringWriter();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.setProperty(JMMarshallerImpl.JAXME_INDENTATION_STRING, "\r\n");
+        marshaller.marshal(pObject, sw);
+        
+        return sw.toString();
+    }
+                </programlisting>
+	          </example>
+		      
+		        
+		    </listitem>
+          </varlistentry>
+
+		  <varlistentry>
+		    <term><token>jaxme.indentation.string</token></term>
+		    <term><classname>JMMarshallerImpl</classname>.<constant>JAXME_INDENTATION_STRING</constant></term>
+		    <listitem>
+		      <para>This property is used in conjunction with formatted output. If formatted output is
+		        turned on, it contains the string which is used to indent one element: By default "  " (two
+		        blanks). The property is ignored, if formatted output is turned off or when marshalling
+		        to a <acronym>DOM</acronym> tree or <acronym>SAX</acronym> <classname>ContentHandler</classname>
+		        occurs.</para>
+		      <para>To demonstrate the effect, we'll show two example documents. First an instance with
+		        default indentation:
+		        <programlisting>
+<![CDATA[
+<Person>
+  <FullName>
+    <FirstName>Jochen</FirstName>
+    <SurName>Wiedmann</SurName>
+  </FullName>
+</Person>
+]]>
+                </programlisting>
+                If we set the indentation string to "    " (four blanks), we'll get
+		        <programlisting>
+<![CDATA[
+<Person>
+    <FullName>
+        <FirstName>Jochen</FirstName>
+        <SurName>Wiedmann</SurName>
+    </FullName>
+</Person>
+]]>
+                </programlisting>
+              </para>
+		    </listitem>
+		  </varlistentry>
+
+		  <varlistentry><term><token>jaxme.private.</token></term>
+		    <term><classname>JMControllerImpl</classname>.<constant>JAXME_PRIVATE_</constant></term>
+		    <listitem>
+		       <para>When writing custom code for formatting or parsing element or attribute values,
+		         you will most probably find at any time, that you wish to access data, which isn't
+		         available by default. In most cases you have the data, when invoking the
+		         <classname>Marshaller</classname> but not inside the formatter or parser.
+		         A typical example might be, that you want to localize the resulting XML
+		         document by using a resource bundle.</para>
+		       <para>The <application>JaxMe</application> <classname>Marshaller</classname> allows
+		         to set arbitrary, application specific properties, but only if they are prefixed
+		         with <token>jaxme.private.</token>. The idea is that an unknown property name
+		         is most probably just a typo or a similar problem and it is better to throw
+		         an exception to let the programmer know that there's something wrong. However,
+		         if the property name is prefixed with <token>jaxme.private.</token>, the
+		         <application>JaxMe</application> user advises, that "this unknown property is
+		         fine".</para>
+		       <warning>Custom property values are arbitrary. However, you should not attempt to
+		         distinguish the between the cases <token>null</token> and missing, because the
+		         JAXB specification has nothing like a collections method
+		         <function>contains(Object)</function>.</warning>
+		    </listitem>
+		  </varlistentry>
+
+          <varlistentry><term><token>jaxme.xml.declaration</token></term>
+            <term><classname>JMMarshallerImpl</classname>.<constant>JAXME_XML_DECLARATION</constant></term>
+            <listitem>
+              <para>When writing to an <classname>OutputStream</classname> or <classname>Writer</classname>,
+                it is likely that you want your resulting XML document to have an XML declaration like
+                <programlisting>
+    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
+                </programlisting>
+                By default JaxMe does not create such a declaration, because that would make it difficult
+                to embed the resulting XML into a larger document.</para>
+              <para>An XML declaration is particularly important, if you use another encoding than
+                <constant>UTF-8</constant>. In that case you should consider a declaration as
+                mandatory.</para>
+              <para>The property has no effect, when marshalling to DOM trees, or SAX handlers.</para>
+              <example><title>Enabling an XML declaration</title>
+                <programlisting>
+    // Convert a JaxMe object into a String, using the above converter
+    public String asString(JAXBContext pContext, Object pObject)
+                                                throws JAXBException {
+                                                
+        java.io.StringWriter sw = new StringWriter();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.TRUE);
+        marshaller.marshal(pObject, sw);
+        
+        return sw.toString();
+    }
+                </programlisting>
+              </example>
+            </listitem>
+          </varlistentry>
+
+		  <varlistentry><term><constant>jaxme.xml.writer</constant></term>
+		    <term><application>JMMarshallerImpl</application>.<constant>JAXME_XML_WRITER</constant></term>
+		    <listitem>
+		      <para>If the above properties still don't satisfy your needs, this property is your
+		        friend. It allows to take complete control on the created XML document, when
+		        marshalling to an <classname>OutputStream</classname> or <classname>Writer</classname>.
+		        (It takes no effect otherwise.)</para>
+		      <para>The property value is an instance of <classname>java.lang.Class</classname>
+		        implementing <classname>org.apache.ws.jaxme.XMLWriter</classname>, which is in turn
+		        extending <classname>org.xml.sax.ContentHandler</classname>. That means, that you
+		        can do arbitrary things, including use of an XSLT stylesheet and stuff like that.</para>
+		      <para><application>JaxMe</application> comes with three ready-to-use implementations:
+		        <variablelist>
+		          <varlistentry><term><classname>org.apache.ws.jaxme.impl.XMLWriterImpl</classname></term>
+		            <listitem>
+		              <para>This is the default implementation, suitable for any encoding and Java
+		                platform. It is very simple: It is in fact using the <token>US-ASCII</token>
+		                encoding, escaping all Unicode points above 126.</para>
+		            </listitem>
+		          </varlistentry>
+		          <varlistentry><term><classname>org.apache.ws.jaxme.impl.CharSetXMLWriter</classname></term>
+		            <listitem>
+		              <para>This implementation is used, whenever you are running Java 1.4 or newer.
+		                It is internally using the class <classname>java.nio.charset.CharsetEncoder</classname>
+		                to determine the Unicode points being escaped.</para>
+		            </listitem>
+		          </varlistentry>
+		          <varlistentry><term><classname>org.apache.ws.jaxme.impl.PassThroughXMLWriter</classname></term>
+		            <listitem>
+		              <para>This implementation does no escaping at all.</para>
+		            </listitem>
+		          </varlistentry>
+		        </variablelist></para>
+		      <para>As an example, we'll write and use and <classname>XMLWriter</classname> which is
+		        escaping the german Umlauts, but no other characters.</para>
+		      <example><title>Implementation of an XMLWriter escaping german Umlauts</title>
+		        <programlisting>
+    public class UmlautXMLWriter extends org.apache.ws.jaxme.impl.XMLWriterImpl {
+      protected boolean canEncode(char c) {
+        switch (c) {
+          case 228:
+          case 246:
+          case 252:
+          case 196:
+          case 214:
+          case 220:
+          case 223:
+            return false;
+          default:
+            return true;
+        }
+      }
+    }
+
+    // Convert a JaxMe object into a String, using the above XMLWriter
+    public String asString(JAXBContext pContext, Object pObject)
+                                                        throws JAXBException {
+                                                        
+        java.io.StringWriter sw = new StringWriter();
+        
+        Marshaller marshaller = pContext.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+        marshaller.setProperty(JMMarshallerImpl.JAXME_XML_WRITER, UmlautXMLWriter.class);
+        marshaller.marshal(pObject, sw);
+        
+        return sw.toString();
+    }
+		        </programlisting>
+		      </example>
+		    </listitem>
+		  </varlistentry>
+		</variablelist>
+        </sect3>
+    </sect2>
+</sect1>

Added: branches/jaxme/upstream/0.5.1/src/documentation/manual/xjctask.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/manual/xjctask.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/manual/xjctask.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<sect1><title>The JaxMe Ant Task</title>
+<para>The JaxMe Ant task was written with the following goals in mind:
+  <itemizedlist>
+    <listitem>To preserve as much compatibility as possible with the JAXB xjc task</listitem>
+    <listitem>To provide access to JaxMe extensions</listitem>
+  </itemizedlist>
+  In other words, if you have existing build scripts using JAXB's xjc, you should
+  be able to convert them to JaxMe with a single switch (by exchanging the
+  class name in the task definition). However, if you like to make use of JaxMe's
+  extensions at a later time, you are free to do so.</para>
+<para>A typical use of the Ant task looks like this:
+  <programlisting><![CDATA[
+    <target name="taskdef">
+      <taskdef name="xjc"
+        classname="org.apache.ws.jaxme.generator.XJCTask"
+        classpathref="generate.class.path"/>
+    </target>
+
+    <target name="generate" depends="taskdef">
+      <xjc schema="schema.xsd" target="build/src">
+        <produces includes="com/acme/*.java"/>
+      </xjc>
+    </target>
+]]></programlisting>
+  </para>
+<para>A target (called "taskdef" above) defines the
+  ant task under a given name ("xjc" in the above example). It is important to remember
+  to include the JaxMe jars in the classpath when defining the task.
+  This task is then called by the source generation target.</para>
+<para>The ant task supports the following attributes:
+  <table><title>Attributes of the JaxMe ant task</title>
+    <tgroup cols="3" colsep="1" rowsep="1" tocentry="1">
+      <thead>
+        <row>
+          <entry>Name</entry>
+          <entry>Description</entry>
+          <entry>Origin</entry>
+          <entry>Required/Default</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>binding</entry>
+          <entry><para>Name of an external binding file being applied to the schema file.
+            This attribute and the nested &lt;binding&gt; element are mutually exclusive.</para>
+            <para>As of this writing, external schema bindings are unsupported by JaxMe.
+              A BuildException is thrown, if you use this attribute anyways.</para></entry>
+          <entry>JAXB XJC</entry>
+          <entry>No</entry>
+        </row>
+		<row>
+		  <entry>extension</entry>
+		  <entry><para>If this attribute has the value "true", then the XJC binding compiler
+		    will run in the extension mode. Otherwise, it will run in the strict conformance mode.</para>
+		    <para>Extension mode indicates that the proprietary "xjc" tags 
+              (specific to the JAXB binding compiler) are accepted.</para></entry>
+          <entry>JAXB XJC</entry>
+		  <entry>No, defaults to "false"</entry>
+		</row>
+        <row>
+          <entry>force</entry>
+          <entry><para>Setting this option to "true" forces the up-to-date check to fail 
+            (and so the nested &lt;produces&gt; elements are ignored).</para>
+            <para>This attribute isn't of much use to the JaxMe user. It is mainly intended
+              for JaxMe developers who want to specify a value from the command line.
+              This is useful when they have updated the schema compiler 
+              and want to run against the old schema with the new version.</para></entry>
+          <entry>JaxMe</entry>
+          <entry>No, defaults to "false"</entry>
+        </row>
+        <row>
+          <entry>package</entry>
+          <entry>Specifies the package name of the generated sources. If this attribute is
+            specified, then it overrides any values specified in the schema bindings.</entry>
+          <entry>JAXB XJC</entry>
+          <entry>No, defaults to values specified in the schema bindings or to a package name
+            derived from the target namespace URI.</entry>
+        </row>
+        <row>
+          <entry>schema</entry>
+          <entry>Name of a schema file being compiled. This attribute and the nested
+            &lt;schema&gt; element are mutually exclusive.</entry>
+          <entry>JAXB XJC</entry>
+          <entry>Yes, unless a nested &lt;schema&gt; element is present</entry>
+        </row>
+        <row>
+          <entry>readonly</entry>
+          <entry>If this attribute has the value "true" then the generated source files
+            will have read-only mode.</entry>
+          <entry>JAXB XJC</entry>
+          <entry>No, defaults to "false"</entry>
+        </row>
+		<row>
+		  <entry>removeOldOutput</entry>
+		  <entry><para>If one or more nested &lt;produces&gt; elements are specified and this attribute is
+            set to "true", then the Ant task will ensure that only generated files will remain. In other
+            words, if you had removed an element named "Foo" from the previous schema version, then the
+            Ant task will remove <filename>Foo.java</filename>.</para>
+            <para>Note, that this behaviour is slightly different from the JAXB ant task "xjc", which
+              removes all files matched by any &lt;produces&gt; element, before running the binding
+              compiler.</para></entry>
+          <entry>JAXB XJC</entry>
+          <entry>No, defaults to "false"</entry>
+		</row>
+        <row>
+          <entry>stackSize</entry>
+          <entry><para>Specifies the thread stack size for the XJC binding compiler (J2SE SDK v1.4
+            or higher). The XJC binding compiler can fail to compile large schemas with
+            StackOverflowError and, in that case, this option can be used to extend the
+            stack size. If unspecified, the default VM size is used. The format is equivalent
+            to the -Xss command-line argument for Sun Microsystems JVM. This value can be
+            specified in bytes (stackSize="2097152"), kilobytes (stackSize="2048kb"),
+            or megabytes (stackSize="2mb").</para>
+            <para>This attribute is ignored by the JaxMe ant task and present for compatibility
+              reasons only. A warning is emitted, if you use it.</para></entry>
+          <entry>JAXB XJC</entry>
+          <entry>No</entry>
+        </row>
+        <row>
+          <entry>resourceTarget</entry>
+          <entry>Specifies the target directory for generating resource files.
+            If required, a package structure is created automatically below
+            the resource target directory. For example, if the "target" attribute
+            has the value "src" and the "package" attribute is "com.acme", then
+            the directory <filename>src/com/acme</filename> will be used.
+          </entry>
+          <entry>JaxMe</entry>
+          <entry>No, defaults to the "target" directory</entry>
+        </row>
+        <row>
+          <entry>target</entry>
+          <entry>Specifies the target directory for generating Java source files.
+            If required, a package structure is created automatically below
+            the resource target directory. For example, if the "target" attribute
+            has the value "src" and the "package" attribute is "com.acme", then
+            the directory <filename>src/com/acme</filename> will be used.</entry>
+          <entry>JAXB XJC</entry>
+          <entry>No, defaults to the current directory</entry>
+        </row>
+        <row>
+          <entry>validating</entry>
+          <entry>Depending on this attributes value, the XML parser used to parse the XML
+            schema file will either be validating or not.</entry>
+          <entry>JaxMe</entry>
+          <entry>No, defaults to "false"</entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </table></para>
+  <para>The ant task also supports the following nested elements:
+    <table><title>Nested elements of the JaxMe ant task</title>
+    <tgroup cols="3" colsep="1" rowsep="1" tocentry="1">
+      <thead>
+        <row>
+          <entry>Name</entry>
+          <entry>Description</entry>
+          <entry>Origin</entry>
+          <entry>Multiplicity</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>arg</entry>
+          <entry><para>This nested element is ignored by the JaxMe ant task and exists for
+            JAXB compatibility only. If this element is present, a warning 
+            will be logged.</para>
+            <para>In the case of JAXB it specifies additional command line arguments being
+              passed to the XJC. For details about the syntax, see the relevant section in
+              the Ant manual.</para>
+            <para>This nested element can be used to specify various options not natively
+              supported in the JAXB xjc Ant task. For example, currently there is no native
+              support for the following xjc command-line options:
+              <itemizedlist>
+                <listitem>-nv</listitem>
+                <listitem>-catalog</listitem>
+                <listitem>-use-runtime</listitem>
+                <listitem>-schema</listitem>
+                <listitem>-dtd</listitem>
+                <listitem>-relaxng</listitem>
+              </itemizedlist></para></entry>
+         <entry>JAXB XJC</entry>
+         <entry>0..Unbounded</entry>
+        </row>
+		<row>
+		  <entry>binding</entry>
+		  <entry><para>Multiple external binding files may be specified. The element syntax is equivalent
+            to a nested &lt;fileset&gt;. Use of a nested &lt;binding&gt; element is
+            mutually exclusive with the use of a "binding" attribute.</para>
+            <para>As of this writing, external schema bindings are unsupported by JaxMe.
+              A BuildException is thrown if this attribute is used.</para></entry>
+          <entry>JAXB XJC</entry>
+          <entry>0..Unbounded</entry>
+		</row>
+		<row>
+		  <entry>classpath</entry>
+		  <entry><para>This nested element specifies the classpath for loading user defined classes.
+		      For example, the schema reader specified by the "schemaReader" nested element may be 
+		      such a type.</para>
+		    <para>The JAXB binding compiler uses this classpath when loading user defined types,
+		      as specified by the &lt;javaType&gt; customization. This is currently not the case
+		      for JaxMe: The type names are simply compiled in without an attempt to actually load
+		      them. This has the advantage that user defined classes may refer to sources which will 
+                      generated.
+		      </para></entry>
+		  <entry>JAXB XJC</entry>
+		  <entry>0..Unbounded</entry>
+		</row>
+		<row>
+		  <entry>depends</entry>
+		  <entry><para>By default the up-to-date check (used by the JaxMe task) considers the specified
+		      schema and binding files only. This is insufficient when auxiliary schema files are included,
+              imported or redefined.</para>
+            <para>The nested &lt;depends&gt; element allows to specify additional files to consider
+              for the up-to-date check. Typically these are the additional schema files.</para>
+            <para>Syntactically the &lt;depends&gt; element specifies a nested &lt;fileset&gt;.</para>
+            </entry>
+          <entry>JAXB XJC</entry>
+          <entry>0..Unbounded</entry>
+		</row>
+		<row>
+		  <entry>produces</entry>
+		  <entry>Specifies the set of files to be created by the JaxMe ant task. These
+		    files are considered as targets for the up-to-date check. The syntax of the &lt;produces&gt;
+            element is equivalent to a nested &lt;fileset&gt;. However, you typically do not
+            need to set the "dir" attribute, because it defaults to the target directory.
+            (Note that the JAXB XJC requires setting the "dir" attribute.)</entry>
+          <entry>JAXB XJC</entry>
+          <entry>0..Unbounded</entry>
+		</row>
+		<row>
+		  <entry>property</entry>
+		  <entry>Sets a property value. These properties may be used to pass configuration
+                  information to the various source generators. For example, the JDBC schema reader uses
+            the options "jdbc.driver", "jdbc.url", "jdbc.user", and "jdbc.password" to
+            configure the database connection. Each property must have attributes "name" (the
+            property name) and "value" (the property value).</entry>
+          <entry>JaxMe</entry>
+          <entry>0..Unbounded</entry>
+		</row>
+        <row>
+          <entry>schema</entry>
+          <entry>Multiple schema files may be compiled in one or more nested &lt;schema&gt;
+            elements. The element syntax is equivalent to a nested &lt;fileset&gt;.
+            Use of a nested &lt;schema&gt; element is mutually exclusive with the use
+            of a "schema" attribute.</entry>
+		  <entry>JAXB XJC</entry>
+          <entry>0..Unbounded</entry>
+        </row>
+        <row>
+          <entry>sgFactoryChain</entry>
+          <entry>If the schema reader is an instance of <classname>JAXBSchemaReader</classname>,
+            then you may add instances of <classname>SGFactoryChain</classname> to
+            the schema generation process. For example, such chains are used to create
+            the persistency layer. The best example is the <classname>JaxMeJdbcSG</classname>,
+            which is able to populate the schema with tables and columns read from a database
+            via JDBC metadata.</entry>
+          <entry>JaxMe</entry>
+          <entry>0..Unbounded</entry>
+        </row>
+        <row>
+          <entry>dtd</entry>
+          <entry>Specifies, that the input files are no instances of XML Schema,
+            but DTD's. The schema reader will use the <classname>DTDParser</classname>
+            to convert the DTD's into instances of XML Schema. If you do use DTD's,
+            you will possibly also set the "targetNamespace" attribute, which
+            specifies a target namespace. (There is no possibility, to specify the
+            target namespace within a DTD.)</entry>
+          <entry>JaxMe; the JAXB RI has a similar possibility by
+            specifying the command line argument "-dtd".</entry>
+          <entry>0..1</entry>
+        </row>
+		<row>
+		  <entry>schemaReader</entry>
+		  <entry>Configures the schema reader to use. Defaults to
+            "org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader", which is the JAXB compliant
+            schema reader. An alternative schema reader is, for example,
+            "org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader" 
+            (a subclass of JAXBSchemaReader with JaxMe specific extensions).</entry>
+          <entry>JaxMe</entry>
+          <entry>0..1</entry>
+		</row>        
+      </tbody>
+    </tgroup>
+    </table>
+  </para>
+
+  <sect2><title>The Up-to-date check</title>
+    <para>By default, the JaxMe ant task will always run the generator and create new files. 
+      When this task is part of a general ant build script, this behaviour will result
+      in new files being generated and recompiled each time the build is run.</para>
+    <para>To achieve greater efficiency, use the nested &lt;produces&gt; and &lt;depends&gt; elements.
+      If one or more &lt;produces&gt; element is specified, then an up-to-date check is performed
+      as follows:
+      <orderedlist>
+        <listitem>If the "force" attribute is set to true, then the up-to-date check fails.</listitem>
+        <listitem>If there are no nested &lt;produces&gt; elements, then the up-to-date check fails.</listitem>
+        <listitem>Otherwise the set of target files will be computed by evaluating all the nested
+          &lt;produces&gt; elements. If either of these nested elements computes an empty set, then
+          the up-to-date check fails.</listitem>
+        <listitem>Otherwise the set of source files will be created by considering the
+          "schema" and "binding" attributes, and the nested &lt;schema&gt;, &lt;binding&gt;, and
+          &lt;depends&gt; elements. If either of the files in the source set is more recent than
+          any of the files in the target set, then the up-to-date check fails.</listitem>
+        <listitem>Otherwise the up-to-date check succeeds.</listitem>
+      </orderedlist></para>
+  </sect2>
+</sect1>

Added: branches/jaxme/upstream/0.5.1/src/documentation/release-0.3.tar.bz2
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/release-0.3.tar.bz2
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/release-0.4.tar.bz2
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/release-0.4.tar.bz2
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/group-logo.gif
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/group-logo.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/icon.png
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/icon.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/jaxme-application-workflow.png
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/jaxme-application-workflow.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/jaxme-compiler-workflow.png
===================================================================
(Binary files differ)


Property changes on: branches/jaxme/upstream/0.5.1/src/documentation/resources/images/jaxme-compiler-workflow.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/jaxme/upstream/0.5.1/src/documentation/skinconf.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/documentation/skinconf.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/documentation/skinconf.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,118 @@
+<?xml version="1.0"?>
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<!--
+Skin configuration file. This file contains details of your project, which will
+be used to configure the chosen Forrest skin.
+-->
+
+<!DOCTYPE skinconfig [
+
+  <!ENTITY % links.att 'name CDATA #REQUIRED'>
+  <!ENTITY % link.att 'name CDATA #REQUIRED href CDATA #REQUIRED'>
+  <!ELEMENT skinconfig (disable-search?, disable-compliance-links?, searchsite-domain?, searchsite-name?,
+  project-name, project-url, project-logo, group-name?, group-url?, group-logo?,
+  host-url?, host-logo?, year?, vendor?, trail?, credits?)*>
+  <!ELEMENT credits (credit*)>
+  <!ELEMENT credit (name, url, image?, width?, height?)>
+  <!-- id uniquely identifies the tool, and role indicates its function -->
+  <!ATTLIST credit id   CDATA #IMPLIED
+                   role CDATA #IMPLIED>
+  <!ELEMENT disable-search (#PCDATA)>
+  <!ELEMENT disable-compliance-links (#PCDATA)>
+  <!ELEMENT searchsite-domain (#PCDATA)>
+  <!ELEMENT searchsite-name (#PCDATA)>  
+  <!ELEMENT project-name (#PCDATA)>
+  <!ELEMENT project-url (#PCDATA)>
+  <!ELEMENT project-logo (#PCDATA)>
+  <!ELEMENT group-name (#PCDATA)>
+  <!ELEMENT group-url (#PCDATA)>
+  <!ELEMENT group-logo (#PCDATA)>
+  <!ELEMENT host-url (#PCDATA)>
+  <!ELEMENT host-logo (#PCDATA)>
+  <!ELEMENT year (#PCDATA)>
+  <!ELEMENT vendor (#PCDATA)>
+  <!ELEMENT trail (link1, link2, link3)>
+  <!ELEMENT link1 EMPTY>
+  <!-- Seems we can't use param entity refs until this is DTDified -->
+  <!ATTLIST link1 name CDATA #REQUIRED href CDATA #IMPLIED>
+  <!ELEMENT link2 EMPTY>
+  <!ATTLIST link2 name CDATA #REQUIRED href CDATA #IMPLIED>
+  <!ELEMENT link3 EMPTY>
+  <!ATTLIST link3 name CDATA #REQUIRED href CDATA #IMPLIED>
+  <!ELEMENT name (#PCDATA)>
+  <!ELEMENT url (#PCDATA)>
+  <!ELEMENT image (#PCDATA)>
+  <!ELEMENT width (#PCDATA)>
+  <!ELEMENT height (#PCDATA)>
+  ]>
+
+<skinconfig>
+  <!-- Do we want to disable the Google search box? -->
+  <disable-search>false</disable-search>
+  <disable-compliance-links>false</disable-compliance-links>
+  <searchsite-domain>ws.apache.org/JaxMe/</searchsite-domain>
+  <searchsite-name>JaxMe 2</searchsite-name>  
+
+  <!-- mandatory project logo
+       skin: forrest-site renders it at the top -->
+  <project-name>JaxMe 2</project-name>
+  <project-url>http://ws.apache.org/JaxMe/</project-url>
+  <project-logo></project-logo>
+
+  <!-- optional group logo
+       skin: forrest-site renders it at the top-left corner -->
+  <group-name>JaxMe 2</group-name>
+  <group-url>http://ws.apache.org/jaxme/</group-url>
+  <group-logo>images/group-logo.gif</group-logo>
+
+  <!-- optional host logo (e.g. sourceforge logo)
+       skin: forrest-site renders it at the bottom-left corner -->
+  <!--
+  <host-url>http://sourceforge.net/projects/jaxme</host-url>
+  <host-logo>http://sourceforge.net/sflogo.php?group_id=42590;type=1</host-logo>
+  -->
+
+  <!-- The following are used to construct a copyright statement -->
+  <year>2003-2004</year>
+  <vendor>Apache Software Foundation</vendor>
+
+  <!-- Some skins use this to form a 'breadcrumb trail' of links. If you don't
+  want these, set the attributes to blank. The DTD purposefully requires them.
+  -->
+  <trail>
+    <link1 name="" href=""/>
+    <link2 name="" href=""/>
+    <link3 name="" href=""/>
+  </trail>
+
+  <!-- Credits are typically rendered as a set of small clickable images in the
+  page footer -->
+  <credits>
+    <credit>
+      <name>Built with Apache Forrest</name>
+      <url>http://xml.apache.org/forrest/</url>
+      <image>images/built-with-forrest-button.png</image>
+      <width>88</width>
+      <height>31</height>
+    </credit>
+    <!-- A credit with @role='pdf' will have its name and url displayed in the
+    PDF page's footer. -->
+  </credits>
+</skinconfig>

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.Element;
+import javax.xml.namespace.QName;
+
+
+/** <p>JaxMe variant of {@link javax.xml.bind.Element}, providing
+ * additional access to namespace URI and local name.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JMElement extends Element {
+  /** <p>Returns the namespace URI and local name.</p>
+   */
+  public QName getQName();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMManager.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMManager.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMManager.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.impl.JMSAXDriver;
+import org.apache.ws.jaxme.impl.JMSAXElementParser;
+import org.xml.sax.SAXException;
+
+
+/** <p>A JMManager controls the object factory (aka JAXBContext)
+ * for a given document type. The document type is both identified
+ * by its QName and its interface, which is extending JMElement.</p>
+ */
+public interface JMManager {
+  /** <p>Returns a property value, which is used to configure
+   * the manager. The property value is set in the configuration
+   * file.</p>
+   *
+   * @param pName The property name
+   * @return pValue The property value; null, if the property is not
+   *   set.
+   */
+  public String getProperty(String pName);
+
+  /** <p>Returns the {@link org.apache.ws.jaxme.impl.JAXBContextImpl},
+   * that created this manager.</p>
+   */
+  public JAXBContextImpl getFactory();
+
+  /** <p>Returns the QName of the document type that this
+   * Manager controls.</p>
+   */
+  public QName getQName();
+
+  /** Returns the interface matching the document type.
+   * Usually, this is a  a subinterface of
+   * {@link JMElement}.
+   * However, for support of POJO's, we should not depend
+   * on this.
+   */
+  public Class getElementInterface();
+
+  /** Returns an instance of the element class. Same as
+   * {@link #getElementS()}, except that it throws a
+   * different exception.
+   */
+  public Object getElementJ() throws JAXBException;
+
+  /** Returns an instance of the element class. Same as
+   * {@link #getElementJ()}, except that it throws a
+   * different exception.
+   */
+  public Object getElementS() throws SAXException;
+
+  /** Returns the document types handler class.
+   */
+  public Class getHandlerClass();
+
+  /** Returns an instance of the document types handler class.
+   */
+  public JMSAXElementParser getHandler() throws SAXException;
+
+  /** Returns the document types driverr class.
+   */
+  public Class getDriverClass();
+
+  /** Returns an instance of the document types driver class.
+   */
+  public JMSAXDriver getDriver() throws SAXException;
+
+  /** <p>Returns the persistency class. The persistency class
+   * must be able to store documents in a database, update,
+   * delete or retrieve them.</p>
+   */
+  public Class getPmClass();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMMarshaller.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMMarshaller.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMMarshaller.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.bind.Marshaller;
+
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+
+
+/** <p>JaxMe's private extension of a JAXB Marshaller.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JMMarshaller.java 231785 2004-02-17 00:39:59 +0100 (Di, 17 Feb 2004) jochen $
+ */
+public interface JMMarshaller extends Marshaller {
+  /** <p>Sets the JAXBContext that created this marshaller.</p>
+   */
+  public void setJAXBContextImpl(JAXBContextImpl pContext);
+  /** <p>Returns the JAXBContext that created this marshaller.</p>
+   */
+  public JAXBContextImpl getJAXBContextImpl();
+  /** <p>Returns the {@link javax.xml.bind.DatatypeConverterInterface}.</p>
+   */
+  public DatatypeConverterInterface getDatatypeConverter();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMPI.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMPI.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMPI.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+/** <p>The JaxMe variant of a processing instruction.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JMPI.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface JMPI {
+  /** <p>Returns the PI's target.</p>
+   */
+  public String getTarget();
+  /** <p>Returns the PI's data.</p>
+   */
+  public String getData();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshaller.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshaller.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshaller.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+
+
+/** <p>JaxMe's private extension of a JAXB Unmarshaller.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JMUnmarshaller.java 231785 2004-02-17 00:39:59 +0100 (Di, 17 Feb 2004) jochen $
+ */
+public interface JMUnmarshaller extends Unmarshaller {
+  /** <p>Sets the JAXBContext that created this unmarshaller.</p>
+   */
+  public void setJAXBContextImpl(JAXBContextImpl pContext);
+  /** <p>Returns the JAXBContext that created this unmarshaller.</p>
+   */
+  public JAXBContextImpl getJAXBContextImpl();
+  /** <p>Returns the unmarshallers {@link javax.xml.bind.DatatypeConverterInterface DatatypeConverter}.</p>
+   */
+  public DatatypeConverterInterface getDatatypeConverter();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshallerHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshallerHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMUnmarshallerHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.bind.UnmarshallerHandler;
+
+import org.apache.ws.jaxme.util.NamespaceSupport;
+import org.xml.sax.Locator;
+
+
+/** JaxMe's private extension of
+ * {@link javax.xml.bind.UnmarshallerHandler}.
+ */
+public interface JMUnmarshallerHandler extends UnmarshallerHandler {
+    /** Returns the {@link JMUnmarshaller}, which created this
+     * handler.
+     */
+    public JMUnmarshaller getJMUnmarshaller();
+
+	/** Sets an observer, which will be notified, when the element has
+	 * been parsed.
+	 */
+	public void setObserver(Observer pObserver);
+
+	/** Returns the observer, which will be notified, when the element has
+	 * been parsed.
+	 */
+	public Observer getObserver();
+
+	/** Returns an instance of {@link NamespaceSupport}.
+	 */
+	public NamespaceSupport getNamespaceSupport();
+
+	/** Returns an instance of {@link Locator}, if it has
+	 * been set, or null.
+	 * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
+	 */
+	public Locator getDocumentLocator();
+
+	/** Returns an instance of {@link DatatypeConverterInterface}.
+	 */
+	public DatatypeConverterInterface getDatatypeConverter();
+
+	/** Returns the current level of nested elements.
+	 */
+	public int getLevel();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMValidator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMValidator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/JMValidator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.Validator;
+
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+
+
+/** <p>JaxMe's private extension of a JAXB Validator.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JMValidator.java 231785 2004-02-17 00:39:59 +0100 (Di, 17 Feb 2004) jochen $
+ */
+public interface JMValidator extends Validator {
+  /** <p>Sets the JAXBContext that created this validator.</p>
+   */
+  public void setJAXBContextImpl(JAXBContextImpl pContext);
+  /** <p>Returns the JAXBContext that created this validator.</p>
+   */
+  public JAXBContextImpl getJAXBContextImpl();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observable.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observable.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observable.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+/** <p>An Observable is an object that may be observed by
+ * another object, the Observer. There may be a single
+ * observer only. If you need more, use a multiplexing
+ * observer.</p>
+ * <p>If the observables state changes, it calls the
+ * observers <code>setObservableState()</code> method.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: Observable.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface Observable {
+  /** <p>Sets the Observer.</p>
+   */
+  public void setObserver(Observer pObserver);
+  /** <p>Returns the Observer.</p>
+   */
+  public Observer getObserver();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observer.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observer.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/Observer.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme;
+
+/** <p>An Observer is the corresponding interface to the
+ * <code>Observable</code>: The Observer is watching the
+ * Observable.</p>
+ * <p>If the Observable changes its state, it calls the
+ * Observers <code>setObservableState()</code> method.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: Observer.java 231881 2004-07-23 07:18:09Z jochen $
+ */
+public interface Observer {
+  /** <p>The Observable indicates that its state has
+   * changed. The Observer must inspect the Observable
+   * to detect what exactly has changed.
+   */
+  public void notify(Object pObject);
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PM.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PM.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PM.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBException;
+
+
+/** <p>The <code>persistence manager</code> (or <code>PM</code>
+ * for short) is responsible for reading objects from the
+ * database or storing them into the database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface PM {
+  /** <p>Initializes the PM. Called from the
+   * {@link org.apache.ws.jaxme.impl.JAXBContextImpl} upon initialization.</p>
+   * @param pManager The manager being queried for configuration details.
+   */
+  public void init(JMManager pManager) throws JAXBException;
+
+  /** <p>Returns the manager being queried for configuration details.</p>
+   */
+  public JMManager getManager();
+
+  /** <p>Reads documents matching the given query. For any document
+   * matching, the Observer's notify method is executed with the
+   * matching document as an argument.</p>
+   *
+   * @param pObserver This Observer is notified for any matching document.
+   *   The document is added as an argument.
+   * @param pQuery The query to perform.
+   */
+  public void select(Observer pObserver, String pQuery) throws JAXBException;
+
+  /** <p>Reads documents matching the given query. For any document
+   * matching, the Observer's notify method is executed with the
+   * matching document as an argument.</p>
+   * <p>The query may contain placeholders. If it does, you have
+   * to supply an instance of {@link PMParams} with the placeholder
+   * values. Example:
+   * <pre>
+   *   manager.select("Name = ? and Id = ?",
+   *                  new PMParams().addString("Someone").addInt(4));
+   * </pre></p>
+   *
+   * @param pObserver This Observer is notified for any matching document.
+   *   The document is added as an argument.
+   * @param pQuery The query to perform. May contain placeholders.
+   * @param pPlaceHolderArgs An array of objects or null, if the
+   *   query doesn't contain any placeholders.
+   */
+  public void select(Observer pObserver, String pQuery,
+                      PMParams pPlaceHolderArgs) throws JAXBException;
+
+  /** <p>Returns an iterator to all documents matching the given query.</p>
+   *
+   * @param pQuery The query to perform.
+   */
+  public java.util.Iterator select(String pQuery) throws JAXBException;
+
+  /** <p>Returns an iterator to all documents matching the given query.
+   * The query may contain placeholders. If it does, you have
+   * to supply an instance of {@link PMParams} with the placeholder
+   * values. Example:
+   * <pre>
+   *   manager.select("Name = ? and Id = ?",
+   *                  new PMParams().addString("Someone").addInt(4));
+   * </pre></p>
+   *
+   * @param pQuery The query to perform. May contain placeholders.
+   * @param pPlaceHolderArgs An array of objects or null, if the
+   *   query doesn't contain any placeholders.
+   */
+  public java.util.Iterator select(String pQuery,
+                                    PMParams pPlaceHolderArgs)
+    throws JAXBException;
+
+  /** <p>Inserts the given document into the database.</p>
+   */
+  public void insert(Element element) throws JAXBException;
+
+  /** <p>Updates the given document in the database.</p>
+   */
+  public void update(Element element) throws JAXBException;
+
+  /** <p>Deletes the given document from the database.</p>
+   */
+  public void delete(Element element) throws JAXBException;
+
+  /** <p>Creates a new, empty element.</p>
+   */
+  public Object create() throws JAXBException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme;
+
+import javax.xml.bind.JAXBException;
+
+/** <p>Exception being thrown in case of persistency problems.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class PMException extends JAXBException {
+  /** <p>Creates a new instance of PMException.</p>
+   */
+  public PMException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new instance of PMException.</p>
+   */
+  public PMException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new instance of PMException.</p>
+   */
+  public PMException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new instance of PMException.</p>
+   */
+  public PMException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new instance of PMException.</p>
+   */
+  public PMException(
+    String pMessage,
+    String pErrorCode,
+    Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMParams.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMParams.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/PMParams.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import java.io.Serializable;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+
+/** <p>Implementation of a parameter object for use in
+ * {@link PM#select(Observer, String, PMParams)}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class PMParams implements Serializable {
+  /** <p>A single parameter.</p>
+   */
+  public static class Param {
+    private int type;
+    private Object value;
+    /** <p>Creates a new parameter with the given type and value.</p>
+     */
+    public Param(int pType, Object pValue) {
+      type = pType;
+      value = pValue;
+    }
+    public int getType() { return type; }
+    public Object getValue() { return value; }
+  }
+
+  private List params;
+  private int max, start;
+  private boolean distinct;
+
+  /** <p>Adds a new parameter.</p>
+   */
+  public void addParam(Param pParam) {
+    if (params == null) { params = new ArrayList(); }
+    params.add(pParam);
+  }
+
+  /** <p>Adds a String parameter.</p>
+   */
+  public void addParam(String pParam) {
+    addParam(new Param(Types.VARCHAR, pParam));
+  }
+
+  /** <p>Adds a Long parameter.</p>
+   */
+  public void addParam(Long pParam) {
+    addParam(new Param(Types.BIGINT, pParam));
+  }
+
+  /** <p>Adds a long parameter.</p>
+   */
+  public void addParam(long pParam) {
+    addParam(new Param(Types.BIGINT, new Long(pParam)));
+  }
+
+  /** <p>Adds an Integer parameter.</p>
+   */
+  public void addParam(Integer pParam) {
+    addParam(new Param(Types.INTEGER, pParam));
+  }
+
+  /** <p>Adds an int parameter.</p>
+   */
+  public void addParam(int pParam) {
+    addParam(new Param(Types.INTEGER, new Integer(pParam)));
+  }
+
+  /** <p>Adds a Short parameter.</p>
+   */
+  public void addParam(Short pParam) {
+    addParam(new Param(Types.SMALLINT, pParam));
+  }
+
+  /** <p>Adds a short parameter.</p>
+   */
+  public void addParam(short pParam) {
+    addParam(new Param(Types.SMALLINT, new Short(pParam)));
+  }
+
+  /** <p>Adds a Byte parameter.</p>
+   */
+  public void addParam(Byte pParam) {
+    addParam(new Param(Types.TINYINT, pParam));
+  }
+
+  /** <p>Adds a byte parameter.</p>
+   */
+  public void addParam(byte pParam) {
+    addParam(new Param(Types.TINYINT, new Byte(pParam)));
+  }
+
+  /** <p>Adds a DateTime parameter.</p>
+   */
+  public void addDateTimeParam(Calendar pParam) {
+    addParam(new Param(Types.TIMESTAMP, pParam));
+  }
+
+  /** <p>Adds a VARBINARY parameter.</p>
+   */
+  public void addParam(byte[] pParam) {
+    addParam(new Param(Types.VARBINARY, pParam));
+  }
+
+  /** <p>Adds a Date parameter.</p>
+   */
+  public void addDateParam(Calendar pParam) {
+    addParam(new Param(Types.DATE, pParam));
+  }
+
+  /** <p>Adds a Time parameter.</p>
+   */
+  public void addTimeParam(Calendar pParam) {
+    addParam(new Param(Types.TIME, pParam));
+  }
+
+  /** <p>Sets the maximum number of result documents.</p>
+   */
+  public void setMaxResultDocuments(int pMax) {
+    max = pMax;
+  }
+
+  /** <p>Returns the maximum number of result documents
+   * or 0 (default) for an unlimited number.</p>
+   */
+  public int getMaxResultDocuments() {
+    return max;
+  }
+
+  /** <p>Sets the maximum number of documents to skip
+   * at the beginning (soft cursoring).</p>
+   */
+  public void setSkippedResultDocuments(int pStart) {
+    start = pStart;
+  }
+
+  /** <p>Sets the maximum number of documents to skip
+   * at the beginning or 0 (default) to skip no documents.</p>
+   */
+  public int getSkippedResultDocuments() {
+    return start;
+  }
+
+  /** <p>Returns the number of parameters added with
+   * <code>addParam()</code>.</p>
+   */
+  public int getNumParams() {
+    return (params == null) ? 0 : params.size()/2;
+  }
+
+  /** <p>Returns an {@link Iterator} to the list of parameters. Any
+   * element in the list is an instance of {@link PMParams.Param}.</p>
+   */
+  public Iterator getParams() {
+    return params.iterator();
+  }
+
+  /** <p>Sets whether the query should guarantee to return only
+   * distinct objects by activating the DISTINCT clause.</p>
+   */
+  public void setDistinct(boolean pDistinct) {
+    distinct = pDistinct;
+  }
+
+  /** <p>Returns whether the query should guarantee to return only
+   * distinct objects by activating the DISTINCT clause.</p>
+   */
+  public boolean isDistinct() {
+    return distinct;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/ValidationEvents.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/ValidationEvents.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/ValidationEvents.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+/** <p>List of error codes, being used in validation events.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: ValidationEvents.java 232063 2005-03-04 10:41:53Z jochen $
+ */
+public interface ValidationEvents {
+	/** More than one alternative in a choice group have
+	 * been used.
+	 */
+	public static final String EVENT_CHOICE_GROUP_REUSE = "JM_EVENT_CHOICE_GROUP_REUSE";
+
+/** <p>A processing instruction was found. JaxMe doesn't know
+   * how to handle processing instruction, thus they are treated
+   * as a validation event, possibly throwing an exception.</p>
+   * <p>This behaviour is questionable. It may very well be changed
+   * at a later time, if another way of handling processing
+   * instructions is defined. However, if we throw an event now,
+   * the possible change is upwards compatible.</p>
+   */
+  public static final String EVENT_PROCESSING_INSTRUCTION = "JM_EVENT_PROCESSING_INSTRUCTION";
+
+  /** <p>A skipped entity was found. JaxMe doesn't know
+   * how to handle skipped entities, thus they are treated
+   * as a validation event, possibly throwing an exception.</p>
+   * <p>This behaviour is questionable. It may very well be changed
+   * at a later time, if another way of handling skipped
+   * entities is defined. However, if we throw an event now,
+   * the possible change is upwards compatible.</p>
+   */
+  public static final String EVENT_SKIPPED_ENTITY = "JM_EVENT_SKIPPED_ENTITY";
+
+  /** <p>Unexpected textual contents have been found. For example,
+   * a sequence must not have embedded text, because it would have
+   * mixed content otherwise. Textual content is ignored, if it
+   * consists of whitespace characters only.</p>
+   */
+  public static final String EVENT_UNEXPECTED_TEXTUAL_CONTENTS = "JM_EVENT_UNEXPECTED_TEXTUAL_CONTENTS";
+
+  /** <p>An unexpected child was found in an atomic element or in a
+   * complex element with simple content.</p>
+   */
+  public static final String EVENT_UNEXPECTED_CHILD_ELEMENT = "JM_EVENT_UNEXPECTED_CHILD_ELEMENT";
+
+  /**A childs of an all group was used more than once.
+   */
+  public static final String EVENT_ALL_GROUP_REUSE = "JM_EVENT_ALL_GROUP_REUSE";
+
+  /** <p>A child element was not expected at this place. For example,
+   * in the case of a choice, this may indicate that more than one
+   * of the possible elements have been found. In the case of a
+   * sequence, this can indicate a mismatch in the order of the
+   * child elements.</p>
+   */
+  public static final String EVENT_UNEXPECTED_CHILD_STATE = "JM_EVENT_UNEXPECTED_CHILD_STATE";
+
+  /** <p>A complex elements child is unknown. A possible reason
+   * is an error in the child elements name.</p>
+   */
+  public static final String EVENT_ADDITIONAL_CHILD_ELEMENT = "JM_EVENT_ADDITIONAL_CHILD_ELEMENT";
+
+  /** <p>An element occurred more than expected. In other words,
+   * the elements <code>maxOccurs</code> facet was violated.</p>
+   */
+  public static final String EVENT_MULTIPLE_OCCURRENCIES = "JM_EVENT_MULTIPLE_OCCURRENCIES";
+
+  /** <p>The root elements type was wrong.</p>
+   */
+  public static final String EVENT_WRONG_ROOT_ELEMENT = "JM_EVENT_WRONG_ROOT_ELEMENT";
+
+  /** <p>An element or attribute value was invalid. For example, in the
+   * case of a dateTime instance, this may indicate an unparseable date.</p>
+   */
+  public static final String EVENT_ILLEGAL_VALUE = "JM_EVENT_ILLEGAL_VALUE";
+
+  /** <p>An attribute was unknown.</p>
+   */
+  public static final String EVENT_UNKNOWN_ATTRIBUTE = "JM_EVENT_UNKNOWN_ATTRIBUTE";
+
+  /** <p>An attribute with an invalid namespace was detected in an
+   * element with an "anyAttribute" declaration.</p>
+   */
+  public static final String EVENT_UNKNOWN_ANY_ATTRIBUTE = "JM_EVENT_UNKNOWN_ANY_ATTRIBUTE";
+
+  /** Some of an elements child are missing.
+   */
+  public static final String EVENT_PREMATURE_END_ELEMENT = null;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/WildcardAttribute.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/WildcardAttribute.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/WildcardAttribute.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import javax.xml.namespace.QName;
+
+/** <p>Wildcard attributes (as specified by <code>xs:anyAttribute</code>)
+ * are stored in a set, the set elements being instances of
+ * <code>WildcardAttribute</code>.</p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class WildcardAttribute {
+    private final QName name;
+    private final String value;
+
+    /** <p>Creates a new instance of <code>WildcardAttribute</code>
+     * with the given name and value.</p>
+     * @throws NullPointerException Either of the arguments is null.
+     */
+    public WildcardAttribute(QName pName, String pValue) {
+        if (pName == null) {
+            throw new NullPointerException("A wildcard attributes name must not be null.");
+        }
+        if (pValue == null) {
+            throw new NullPointerException("A wildcard attributes value must not be null.");
+        }
+        name = pName;
+        value = pValue;
+    }
+    
+    /** <p>Returns the attributes name.</p>
+     */
+    public QName getName() {
+        return name;
+    }
+
+    /** <p>Returns the attributes value.</p>
+     */
+    public String getValue() {
+        return value;
+    }
+
+    public String toString() {
+        return name + "=" + value;
+    }
+
+    /** <p>Returns <code>getName().hashCode()</code>.</p>
+     */
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    /** <p>Returns true, if the object <code>pOther</code> is an instance of
+     * <code>WildcardAttribute</code> and <code>pOther.getName().equals(getName())</code>.</p>
+     */
+    public boolean equals(Object pOther) {
+        return pOther != null  &&  pOther instanceof WildcardAttribute  &&
+        	((WildcardAttribute) pOther).name.equals(name);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLConstants.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLConstants.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLConstants.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+package org.apache.ws.jaxme;
+
+
+public class XMLConstants {
+	/** <p>The XML Schema namespace:
+     * <code>http://www.w3.org/2001/XMLSchema-instance</code>
+     */
+    public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema-instance";
+
+    /** <p>The attribute specifying a schema, which may
+     * be used to validate the instance, if the schema
+     * has a target namespace: <code>schemaLocation</code>.</p>
+     * @see #XML_SCHEMA_URI
+     * @see #XML_SCHEMA_NO_NS_ATTR
+     */
+    public static final String XML_SCHEMA_NS_ATTR = "schemaLocation";
+
+    /** <p>The attribute specifying a schema, which may
+     * be used to validate the instance, if the schema
+     * doesn't have a namespace: <code>noNamespaceSchemaLocation</code>.</p>
+     * @see #XML_SCHEMA_URI
+     */
+    public static final String XML_SCHEMA_NO_NS_ATTR = "noNamespaceSchemaLocation";
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLWriter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLWriter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/XMLWriter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme;
+
+import java.io.Writer;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+
+
+/** <p>A simple serializer for XML documents.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XMLWriter extends org.xml.sax.ContentHandler {
+  /** <p>Initializes the XMLWriter by setting the Marshaller which created it.</p>
+   */
+  public void init(JMMarshallerImpl pMarshaller) throws JAXBException;
+
+  /** <p>Sets the {@link Writer} to which the Marshaller ought to write.</p>
+   */
+  public void setWriter(Writer pWriter) throws JAXBException;
+
+  /** <p>Returns whether the XMLWriter can encode the character
+   * <code>c</code> without an escape sequence like &amp;#ddd;.</p>
+   */
+  public boolean canEncode(char c);
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressCreator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.examples.misc.address;
+
+
+import java.io.FileWriter;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.apache.ws.jaxme.test.misc.address.Address;
+import org.apache.ws.jaxme.test.misc.address.ObjectFactory;
+import org.apache.ws.jaxme.test.misc.address.AddressType.EmailDetailsType.EmailType;
+import org.apache.ws.jaxme.test.misc.address.AddressType.PhoneDetailsType.PhoneType;
+
+
+public class AddressCreator {
+	public static void writeAddress(Writer pWriter) throws JAXBException {
+		ObjectFactory f = new ObjectFactory();
+		
+		// Create the element:
+		Address addr = f.createAddress();
+		addr.setName(f.createAddressTypeNameType());
+		addr.getName().setFirst("Jane");
+		addr.getName().setLast("Doe");
+		addr.setPostal(f.createAddressTypePostalType());
+		addr.getPostal().setStreet("34 Main Street");
+		addr.getPostal().setCity("Boston");
+		addr.getPostal().setState("MA");
+		addr.getPostal().setZIP("02215");
+		addr.setEmailDetails(f.createAddressTypeEmailDetailsType());
+		
+		EmailType email = f.createAddressTypeEmailDetailsTypeEmailType();
+		email.setType("Private");
+		email.setEmailAddress("jdoe at yourcompany.com");
+		addr.getEmailDetails().getEmail().add(email);
+		email = f.createAddressTypeEmailDetailsTypeEmailType();
+		email.setType("Office");
+		email.setEmailAddress("josephdoe at mycompany.com");
+		addr.getEmailDetails().getEmail().add(email);
+		email = f.createAddressTypeEmailDetailsTypeEmailType();
+		email.setType("Office");
+		email.setEmailAddress("joseph.doe at mycompany.com");
+		addr.getEmailDetails().getEmail().add(email);
+		
+		addr.setPhoneDetails(f.createAddressTypePhoneDetailsType());
+		PhoneType phone = f.createAddressTypePhoneDetailsTypePhoneType();
+		phone.setType("Work");
+		phone.setPhoneNumber("555.6789");
+		addr.getPhoneDetails().getPhone().add(phone);
+		phone = f.createAddressTypePhoneDetailsTypePhoneType();
+		phone.setType("Fax");
+		phone.setPhoneNumber("555.1212");
+		addr.getPhoneDetails().getPhone().add(phone);
+		
+		// And save it into the file "Address.xml"
+		JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
+		Marshaller marshaller = context.createMarshaller();
+		marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+		marshaller.marshal(addr, pWriter);
+	}
+	
+	public static void main(String[] args) throws Exception {
+		FileWriter fw = new FileWriter("Address.xml");
+		writeAddress(fw);
+		fw.close();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressPrinter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressPrinter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/examples/misc/address/AddressPrinter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.examples.misc.address;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ws.jaxme.test.misc.address.Address;
+import org.xml.sax.InputSource;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: AddressPrinter.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class AddressPrinter {
+  public static Address getAddress(InputSource pSource) throws JAXBException {
+    JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
+    Unmarshaller unmarshaller = context.createUnmarshaller();
+    return (Address) unmarshaller.unmarshal(pSource);
+  }
+
+  public static String getAddressAsString(Address pAddress) throws JAXBException {
+    StringWriter sw = new StringWriter();
+    JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
+    Marshaller marshaller = context.createMarshaller();
+    marshaller.marshal(pAddress, sw);
+    return sw.toString();
+  }
+
+  public static void main(String[] args) throws Exception {
+    File f = new File("Address.xml");
+    InputSource isource = new InputSource(new FileInputStream(f));
+    isource.setSystemId(f.toURL().toString());
+    Address addr = getAddress(isource);
+
+    // A simpler variant might be:
+    // Address addr = unmarshaller.unmarshal(f);
+
+    if (addr.getName() == null) {
+      System.out.println("Loaded address without name.");
+    } else {
+      System.out.println("Loaded address " + addr.getName().getLast() +
+                         ", " + addr.getName().getFirst() + ".");
+    }
+    System.out.println("Details:" + getAddressAsString(addr));
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Generator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Generator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Generator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/** <p>The Generator is a frontend for working with the
+ * SchemaReaders, SourceWriters and whatever else.</p>
+ * <p>
+ * <strong>Usage:</strong> Generates java source definitions
+ * from various inputs:
+ * </p>
+ * <ul>
+ *  <li>{@link #generate(java.net.URL)}</li> 
+ *  <li>{@link #generate(java.io.File)}</li> 
+ *  <li>{@link #generate(org.xml.sax.InputSource)}</li>
+ * </ul>
+ * <p>
+ * The inputs are interpreted into schema
+ * definitions by the {@link SchemaReader} set by calling
+ * {@link #setSchemaReader}. 
+ * </p>
+ * <p>
+ * Other properties give fine grained
+ * control over various aspects of the file generation:
+ * </p>
+ * <ul>
+ *   <li>{@link #setForcingOverwrite}</li>
+ *   <li>{@link #setSettingReadOnly}</li>
+ *   <li>{@link #setTargetDirectory}</li>
+ * </ul>
+ * <p> 
+ * and the processing of the schema:
+ * </p>
+ * <ul>
+ *   <li>{@link #setValidating}</li>
+ *   </li>{@link #setEntityResolver})</li>
+ * </ul>
+ * </p>
+ * <p><em>Implementation note</em>: If you update this interface, you
+ * should consider updating the following files and classes as
+ * well:
+ * <ul>
+ *   <li>{@link Main}</li>
+ *   <li>{@link XJCTask}</li>
+ *   <li>docs/Reference.html</li>
+ * </ul></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: Generator.java 358956 2005-12-25 01:43:38 +0100 (So, 25 Dez 2005) jochen $
+ */
+public interface Generator extends PropertySource {
+  /** <p>Sets the SchemaReader to use.</p>
+   */
+  public void setSchemaReader(SchemaReader pSchemaReader);
+
+  /** <p>Returns the SchemaReader being used.</p>
+   */
+  public SchemaReader getSchemaReader();
+
+  /** Sets the directory where Java source files are being
+   * created.
+   */
+  public void setTargetDirectory(File pDirectory);
+
+  /** Returns the directory where Java source files are being
+   * created.
+   */
+  public File getTargetDirectory();
+
+  /** Sets the directory where resource files are being
+   * created. By default, this is the Java source directory.
+   */
+  public void setResourceTargetDirectory(File pDirectory);
+
+  /** Sets the directory where resource files are being
+   * created. By default, this is the Java source directory.
+   */
+  public File getResourceTargetDirectory();
+
+  /** <p>Sets whether the generator is using a validating XML
+   * schema parser. Defaults to false.</p>
+   */
+  public void setValidating(boolean pValidating);
+
+  /** <p>Returns whether the generator is using a validating XML
+   * schema parser. Defaults to false.</p>
+   */
+  public boolean isValidating();
+
+  /** <p>Returns whether the generator is forcing an overwrite of files.</p>
+   */
+  public boolean isForcingOverwrite();
+
+  /** <p>Sets whether the generator is forcing an overwrite of files.</p>
+   */
+  public void setForcingOverwrite(boolean pIsForcingOverwrite);
+
+  /** <p>Returns whether the generator will create files in read-only mode.</p>
+   */
+  public boolean isSettingReadOnly();
+
+  /** <p>Sets whether the generator will create files in read-only mode.</p>
+   */
+  public void setSettingReadOnly(boolean pIsSettingReadOnly);
+
+  /** <p>
+    * Generates java source from the given <code>File</code>.
+    * </p>
+    * @param pFile reads the schema (from which the source is to be generated)
+    * from the given file.
+    * @return <code>SchemaSG</code> describing the source generated
+    */
+  public SchemaSG generate(File pFile) throws Exception;
+
+  /** <p>
+    * Generates java source from the given <code>URL</code>.
+    * </p>
+    * @param pURL reads the schema (from which the source is to be generated)
+    * from the given URL.
+    * @return <code>SchemaSG</code> describing the source generated
+    */
+  public SchemaSG generate(URL pURL) throws Exception;
+
+  /** <p>
+    * Generates java source from the given <code>URL</code>.
+    * </p>
+    * @param pSource reads the schema (from which the source is to be generated)
+    * from the SAX Input Source. The System ID should be (if possible) set.
+    * @return <code>SchemaSG</code> describing the source generated
+    */
+  public SchemaSG generate(InputSource pSource) throws Exception;
+
+  /** <p>Returns a key for getting and setting custom data.</p>
+   */
+  public String getKey();
+
+  /** <p>Sets the {@link EntityResolver} being used to import external
+   * schemata.</p>
+   */
+  public void setEntityResolver(EntityResolver pEntityResolver);
+
+  /** <p>Returns the {@link EntityResolver} being used to import external
+   * schemata.</p>
+   */
+  public EntityResolver getEntityResolver();
+
+    /** Sets the external schema bindings.
+     */
+  	public void addBindings(InputSource pSource)
+  			throws ParserConfigurationException, SAXException, IOException;
+
+  	/** Returns the external schema bindings, if any, or null.
+     */
+    public Document[] getBindings();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Main.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Main.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/Main.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,321 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.xml.sax.InputSource;
+
+
+/** <p>A command line interface for the JaxMe source generator.</p>
+ * <p><em>Implementation note</em>: If you update this class, you
+ * should consider updating the following files and classes as
+ * well:
+ * <ul>
+ *   <li>{@link Generator}</li>
+ *   <li>{@link XJCTask}</li>
+ *   <li>docs/Reference.html</li>
+ * </ul></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Main {
+  /** <p>Prints the Usage message and exits with error status.</p>
+   */
+  public static void Usage(String msg) {
+    if (msg != null) {
+      System.err.println(msg);
+      System.err.println();
+    }
+    java.io.PrintStream ps = System.err;
+    ps.println("Usage: " + Main.class.getName() + " <inputfile> [options]");
+    ps.println();
+    ps.println("Reads a schema definition from the given <inputfile>");
+    ps.println("Possible options are:");
+    ps.println("  --bindingFile=<filename> Adds an external binding file.");
+    ps.println("                           Multiple external binding files may");
+    ps.println("                           be used by repeating this option.");
+    ps.println("  --force                  Force overwriting files");
+    ps.println("  --schemaReader=<class>   Sets the SchemaReader class; defaults to");
+    ps.println("                           " + JAXBSchemaReader.class.getName());
+    ps.println("  --sgFactoryChain=<class> Adds an instance of <class> to the");
+    ps.println("                           generation process.");
+    ps.println("  --logFile=<filename>     Sets a logfile for debugging purposes.");
+    ps.println("                           By default System.err is used.");
+    ps.println("  --logLevel=<level>       Sets the default logging level.");
+    ps.println("                           Possible levels are fatal, error (default),");
+    ps.println("                           warn, info and debug");
+    ps.println("  --option=<name=value>    Sets the option <name> to the given <value>.");
+    ps.println("  --package=<name>         Sets the package of the generated sources to");
+    ps.println("                           <name>.");
+    ps.println("  --resourceTarget=<dir>   Sets the directory where to generate");
+    ps.println("                           resource files. By default, the same directory");
+    ps.println("                           is used for Java sources and resource files.");
+    ps.println("  --target=<dir>           Sets the directory where to generate Java");
+    ps.println("                           sources. By default the current directory");
+    ps.println("                           is used.");
+    ps.println("  --validating             Turns the XML parsers validation on.");
+    System.exit(1);
+  }
+
+  /**
+   * @param args the command line arguments
+   */
+  public static void main (String args[]) throws Exception {
+    java.io.File schemaFile = null;
+    Generator g = new GeneratorImpl();
+    String schemaReaderClass = JAXBSchemaReader.class.getName();
+    String target = null, resourceTarget = null;
+    String logFile = null;
+    String logLevel = null;
+    String packageName = null;
+    List sgFactoryChains = new ArrayList();
+
+    for (int i = 0;  i < args.length;  i++) {
+      String arg = args[i];
+      if (arg.equals("--")) {
+        for (int j = i;  j < args.length;  j++) {
+          if (schemaFile != null) {
+            Usage("Only one input file may be specified.");
+          }
+          schemaFile = new java.io.File(args[j]);
+        }
+        break;
+      }
+      if (arg.startsWith("--")) {
+        arg = arg.substring(1);
+      }
+      if (arg.startsWith("-")) {
+        arg = arg.substring(1);
+        int optIndex = arg.indexOf('=');
+        String opt = null;
+        if (optIndex > 0) {
+          opt = arg.substring(optIndex+1);
+          arg = arg.substring(0, optIndex);
+        }
+        if (arg.equalsIgnoreCase("bindingFile")) {
+          if (opt == null) {
+        	if (i == args.length) {
+        	  Usage("Missing argument for option " + arg);
+        	}
+        	opt = args[++i];
+          }
+          File f = new File(opt);
+          if (f.isFile()) {
+        	  try {
+        		  g.addBindings(new InputSource(f.toURL().toExternalForm()));
+        	  } catch (Exception e) {
+        		  System.err.println("The external binding file "
+        				  + f.getAbsolutePath() + " could not be read: "
+        				  + e.getMessage());
+        		  e.printStackTrace();
+        		  System.exit(1);
+        	  }
+          } else {
+        	  System.err.println("The external binding file "
+        			  + f.getAbsolutePath() + " does not exist.");
+        	  System.exit(1);
+          }
+        } else if (arg.equalsIgnoreCase("force")) {
+        	g.setForcingOverwrite(true);
+        } else if (arg.equalsIgnoreCase("schemaReader")) {
+          if (logLevel != null) {
+            Usage("The option " + arg + " may be used only once.");
+          }
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          schemaReaderClass = opt;
+        } else if (arg.equalsIgnoreCase("logFile")) {
+          if (logFile != null) {
+            Usage("The option " + arg + " may be used only once.");
+          }
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          logFile = opt;
+        } else if (arg.equalsIgnoreCase("package")) {
+          if (packageName != null) {
+            Usage("The option " + arg + " may be used only once.");
+          }
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          packageName = opt;
+          g.setProperty("jaxme.package.name", packageName);
+        } else if (arg.equalsIgnoreCase("logLevel")) {
+          if (logLevel != null) {
+            Usage("The option " + arg + " may be used only once.");
+          }
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          logLevel = opt;
+        } else if (arg.equalsIgnoreCase("target")) {
+          if (target != null) {
+            Usage("The option " + arg + " may be used only once.");
+          }
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          target = opt;
+        } else if (arg.equalsIgnoreCase("resourceTarget")) {
+            if (resourceTarget != null) {
+              Usage("The option " + arg + " may be used only once.");
+            }
+            if (opt == null) {
+              if (i == args.length) {
+                Usage("Missing argument for option " + arg);
+              }
+              opt = args[++i];
+            }
+            resourceTarget = opt;
+        } else if (arg.equalsIgnoreCase("option")) {
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          int offset = opt.indexOf('=');
+          if (offset < 1) {
+            System.err.println("Failed to parse option definition " + opt);
+            System.err.println("Must be like --option=name=value or");
+            System.err.println("--option=name=target=value");
+            System.err.println();
+            Usage(null);
+          }
+          String optName = opt.substring(0, offset);
+          String optValue = opt.substring(offset+1);
+          g.setProperty(optName, optValue);
+        } else if (arg.equalsIgnoreCase("validating")) {
+          g.setValidating(true);
+        } else if ("sgFactoryChain".equals(arg)) {
+          if (opt == null) {
+            if (i == args.length) {
+              Usage("Missing argument for option " + arg);
+            }
+            opt = args[++i];
+          }
+          Class c = null;
+          try {
+            c = Class.forName(opt);
+          } catch (ClassNotFoundException e) {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            if (cl != null) {
+              try {
+                c = cl.loadClass(opt);
+              } catch (ClassNotFoundException f) {
+              }
+            }
+            if (c != null) {
+              System.err.println("Failed to load class " + opt);
+              System.exit(1);
+            }
+          }
+          if (!SGFactoryChain.class.isAssignableFrom(c)) {
+            System.err.println("The SGFactoryChain implementation " + c.getName() +
+                               " is not implementing " + SGFactoryChain.class.getName());
+          }
+          sgFactoryChains.add(c);
+        } else if (arg.equalsIgnoreCase("h")  ||  arg.equalsIgnoreCase("help")  ||
+                   arg.equalsIgnoreCase("?")) {
+          Usage(null);
+        } else {
+          Usage("Unknown option name: " + arg);
+        }
+      } else if (schemaFile != null) {
+        Usage("Only one input file may be specified.");
+       } else {
+         schemaFile = new java.io.File(args[i]);
+       }
+    }
+
+    if (schemaFile == null) {
+      Usage("A Schema file must be specified");
+    }
+
+    SchemaReader sr = null;
+    try {
+      Class c = Class.forName(schemaReaderClass);
+      sr = (SchemaReader) c.newInstance();
+      g.setSchemaReader(sr);
+      sr.setGenerator(g);
+    } catch (ClassNotFoundException e) {
+      System.err.println("Could not find SchemaReader class " + schemaReaderClass);
+      System.exit(1);
+    } catch (ClassCastException e) {
+      System.err.println("Class " + schemaReaderClass +
+                         " is not implementing " + SchemaReader.class.getName());
+      System.exit(1);
+    } catch (InstantiationException e) {
+      System.err.println("Failed to instantiate SchemaReader class " + schemaReaderClass);
+      System.exit(1);
+    } catch (IllegalAccessException e) {
+      System.err.println("Illegal access to SchemaReader class " + schemaReaderClass);
+      System.exit(1);
+    }
+
+    if (sgFactoryChains.size() > 0) {
+      if (!(sr instanceof JAXBSchemaReader)) {
+        System.err.println("Additional instances of " + SGFactoryChain.class.getName()
+                           + " may be specified only, if the schema reader is an instance of "
+                           + JAXBSchemaReader.class.getName());
+        System.exit(1);
+      }
+      JAXBSchemaReader jsr = (JAXBSchemaReader) sr;
+      for (int i = 0;  i < sgFactoryChains.size();  i++) {
+        jsr.addSGFactoryChain((Class) sgFactoryChains.get(i));
+      }
+    }
+
+    if (target != null) {
+      g.setTargetDirectory(new File(target));
+    }
+    if (resourceTarget != null) {
+      g.setResourceTargetDirectory(new File(target));
+    }
+
+    try {
+      g.generate(schemaFile);
+    } catch (Exception e) {
+      e.printStackTrace();
+      System.exit(1);
+    }
+
+    System.exit(0);     // Explicit System.exit, so that hsqldb closes nicely
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/PropertySource.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/PropertySource.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/PropertySource.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator;
+
+/** <p>An instance of PropertySource (typically the {@link org.apache.ws.jaxme.generator.Generator}
+ * can be queried for properties.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface PropertySource {
+  /** <p>Returns the given property value or null, if the property is not
+   * set.</p>
+   */
+  public String getProperty(String pName);
+
+  /** <p>Returns the given property value. If the property is not set, returns
+   * the given default value.</p>
+   */
+  public String getProperty(String pName, String pDefault);
+
+  /** <p>Sets the given property value.</p>
+   */
+  public void setProperty(String pName, String pValue);
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: SchemaException.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class SchemaException extends Exception {
+  private Throwable inner;
+
+  public SchemaException(String pMsg) {
+	 super(pMsg);
+  }
+
+  public SchemaException(Throwable pInner) {
+    inner = pInner;
+  }
+
+  public SchemaException(String pMsg, Throwable pInner) {
+    this(pMsg);
+    inner = pInner;
+  }
+
+  public Throwable getInner() {
+    return inner;
+  }
+
+  public void printStackTrace() {
+    super.printStackTrace();
+    if (inner != null) {
+      System.err.println("Root cause:");
+      inner.printStackTrace();
+    }
+  }
+
+  public void printStackTrace(PrintStream pStream) {
+    super.printStackTrace(pStream);
+    if (inner != null) {
+      pStream.println("Root cause:");
+      inner.printStackTrace(pStream);
+    }
+  }
+
+  public void printStackTrace(PrintWriter pWriter) {
+    super.printStackTrace(pWriter);
+    if (inner != null) {
+      pWriter.println("Root cause:");
+      inner.printStackTrace(pWriter);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaOption.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaOption.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaOption.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator;
+
+public class SchemaOption {
+  private final String name;
+  private final String target;
+  private final String value;
+
+  /** Creates a new instance of SchemaOption */
+  public SchemaOption(String pName, String pValue, String pTarget) {
+    name = pName;
+    target = (pTarget == null  ||  pTarget.length() == 0) ? null : pTarget;
+    value = pValue;
+  }
+
+  public String getName() { return name; }
+  public String getTarget() { return target; }
+  public String getValue() { return value; }
+
+  public String toString() {
+    if (target == null) {
+      return name + "=" + value;
+    } else {
+      return name + "=" + target + "=" + value;
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaReader.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaReader.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/SchemaReader.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** <p>A SchemaReader is responsible for reading a schema
+ * definition.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SchemaReader {
+  /** <p>Returns the Generator controlling the SchemaReader.</p>
+   */
+  public Generator getGenerator();
+
+  /** <p>Sets the Generator controlling the SchemaReader.</p>
+   */
+  public void setGenerator(Generator pGenerator);
+
+  /** <p>Adds an instance of {@link org.apache.ws.jaxme.generator.sg.SGFactoryChain}
+   * to the SGFactory.</p>
+   */
+  public void addSGFactoryChain(Class pClass);
+
+  /** <p>Returns the {@link SGFactory}.</p>
+   */
+  public SGFactory getSGFactory() throws SAXException;
+
+  /** <p>Called for parsing a schema definition from the
+   * given Reader.</p>
+   *
+   * @param pSource A SAX Input Source, with the system ID set,
+   *   if possible
+   */
+  public SchemaSG parse(InputSource pSource) throws Exception;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/XJCTask.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/XJCTask.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/XJCTask.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1084 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.TextFile;
+import org.apache.ws.jaxme.logging.AntProjectLoggerFactory;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.logging.LoggerFactory;
+import org.apache.ws.jaxme.util.ClassLoader;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXParseException;
+
+
+/** <p>An Ant task for running JaxMe, designed to be JAXB compatible.</p>
+ * <p>This task supports the following attributes:</p>
+ * <table border="1">
+ *   <tr>
+ *     <th>Name</th>
+ *     <th>Description</th>
+ *     <th>Required/Default</th>
+ *   </tr>
+ *   <tr>
+ *     <td>schema</td>
+ *     <td>Name of a schema file being compiled</td>
+ *     <td>This or nested &lt;schema&gt; elements are required</td>
+ *   </tr>
+ *   <tr>
+ *     <td>binding</td>
+ *     <td>An external binding file being applied to the schema file</td>
+ *     <td>No</td>
+ *   </tr>
+ *   <tr>
+ *     <td>force</td>
+ *     <td>Setting this option to true forces the up-to-date check to fail.
+ *       This option is mainly useful while working on the JaxMe generator.
+ *       For JaxMe users, which only change schema files, this option isn't of much
+ *       use. It is designed for JaxMe developers.</td>
+ *     <td>No, false</td>
+ *   </tr>
+ *   <tr>
+ *     <td>package</td>
+ *     <td>Specifies the generated Java sources package name. Overrides package specifications in
+ *       the schema bindings, if any.</td>
+ *     <td>No, a package may be specified in the schema bindings.</td>
+ *   </tr>
+ *   <tr>
+ *     <td>target</td>
+ *     <td>Specifies the target directory for generated Java source files. A package
+ *       structure will be created below that directory. For example, with target="src" and
+ *       package="org.acme", you will have files being created in "src/org/acme".</td>
+ *     <td>No, defaults to the current directory</td>
+ *   </tr>
+ *   <tr>
+ *     <td>resourceTarget</td>
+ *     <td>Specifies the target directory for generated resource files. A package
+ *       structure will be created below that directory. For example, with target="src" and
+ *       package="org.acme", you will have files being created in "src/org/acme".</td>
+ *     <td>No, defaults to the "target" directory</td>
+ *   </tr>
+ *   <tr>
+ *     <td>readonly</td>
+ *     <td>Generated Java source files are in read-only mode, if true is specified</td>
+ *     <td>No, defaults to false</td>
+ *   </tr>
+ *   <tr>
+ *     <td>extension</td>
+ *     <td>If set to true, the XJC binding compiler will run in the extension mode.
+ *       Otherwise, it will run in the strict conformance mode.</td>
+ *     <td>No, defaults to false</td>
+ *   </tr>
+ *   <tr>
+ *     <td>stackSize</td>
+ *     <td>Specify the thread stack size for the XJC binding compiler (J2SE SDK v1.4 or higher).
+ *       The XJC binding compiler can fail to compile large schemas with StackOverflowError and,
+ *       in that case, this option can be used to extend the stack size. If unspecified, the default
+ *       VM size is used. The format is equivalent to the -Xss command-line argument for Sun Microsystems JVM.
+ *       This value can be specified in bytes (stackSize="2097152"), kilobytes (stackSize="2048kb"),
+ *       or megabytes (stackSize="2mb").<br>
+ *       This attribute is ignored by the JaxMe ant task and present for compatibility reasons only.</td>
+ *     <td>No, defaults to false</td>
+ *   </tr>
+ *   <tr>
+ *     <td>removeOldOutput</td>
+ *     <td>If one or more nested &lt;produces&gt; elements are specified and this attribute is
+ *       set to true, then the Ant task will ensure that only generated files will remain. In other
+ *       words, if you had removed an element named "Foo" from the previous schema version, then the
+ *       Ant task will remove "Foo.java".</td>
+ *     <td>No, defaults to false</td>
+ *   </tr>
+ *   <tr>
+ *     <td>validating</td>
+ *     <td>Sets whether the XML schema parser is validating. By default it isn't.</td>
+ *     <td>No, defaults to false</td>
+ *   </tr>
+ * </table>
+ * <p>Besides the attributes, the ant task also supports the following nested elements:</p>
+ * <table border="1">
+ *   <tr>
+ *     <th>Name</th>
+ *     <th>Description</th>
+ *     <th>Required/Multiplicity</th>
+ *   </tr>
+ *   <tr>
+ *     <td>schema</td>
+ *     <td>Multiple schema files may be compiled in one or more nested &lt;schema&gt;
+ *       elements. The element syntax is equivalent to a nested &lt;fileset&gt;.
+ *       Use of a nested &lt;schema&gt; element is mutually exclusive with the use
+ *       of a "schema" attribute.</td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>binding</td>
+ *     <td>Multiple external binding files may be specified. The element syntax is equivalent
+ *       to a nested &lt;fileset&gt;. Use of a nested &lt;binding&gt; element is
+ *       mutually exclusive with the use of a "binding" attribute.</td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>classpath</td>
+ *     <td>This nested element is ignored by the JaxMe ant task and exists for compatibility
+ *       to the JAXB ant task only. In the case of JAXB it specifies a classpath for loading
+ *       user defined types (required in the case of a &lt;javaType&gt; customization)
+ *       </td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>arg</td>
+ *     <td>This nested element is ignored by the JaxMe ant task and exists for compatibility
+ *       to the JAXB ant task only. In the case of JAXB it specifies additional command line
+ *       arguments being passed to the XJC. For details about the syntax, see the relevant
+ *       section in the Ant manual.<br>
+ *       This nested element can be used to specify various options not natively supported in
+ *       the xjc Ant task. For example, currently there is no native support for the following
+ *       xjc command-line options:
+ *       <ul>
+ *         <li>-nv</li>
+ *         <li>-catalog</li>
+ *         <li>-use-runtime</li>
+ *         <li>-schema</li>
+ *         <li>-dtd</li>
+ *         <li>-relaxng</li>
+ *       </ul>
+ *     </td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>dtd</td>
+ *     <td>If this nested element is used to specify, that the input files
+ *       aren't instances of XML Schema, but DTD's. The nested element may
+ *       have an attribute "targetNamespace", which specifies an optional
+ *       target namespace.
+ *     </td>
+ *     <td>No</td>
+ *   </tr>
+ *   <tr>
+ *     <td>depends</td>
+ *     <td>By default the JaxMe Ant tasks up-to-date check considers the specified schema
+ *       and binding files only. This is insufficient, if other schema files are included,
+ *       imported or redefined.<br>
+ *       The nested &lt;depends&gt; element allows to specify additional files to consider
+ *       for the up-to-date check. Typically these are the additional schema files.<br>
+ *       Syntactically the &lt;depends&gt; element specifies a nested &lt;fileset&gt;.</td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>produces</td>
+ *     <td>Specifies the set of files being created by the JaxMe ant task. These files are
+ *       considered as targets for the up-to-date check. The syntax of the &lt;produces&gt;
+ *       element is equivalent to a nested &lt;fileset&gt;. However, you typically do not
+ *       need to set the "dir" attribute, because it defaults to the target directory.</td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>property</td>
+ *     <td>Sets a property value. These properties may be used by the various source
+ *       generators to configure the behaviour. For example, the JDBC schema reader uses
+ *       the options "jdbc.driver", "jdbc.url", "jdbc.user", and "jdbc.password" to
+ *       configure the database connection. Each property must have attributes "name" (the
+ *       property name) and "value" (the property value).</td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ *   <tr>
+ *     <td>schemaReader</td>
+ *     <td>Configures the schema reader to use. Defaults to
+ *       "org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader", which is the JAXB compliant
+ *       schema reader. An alternative schema readers is, for example,
+ *       "org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader" (a subclass of JAXBSchemaReader
+ *       with JaxMe specific extensions).</td>
+ *     <td>0 - 1</td>
+ *   </tr>
+ *   <tr>
+ *     <td>sgFactoryChain</td>
+ *     <td>If the schema reader is an instance of
+ *       {@link org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader}, then you may
+ *       add instances of {@link org.apache.ws.jaxme.generator.sg.SGFactoryChain} to
+ *       the schema generation process. For example, such chains are used to create
+ *       the persistency layer. The best example is the
+ *       {@link org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG}, which is able to
+ *       populate the schema with tables and columns read from a database via
+ *       JDBC metadata.</td>
+ *     <td>0 - Unbounded</td>
+ *   </tr>
+ * </table>
+ * <p>By default, the JaxMe ant task will always run the generator and create new files. This
+ * is typically inappropriate for an ant script where your desire is to have as little
+ * modifications as possible, because new files also need to be recompiled, which is slow
+ * and time consuming.</p>
+ * <p>To achieve a better behaviour, use the nested &lt;produces&gt; and &lt;depends&gt; elements.
+ * If one or more &lt;produces&gt; element is specified, then an up-to-date check is performed
+ * as follows:
+ * <ol>
+ *   <li>If either of the filesets specified by the &lt;produces&gt; elements is empty,
+ *     then the binding compiler will run.</li>
+ *   <li>Otherwise the sets of source and target files will be created. The set of source
+ *     files is specified by the "schema" and "binding" attributes, and by the nested
+ *     &lt;schema&gt;, &lt;binding&gt;, and &lt;depends&gt; elements. If any of the files
+ *     in the source set is newer than any of the files in the target set, then the
+ *     binding comoiler will run.</li>
+ * </ol>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XJCTask extends Task {
+	/** This class is used to store the nested element "dtd".
+	 */
+    public static class Dtd {
+		private String targetNamespace;
+        /** Sets the target namespace being used.
+         */
+        public void setTargetNamespace(String pTargetNamespace) {
+        	targetNamespace = pTargetNamespace;
+        }
+        /** Returns the target namespace being used.
+         */
+        public String getTargetNamespace() {
+        	return targetNamespace;
+        }
+    }
+
+  public static class Property {
+    private String name;
+    private String value;
+    public void setName(String pName) { name = pName; }
+    public void setValue(String pValue) { value = pValue; }
+    public String getName() { return name; }
+    public String getValue() { return value; }
+    public void finish() {
+      if (name == null) {
+        throw new NullPointerException("Missing attribute: 'name'");
+      }
+      if (value == null) {
+        throw new NullPointerException("Missing attribute: 'value'");
+      }
+    }
+  }
+
+  public static class ClassType {
+    private String className;
+    public void setClassName(String pClassName) {
+      className = pClassName;
+    }
+    public String getClassName() {
+      return className;
+    }
+    public Object getInstance(Class pInstanceClass) {
+      if (className == null) {
+        throw new NullPointerException("Missing attribute: 'class'");
+      }
+      Class cl;
+      try {
+        cl = ClassLoader.getClass(className, pInstanceClass);
+      } catch (ClassNotFoundException e) {
+        throw new BuildException("Could not load class " + className, e);
+      } catch (IllegalArgumentException e) {
+        throw new BuildException(e);
+      }
+
+      try {
+        return cl.newInstance();
+      } catch (Exception e) {
+        throw new BuildException("The class " + className +
+                                  " could not be instantiated: " +
+                                  e.getMessage(), e);
+      }
+    }
+  }
+
+  private File binding, schema, target, resourceTarget;
+  private String packageName;
+  private boolean readOnly, extension, removeOldOutput, force, isValidating;
+  private boolean isSettingLoggerFactory = true;
+  private String stackSize;
+  private List bindings = new ArrayList(), schemas = new ArrayList();
+  private List depends = new ArrayList(), produces = new ArrayList();
+  private List sgFactoryChains = new ArrayList();
+  private ClassType schemaReader;
+  private List properties = new ArrayList();
+  private Dtd dtd;
+
+  /** <p>Sets a property value. These properties may be used by the various source
+   * generators to configure the behaviour. For example, the JDBC schema reader uses
+   * the options "jdbc.driver", "jdbc.url", "jdbc.user", and "jdbc.password" to
+   * configure the database connection. Each property must have attributes "name" (the
+   * property name) and "value" (the property value).</p>
+   */
+  public Property createProperty() {
+    Property property = new Property();
+    properties.add(property);
+    return property;
+  }
+
+  /** <p>Returns the configured property values. These properties may be used by the various source
+   * generators to configure the behaviour. For example, the JDBC schema reader uses
+   * the options "jdbc.driver", "jdbc.url", "jdbc.user", and "jdbc.password" to
+   * configure the database connection. Each property must have attributes "name" (the
+   * property name) and "value" (the property value).</p>
+   */
+  public Property[] getProperties() {
+    return (Property[]) properties.toArray(new Property[properties.size()]);
+  }
+
+  /**  <p>Configures the schema reader to use. Defaults to
+   * "org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader", which is the JAXB compliant
+   * schema reader. An alternative schema readers  is, for example,
+   * "org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader" (a subclass of JAXBSchemaReader
+   * with JaxMe specific extensions).</p> 
+   */ 
+  public ClassType createSchemaReader() {
+    if (schemaReader != null) {
+      throw new BuildException("Only one SchemaReader may be configured");
+    }
+    schemaReader = new ClassType();
+    return schemaReader; 
+  }
+
+  /**  <p>Returns the configured schema reader to use. Defaults to
+   * "org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader", which is the JAXB compliant
+   * schema reader. An alternative schema readers  is, for example,
+   * "org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader" (a subclass of JAXBSchemaReader
+   * with JaxMe specific extensions).</p> 
+   */ 
+  public SchemaReader getSchemaReader() {
+    if (schemaReader == null) {
+      if (isExtension()) {
+      	return new JaxMeSchemaReader();
+      } else {
+      	return new JAXBSchemaReader();
+      }
+    } else {
+      return (SchemaReader) schemaReader.getInstance(SchemaReader.class);
+    }
+  }
+
+  /** <p>Configures a new instance of
+   * {@link org.apache.ws.jaxme.generator.sg.SGFactoryChain} being included into
+   * the schema generation process. This option is valid only, if the schema reader
+   * is an instance of {@link JAXBSchemaReader}, because its method
+   * {@link JAXBSchemaReader#addSGFactoryChain(Class)} must be invoked.</p>
+   * <p>The order of the chain elements may be significant. The schema reader
+   * itself will always be the last element in the chain.</p>
+   */
+  public ClassType createSGFactoryChain() {
+    ClassType result = new ClassType();
+    sgFactoryChains.add(result);
+    return result;
+  } 
+
+  /** <p>Returns the array of configured instances of
+   * {@link org.apache.ws.jaxme.generator.sg.SGFactoryChain}. The order of
+   * the array is significant. The schema reader itself will always be the
+   * last element in the chain. Therefore, it is not present in the array.</p>
+   */
+  public ClassType[] getSGFactoryChains() {
+    return (ClassType[]) sgFactoryChains.toArray(new ClassType[sgFactoryChains.size()]);
+  }
+
+  /**  <p>Returns the ant tasks description.</p> 
+   */ 
+  public String getDescription() { 
+    return  "A JaxMe generator task converting XML schemata into Java source files."; 
+  }
+
+  /** <p>Sets whether the XML schema parser is validating.</p>
+   */
+  public void setValidating(boolean pValidating) {
+    isValidating = pValidating;
+  }
+
+  /** <p>Returns whether the XML schema parser is validating.</p>
+   */
+  public boolean isValidating() {
+    return isValidating;
+  }
+
+  /** <p>Setting this option to true forces the up-to-date check to fail.
+   * This option is mainly useful while working on the JaxMe generator.
+   * For JaxMe users, which only change schema files, this option isn't of much
+   * use. It is designed for JaxMe developers.</p>
+   */
+  public boolean isForce() {
+    return force;
+  }
+
+  /** <p>Setting this option to true forces the up-to-date check to fail.
+   * This option is mainly useful while working on the JaxMe generator.
+   * For JaxMe users, which only change schema files, this option isn't of much
+   * use. It is designed for JaxMe developers.</p>
+   */
+  public void setForce(boolean pForce) {
+    force = pForce;
+  }
+
+  /** <p>Returns whether the ant task is setting the {@link LoggerFactory}. This
+   * option is only useful, if you are using the Ant task from another Java class
+   * and not from within Ant.</p>
+   */
+  public boolean isSettingLoggerFactory() {
+    return isSettingLoggerFactory;
+  }
+
+  /** <p>Sets whether the ant task is setting the {@link LoggerFactory}. This
+   * option is only useful, if you are using the Ant task from another Java class
+   * and not from within Ant.</p>
+   */
+  public void setSettingLoggerFactory(boolean pIsSettingLoggerFactory) {
+    isSettingLoggerFactory = pIsSettingLoggerFactory;
+  }
+
+  /** <p>Returns an external binding file being applied to the schema file.</p>
+   */
+  public File getBinding() {
+    return binding;
+  }
+
+  /** <p>Sets an external binding file being applied to the schema file.</p>
+   */
+  public void setBinding(File pBinding) {
+    binding = pBinding;
+  }
+
+  /** <p>Returns, whether the XJC binding compiler will run in the extension mode.
+   * By default, it will run in the strict conformance mode.</p>
+   */
+  public boolean isExtension() {
+    return extension;
+  }
+
+  /** <p>Sets, whether the XJC binding compiler will run in the extension mode.
+   * By default, it will run in the strict conformance mode.</p>
+   */
+  public void setExtension(boolean pExtension) {
+    extension = pExtension;
+  }
+
+  /** <p>Returns the generated Java sources package name. A non-null package specification
+   * overrides package specifications in the schema bindings, if any.</p>
+   */
+  public String getPackage() {
+    return packageName;
+  }
+
+  /** <p>Sets the generated Java sources package name. A non-null package specification
+   * overrides package specifications in the schema bindings, if any.</p>
+   */
+  public void setPackage(String pPackageName) {
+    packageName = pPackageName;
+  }
+
+  /** @deprecated Use {@link #setPackage(String)}.
+   */
+  public void setPackageName(String pPackageName) {
+      log("Warning: The 'packageName' attribute is updated to 'package', for compatibility reasons. Please update your build script.", Project.MSG_WARN);
+      setPackage(pPackageName);
+  }
+
+  /** <p>Returns, whether generated Java source files are in read-only mode.</p>
+   */
+  public boolean isReadOnly() {
+    return readOnly;
+  }
+
+  /** <p>Sets, whether generated Java source files are in read-only mode.</p>
+   */
+  public void setReadOnly(boolean pReadOnly) {
+    readOnly = pReadOnly;
+  }
+
+  /** <p>If one or more nested &lt;produces&gt; elements are specified and
+   * this attribute is set to true, then the Ant task will ensure that only
+   * generated files will remain. In other words, if you had removed an element
+   * named "Foo" from the previous schema version, then the Ant task will remove
+   * "Foo.java".</p>
+   */
+  public boolean isRemoveOldOutput() {
+    return removeOldOutput;
+  }
+
+  /** <p>If one or more nested &lt;produces&gt; elements are specified and
+   * this attribute is set to true, then the Ant task will ensure that only
+   * generated files will remain. In other words, if you had removed an element
+   * named "Foo" from the previous schema version, then the Ant task will remove
+   * "Foo.java".</p>
+   */
+  public void setRemoveOldOutput(boolean pRemoveOldOutput) {
+    removeOldOutput = pRemoveOldOutput;
+  }
+
+  /** <p>Returns the name of the schema file being compiled.</p>
+   */
+  public File getSchema() {
+    return schema;
+  }
+
+  /** <p>Sets the name of the schema file being compiled.</p>
+   */
+  public void setSchema(File pSchema) {
+    schema = pSchema;
+  }
+
+  /** <p>Returns the thread stack size for the XJC binding compiler (J2SE SDK v1.4 or higher).
+   * The XJC binding compiler can fail to compile large schemas with StackOverflowError and,
+   * in that case, this option can be used to extend the stack size. If unspecified, the default
+   * VM size is used. The format is equivalent to the -Xss command-line argument for Sun Microsystems JVM.
+   * This value can be specified in bytes (stackSize="2097152"), kilobytes (stackSize="2048kb"),
+   * or megabytes (stackSize="2mb").</p>
+   * <p>This attribute is ignored by the JaxMe ant task and present for compatibility reasons only.</p>
+   */
+  public String getStackSize() {
+    return stackSize;
+  }
+
+  /** <p>Sets the thread stack size for the XJC binding compiler (J2SE SDK v1.4 or higher).
+   * The XJC binding compiler can fail to compile large schemas with StackOverflowError and,
+   * in that case, this option can be used to extend the stack size. If unspecified, the default
+   * VM size is used. The format is equivalent to the -Xss command-line argument for Sun Microsystems JVM.
+   * This value can be specified in bytes (stackSize="2097152"), kilobytes (stackSize="2048kb"),
+   * or megabytes (stackSize="2mb").</p>
+   * <p>This attribute is ignored by the JaxMe ant task and present for compatibility reasons only.</p>
+   */
+  public void setStackSize(String pStackSize) {
+    stackSize = pStackSize;
+    log("The 'stackSize' attribute is ignored by the JaxMe ant task.", Project.MSG_WARN);
+  }
+
+  /** Returns the target directory for generating Java source files. A package
+   * structure will be created below that directory. For example, with target="src" and
+   * package="org.acme", you will have files being created in "src/org/acme".
+   */
+  public File getTarget() {
+    return target;
+  }
+
+  /** Sets the target directory for generating Java source files. A package
+   * structure will be created below that directory. For example, with target="src" and
+   * package="org.acme", you will have files being created in "src/org/acme".
+   */
+  public void setTarget(File pTarget) {
+    target = pTarget;
+  }
+
+  /** Returns the target directory for generating resource files. A package
+   * structure will be created below that directory. For example, with target="src"
+   * and package="org.acme", you will have files being created in "src/org/acme".
+   * By default, the same directory is being used for Java source files and
+   * resource files.
+   */
+  public File getResourceTarget() {
+    return resourceTarget;
+  }
+
+  /** Sets the target directory for generating resource files. A package
+   * structure will be created below that directory. For example, with target="src"
+   * and package="org.acme", you will have files being created in "src/org/acme".
+   * By default, the same directory is being used for Java source files and
+   * resource files.
+   */
+  public void setResourceTarget(File pTarget) {
+    resourceTarget = pTarget;
+  }
+
+  /** <p>Multiple schema files may be compiled in one or more nested &lt;schema&gt;
+   * elements. The element syntax is equivalent to a nested &lt;fileset&gt;.
+   * Use of a nested &lt;schema&gt; element is mutually exclusive with the use
+   * of a "schema" attribute.</p>
+   */
+  public void addSchema(FileSet pSchemas) {
+    if (getSchema() != null) {
+      throw new BuildException("The 'schema' attribute and the nested 'schema' element are mutually exclusive.");
+    }
+    schemas.add(pSchemas);
+  }
+
+  /** <p>Multiple schema files may be compiled in one or more nested &lt;schema&gt;
+   * elements. The element syntax is equivalent to a nested &lt;fileset&gt;.
+   * Use of a nested &lt;schema&gt; element is mutually exclusive with the use
+   * of a "schema" attribute.</p>
+   */
+  public FileSet[] getSchemas() {
+    return (FileSet[]) schemas.toArray(new FileSet[schemas.size()]);
+  }
+
+  /** <p>Multiple external binding files may be specified. The element syntax is equivalent
+   * to a nested &lt;fileset&gt;. Use of a nested &lt;binding&gt; element is
+   * mutually exclusive with the use of a "binding" attribute.</p>
+   */
+  public void addBinding(FileSet pBindings) {
+    if (getBinding() != null) {
+      throw new BuildException("The 'binding' attribute and the nested 'binding' element are mutually exclusive.");
+    }
+    bindings.add(pBindings);
+  }
+
+  /** <p>Multiple external binding files may be specified. The element syntax is equivalent
+   * to a nested &lt;fileset&gt;. Use of a nested &lt;binding&gt; element is
+   * mutually exclusive with the use of a "binding" attribute.</p>
+   */
+  public FileSet[] getBindings() {
+    return (FileSet[]) bindings.toArray(new FileSet[bindings.size()]);
+  }
+
+  /** <p>This nested element is ignored by the JaxMe ant task and exists for compatibility
+   * to the JAXB ant task only. In the case of JAXB it specifies a classpath for loading
+   * user defined types (required in the case of a &lt;javaType&gt; customization)</p>
+   */
+  public void addClasspath(Path pClasspath) {
+    log("The 'classpath' attribute is ignored by the JaxMe ant task.", Project.MSG_WARN);
+  }
+
+  /** <p>This nested element is ignored by the JaxMe ant task and exists for compatibility
+   * to the JAXB ant task only. In the case of JAXB it specifies additional command line
+   * arguments being passed to the XJC. For details about the syntax, see the relevant
+   * section in the Ant manual.<br>
+   * This nested element can be used to specify various options not natively supported in
+   * the xjc Ant task. For example, currently there is no native support for the following
+   * xjc command-line options:
+   * <ul>
+   *   <li>-nv</li>
+   *   <li>-catalog</li>
+   *   <li>-use-runtime</li>
+   *   <li>-schema</li>
+   *   <li>-dtd</li>
+   *   <li>-relaxng</li>
+   * </ul></p>
+   */
+  public void addArg(Commandline.Argument pArg) {
+    log("The 'arg' attribute is ignored by the JaxMe ant task.", Project.MSG_WARN);
+  }
+
+  /** <p>By default the JaxMe Ant tasks up-to-date check considers the specified schema
+   * and binding files only. This is insufficient, if other schema files are included,
+   * imported or redefined.<br>
+   * The nested &lt;depends&gt; element allows to specify additional files to consider
+   * for the up-to-date check. Typically these are the additional schema files.<br>
+   * Syntactically the &lt;depends&gt; element specifies a nested &lt;fileset&gt;.</p>
+   */
+  public void addDepends(FileSet pDepends) {
+    depends.add(pDepends);
+  }
+
+  /** <p>By default the JaxMe Ant tasks up-to-date check considers the specified schema
+   * and binding files only. This is insufficient, if other schema files are included,
+   * imported or redefined.<br>
+   * The nested &lt;depends&gt; element allows to specify additional files to consider
+   * for the up-to-date check. Typically these are the additional schema files.<br>
+   * Syntactically the &lt;depends&gt; element specifies a nested &lt;fileset&gt;.</p>
+   */
+  public FileSet[] getDepends() {
+    return (FileSet[]) depends.toArray(new FileSet[depends.size()]);
+  }
+
+  /** <p>Specifies the set of files being created by the JaxMe ant task. These files are
+   * considered as targets for the up-to-date check. The syntax of the &lt;produces&gt;
+   * element is equivalent to a nested &lt;fileset&gt;.</p>
+   */
+  public FileSet createProduces() {
+    FileSet result = new FileSet();
+    produces.add(result);
+    return result;
+  }
+
+  /** <p>Returns the set of files being created by the JaxMe ant task. These files are
+   * considered as targets for the up-to-date check. The syntax of the &lt;produces&gt;
+   * element is equivalent to a nested &lt;fileset&gt;.</p>
+   */
+  public FileSet[] getProduces() {
+    return (FileSet[]) produces.toArray(new FileSet[produces.size()]);
+  }
+
+    /** Creates a nested element "dtd".
+     */
+    public Dtd createDtd() {
+    	if (dtd == null) {
+    		dtd = new Dtd();
+            return dtd;
+        } else {
+        	throw new BuildException("Multiple nested 'dtd' elements are forbidden.",
+                                     getLocation());
+        }
+    }
+
+    /** Returns the nested element "dtd".
+     */
+    public Dtd getDtd() {
+    	return dtd;
+    }
+
+  public void finish() {
+    if (getSchema() == null  &&  getSchemas().length == 0) {
+      throw new BuildException("Either of the 'schema' attribute or the nested 'schema' elements must be given.",
+                                getLocation());
+    }
+  }
+
+  private File[] getFiles(FileSet[] pFileSets) {
+    List list = new ArrayList();
+    for (int i = 0;  i < pFileSets.length;  i++) {
+      FileSet fileSet = pFileSets[i];
+      DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
+      scanner.scan();
+      String[] files = scanner.getIncludedFiles();
+      for (int j = 0;  j < files.length;  j++) {
+        list.add(new File(fileSet.getDir(getProject()), files[j]));
+      }
+    }
+    return (File[]) list.toArray(new File[list.size()]);
+  }
+
+  private File[] getSchemaFiles() {
+    if (getSchema() != null) {
+      return new File[]{getSchema()};
+    } else {
+      return getFiles(getSchemas());
+    }
+  }
+
+  private File[] getBindingFiles() {
+    if (getBinding() != null) {
+      return new File[]{getBinding()};
+    } else {
+      return getFiles(getBindings());
+    }
+  }
+
+  private File[] getDependsFiles() {
+    return getFiles(getDepends());
+  }
+
+  public boolean isUpToDate(File[] pSchemaFiles, File[] pBindingFiles, File[] pDependsFiles, List pProducesList) {
+    FileSet[] myProduces = getProduces();
+    if (myProduces.length == 0) {
+      log("No nested 'produces' elements, up-to-date check returns false", Project.MSG_VERBOSE);
+      return false;
+    }
+
+    boolean result = true;
+    long firstTarget = 0;
+    File firstTargetFile = null;
+    for (int i = 0;  i < myProduces.length;  i++) {
+      File dir = myProduces[i].getDir(getProject());
+      if (dir == null) {
+        dir = getTarget();
+        if (dir == null) {
+          dir = getProject().getBaseDir();
+        }
+        myProduces[i].setDir(dir);
+      }
+      if (!dir.exists()) {
+        log("The directory specified by the nested 'produces' element #" + i + " does not exist, up-to-date check returns false",
+            Project.MSG_VERBOSE);
+        result = false;
+        continue;
+      }
+      DirectoryScanner scanner = myProduces[i].getDirectoryScanner(getProject());
+      scanner.scan();
+      String[] files = scanner.getIncludedFiles();
+      if (files.length == 0) {
+        log("The fileset specified by the nested 'produces' element #" + i + " is empty, up-to-date check returns false",
+            Project.MSG_VERBOSE);
+        result = false;
+      }
+      for (int j = 0;  j < files.length;  j++) {
+        File f = new File(dir, files[j]).getAbsoluteFile();
+        if (pProducesList != null) {
+          pProducesList.add(f);
+        }
+        long l = f.lastModified();
+        if (l == -1) {
+          log("Unable to determine timestamp of target file " + f + ", up-to-date check returns false.", Project.MSG_VERBOSE);
+          result = false;
+        }
+        if (firstTargetFile == null  ||  firstTarget > l) {
+          firstTargetFile = f;
+          firstTarget = l;
+        }
+      }
+    }
+
+    if (isForce()) {
+      log("Force option is set, up-to-date check returns false", Project.MSG_VERBOSE);
+      result = false;
+    }
+
+    if (!result) {
+      return false;
+    }
+
+    List sourceFiles = new ArrayList();
+    for (int i = 0;  i < pSchemaFiles.length;  i++) {
+      sourceFiles.add(pSchemaFiles[i]);
+    }
+    for (int i = 0;  i < pBindingFiles.length;  i++) {
+      sourceFiles.add(pBindingFiles[i]);
+    }
+    for (int i = 0;  i < pDependsFiles.length;  i++) {
+      sourceFiles.add(pDependsFiles[i]);
+    }
+
+    long lastSource = 0;
+    File lastSourceFile = null;
+    for (Iterator iter = sourceFiles.iterator();  iter.hasNext();  ) {
+      File f = (File) iter.next();
+      long l = f.lastModified();
+      if (l == -1) {
+        log("Unable to determine timestamp of source file " + f + ", up-to-date check returns false.", Project.MSG_VERBOSE);
+        result = false;
+      }
+      if (lastSourceFile == null  ||  lastSource < l) {
+        lastSource = l;
+        lastSourceFile = f;
+      }
+    }
+
+    if (lastSourceFile == null) {
+      log("No source files found, up-to-date check returns false.", Project.MSG_VERBOSE);
+      return false;
+    }
+
+    if (!result) {
+      return false;
+    }
+
+    try {
+      URL url = Generator.class.getClassLoader().getResource(Generator.class.getName().replace('.', '/') + ".class");
+      if (url != null) {
+        long l = url.openConnection().getLastModified();
+        if (l != 0  &&  lastSource < l) {
+          log("Generator class is newer than any schema files, using Generator classes timestamp as schema timestamp.", Project.MSG_DEBUG);
+          lastSource = l;
+        }
+      }
+    } catch (IOException e) {
+    }
+
+    if (lastSource >= firstTarget) {
+      log("Source file " + lastSourceFile + " is more recent than target file " + firstTargetFile + ", up-to-date check returns false", Project.MSG_VERBOSE);
+      return false;
+    }
+
+    log("All target files are up-to-date.", Project.MSG_VERBOSE);
+    return true;
+  }
+
+  public class MyClassLoader extends java.lang.ClassLoader {
+    private java.lang.ClassLoader parent;
+    public java.lang.ClassLoader getMyParent() {
+      return parent;
+    }
+    public MyClassLoader(java.lang.ClassLoader pParent) {
+      super(XJCTask.this.getClass().getClassLoader());
+      parent = pParent;
+    }
+    public Class findClass(String name) throws ClassNotFoundException {
+      return parent.loadClass(name);
+    }
+    public URL findResource(String resource) {
+      return parent.getResource(resource);
+    }
+    public Enumeration findResources(String resource) throws IOException {
+      return parent.getResources(resource);
+    }
+  }
+
+  public void stopLogging(LoggerFactory pFactory) {
+    if (pFactory != null) {
+      LoggerAccess.setLoggerFactory(pFactory);
+    }
+  }
+
+  public LoggerFactory initLogging() {
+    if (!isSettingLoggerFactory()) {
+      return null;
+    }
+    LoggerFactory loggerFactory = LoggerAccess.getLoggerFactory();
+    if (!(loggerFactory instanceof AntProjectLoggerFactory)) {
+      loggerFactory = new AntProjectLoggerFactory(this);
+      LoggerAccess.setLoggerFactory(loggerFactory);
+      return loggerFactory;
+    }
+    return null;
+  }
+
+  public void execute() {
+    java.lang.ClassLoader parent = Thread.currentThread().getContextClassLoader();
+    MyClassLoader cl = new MyClassLoader(parent == null ? getClass().getClassLoader() : parent);
+    LoggerFactory loggerFactory = initLogging();
+    try {
+      Thread.currentThread().setContextClassLoader(cl);
+
+      File[] schemaFiles = getSchemaFiles();
+      if (schemaFiles.length == 0) {
+        log("No schema files specified", Project.MSG_WARN);
+        return;
+      }
+    
+      File[] bindingFiles = getBindingFiles();
+      File[] dependFiles = getDependsFiles();
+      List producesFiles = isRemoveOldOutput() ? new ArrayList() : null;
+      if (isUpToDate(schemaFiles, bindingFiles, dependFiles, producesFiles)) {
+        return;
+      }
+  
+      Set producesFilesSet = null;
+      if (producesFiles != null) {
+        producesFilesSet = new HashSet();
+        for (Iterator iter = producesFiles.iterator();  iter.hasNext();  ) {
+          File f = ((File) iter.next());
+          producesFilesSet.add(f);
+        }
+      }
+      
+  
+      Generator generator = new GeneratorImpl();
+      generator.setForcingOverwrite(isForce());
+      generator.setSettingReadOnly(isReadOnly());
+      generator.setValidating(isValidating());
+      for (int i = 0;  i < bindingFiles.length;  i++) {
+    	  try {
+    		  String systemId = bindingFiles[i].toURL().toExternalForm();
+    		  generator.addBindings(new InputSource(systemId));
+    	  } catch (Exception e) {
+    		  throw new BuildException("Failed to read external binding file "
+    				  + bindingFiles[i] + ": " + e.getMessage(), e,
+    				  getLocation());
+    	  }
+      }
+
+      if (getPackage() != null) {
+        generator.setProperty("jaxme.package.name", getPackage());
+      }
+      Dtd myDtd = getDtd();
+      if (myDtd != null) {
+      	generator.setProperty("jaxme.dtd.input", "true");
+        if (myDtd.getTargetNamespace() != null) {
+          generator.setProperty("jaxme.dtd.targetNamespace", myDtd.getTargetNamespace());
+        }
+      }
+      Property[] myProperties = getProperties();
+      for (int i = 0;  i < myProperties.length;  i++) {
+        Property ot = myProperties[i];
+        log("Option " + ot.getName() + "=" + ot.getValue(), Project.MSG_VERBOSE);
+        generator.setProperty(ot.getName(), ot.getValue());
+      }
+
+      SchemaReader reader = getSchemaReader();
+      if (reader instanceof JAXBSchemaReader) {
+      	((JAXBSchemaReader) reader).setSupportingExtensions(isExtension());
+      }
+      generator.setSchemaReader(reader);
+      reader.setGenerator(generator);
+      generator.setTargetDirectory(getTarget());
+      generator.setResourceTargetDirectory(getResourceTarget());
+
+      ClassType[] mySgFactoryChains = getSGFactoryChains();
+      if (mySgFactoryChains.length > 0) {
+        if (!(reader instanceof JAXBSchemaReader)) {
+          throw new BuildException("The nested child element 'sgFactoryChain' is valid only, if the schema reader is an instance of "
+                                    + JAXBSchemaReader.class.getName(), getLocation());
+        }
+        for (int i = 0;  i < mySgFactoryChains.length;  i++) {
+          ClassType ct = mySgFactoryChains[i];
+          Class c;
+          try {
+            c = cl.loadClass(ct.getClassName());
+          } catch (ClassNotFoundException e) {
+            throw new BuildException("Failed to load SGFactoryChain implementation class " + ct.getClassName(),
+                                      getLocation());
+          }
+          if (!SGFactoryChain.class.isAssignableFrom(c)) {
+            throw new BuildException("The SGFactoryChain class " + c.getName() +
+                                      " is not implementing " + SGFactoryChain.class.getName(),
+                                      getLocation());
+          }
+          reader.addSGFactoryChain(c);
+        }
+      }
+
+      for (int i = 0;  i < schemaFiles.length;  i++) {
+        log("Reading schema file " + schemaFiles[i], Project.MSG_VERBOSE);
+        try {
+		  SchemaSG schemaSG = generator.generate(schemaFiles[i]);
+          if (producesFilesSet != null) {
+            JavaSourceFactory jsf = schemaSG.getJavaSourceFactory();
+            File targetDirectory = getTarget();
+            for (Iterator iter = jsf.getJavaSources();  iter.hasNext();  ) {
+              JavaSource js = (JavaSource) iter.next();
+              File f = jsf.getLocation(targetDirectory, js).getAbsoluteFile();
+              producesFilesSet.remove(f);
+            }
+            for (Iterator iter = jsf.getTextFiles();  iter.hasNext();  ) {
+              TextFile tf = (TextFile) iter.next();
+              File f = jsf.getLocation(targetDirectory, tf).getAbsoluteFile();
+              producesFilesSet.remove(f);
+            }
+          }
+        } catch (SAXParseException e) {
+            String msg = LocSAXException.formatMsg(e.getMessage() == null ? e.getClass().getName() : e.getMessage(),
+                                                   e.getPublicId(),
+                                                   e.getSystemId(),
+                                                   e.getLineNumber(),
+                                                   e.getColumnNumber());
+            throw new BuildException(msg, e, getLocation());
+        } catch (Exception e) {
+			String msg = e.getMessage();
+			if (msg == null) {
+				msg = e.getClass().getName();
+			}
+            throw new BuildException(schemaFiles[i] + ": " + msg, e, getLocation());
+        }
+      }
+  
+      if (producesFilesSet != null) {
+        for (Iterator iter = producesFilesSet.iterator();  iter.hasNext();  ) {
+          File f = (File) iter.next();
+          log("Removing orphan file " + f, Project.MSG_VERBOSE);
+          if (!f.delete()) {
+            throw new BuildException("Unable to delete file " + f);
+          }
+        }
+      }
+    } finally {
+      Thread.currentThread().setContextClassLoader(parent);
+      stopLogging(loggerFactory);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/GeneratorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/GeneratorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/GeneratorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** <p>The Generator is reading an input schema. The schema is
+ * converted into a DOM tree. Finally one or more source
+ * writers are executed.
+ */
+public class GeneratorImpl implements Generator {
+	private static final Logger log = LoggerAccess.getLogger(GeneratorImpl.class);
+	private static final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+	static {
+		dbf.setNamespaceAware(true);
+		dbf.setValidating(false);
+	}
+
+	private SchemaReader schemaReader;
+	private java.io.File targetDirectory;
+	private java.io.File resourceTargetDirectory;
+	private Map properties = new HashMap();
+	private int nextKey;
+	private boolean isValidating, isForcingOverwrite, isSettingReadOnly;
+	private EntityResolver entityResolver;
+	private final List bindings = new ArrayList();
+	
+	/** <p>Sets the {@link EntityResolver} being used to import external
+	 * schemata.</p>
+	 */
+	public void setEntityResolver(EntityResolver pEntityResolver) {
+		entityResolver = pEntityResolver;
+	}
+	
+	/** <p>Returns the {@link EntityResolver} being used to import external
+	 * schemata.</p>
+	 */
+	public EntityResolver getEntityResolver() {
+		return entityResolver;
+	}
+	
+	/** <p>Returns whether the generator is forcing an overwrite of files.</p>
+	 */
+	public boolean isForcingOverwrite() {
+		return isForcingOverwrite;
+	}
+	
+	/** <p>Sets whether the generator is forcing an overwrite of files.</p>
+	 */
+	public void setForcingOverwrite(boolean pIsForcingOverwrite) {
+		isForcingOverwrite = pIsForcingOverwrite;
+	}
+	
+	/** <p>Returns whether the generator will create files in read-only mode.</p>
+	 */
+	public boolean isSettingReadOnly() {
+		return isSettingReadOnly;
+	}
+	
+	/** <p>Sets whether the generator will create files in read-only mode.</p>
+	 */
+	public void setSettingReadOnly(boolean pIsSettingReadOnly) {
+		isSettingReadOnly = pIsSettingReadOnly;
+	}
+	
+	public boolean isValidating() {
+		return isValidating;
+	}
+	
+	public void setValidating(boolean pIsValidating) {
+		isValidating = pIsValidating;
+	}
+	
+	/** Creates a new GeneratorImpl */
+	public GeneratorImpl() {
+	}
+	
+	/** <p>Sets the SchemaReader.</p>
+	 */
+	public void setSchemaReader(SchemaReader pReader) {
+		schemaReader = pReader;
+	}
+	
+	/** <p>Returns the SchemaReader.</p>
+	 */
+	public SchemaReader getSchemaReader() {
+		return schemaReader;
+	}
+	
+	public void setTargetDirectory(File pDirectory) {
+		targetDirectory = pDirectory;
+	}
+	
+	public File getTargetDirectory() {
+		return targetDirectory;
+	}
+	
+	public void setResourceTargetDirectory(File pDirectory) {
+		resourceTargetDirectory = pDirectory;
+	}
+	
+	public File getResourceTargetDirectory() {
+		return resourceTargetDirectory;
+	}
+
+	public SchemaSG generate(InputSource pSource) throws Exception {
+		SchemaReader sr = getSchemaReader();
+		sr.setGenerator(this);
+		
+		SchemaSG s = sr.parse(pSource);
+		s.generate();
+		File targetDir = getTargetDirectory();
+		File resourceTargetDir = getResourceTargetDirectory();
+		if (resourceTargetDir == null) {
+			resourceTargetDir = targetDir;
+		}
+		JavaSourceFactory jsf = s.getJavaSourceFactory();
+		for (Iterator iter = jsf.getJavaSources();  iter.hasNext();  ) {
+			((JavaSource) iter.next()).setForcingFullyQualifiedName(true);
+		}
+		s.getJavaSourceFactory().write(targetDir, resourceTargetDir);
+		
+		return s;
+	}
+	
+	
+	/** <p>Opens the given file, calls the specified SchemaReaders
+	 * () method and SourceWriters write() method.</p>
+	 */
+	public SchemaSG generate(File pFile) throws Exception {
+		final String mName = "generate(File)";
+		log.finer(mName, "->", pFile);
+		String path = pFile.getAbsolutePath();
+		if (!pFile.exists()) {
+			throw new java.io.FileNotFoundException("File does not exist: " + path);
+		}
+		if (!pFile.isFile()) {
+			throw new java.io.FileNotFoundException("Not a file: " + path);
+		}
+		
+		InputSource isource = new InputSource(new FileInputStream(pFile));
+		isource.setSystemId(pFile.toURL().toString());
+		SchemaSG s = generate(isource);
+		log.finer(mName, "<-", s);
+		return s;
+	}
+	
+	/** <p>Opens the given URL, calls the specified SchemaReaders
+	 * () method and SourceWriters write() method.</p>
+	 */
+	public SchemaSG generate(java.net.URL pURL) throws Exception {
+		final String mName = "generate(URL)";
+		log.entering(mName, pURL);
+		java.net.URLConnection conn = pURL.openConnection();
+		
+		InputSource isource = new InputSource(conn.getInputStream());
+		isource.setSystemId(pURL.toString());
+		SchemaSG s = generate(isource);
+		log.exiting(mName, s);
+		return s;
+	}
+	
+	public String getProperty(String pName) {
+		return (String) properties.get(pName);
+	}
+	
+	public String getProperty(String pName, String pDefault) {
+		String result = (String) properties.get(pName);
+		return (result == null) ? pDefault : result;
+	}
+	
+	public void setProperty(String pName, String pValue) {
+		properties.put(pName, pValue);
+	}
+	
+	public String getKey() {
+		return Integer.toString(nextKey++);
+	}
+
+	public void addBindings(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
+		DocumentBuilder db = dbf.newDocumentBuilder();
+		EntityResolver er = getEntityResolver();
+		if (er != null) {
+			db.setEntityResolver(er);
+		}
+		bindings.add(db.parse(pSource));
+	}
+
+	public Document[] getBindings() {
+		return (Document[]) bindings.toArray(new Document[bindings.size()]);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/Inliner.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/Inliner.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/Inliner.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.ws.jaxme.util.DOMSerializer;
+import org.apache.ws.jaxme.xs.SchemaTransformer;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+
+/** Performs the modifications on an XML schema file, as
+ * specified by an external binding file. This is based
+ * on a suggestion from Ortwin Glück, see
+ * <a href="http://wiki.apache.org/ws/JaxMe/ExternalSchemaBindings">
+ * http://wiki.apache.org/ws/JaxMe/ExternalSchemaBindings</a>.
+ */
+public class Inliner implements SchemaTransformer {
+	private static final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+	static {
+		dbf.setNamespaceAware(true);
+		dbf.setValidating(false);
+	}
+
+	private final Document[] bindings;
+	private XMLReader transformedXMLReader;
+	private InputSource transformedInputSource;
+
+	/** Creates a new instance with the given bindings.
+	 */
+	public Inliner(Document[] pBindings) {
+		bindings = pBindings;
+	}
+
+	private Document read(InputSource pSource, XMLReader pReader)
+			throws SAXException, ParserConfigurationException, IOException {
+		DocumentBuilder db = dbf.newDocumentBuilder();
+		db.setEntityResolver(pReader.getEntityResolver());
+		db.setErrorHandler(pReader.getErrorHandler());
+		return db.parse(pSource);
+	}
+
+	private void apply(Document pSchema, Document pBindings, String pURI) throws XPathExpressionException {
+		for (Iterator iter = getBindingElements(pBindings, pURI);  iter.hasNext();  ) {
+			Element e = (Element) iter.next();
+			String xpathQuery = e.getAttribute("node");
+			XPathFactory xpathFactory = XPathFactory.newInstance();
+			XPath xpath = xpathFactory.newXPath();
+			NodeList nodes = (NodeList) xpath.evaluate(xpathQuery, e, XPathConstants.NODESET);
+			for (int i = 0;  i < nodes.getLength();  i++) {
+				Node node = nodes.item(i);
+				if (node.getNodeType() != Node.ELEMENT_NODE) {
+					continue;
+				}
+				Element match = (Element) node;
+				if (!XSParser.XML_SCHEMA_URI.equals(match.getNamespaceURI())) {
+					continue;
+				}
+				String prefix = match.getPrefix();
+				Element annotationElement = getChild(match, prefix, "annotation");
+				Element appInfoElement = getChild(annotationElement, prefix, "appInfo");
+				for (Node child = e.getFirstChild();  child != null;  child = child.getNextSibling()) {
+					appInfoElement.appendChild(pSchema.importNode(child, true));
+				}
+			}
+		}
+	}
+
+	private Iterator getBindingElements(Document pBindings, String pURI) {
+		Element root = pBindings.getDocumentElement();
+		List result = new ArrayList();
+		for (Node child = root.getFirstChild();  child != null;  child = child.getNextSibling()) {
+			if (child.getNodeType() == Node.ELEMENT_NODE) {
+				Element e = (Element) child;
+				if (JAXBParser.JAXB_SCHEMA_URI.equals(e.getNamespaceURI())  &&
+					"bindings".equals(e.getLocalName())  &&
+					pURI.equals(e.getAttribute("schemaLocation"))) {
+					result.add(e);
+				}
+			}
+		}
+		return result.iterator();
+	}
+
+	private Element getChild(Element pParent, String pPrefix, String pName) {
+		for (Node child = pParent.getFirstChild();  child != null;  child = child.getNextSibling()) {
+			if (child.getNodeType() == Node.ELEMENT_NODE) {
+				Element e = (Element) child;
+				if (pName.equals(e.getLocalName())  &&  XSParser.XML_SCHEMA_URI.equals(e.getNamespaceURI())) {
+					return e;
+				}
+			}
+		}
+
+		String qName = (pPrefix == null || pPrefix.length() == 0) ? pName : pPrefix + ":" + pName;
+		Element e = pParent.getOwnerDocument().createElementNS(XSParser.XML_SCHEMA_URI, qName);
+		pParent.insertBefore(e, pParent.getFirstChild());
+		return e;
+	}
+
+	public void parse(InputSource pSource, XMLReader pReader) throws ParserConfigurationException, SAXException, IOException {
+		final Document schema = read(pSource, pReader);
+		String uri = pSource.getSystemId();
+		if (uri != null) {
+			try {
+				for (int i = 0;  i < bindings.length;  i++) {
+					apply(schema, bindings[i], uri);
+				}
+			} catch (XPathExpressionException e) {
+				throw new SAXException(e);
+			}
+		}
+		transformedInputSource = new InputSource();
+		transformedXMLReader = new XMLFilterImpl(){
+			public void parse(InputSource pInput) throws SAXException, IOException {
+				new DOMSerializer().serialize(schema, this);
+			}
+
+			public void parse(String pSystemId) throws SAXException, IOException {
+				throw new IllegalStateException("Not implemented");
+			}
+		};
+	}
+
+	public InputSource getTransformedInputSource() {
+		return transformedInputSource;
+	}
+
+	public XMLReader getTransformedXMLReader() {
+		return transformedXMLReader;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/SchemaReaderImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/SchemaReaderImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/SchemaReaderImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.impl;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.SchemaReader;
+
+
+/** <p>An abstract default implementation for SchemaReaders.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class SchemaReaderImpl implements SchemaReader {
+  private Generator generator;
+
+  public SchemaReaderImpl() {}
+
+  public void setGenerator(Generator pGenerator) { generator = pGenerator; }
+
+  public Generator getGenerator() { return generator; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains implementations for the <code>JaxMe</code> specific source generators.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+This package contains <code>JaxMe</code> specific source generators.
+This code uses the generic 
+<a href='http://ws.apache.org/jaxme/js/index.html'>JaxMeJS</a>
+java source generation framework to generate source from schema.
+    </p>
+        <p>
+The base package contains startup code (for Ant and from the command line).
+The actual implementations are contained within subpackages.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AtomicTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AtomicTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AtomicTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface AtomicTypeSG {
+  /** <p>Returns the value of the "maxExclusive" facet or null, if the facet
+   * is not set.</p>
+   */
+  public String getMaxExclusive();
+  /** <p>Returns the value of the "maxInclusive" facet or null, if the facet
+   * is not set.</p>
+   */
+  public String getMaxInclusive();
+  /** <p>Returns the value of the "minExclusive" facet or null, if the facet
+   * is not set.</p>
+   */
+  public String getMinExclusive();
+  /** <p>Returns the value of the "minInclusive" facet or null, if the facet
+   * is not set.</p>
+   */
+  public String getMinInclusive();
+  /** <p>Returns the value of the "length" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getLength();
+  /** <p>Returns the value of the "minLength" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getMinLength();
+  /** <p>Returns the value of the "maxLength" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getMaxLength();
+  /** <p>Returns the value of the "fractionDigits" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getFractionDigits();
+  /** <p>Returns the value of the "totalDigits" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getTotalDigits();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AttributeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AttributeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/AttributeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.SGItem;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.xml.sax.SAXException;
+
+
+/** <p>A source generator for attributes.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface AttributeSG extends SGItem {
+  /** <p>Returns the attribute name.</p>
+   */
+  public XsQName getName();
+
+  /** <p>Returns whether the attribute is required.</p>
+   */
+  public boolean isRequired();
+
+  /** <p>Invokes the given {@link SGlet} on any attribute value,
+   * assuming they are non-null.</p>
+   */
+  public void forAllValues(JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException;
+
+  /** <p>Invokes the given {@link SGlet} on any non null attribute
+   * value.</p>
+   */
+  public void forAllNonNullValues(JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException;
+
+  /** <p>Creates a new instance of {@link org.apache.ws.jaxme.generator.sg.PropertySGChain}.</p>
+   */
+  public Object newPropertySGChain();
+
+  /** <p>Returns an instance of {@link org.apache.ws.jaxme.generator.sg.PropertySG}.</p>
+   */
+  public PropertySG getPropertySG();
+
+  /** <p>Returns the attributes type.</p>
+   */
+  public TypeSG getTypeSG();
+
+  /** <p>Returns whether this is a "wildcard" attribute.</p>
+   */
+  public boolean isWildcard();
+
+  /** <p>If this is a "wildcard" attribute: Returns the namespace
+   * list.</p>
+   */
+  public XsNamespaceList getNamespaceList();
+
+  /** <p>If this is a "wildcard" attribute: Returns how to process
+   * unknown attributes.</p>
+   */
+  public XsTWildcard.ProcessContents getProcessContents();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexContentSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexContentSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexContentSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+
+
+/** Interface of a complex type with a complex content model.
+ */
+public interface ComplexContentSG {
+    /** <p>Returns the items location in the schema; useful for
+     * error messages.</p>
+     */
+    public Locator getLocator();
+
+    /** <p>Initializes the item.</p>
+     */
+    public void init() throws SAXException;
+	/** Returns, whether the types content model is empty.
+	 */
+	public boolean isEmpty();
+	
+	/** Returns, whether the types content model is mixed.
+	 */
+	public boolean isMixed();
+	
+	/** Returns the complex types root particle.
+	 */
+	public ParticleSG getRootParticle();
+
+	/** Returns a list of all element particles, which are
+	 * being generated as properties of the type.
+	 */
+	public ParticleSG[] getElementParticles() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ComplexTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a source generator for complex types.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ComplexTypeSG {
+  /** <p>Initializes the instance.</p>
+   */
+  public void init() throws SAXException;
+
+  /** <p>Returns the {@link TypeSG} that created this instance.</p>
+   */
+  public TypeSG getTypeSG();
+
+  /** <p>Returns the types {@link Locator}.</p>
+   */
+  public Locator getLocator();
+
+  /** <p>Returns the datatypes runtime type, which is the binding
+   * interface.</p>
+   */
+  public Context getClassContext();
+
+  /** <p>Generates the types interface as a standalone class.
+   * This is used for global types.</p>
+   */
+  public JavaSource getXMLInterface() throws SAXException;
+
+  /** <p>Generates the types interface as an inner class of the given.</p>
+   */
+  public JavaSource getXMLInterface(JavaSource pSource) throws SAXException;
+
+  /** <p>Generates the types implementation as a standalone class.
+   * This is used for global types.</p>
+   */
+  public JavaSource getXMLImplementation() throws SAXException;
+
+  /** <p>Generates the types implementation as an inner class of the given.</p>
+   */
+  public JavaSource getXMLImplementation(JavaSource pSource) throws SAXException;
+
+  /** <p>Generates the types XML serializer as a standalone class.
+   * This is used for global types.</p>
+   */
+  public JavaSource getXMLSerializer() throws SAXException;
+
+  /** <p>Generates the types XML serializer as an inner class of the given.
+   * This is used for local types.</p>
+   */
+  public JavaSource getXMLSerializer(JavaSource pSource) throws SAXException;
+
+  /** <p>Generates the types XML handler as a standalone class.
+   * This is used for global types.</p>
+   */
+  public JavaSource getXMLHandler(JavaQName pQName) throws SAXException;
+
+  /** <p>Generates the types XML handler as an inner class of the given.
+   * This is used for local types.</p>
+   */
+  public JavaSource getXMLHandler(JavaSource pSource) throws SAXException;
+
+  /** <p>Returns whether the data type has attributes.</p>
+   */
+  public boolean hasAttributes();
+
+  /** <p>Creates a new instance of
+   * {@link org.apache.ws.jaxme.generator.sg.AttributeSGChain}
+   * generating the given attribute.</p>
+   */
+  public Object newAttributeSG(XSAttribute pAttribute) throws SAXException;
+
+  /** <p>Creates a new instance of
+   * {@link org.apache.ws.jaxme.generator.sg.AttributeSGChain}
+   * generating the given wildcard attributes.</p>
+   */
+  public Object newAttributeSG(XSWildcard pWildcard) throws SAXException;
+
+  /** <p>Adds the given {@link AttributeSG} to the list of attributes
+   * and invokes the method {@link org.apache.ws.jaxme.generator.sg.SGItem#init()}
+   * on it.</p>
+   */
+  public void addAttributeSG(AttributeSG pAttribute) throws SAXException;
+
+  /** <p>Returns the data types array of attributes.</p>
+   */
+  public AttributeSG[] getAttributes();
+
+  /** <p>Returns whether the data type has simple content.</p>
+   */
+  public boolean hasSimpleContent();
+
+  /** <p>If the complex type has simple content: Creates an instance of
+   * {@link org.apache.ws.jaxme.generator.sg.SimpleContentSGChain} generating the type.</p>
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.SimpleContentSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.SimpleContentSGChain}
+   * interface.</p>
+   */
+  public Object newSimpleContentTypeSG() throws SAXException;
+
+  /** <p>If the data type has simple content: Returns an instance of
+   * {@link SimpleContentSG}. Uses {@link #newSimpleContentTypeSG()}
+   * internally.</p>
+   */
+  public SimpleContentSG getSimpleContentSG();
+
+  /** <p>If the complex type has complex content: Creates an instance of
+   * {@link org.apache.ws.jaxme.generator.sg.ComplexContentSGChain} generating the given complex type.</p>
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.ComplexContentSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.ComplexContentSGChain}
+   * interface.</p>
+   */
+  public Object newComplexContentTypeSG() throws SAXException;
+
+  /** <p>If the data type has complex content: Returns an instance of
+   * {@link ComplexContentSG}. Uses {@link #newComplexContentTypeSG()}
+   * internally.</p>
+   */
+  public ComplexContentSG getComplexContentSG();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Context.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Context.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Context.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.JavaQName;
+
+
+/** <p>A common base interface for items that may enclose a local
+ * type. This is used to construct inner class names.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Context {
+  /** <p>Returns the contexts XML interface name.</p>
+   */
+  public JavaQName getXMLInterfaceName();
+
+  /** <p>Returns the contexts XML implementation name.</p>
+   */
+  public JavaQName getXMLImplementationName();
+
+  /** <p>Returns the contexts XML handler name.</p>
+   */
+  public JavaQName getXMLHandlerName();
+
+  /** <p>Returns the contexts XML serializer name.</p>
+   */
+  public JavaQName getXMLSerializerName();
+
+  /** <p>Returns the contexts XML validator name.</p>
+   */
+  public JavaQName getXMLValidatorName();
+
+  /** <p>Returns the contexts PM name.</p>
+   */
+  public JavaQName getPMName();
+
+  /** <p>Returns whether the class context is global.</p>
+   */
+  public boolean isGlobal();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Facet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Facet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/Facet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Facet {
+  public class Type implements Serializable {
+    private final String name;
+    Type(String pName) { name = pName; }
+    public String getName() { return name; }
+    public String toString() { return name; }
+    private static final Type[] instances = new Type[]{
+      ENUMERATION, FRACTION_DIGITS, LENGTH, MAX_EXCLUSIVE, MAX_INCLUSIVE,
+      MAX_LENGTH, MIN_EXCLUSIVE, MIN_INCLUSIVE, MIN_LENGTH, PATTERN, TOTAL_DIGITS 
+    };
+    public static Type valueOf(String pName) {
+      for (int i = 0;  i < instances.length;  i++) {
+        if (instances[i].name.equals(pName)) {
+          return instances[i];
+        }
+      }
+      throw new IllegalArgumentException("Unknown facet type: " + pName);
+    }
+    public int hashCode() { return name.hashCode(); }
+    public boolean equals(Object o) {
+      return o != null  &&  (o instanceof Type)  &&  ((Type) o).name.equals(name);
+    }
+  };
+
+  /** <p>The facet type enumeration. Use the method {@link #getValues}
+   * to query for the values.</p>
+   */
+  public static final Type ENUMERATION = new Type("enumeration");
+
+  /** <p>The facet type fractionDigits. Use the method {@link #getNumValue}
+   * to query for the values.</p>
+   */
+  public static final Type FRACTION_DIGITS = new Type("fractionDigits");
+
+  /** <p>The facet type length. Use the method {@link #getNumValue}
+   * to query for the values.</p>
+   */
+  public static final Type LENGTH = new Type("length");
+
+  /** <p>The facet type maxLength. Use the method {@link #getNumValue}
+   * to query for the values.</p>
+   */
+  public static final Type MAX_LENGTH = new Type("maxLength");
+
+  /** <p>The facet type maxExclusive. Use the method {@link #getValue} to
+   * query for the value.</p>
+   */
+  public static final Type MAX_EXCLUSIVE = new Type("maxExclusive");
+
+  /** <p>The facet type maxInclusive. Use the method {@link #getValue} to
+   * query for the value.</p>
+   */
+  public static final Type MAX_INCLUSIVE = new Type("maxInclusive");
+
+  /** <p>The facet type minLength. Use the method {@link #getNumValue}
+   * to query for the values.</p>
+   */
+  public static final Type MIN_LENGTH = new Type("minLength");
+
+  /** <p>The facet type minExclusive. Use the method {@link #getValue} to
+   * query for the value.</p>
+   */
+  public static final Type MIN_EXCLUSIVE = new Type("minExclusive");
+
+  /** <p>The facet type minInclusive. Use the method {@link #getValue} to
+   * query for the value.</p>
+   */
+  public static final Type MIN_INCLUSIVE = new Type("minInclusive");
+
+  /** <p>The facet type pattern. Use the method {@link #getValues}
+   * to query for the values.</p>
+   */
+  public static final Type PATTERN = new Type("pattern");
+
+  /** <p>The facet type totalDigits. Use the method {@link #getNumValue}
+   * to query for the values.</p>
+   */
+  public static final Type TOTAL_DIGITS = new Type("totalDigits");
+
+  /** <p>Returns the facet type.</p>
+   */
+  public Type getType();
+
+  /** <p>If the facet has the types {@link #ENUMERATION} or {@link #PATTERN}:
+   * Used to fetch the possible values.</p>
+   */
+  public String[] getValues();
+
+  /** <p>If the facet has the types {@link #MAX_EXCLUSIVE}, {@link #MIN_EXCLUSIVE},
+   * {@link #MAX_INCLUSIVE}, or {@link #MIN_INCLUSIVE}: Returns the facet value.</p>
+   */
+  public String getValue();
+
+  /** <p>If the facet has the types {@link #FRACTION_DIGITS} or {@link #TOTAL_DIGITS}:
+   * Returns the facet value.</p>
+   */
+  public long getNumValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/GroupSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/GroupSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/GroupSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGItem;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a source generator for model groups.</p>
+ */
+public interface GroupSG extends SGItem {
+	/** <p>Returns whether the group is global.</p>
+	 */
+	public boolean isGlobal();
+
+    /** If the group is global: Returns the groups name.
+     * @throws IllegalStateException The group isn't global.
+     * @see #isGlobal()
+     */
+    public XsQName getName();
+
+	/** <p>Returns whether the groups compositor is "all".</p>
+	 */
+	public boolean isAll();
+	
+	/** <p>Returns whether the groups compositor is "choice".</p>
+	 */
+	public boolean isChoice();
+	
+	/** <p>Returns whether the groups compositor is "sequence".</p>
+	 */
+	public boolean isSequence();
+	
+	/** <p>Returns the groups {@link Context}.</p>
+	 */
+	public Context getClassContext() throws SAXException;
+	
+	/** <p>Returns the groups particles.</p>
+	 */
+	public ParticleSG[] getParticles() throws SAXException;
+	
+	/** <p>Creates a new instance of
+	 * {@link org.apache.ws.jaxme.generator.sg.ParticleSGChain} generating the
+	 * given particle.</p>
+	 * <p><em>Implementation note</em>: The type
+	 * {@link org.apache.ws.jaxme.generator.sg.ParticleSGChain}
+	 * must not be exposed in the interface, because the interface
+	 * class is used to generate this type. In other words, this
+	 * interface must be compilable without the
+	 * {@link org.apache.ws.jaxme.generator.sg.ParticleSGChain}
+	 * interface.</p>
+	 */
+	public Object newParticleSG(XSParticle pParticle) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ListTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ListTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ListTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ListTypeSG {
+  /** <p>Returns the list item type.</p>
+   */
+  public TypeSG getItemType();
+
+  /** <p>Returns the value of the "length" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getLength();
+
+  /** <p>Returns the value of the "maxLength" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getMaxLength();
+
+  /** <p>Returns the value of the "minLength" facet or null, if the facet
+   * is not set.</p>
+   */
+  public Long getMinLength();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ObjectSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ObjectSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ObjectSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.SGItem;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.xml.sax.SAXException;
+
+
+/** <p>A source generator for elements or attributes.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ObjectSG extends SGItem {
+  /** <p>Returns the objects name.</p>
+   */
+  public XsQName getName();
+
+  /** <p>Returns the objects {@link Context}.</p>
+   */
+  public Context getClassContext();
+
+  /** <p>Returns the objects type.</p>
+   */
+  public TypeSG getTypeSG();
+
+  /** <p>If the object is global and complex: Generates its XML interface.</p>
+   */
+  public JavaSource getXMLInterface() throws SAXException;
+
+  /** <p>If the object is global and complex: Generates its XML implementation.</p>
+   */
+  public JavaSource getXMLImplementation() throws SAXException;
+
+  /** <p>If the object is global and complex: Generates its XML handler.</p>
+   */
+  public JavaSource getXMLHandler() throws SAXException;
+
+  /** <p>If the object is global and complex: Generates its XML serializer.</p>
+   */
+  public JavaSource getXMLSerializer() throws SAXException;
+
+  /** <p>Generates the objects sources.</p>
+   */
+  public void generate() throws SAXException;
+
+  /** Returns whether the <code>ObjectSG</code> is global.
+   */
+  public boolean isGlobal() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ParticleSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ParticleSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/ParticleSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** Interface of a particle.
+ */
+public interface ParticleSG {
+    /** <p>Initializes the ParticleSG.</p>
+     */
+    public void init() throws SAXException;
+
+    /** <p>Returns the particles locator.</p>
+     */
+    public Locator getLocator();
+    
+    /** <p>Returns whether the pariticle is a group. If so, you may use the
+     * {@link #getGroupSG()} method.</p>
+     * @see #getGroupSG()
+     */
+    public boolean isGroup();
+    
+    /** <p>Returns whether the particle is an element. If so, you may use the
+     * {@link #getObjectSG()} method.</p>
+     * @see #getObjectSG()
+     */
+    public boolean isElement();
+    
+    /** <p>Returns whether the particle is a wildcard. If so, you may use the
+     * {@link #getObjectSG()} method.</p>
+     * @see #getObjectSG()
+     */
+    public boolean isWildcard();
+    
+    /** <p>If the particle is a group, returns the particles {@link GroupSG}.</p>
+     * @throws IllegalStateException The particle is no group.
+     * @see #isGroup()
+     */
+    public GroupSG getGroupSG();
+    
+    /** <p>If the particle is an element or wildcard, returns the particles {@link ObjectSG}.</p>
+     * @throws IllegalStateException The particle is neither an element nor a wildcard
+     * @see #isElement()
+     * @see #isWildcard()
+     */
+    public ObjectSG getObjectSG();
+    
+    /** <p>Returns the particles minOccurs value.</p>
+     * @see #getMaxOccurs()
+     */
+    public int getMinOccurs();
+    
+    /** <p>Returns the particles maxOccurs value; -1 indicated "unbounded".</p>
+     * @see #isMultiple()
+     * @see #getMinOccurs()
+     */
+    public int getMaxOccurs();
+    
+    /** <p>Returns whether the particles multiplicity is 2 or greater.</p>
+     * @see #getMaxOccurs()
+     */
+    public boolean isMultiple();
+    
+    /** <p>Creates a new instance of {@link org.apache.ws.jaxme.generator.sg.PropertySGChain}.</p>
+     */
+    public Object newPropertySGChain() throws SAXException;
+
+    /** <p>Returns an instance of {@link org.apache.ws.jaxme.generator.sg.PropertySG}.</p>
+     */
+    public PropertySG getPropertySG() throws SAXException;
+    
+    /** <p>Invokes the given {@link SGlet} for all non null values.</p>
+     */
+    public void forAllNonNullValues(JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/PropertySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/PropertySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/PropertySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface PropertySG {
+  /** <p>Initializes the <code>PropertySG</code>.</p>
+   */
+  public void init() throws SAXException;
+
+  /** <p>Returns whether the property has an "is set" method.</p>
+   */
+  public boolean hasIsSetMethod();
+
+  /** <p>Returns the properties collection type.</p>
+   */
+  public String getCollectionType();
+
+  /** <p>Returns the objects field name. By default, this is the
+   * property name with the prefix '_'.</p>
+   */
+  public String getXMLFieldName() throws SAXException;
+
+  /** <p>Returns the objects property name.</p>
+   */
+  public String getPropertyName() throws SAXException;
+
+  /** <p>Returns the objects getter name.</p>
+   */
+  public String getXMLGetMethodName() throws SAXException;
+
+  /** <p>Returns the objects setter name.</p>
+   */
+  public String getXMLSetMethodName() throws SAXException;
+
+  /** <p>Returns the name of the objects "isSet" method.</p>
+   */
+  public String getXMLIsSetMethodName() throws SAXException;
+
+  /** <p>Creates the Java field holding the objects property value.</p>
+   */
+  public JavaField getXMLField(JavaSource pSource) throws SAXException;
+
+  /** <p>Creates the getter returning the property value.</p>
+   */
+  public JavaMethod getXMLGetMethod(JavaSource pSource) throws SAXException;
+
+  /** <p>Creates the setter returning the property value.</p>
+   */
+  public JavaMethod getXMLSetMethod(JavaSource pSource) throws SAXException;
+
+  /** <p>Creates the isSet returning whether the property value is set or not.</p>
+   */
+  public JavaMethod getXMLIsSetMethod(JavaSource pSource) throws SAXException;
+
+  /** <p>Returns a piece of Java code with the property value.</p>
+   * @param pElement The element on which the value is being set or null for "this".
+   */
+  public Object getValue(DirectAccessible pElement) throws SAXException;
+
+  /** <p>Creates a piece of Java code setting the elements property value.
+   * In the case of an element with multiplicity > 1, the object must be
+   * a list or an array.</p>
+   *
+   * @param pMethod The method being generated.
+   * @param pElement The element on which the value is being set or null for "this".
+   * @param pType The values type, if a cast is required, or null, if the value
+   *   is already casted.
+   */
+  public void setValue(JavaMethod pMethod, DirectAccessible pElement, Object pValue, JavaQName pType)
+    throws SAXException;
+
+  /** <p>Creates a piece of Java code adding an element value. In the case
+   * of an element with multiplicity > 1, the object must be the atomic
+   * value.</p>
+   * @param pElement The element on which the value is being set or null for "this".
+   * @param pType The values type, if a cast is required, or null, if the value
+   *   is already casted.
+   */
+  public void addValue(JavaMethod pMethod, DirectAccessible pElement, TypedValue pValue, JavaQName pType)
+    throws SAXException;
+
+  /** <p>Invokes the given {@link org.apache.ws.jaxme.generator.sg.SGlet}
+   * for any value.</p>
+   * @param pElement The element on which the value is being set or null for "this".
+   */
+  public void forAllValues(JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException;
+
+  /** <p>Invokes the given {@link org.apache.ws.jaxme.generator.sg.SGlet}
+   * for any non null value.</p>
+   * @param pElement The element on which the value is being set or null for "this".
+   */
+  public void forAllNonNullValues(JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException;
+
+  /** <p>Generates the property setters and getters.</p>
+   */
+  public void generate(JavaSource pSource) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a factory for SG classes.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SGFactory {
+  /** <p>Returns the {@link org.apache.ws.jaxme.generator.Generator}.</p>
+   */
+  public Generator getGenerator();
+
+  /** <p>Initializes the {@link SGFactory}.</p>
+   */
+  public void init();
+
+  /** <p>Creates a new instance of {@link org.apache.ws.jaxme.xs.xml.XsObjectFactory},
+   * used by the parser.</p>
+   */
+  public XsObjectFactory newXsObjectFactory() throws SAXException;
+
+  /** <p>Creates a new instance of {@link org.apache.ws.jaxme.xs.XSObjectFactory},
+   * used by the parser.</p>
+   */
+  public XSObjectFactory newXSObjectFactory() throws SAXException;
+
+  /** <p>Creates a new instance of {@link SchemaSG} generating the
+   * given schema.</p>
+   */
+  public Object newSchemaSG(XSSchema pSchema) throws SAXException;
+  /** <p>Returns an instance of {@link SchemaSG} generating the
+   * given schema.</p>
+   */
+  public SchemaSG getSchemaSG(XSSchema pSchema) throws SAXException;
+  /** <p>Returns the factorys instance of {@link SchemaSG}.</p>
+   * @throws IllegalStateException The factory has not yet created an
+   *    instance of SchemaSG. In other words, the methods
+   *    {@link #newSchemaSG(XSSchema)} and {@link #getSchemaSG(XSSchema)}
+   *    have not yet been invoked.
+   */
+  public SchemaSG getSchemaSG();
+
+  /** <p>Creates a new instance of {@link ObjectSG} generating the
+   * given element.</p>
+   */
+  public Object newObjectSG(XSElement pElement) throws SAXException;
+
+  /** <p>Returns an instance of {@link ObjectSG} generating the
+   * given element.</p>
+   */
+  public ObjectSG getObjectSG(XSElement pElement) throws SAXException;
+
+  /** <p>Creates a new instance of {@link ObjectSG} generating the
+   * given element in the given context.</p>
+   */
+  public Object newObjectSG(XSElement pElement, Context pContext) throws SAXException;
+
+  /** <p>Returns an instance of {@link ObjectSG} generating the given
+   * element in the given context.</p>
+   */
+  public ObjectSG getObjectSG(XSElement pElement, Context pContext) throws SAXException;
+
+  /** <p>Creates a new instance of {@link ObjectSG} generating the given
+   * wildcard in the given context.</p>
+   */
+  public Object newObjectSG(XSAny any);
+
+  /** <p>Returns an instance of {@link ObjectSG} generating the given
+   * wildcard in the given context.</p>
+   */
+  public ObjectSG getObjectSG(XSAny pWildcard, Context pContext) throws SAXException;
+
+  /** <p>Creates a new instance of {@link GroupSG} generating the
+   * given schema.</p>
+   */
+  public GroupSG newGroupSG(XSGroup pGroup) throws SAXException;
+
+  /** <p>Returns an instance of {@link GroupSG} generating the
+   * given schema.</p>
+   */
+  public GroupSG getGroupSG(XSGroup pGroup) throws SAXException;
+
+  /** <p>Creates a new instance of {@link GroupSG}, which is embedded
+   * into the given {@link Context}.</p>
+   */
+  public GroupSG newGroupSG(XSGroup pGroup, Context pClassContext) throws SAXException;
+
+  /** <p>Returns an instance of {@link GroupSG}, which is embedded
+   * into the given {@link Context}.</p>
+   */
+  public GroupSG getGroupSG(XSGroup pGroup, Context pClassContext) throws SAXException;
+
+  /** <p>Creates a new, global instance of
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * generating the given type.</p>
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * interface.</p>
+   */
+  public Object newTypeSG(XSType pType) throws SAXException;
+
+  /** <p>Returns a global instance of {@link TypeSG} generating
+   * the given type.</p>
+   */
+  public TypeSG getTypeSG(XSType pType) throws SAXException;
+
+  /** <p>Creates a new, local instance of
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain},
+   * generating the given type within the given {@link Context}.
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * interface.</p>
+   */
+  public Object newTypeSG(XSType pType, Context pClassContext, XsQName pName) throws SAXException;
+
+  /** <p>Returns a local instance of {@link TypeSG} generating
+   * the given type within the given {@link Context}.</p>
+   */
+  public TypeSG getTypeSG(XSType pType, Context pClassContext, XsQName pName) throws SAXException;
+
+  /** <p>Creates a new, local instance of
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain},
+   * as if it were a global type with the given name.</p>
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.TypeSGChain}
+   * interface.</p>
+   */
+  public Object newTypeSG(XSType pType, XsQName pName) throws SAXException;
+
+  /** <p>Returns a new instance of {@link TypeSG} generating
+   * the given type, as if it were a global type with the
+   * given name.</p>
+   */
+  public TypeSG getTypeSG(XSType pType, XsQName pName) throws SAXException;
+
+  /** <p>Creates a new instance of {@link XSParser}.</p>
+   */
+  public XSParser newXSParser() throws SAXException;
+
+  /** <p>Creates a new enumeration facet.</p>
+   */
+  public Facet newFacet(XSType pType, XSEnumeration[] pEnumerations) throws SAXException;
+
+  /** <p>Returns an array of all groups created by the factory.</p>
+   */
+  public GroupSG[] getGroups();
+
+  /** <p>Returns an array of all types created by the factory.</p>
+   */
+  public TypeSG[] getTypes();
+
+  /** <p>Returns an array of all objects created by the factory.</p>
+   */
+  public ObjectSG[] getObjects();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGItem.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGItem.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGItem.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>A common base interface for
+ * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSG},
+ * {@link org.apache.ws.jaxme.generator.sg.ObjectSG},
+ * {@link org.apache.ws.jaxme.generator.sg.SchemaSG},
+ * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSG}, and
+ * {@link org.apache.ws.jaxme.generator.sg.TypeSG}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SGItem {
+  /** <p>Returns the factory that created this item.</p>
+   */
+  public SGFactory getFactory();
+
+  /** <p>Returns the items schema.</p>
+   */
+  public SchemaSG getSchema();
+
+  /** <p>Returns the items location in the schema; useful for
+   * error messages.</p>
+   */
+  public Locator getLocator();
+
+  /** <p>Initializes the item.</p>
+   */
+  public void init() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGlet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGlet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SGlet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.xml.sax.SAXException;
+
+
+/** <p>An SGlet is a tiny source generator used to generate
+ * sources in a loop.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SGlet {
+  public interface TypedSGlet extends SGlet {
+    public boolean isCasting();
+    public JavaQName getType();
+  }
+  public void generate(JavaMethod pMethod, Object pValue) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SchemaSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SchemaSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SchemaSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import java.util.List;
+
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.SGItem;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a source generator for the whole schema.</p>
+ * <p>
+ * Specifies the source representing a complete schema.
+ * The actual generation of the concrete source files
+ * is delegated to the <code>JavaSourceFactory</code>
+ * available by calling {@link #getJavaSourceFactory}.
+ * Various portions of the source artifacts are made
+ * available through property accessors.
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SchemaSG extends SGItem {
+  /** <p>Returns the schemas global types.</p>
+   */
+  public TypeSG[] getTypes() throws SAXException;
+
+  /** <p>Returns the schemas global type with the given name or
+   * null, if no such type exists.</p>
+   */
+  public TypeSG getType(XsQName pName) throws SAXException;
+
+  /** <p>Returns the schemas model groups.</p>
+   */
+  public GroupSG[] getGroups() throws SAXException;
+
+  /** <p>Returns the schemas global group with the given name or
+   * null, if no such type exists.</p>
+   */
+  public GroupSG getGroup(XsQName pName) throws SAXException;
+
+  /** <p>Returns the schemas global attributes and elements.</p>
+   */
+  public ObjectSG[] getObjects() throws SAXException;
+
+  /** <p>Returns the schemas global element with the given name or
+   * null, if no such element exists.</p>
+   */
+  public ObjectSG getElement(XsQName pName) throws SAXException;
+
+  /** <p>Returns the schemas global elements.</p>
+   */
+  public ObjectSG[] getElements() throws SAXException;
+
+  /** <p>Returns the schemas collection type, as specified by the
+   * JAXB globalBindings tag.</p>
+   */
+  public String getCollectionType();
+
+  /** <p>Returns the schemas {@link org.apache.ws.jaxme.js.JavaSourceFactory}.</p>
+   */
+  public JavaSourceFactory getJavaSourceFactory();
+
+  /** <p>Performs the source generation.</p>
+   */
+  public void generate() throws SAXException;
+
+  /** <p>Returns whether the schema prefers model group binding style or not.
+   * Defaults to false.</p>
+   */
+  public boolean isBindingStyleModelGroup();
+
+  /** <p>Returns whether the value "choiceContentProperty" is enabled.
+   * Defaults to false.</p>
+   */
+  public boolean isChoiceContentProperty();
+
+  /** <p>Returns whether the property "enableFailFastCheck" is enabled.
+   * Defaults to false.</p>
+   */
+  public boolean isFailFastCheckEnabled();
+
+  /** <p>Returns whether the property "enableJavaConventions" is enabled.
+   * Defaults to true.</p>
+   */
+  public boolean isJavaNamingConventionsEnabled();
+
+  /** <p>Returns whether the property "isFixedAttributeConstantProperty" is
+   * enabled. Defaults to false.</p>
+   */
+  public boolean isFixedAttributeConstantProperty();
+
+  /** <p>Returns whether the property "generateIsSetMethod" is enabled.
+   * Defaults to false.</p>
+   */
+  public boolean isGeneratingIsSetMethod();
+
+  /** <p>Returns whether the property "underscoreBinding" has the value
+   * "asWordSeparator". Defaults to true.</p>
+   */
+  public boolean isUnderscoreWordSeparator();
+
+  /** <p>Returns the globally configured instances of {@link JAXBJavaType}.</p>
+   */
+  public JAXBJavaType[] getJAXBJavaTypes();
+
+  /** <p>Returns the globally configured value for <code>typesafeenumbase</code>.</p>
+   */
+  public XsQName[] getTypesafeEnumBase();
+
+  /** <p>Generates the "Configuration.xml" file as a DOM node. Event
+   * handlers may modify the DOM node.</p>
+   * @param pPackageName The package, for which a configuration is being generated.
+   * @param pContextList A list of objects generated in the package.
+   */
+  public Document getConfigFile(String pPackageName, List pContextList) throws SAXException;
+
+  /** <p>Creates the "jaxb.properties" file.</p>
+   */
+  public void generateJaxbProperties() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleContentSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleContentSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleContentSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.xml.sax.SAXException;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+
+
+/** 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SimpleContentSG {
+  /** <p>Initializes the SimpleContentSG.</p>
+   */
+  public void init() throws SAXException;
+
+  /** <p>Creates an instance of
+   * {@link org.apache.ws.jaxme.generator.sg.PropertySGChain} generating
+   * the content element.</p>
+   */
+  public Object newPropertySGChain() throws SAXException;
+
+  /** <p>Returns the content elements {@link PropertySG}.</p>
+   */
+  public PropertySG getPropertySG() throws SAXException;
+
+  /** <p>Returns the complex type, to which this content element
+   * belongs.</p>
+   */
+  public TypeSG getTypeSG() throws SAXException;
+
+  /** <p>Returns the content elements simple type.</p>
+   */
+  public TypeSG getContentTypeSG() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.generator.sg.ListTypeSG;
+import org.apache.ws.jaxme.generator.sg.UnionTypeSG;
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.generator.sg.Facet.Type;
+import org.apache.ws.jaxme.generator.sg.SGItem;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a source generator for complex types.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SimpleTypeSG extends SGItem {
+  /** <p>Returns whether the simple type is atomic.</p>
+   */
+  public boolean isAtomic();
+
+  /** <p>Returns whether the simple type is a list.</p>
+   */
+  public boolean isList();
+
+  /** <p>Returns whether the simple type is a union.</p>
+   */
+  public boolean isUnion();
+
+  /** <p>Returns whether the simple type is nullable.</p>
+   */
+  public boolean isNullable();
+
+  /** <p>Sets whether the simple type is nullable.</p>
+   */
+  public void setNullable(boolean pNullable);
+
+  /** <p>If the simple type is atomic: Returns its atomic type details.</p>
+   */
+  public AtomicTypeSG getAtomicType();
+
+  /** <p>If the simple type is a list: Returns its item type details.</p>
+   * @throws IllegalStateException The type is no list.
+   */
+  public ListTypeSG getListType();
+
+  /** <p>If the simple type is a union: Returns its union type details.</p>
+   * @throws IllegalStateException The type is no union.
+   */
+  public UnionTypeSG getUnionType();
+
+  /** <p>Returns the data types runtime type.</p>
+   */
+  public JavaQName getRuntimeType();
+
+  /** Returns whether converting this type from a string can cause a
+   * {@link javax.xml.bind.ParseConversionEvent}.
+   */
+  public boolean isCausingParseConversionEvent();
+
+  /** <p>Returns a piece of Java code converting the string <code>pValue</code>
+   * into the runtime type. Conversion occurs at runtime, using the
+   * given instance of {@link org.apache.ws.jaxme.JMUnmarshallerHandler}.</p>
+   * @param pMethod The method performing the type convertion.
+   * @param pValue The value being casted
+   * @param pData A piece of Java code holding an instance of
+   * {@link org.apache.ws.jaxme.JMUnmarshallerHandler};
+   *  may be used to support the conversion.
+   */
+  public TypedValue getCastFromString(JavaMethod pMethod, Object pValue, Object pData) throws SAXException;
+
+  /** <p>Returns a piece of Java code converting the runtime type
+   * <code>pValue</code> into a string. Conversion occurs at runtime, using the
+   * given instance of {@link org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl}.</p>
+   */
+  public TypedValue getCastToString(JavaMethod pMethod, Object pValue, DirectAccessible pData) throws SAXException;
+
+  /** <p>Returns a piece of Java code converting the string <code>pValue</code>
+   * into the runtime type. Conversion occurs at compile time.</p>
+   */
+  public TypedValue getCastFromString(String pValue) throws SAXException;
+
+  /** <p>Returns whether the simple type does have a "set" method.</p>
+   */
+  public boolean hasSetMethod() throws SAXException;
+
+  /** <p>Returns the collection type, which is either of "indexed" (an array)
+   * or a list implementation, as specified by JAXB's property tag.</p>
+   */
+  public String getCollectionType();
+
+  /** <p>Returns all of the simple types facets.</p>
+   */
+  public Facet[] getFacets();
+
+  /** <p>Returns the simple types facets with the given type or null, if no
+   * such facet exists.</p>
+   */
+  public Facet getFacet(Type pType);
+
+  /** <p>Invokes the given {@link SGlet} on any value, assuming they
+   * are non null.</p>
+   */
+  public void forAllValues(JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException;
+
+  /** <p>Invokes the given {@link SGlet} on any non null value.</p>
+   */
+  public void forAllNonNullValues(JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException;
+
+  /** <p>Generates helper classes required by the simple type.</p>
+   */
+  public void generate() throws SAXException;
+
+  /** <p>Generates helper classes required by the simple type.
+   * The generated classes are inner classes of the given.</p>
+   */
+  public void generate(JavaSource pSource) throws SAXException;
+
+  /** <p>Returns code creating a boolean value indicating whether the given values
+   * are equal.</p>
+   */
+  public Object getEqualsCheck(JavaMethod pMethod, Object pValue1, Object pValue2) throws SAXException;
+
+  /** <p>Returns the types initial value, as created by the constructor.</p>
+   */
+  public Object getInitialValue(JavaSource pSource) throws SAXException;
+
+  /** <p>Generates a set method for the simple type.</p>
+   */
+  public JavaMethod getXMLSetMethod(JavaSource pSource, String pFieldName,
+		  							String pParamName, String pMethodName) throws SAXException;
+
+  /** <p>Adds code for validating the value <code>pValue</code> to the "add" or
+   * "set" method <code>pMethod</code>.</p>
+   */
+  public void addValidation(JavaMethod pMethod, DirectAccessible pValue) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/TypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/TypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/TypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.SGItem;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a source generator for types; applies both to
+ * simple and complex types.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface TypeSG extends SGItem {
+  /** <p>A property allows to store custom data related to the type.
+   * Properties are used by external source generators. For example,
+   * the JDBC source generator will use this to store the complex
+   * types table name here.</p>
+   */
+  public void setProperty(String pName, Object pValue);
+
+  /** <p>A property allows to store custom data related to the type.
+   * Properties are used by external source generators. For example,
+   * the JDBC source generator will use this to store the complex
+   * types table name here.</p>
+   */
+  public Object getProperty(String pName);
+
+  /** <p>Returns whether this is a global type.</p>
+   */
+  public boolean isGlobalType();
+
+  /** <p>Returns whether this type is generated with a global class.</p>
+   */
+  public boolean isGlobalClass();
+
+  /** <p>If the type is global: Returns the types name.</p>
+   * @throws IllegalStateException The type isn't global.
+   */
+  public XsQName getName();
+
+  /** <p>Returns whether the type is complex. If so, it is valid to
+   * invoke the method {@link #getComplexTypeSG}. Otherwise, you may
+   * invoke the method {@link #getSimpleTypeSG}.</p>
+   */
+  public boolean isComplex();
+
+  /** <p>If the type is simple: Creates a new instance of
+   * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain} generating the type.</p>
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain}
+   * interface.</p>
+   */
+  public Object newSimpleTypeSG() throws SAXException;
+
+  /** <p>If the type is complex: Creates an instance of
+   * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain} generating the type.</p>
+   * <p><em>Implementation note</em>: The type
+   * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain}
+   * must not be exposed in the interface, because the interface
+   * class is used to generate this type. In other words, this
+   * interface must be compilable without the
+   * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain}
+   * interface.</p>
+   */
+  public Object newComplexTypeSG() throws SAXException;
+
+  /** <p>If the type is complex: Returns an instance of
+   * {@link ComplexTypeSG} generating the type.</p>
+   */
+  public ComplexTypeSG getComplexTypeSG();
+
+  /** <p>If the type is simple: Returns an instance of {@link SimpleTypeSG}
+   * for generating the type.</p>
+   *
+   * @throws IllegalStateException The type is complex.
+   */
+  public SimpleTypeSG getSimpleTypeSG();
+
+  /** <p>Generates a Java field for an instance of this type.</p>
+   */
+  public JavaField getXMLField(JavaSource pSource, 
+                                     String pFieldName, String pDefaultValue) throws SAXException;
+
+  /** <p>Generates a get method returning an instance of this type.</p>
+   */
+  public JavaMethod getXMLGetMethod(JavaSource pSource,
+                                     String pFieldName, String pMethodName) throws SAXException;
+
+  /** <p>Generates a set method returning an instance of this type.</p>
+   */
+  public JavaMethod getXMLSetMethod(JavaSource pSource, String pFieldName,
+		  							String pParamName,
+  		                            String pMethodName, boolean pSetIsSet) throws SAXException;
+
+  /** <p>Generates an "isSet" method returning whether the field is set.</p>
+   */
+  public JavaMethod getXMLIsSetMethod(JavaSource pSource,
+                                       String pFieldName, String pMethodName) throws SAXException;
+
+  /** <p>Returns the types runtime type.</p>
+   */
+  public JavaQName getRuntimeType() throws SAXException;
+
+  /** <p>Generates the types sources.</p>
+   */
+  public void generate() throws SAXException;
+
+  /** <p>Generates the types sources as an inner class of the given.</p>
+   */
+  public void generate(JavaSource pSource) throws SAXException;
+
+  /** <p>Returns whether the type is a restriction of another type.</p>
+   */
+  public boolean isRestriction();
+
+  /** <p>If the type is a restriction: Returns the restricted type.</p>
+   * @throws IllegalStateException The type is no restriction.
+   */
+  public TypeSG getRestrictedType();
+
+  /** <p>Returns whether the type is an extension of another type.</p>
+   */
+  public boolean isExtension();
+
+  /** <p>If the type is an extension: Returns the extended type.</p>
+  * @throws IllegalStateException The type is no extension.
+   */
+  public TypeSG getExtendedType();
+
+  /** <p>Returns information on the types syntactical context.</p>
+   */
+  public XsSchemaHeader getSchemaHeader();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/UnionTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/UnionTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/UnionTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface UnionTypeSG {
+  /** <p>Returns the array of member types.</p>
+   */
+  public TypeSG[] getMemberTypes();
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AbstractContext.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AbstractContext.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AbstractContext.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.util.JavaNamer;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractContext implements Context {
+    private XsQName name;
+    private JavaQName xmlInterfaceName, xmlImplementationName, xmlHandlerName, xmlSerializerName;
+    private JavaQName xmlValidatorName, pmName;
+
+    public XsQName getName() { return name; }
+    protected void setName(XsQName pName) { name = pName; }
+    public JavaQName getXMLHandlerName() { return xmlHandlerName; }
+    protected void setXMLHandlerName(JavaQName pXmlHandlerName) { xmlHandlerName = pXmlHandlerName; }
+    public JavaQName getXMLImplementationName() { return xmlImplementationName; }
+    protected void setXMLImplementationName(JavaQName pXmlImplementationName) { xmlImplementationName = pXmlImplementationName; }
+    public JavaQName getXMLInterfaceName() { return xmlInterfaceName; }
+    protected void setXMLInterfaceName(JavaQName pXmlInterfaceName) {
+        xmlInterfaceName = pXmlInterfaceName;
+    }
+    public JavaQName getXMLSerializerName() { return xmlSerializerName; }
+    protected void setXMLSerializerName(JavaQName pXmlSerializerName) { xmlSerializerName = pXmlSerializerName; }
+    protected void setXMLValidatorName(JavaQName pXmlValidatorName) { xmlValidatorName = pXmlValidatorName; }
+    public JavaQName getXMLValidatorName() { return xmlValidatorName; }
+    protected void setPMName(JavaQName pPMName) { pmName = pPMName; }
+    public JavaQName getPMName() { return pmName; }
+
+    protected static String getClassNameFromLocalName(Locator pLocator, String pLocalName,
+            										  SchemaSG pSchemaSG) throws SAXException {
+        if (pLocalName == null  ||  pLocalName.length() == 0) {
+            throw new LocSAXException("Invalid local name: " + pLocalName, pLocator);
+        }
+        return JavaNamer.convert(pLocalName, pSchemaSG);
+    }
+
+    protected static String getPackageName(SchemaSG pSchemaSG,
+            							   JAXBSchemaBindings pSchemaBindings,
+            							   Locator pLocator,
+            							   XsQName pQName)
+    		throws SAXException {
+        String packageName = pSchemaSG.getFactory().getGenerator().getProperty("jaxme.package.name");
+        if (packageName == null) {
+            if (pSchemaBindings != null) {
+                JAXBSchemaBindings.Package jaxbPackage = pSchemaBindings.getPackage();
+                if (jaxbPackage != null) {
+                    packageName = jaxbPackage.getName();
+                }
+            }
+        }
+      
+        if (packageName == null) {
+            packageName = getPackageNameFromURI(pLocator, pQName.getNamespaceURI());
+        }
+        return packageName;
+    }
+
+    protected static String getPackageNameFromURL(URL pURL) {
+        List tokens = new ArrayList();
+        for (StringTokenizer st = new StringTokenizer(pURL.getHost(), ".");
+        	 st.hasMoreTokens();  ) {
+            tokens.add(st.nextToken());
+        }
+        Collections.reverse(tokens);
+        for (StringTokenizer st = new StringTokenizer(pURL.getPath(), "/");
+        	 st.hasMoreTokens();  ) {
+            tokens.add(st.nextToken());
+        }
+  
+        if (tokens.size() == 0) {
+            throw new IllegalArgumentException("Could not parse URL " + pURL);
+        }
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0;  i < tokens.size();  i++) {
+            if (i > 0) {
+                sb.append('.');
+            }
+            String tok = (String) tokens.get(i);
+            if (tok.length() == 0) {
+                throw new IllegalArgumentException("Could not parse URL " + pURL);
+            }
+            for (int j = 0;  j < tok.length();  j++) {
+                char c = Character.toLowerCase(tok.charAt(j));
+                if ((j == 0  &&  Character.isJavaIdentifierStart(c))
+                	||  (j > 0  && Character.isJavaIdentifierPart(c))) {
+                    sb.append(c);
+                } else {
+                    sb.append('_');
+                }
+            }
+        }
+        return sb.toString();
+    }
+  
+    protected static String getPackageNameFromURI(Locator pLocator, String pURI) throws SAXException {
+        if (pURI == null  ||  pURI.length() == 0) {
+            throw new LocSAXException("Unable to derive package name from an empty namespace URI. Use the schemaBindings to specify a package name.", pLocator);
+        }
+        try {
+            URL url = new java.net.URL(pURI);
+            return getPackageNameFromURL(url);
+        } catch (MalformedURLException e) {
+            throw new LocSAXException("Unable to derive package name from an URI, which is no URL: " + pURI,
+                    pLocator);
+        }
+    }
+    
+    public String toString() {
+        return super.toString() + " [" + getName() + "," + getXMLInterfaceName() + "," +
+        getXMLImplementationName() + "]";
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyAttributePropertySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyAttributePropertySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyAttributePropertySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.WildcardAttribute;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaClassInitializer;
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.xml.sax.SAXException;
+
+
+/** <p>PropertySG for attribute wildcards.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class AnyAttributePropertySG extends JAXBPropertySG {
+    private final XsNamespaceList namespaceList;
+    private final XsSchemaHeader schemaHeader;
+
+    protected AnyAttributePropertySG(AttributeSG pAttribute, XSWildcard pWildcard) {
+		super("anyAttribute", pAttribute.getSchema(), pWildcard, null, null);
+		namespaceList = pWildcard.getNamespaceList();
+		schemaHeader = pWildcard.getSchemaHeader();
+	}
+
+    protected String getTargetNamespace() {
+        String targetNamespace = schemaHeader == null ? "" : schemaHeader.getTargetNamespace().toString();
+        if (targetNamespace == null) {
+            targetNamespace = "";
+        }
+        return targetNamespace;
+    }
+
+	public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
+		if (pSource.isInterface()) {
+			return null;
+		}
+		JavaQName runtimeType = JavaQNameImpl.getInstance(Map.class);
+		JavaField jf = pSource.newJavaField(pController.getXMLFieldName(), runtimeType, JavaSource.PRIVATE);
+		jf.setFinal(true);
+		jf.addLine("new ", HashMap.class, "()");
+		return jf;
+	}
+
+	protected JavaField getNamespaces(PropertySG pController, JavaSource pSource) throws SAXException {
+	    if (namespaceList.isAny()  ||  namespaceList.isOther()) {
+	        return null;
+	    }
+	    String namespaces = pController.getXMLFieldName() + "Namespaces";
+	    JavaField jf = pSource.newJavaField(namespaces, Set.class);
+	    jf.setStatic(true);
+	    jf.setFinal(true);
+	    JavaClassInitializer jci = pSource.newJavaClassInitializer();
+	    LocalJavaField set = jci.newJavaField(Set.class);
+	    set.addLine("new ", HashSet.class, "()");
+	    XsAnyURI[] uris = namespaceList.getUris();
+	    for (int i = 0;  i < uris.length;  i++) {
+	        jci.addLine(set, ".add(", JavaSource.getQuoted(uris[i].toString()), ");");
+	    }
+	    jci.addLine(jf, " = ", Collections.class, ".unmodifiableSet(", set, ");");
+	    return jf;
+	}
+
+	protected void getValidNamespaceCheck(PropertySG pController, JavaMethod pMethod, Parameter pName)
+			throws SAXException {
+	    if (namespaceList.isAny()) {
+	        // No checks for namespace
+	    } else if (namespaceList.isOther()) {
+	        String targetNamespace = getTargetNamespace();
+	        pMethod.addIf(JavaSource.getQuoted(targetNamespace), ".equals(", pName, ".getNamespaceURI())");
+	        pMethod.addThrowNew(IllegalArgumentException.class,
+	                			JavaSource.getQuoted("The namespace of the pName argument must not match the target namespace '" +
+	                			        			 targetNamespace + "'."));
+	        pMethod.addEndIf();
+	    } else {
+	        String targetNamespace = getTargetNamespace();
+	        String namespaces = pController.getXMLFieldName() + "Namespaces";
+	        pMethod.addIf("!", namespaces, ".contains(", pName, ".getNamespaceURI())");
+	        pMethod.addThrowNew(IllegalArgumentException.class,
+	                			JavaSource.getQuoted("The namespace of the pName argument must not match the target namespace '" +
+	                			        			 targetNamespace + "'."));
+	        pMethod.addEndIf();
+	    }
+	}
+
+	public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+	    JavaMethod jm = pSource.newJavaMethod(pController.getXMLGetMethodName(), String.class, JavaSource.PUBLIC);
+	    JavaComment jc = jm.newComment();
+	    jc.addLine("<p>Returns the value of the 'anyAttribute' named <code>pName</code>.</p>");
+	    jc.addLine("@return Attribute value or null, if the attribute is not set.");
+	    jc.addLine("@throws NullPointerException The <code>pName</code> argument is null.");
+	    if (!namespaceList.isAny()) {
+	        jc.addLine("@throws IllegalArgumentException The namespace <code>pName.getNamespaceURI()</code> is invalid.");
+	    }
+	    Parameter pName = jm.addParam(QName.class, "pName");
+	    if (!pSource.isInterface()) {
+		    jm.addIf(pName, " == null");
+		    jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pName argument must not be null."));
+		    jm.addEndIf();
+		    getValidNamespaceCheck(pController, jm, pName);
+		    jm.addLine("return (", String.class, ") ", pController.getXMLFieldName(), ".get(", pName, ");");
+	    }
+	    return jm;
+	}
+
+	public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+	    JavaMethod jm = pSource.newJavaMethod(pController.getXMLSetMethodName(), void.class, JavaSource.PUBLIC);
+	    JavaComment jc = jm.newComment();
+	    jc.addLine("<p>Sets the 'anyAttribute' named <code>pName</code> to the value <code>pValue</code>.</p>");
+	    if (!namespaceList.isAny()) {
+	        jc.addLine("@throws IllegalArgumentException The namespace <code>pName.getNamespaceURI()</code> is invalid.");
+	    }
+	    jc.addLine("@throws NullPointerException Either of the arguments <code>pName</code> or <code>pValue</code> is null.");
+	    Parameter pName = jm.addParam(QName.class, "pName");
+	    Parameter pValue = jm.addParam(String.class, "pValue");
+	    if (!pSource.isInterface()) {
+		    jm.addIf(pName, " == null");
+		    jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pName argument must not be null."));
+		    jm.addEndIf();
+		    jm.addIf(pValue, " == null");
+		    jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pValue argument must not be null."));
+		    jm.addEndIf();
+		    getValidNamespaceCheck(pController, jm, pName);
+		    jm.addLine(pController.getXMLFieldName(), ".put(", pName, ", ", pValue, ");");
+	    }
+	    return jm;
+	}
+
+	public JavaMethod getXMLUnsetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+	    JavaMethod jm = pSource.newJavaMethod("un" + pController.getXMLSetMethodName(), boolean.class, JavaSource.PUBLIC);
+	    JavaComment jc = jm.newComment();
+	    jc.addLine("<p>Removes the 'anyAttribute' named <code>pName</code>.</p>");
+	    if (!namespaceList.isAny()) {
+	        jc.addLine("@throws IllegalArgumentException The namespace <code>pName.getNamespaceURI()</code> is invalid.");
+	    }
+	    jc.addLine("@throws NullPointerException Either of the arguments <code>pName</code> or <code>pValue</code> is null.");
+	    jc.addLine("@return True, if the attribute was set, otherwise false.");
+	    Parameter pName = jm.addParam(QName.class, "pName");
+	    if (!pSource.isInterface()) {
+		    jm.addIf(pName, " == null");
+		    jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pName argument must not be null."));
+		    jm.addEndIf();
+		    getValidNamespaceCheck(pController, jm, pName);
+		    jm.addLine("return ", pController.getXMLFieldName(), ".remove(", pName, ") != null;");
+	    }
+	    return jm;
+	}
+
+	public JavaMethod getXMLGetArrayMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+	    JavaMethod jm = pSource.newJavaMethod(pController.getXMLGetMethodName() + "Array", WildcardAttribute[].class, JavaSource.PUBLIC);
+	    JavaComment jc = jm.newComment();
+	    jc.addLine("<p>Returns the array of 'anyAttributes'.</p>");
+	    LocalJavaField size = jm.newJavaField(int.class);
+	    size.addLine(pController.getXMLFieldName(), ".size()");
+	    LocalJavaField result = jm.newJavaField(jm.getType());
+	    result.addLine("new ", WildcardAttribute.class, "[", size, "]");
+	    DirectAccessible iter = jm.addForCollection(new Object[]{pController.getXMLFieldName(), ".entrySet()"});
+	    LocalJavaField entry = jm.newJavaField(Map.Entry.class);
+	    entry.addLine("(", Map.Entry.class, ") ", iter, ".next()");
+	    if (!pSource.isInterface()) {
+		    jm.addLine(result, "[--", size, "] = new ", WildcardAttribute.class, "((",
+		               QName.class, ") ", entry, ".getKey(), (", String.class, ") ",
+					   entry, ".getValue());");
+		    jm.addEndFor();
+		    jm.addLine("return ", result, ";");
+	    }
+	    return jm;
+	}
+
+	public void generate(PropertySG pController, JavaSource pSource) throws SAXException {
+	    super.generate(pController, pSource);
+	    getXMLUnsetMethod(pController, pSource);
+	    getXMLGetArrayMethod(pController, pSource);
+	    if (!pSource.isInterface()) {
+	        getNamespaces(pController, pSource);
+	    }
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyElementPropertySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyElementPropertySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AnyElementPropertySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class AnyElementPropertySG extends JAXBPropertySG {
+    protected AnyElementPropertySG(ObjectSG pObjectSG, XSAny pAny) {
+        super("any", pObjectSG.getSchema(), pAny, null, null);
+    }
+
+    public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
+        String fieldName = pController.getXMLFieldName();
+        JavaField result = pSource.newJavaField(fieldName, Object.class, JavaSource.PRIVATE);
+        return result;
+    }
+
+    public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+        String fieldName = pController.getXMLFieldName();
+        String methodName = pController.getXMLGetMethodName();
+        JavaMethod result = pSource.newJavaMethod(methodName, Object.class, JavaSource.PUBLIC);
+        result.addLine("return ", fieldName, ";");
+        return result;
+    }
+
+    public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+        String fieldName = pController.getXMLFieldName();
+        String methodName = pController.getXMLSetMethodName();
+        JavaMethod result = pSource.newJavaMethod(methodName, void.class, JavaSource.PUBLIC);
+        Parameter param = result.addParam(Object.class, "p" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1));
+        result.addLine(fieldName, " = ", param, ";");
+        return result;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ArrayPropertySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ArrayPropertySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ArrayPropertySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,203 @@
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.xml.sax.SAXException;
+
+
+/** A subclass of {@link MultiplePropertySG}, which generates
+ * arrays rather than lists.
+ */
+public class ArrayPropertySG extends MultiplePropertySG {
+	protected ArrayPropertySG(PropertySGChain pBase, ObjectSG pObjectSG, int pMinOccurs, int pMaxOccurs) throws SAXException {
+		super(pBase, pObjectSG, pMinOccurs, pMaxOccurs);
+	}
+
+	private JavaQName getArrayClass() throws SAXException {
+		return JavaQNameImpl.getArray(getInstanceClass());
+	}
+
+	public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		JavaQName arrayClass = getArrayClass();
+		String fieldName = pController.getXMLFieldName();
+		String methodName = pController.getXMLGetMethodName();
+		JavaMethod result = pSource.newJavaMethod(methodName, arrayClass, JavaSource.PUBLIC);
+		if (!pSource.isInterface()) {
+			Object o = new Object[]{"new ", arrayClass.getInstanceClass(),
+									"[", fieldName, ".size()]"};
+			if (isAutoBoxing()) {
+				LocalJavaField res = result.newJavaField(getArrayClass());
+				res.addLine(o);
+				DirectAccessible i = result.addForList(int.class, fieldName);
+				result.addLine(res, "[", i, "] = ", asPrimitive(i, fieldName), ";");
+				result.addEndFor();
+				result.addLine("return ", res, ";");
+			} else {
+				result.addLine("return (", arrayClass, ") ", fieldName,
+						".toArray(", o, ");");
+			}
+		}
+		return result;
+	}
+
+	protected JavaMethod getXMLGetElementMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		JavaQName instanceClass = getInstanceClass();
+		String fieldName = pController.getXMLFieldName();
+		String methodName = pController.getXMLGetMethodName();
+		JavaMethod result = pSource.newJavaMethod(methodName, instanceClass, JavaSource.PUBLIC);
+		Parameter index = result.addParam(int.class, "pIndex");
+		if (!pSource.isInterface()) {
+			result.addLine("return ", asPrimitive(index, fieldName), ";");
+		}
+		return result;
+	}
+
+	protected JavaMethod getXMLGetLengthMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		String fieldName = pController.getXMLFieldName();
+		String methodName = pController.getXMLGetMethodName() + "Length";
+		JavaMethod result = pSource.newJavaMethod(methodName, int.class, JavaSource.PUBLIC);
+		if (!pSource.isInterface()) {
+			result.addLine("return ", fieldName, ".size();");
+		}
+		return result;
+	}
+
+	private Object asPrimitive(DirectAccessible pIndex, String pFieldName) throws SAXException {
+		return asPrimitive(new Object[]{"((", getObjectClass(), ") ",
+										pFieldName, ".get(", pIndex, "))"});
+	}
+
+	private Object asPrimitive(Object pObject) throws SAXException {
+		if (isAutoBoxing()) {
+			return new Object[]{pObject, ".", getInstanceClass().getPrimitiveConversionMethod(), "()"};
+		} else {
+			return pObject;
+		}
+	}
+
+	public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		JavaQName arrayClass = getArrayClass();
+		String fieldName = pController.getXMLFieldName();
+		String methodName = pController.getXMLSetMethodName();
+		JavaMethod result = pSource.newJavaMethod(methodName, "void", JavaSource.PUBLIC);
+		Parameter array = result.addParam(arrayClass, "pValue");
+		if (!pSource.isInterface()) {
+			result.addLine(fieldName, ".clear();");
+			result.addIf(array, " != null");
+			DirectAccessible i = result.addForArray(int.class, array);
+			Object o = new Object[]{array, "[", i, "]"};
+			result.addLine(fieldName, ".add(", asObject(o), ");");
+			result.addEndFor();
+			result.addEndIf();
+		}
+		return result;
+	}
+
+	protected JavaMethod getXMLSetElementMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		JavaQName instanceClass = getInstanceClass();
+		String fieldName = pController.getXMLFieldName();
+		String methodName = pController.getXMLSetMethodName();
+		JavaMethod result = pSource.newJavaMethod(methodName, "void", JavaSource.PUBLIC);
+		Parameter index = result.addParam(int.class, "pIndex");
+		Parameter element = result.addParam(instanceClass, "pValue");
+		if (!pSource.isInterface()) {
+			result.addLine(fieldName, ".set(", index, ", ", asObject(element), ");");
+		}
+		return result;
+	}
+
+	public void forAllValues(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		LocalJavaField array = pMethod.newJavaField(getArrayClass());
+		array.addLine(pController.getValue(pElement));
+		DirectAccessible i = pMethod.addForArray(array);
+		Object v;
+		boolean isCasting = !OBJECT_TYPE.equals(getInstanceClass());
+		if (isCasting  &&  pSGlet instanceof SGlet.TypedSGlet) {
+			isCasting = ((SGlet.TypedSGlet) pSGlet).isCasting();
+		}
+		if (isCasting) {
+			v = new Object[]{"(", getInstanceClass(), ")", array, "[", i, "]"};
+		} else {
+			v = new Object[]{array, "[", i, "]"};
+		}
+		TypeSG tSG = getObjectSG().getTypeSG();
+		if (tSG.isComplex()) {
+			pSGlet.generate(pMethod, v);
+		} else {
+			tSG.getSimpleTypeSG().forAllValues(pMethod, v, pSGlet);
+		}
+		pMethod.addEndFor();
+	}
+
+	public void forAllNonNullValues(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		LocalJavaField array = pMethod.newJavaField(getArrayClass());
+		array.addLine(pController.getValue(pElement));
+		DirectAccessible i = pMethod.addForArray(array);
+		TypeSG typeSG = getObjectSG().getTypeSG();
+		Object v;
+		boolean isCasting = !OBJECT_TYPE.equals(typeSG.getRuntimeType());
+		JavaQName qName = typeSG.getRuntimeType();
+		if (isCasting  &&  pSGlet instanceof SGlet.TypedSGlet) {
+			SGlet.TypedSGlet typedSGlet = (SGlet.TypedSGlet) pSGlet;
+			isCasting = typedSGlet.isCasting();
+			if (typedSGlet.getType() != null) {
+				qName = typedSGlet.getType();
+			}
+		}
+		if (isCasting) {
+			v = new Object[]{"(", qName, ")", array, "[", i, "]"};
+		} else {
+			v = new Object[]{array, "[", i, "]"};
+		}
+		if (typeSG.isComplex()) {
+			pSGlet.generate(pMethod, v);
+		} else {
+			typeSG.getSimpleTypeSG().forAllNonNullValues(pMethod, v, pSGlet);
+		}
+		pMethod.addEndFor();
+	}
+
+	public void generate(PropertySG pController, JavaSource pSource) throws SAXException {
+		super.generate(pController, pSource);
+		getXMLSetElementMethod(pController, pSource);
+		getXMLGetElementMethod(pController, pSource);
+		getXMLGetLengthMethod(pController, pSource);
+	}
+
+	public void setValue(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, Object pValue, JavaQName pType)
+			throws SAXException {
+		pMethod.addLine(pElement, ".", pController.getXMLSetMethodName(), "(", pValue, ");"); 
+	}
+
+	public void addValue(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, TypedValue pValue, JavaQName pType) throws SAXException {
+		if (getObjectSG().getTypeSG().isComplex()) {
+			LocalJavaField g = pMethod.newJavaField(getInstanceClass());
+			g.addLine("(", getInstanceClass(), ") ", pValue);
+			pValue = g;
+		}
+		JavaQName arrayClass = getArrayClass();
+		LocalJavaField f = pMethod.newJavaField(arrayClass);
+		f.addLine(pController.getValue(pElement));
+		pMethod.addIf(f, " == null  ||  ", f, ".length == 0");
+		pMethod.addLine(f, " = new ", arrayClass, "{", pValue, "};");
+		pController.setValue(pMethod, pElement, f, pType);
+		pMethod.addElse();
+		LocalJavaField g = pMethod.newJavaField(arrayClass);
+		g.addLine("new ", getInstanceClass(), "[", f, ".length + 1]");
+		pMethod.addLine(System.class, ".arraycopy(", f, ", 0, ", g, ", 0, ", f, ".length);");
+		pMethod.addLine(g, "[", f, ".length] = ", pValue, ";");
+		pController.setValue(pMethod, pElement, g, pType);
+		pMethod.addEndIf();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AtomicTypeSGImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AtomicTypeSGImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/AtomicTypeSGImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.xs.XSAtomicType;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class AtomicTypeSGImpl implements AtomicTypeSG {
+  private final String maxExclusive, maxInclusive;
+  private final String minExclusive, minInclusive;
+  private final Long fractionDigits, totalDigits;
+  private final Long length, maxLength, minLength;
+
+  public AtomicTypeSGImpl(XSAtomicType xsAtomicType) {
+    maxExclusive = xsAtomicType.getMaxExclusive();
+    maxInclusive = xsAtomicType.getMaxInclusive();
+    minExclusive = xsAtomicType.getMinExclusive();
+    minInclusive = xsAtomicType.getMinInclusive();
+    fractionDigits = xsAtomicType.getFractionDigits();
+    totalDigits = xsAtomicType.getTotalDigits();
+    length = xsAtomicType.getLength();
+    maxLength = xsAtomicType.getMaxLength();
+    minLength = xsAtomicType.getMinLength();
+  }
+
+  public String getMaxExclusive() { return maxExclusive; }
+  public String getMaxInclusive() { return maxInclusive; }
+  public String getMinExclusive() { return minExclusive; }
+  public String getMinInclusive() { return minInclusive; }
+  public Long getFractionDigits() { return fractionDigits; }
+  public Long getTotalDigits() { return totalDigits; }
+  public Long getLength() { return length; }
+  public Long getMaxLength() { return maxLength; }
+  public Long getMinLength() { return minLength; }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/EnumerationSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/EnumerationSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/EnumerationSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,274 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBEnumeration;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSimpleType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumMember;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class EnumerationSG extends SimpleTypeSGChainImpl {
+  private class EnumValue {
+    private final String value;
+    private final String name;
+    public EnumValue(String pValue, String pName) {
+      value = pValue;
+      name = pName;
+    }
+    public String getName() { return name; }
+    public String getValue() { return value; }
+  }
+
+  private final JavaQName qName;
+  private final EnumValue[] values;
+
+  /** <p>Creates a new instance of EnumerationSG.java.</p>
+   */
+  protected EnumerationSG(SimpleTypeSGChain o, JavaQName pName, XSType pType) throws SAXException {
+    super(o);
+    qName = pName;
+
+    XSSimpleType simpleType = pType.getSimpleType();
+    XSEnumeration[] enumerations = simpleType.getEnumerations();
+    List enums = new ArrayList();
+    for (int i = 0;  i < enumerations.length;  i++) {
+      XSEnumeration en = enumerations[i];
+      String name = null;
+      String value = en.getValue();
+      if (en instanceof JAXBEnumeration) {
+        JAXBEnumeration jaxbEnumeration = (JAXBEnumeration) en;
+        JAXBTypesafeEnumMember member = jaxbEnumeration.getJAXBTypesafeEnumMember();
+        if (member != null) {
+          name = member.getName();
+        }
+      }
+
+      if (name == null) {
+        if (simpleType instanceof JAXBSimpleType) {
+          JAXBSimpleType jaxbSimpleType = (JAXBSimpleType) simpleType;
+          JAXBTypesafeEnumClass jaxbTypesafeEnumClass = jaxbSimpleType.getJAXBTypesafeEnumClass();
+          if (jaxbTypesafeEnumClass != null) {
+            for (Iterator iter = jaxbTypesafeEnumClass.getTypesafeEnumMember();  iter.hasNext();  ) {
+              JAXBTypesafeEnumMember member = (JAXBTypesafeEnumMember) iter.next();
+              if (value.equals(member.getValue())) {
+                name = member.getName();
+                break;
+              }
+            }
+          }
+        }
+
+        if (name == null) {
+          if ("".equals(value)) {
+            name = "EMPTY";
+          } else {
+            StringBuffer sb = new StringBuffer();
+            char c = value.charAt(0);
+            int offset;
+            if (Character.isJavaIdentifierStart(c)) {
+              sb.append(Character.toUpperCase(c));
+              offset = 1;
+            } else {
+              sb.append("V");
+              offset = 0;
+            }
+            for (int j = offset;  j < value.length();  j++) {
+              c = value.charAt(j);
+              if (Character.isJavaIdentifierPart(c)) {
+                sb.append(Character.toUpperCase(c));
+              } else {
+                sb.append('_');
+              }
+            }
+            name = sb.toString();
+          }
+        }
+      }
+
+      for (int j = 0;  j < enums.size();  j++) {
+        EnumValue ev = (EnumValue) enums.get(j);
+        if (name.equals(ev.getName())) {
+          throw new LocSAXException("An enumeration value named " + name + " already exists.", en.getLocator());
+        }
+        if (value.equals(ev.getValue())) {
+          throw new LocSAXException("An enumeration value " + value + " already exists.", en.getLocator());
+        }
+      }
+      enums.add(new EnumValue(value, name));
+    }
+    values = (EnumValue[]) enums.toArray(new EnumValue[enums.size()]);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) {
+    return new TypedValueImpl(new Object[]{qName, ".fromString(", pValue, ")"}, qName);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    for (int i = 0;  i < values.length;  i++) {
+      if (values[i].getValue().equals(pValue)) {
+        return new TypedValueImpl(new Object[]{qName, ".", values[i].getName()}, qName);
+      }
+    }
+    return super.getCastFromString(pController, pValue);
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
+    return new TypedValueImpl(new Object[]{pValue, ".toString()"}, String.class);
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return qName; }
+
+  public JavaSource getEnumClass(SimpleTypeSG pController) throws SAXException {
+    JavaQName valueType = super.getRuntimeType(pController);
+    JavaQName qNameArray = JavaQNameImpl.getArray(qName);
+
+    JavaSource js = pController.getSchema().getJavaSourceFactory().newJavaSource(qName, JavaSource.PUBLIC);
+    js.addImplements(Serializable.class);
+
+    JavaField name = js.newJavaField("name", String.class, JavaSource.PRIVATE);
+    name.setFinal(true);
+    JavaField value = js.newJavaField("value", valueType, JavaSource.PRIVATE);
+    value.setFinal(true);
+    JavaField lexicalValue = js.newJavaField("lexicalValue", String.class, JavaSource.PRIVATE);
+    lexicalValue.setFinal(true);
+
+    List instanceParams = new ArrayList();
+    for (int i = 0;  i < values.length;  i++) {
+      JavaField _f = js.newJavaField("_" + values[i].getName(), String.class, JavaSource.PUBLIC);
+      _f.setStatic(true);
+      _f.setFinal(true);
+      _f.addLine(JavaSource.getQuoted(values[i].getName()));
+
+      JavaField f = js.newJavaField(values[i].getName(), qName, JavaSource.PUBLIC);
+      f.addLine("new ", qName, "(", JavaSource.getQuoted(values[i].getName()), ", ",
+                super.getCastFromString(pController, values[i].getValue()), ", ",
+                JavaSource.getQuoted(values[i].getValue()), ");");
+      f.setStatic(true);
+      f.setFinal(true);
+      if (!instanceParams.isEmpty()) instanceParams.add(", ");
+      instanceParams.add(f);
+    }
+    JavaField instances = js.newJavaField("instances", qNameArray, JavaSource.PRIVATE);
+    instances.addLine(new Object[]{"new ", qNameArray, "{", instanceParams, "}"});
+    instances.setStatic(true);
+    instances.setFinal(true);
+
+    JavaConstructor con = js.newJavaConstructor(JavaSource.PRIVATE);
+    DirectAccessible pName = con.addParam(String.class, "pName");
+    DirectAccessible pValue = con.addParam(super.getRuntimeType(pController), "pValue");
+    DirectAccessible pLexicalValue = con.addParam(String.class, "pLexicalValue");
+    con.addLine(name, " = ", pName, ";");
+    con.addLine(value, " = ", pValue, ";");
+    con.addLine(lexicalValue, " = ", pLexicalValue, ";");
+
+    JavaMethod toStringMethod = js.newJavaMethod("toString", String.class, JavaSource.PUBLIC);
+    toStringMethod.addLine("return ", lexicalValue, ";");
+
+    JavaMethod getValueMethod = js.newJavaMethod("getValue", valueType, JavaSource.PUBLIC);
+    getValueMethod.addLine("return ", value, ";");
+
+    JavaMethod getNameMethod = js.newJavaMethod("getName", String.class, JavaSource.PUBLIC);
+    getNameMethod.addLine("return ", name, ";");
+
+    JavaMethod getInstancesMethod = js.newJavaMethod("getInstances", qNameArray, JavaSource.PUBLIC);
+    getInstancesMethod.setStatic(true);
+    getInstancesMethod.addLine("return ", instances, ";");
+
+    JavaMethod fromValueMethod = js.newJavaMethod("fromValue", qName, JavaSource.PUBLIC);
+    pValue = fromValueMethod.addParam(valueType, "pValue");
+    fromValueMethod.setStatic(true);
+    DirectAccessible i = fromValueMethod.addForArray(instances);
+    fromValueMethod.addIf(pController.getEqualsCheck(fromValueMethod, new Object[]{instances, "[", i, "].value"}, pValue));
+    fromValueMethod.addLine("return ", instances, "[", i, "];");
+    fromValueMethod.addEndIf();
+    fromValueMethod.addEndFor();
+    fromValueMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid value: "),
+                                " + ", pValue);
+
+    JavaMethod fromNameMethod = js.newJavaMethod("fromName", qName, JavaSource.PUBLIC);
+    pName = fromNameMethod.addParam(String.class, "pName");
+    fromNameMethod.setStatic(true);
+    i = fromNameMethod.addForArray(instances);
+    fromNameMethod.addIf(instances, "[", i, "].name.equals(", pName, ")");
+    fromNameMethod.addLine("return ", instances, "[", i, "];");
+    fromNameMethod.addEndIf();
+    fromNameMethod.addEndFor();
+    fromNameMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid name: "),
+                                " + ", pName);
+
+    JavaMethod fromStringMethod = js.newJavaMethod("fromString", qName, JavaSource.PUBLIC);
+    pValue = fromStringMethod.addParam(String.class, "pValue");
+    fromStringMethod.setStatic(true);
+    fromStringMethod.addLine("return ", fromValueMethod, "(",
+                             super.getCastFromString(pController, fromStringMethod, pValue, null), ");");
+
+    if (js.isImplementing(Serializable.class)) {
+      JavaMethod readResolveMethod = js.newJavaMethod("readResolve", Object.class, JavaSource.PRIVATE);
+      readResolveMethod.addLine("return ", fromValueMethod, "(", value, ");");
+    }
+    return js;
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(qName);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, f);
+    pMethod.addEndIf();
+  }
+
+  public void generate(SimpleTypeSG pController) throws SAXException {
+    super.generate(pController);
+    getEnumClass(pController);
+  }
+
+  public void generate(SimpleTypeSG pController, JavaSource pSource) throws SAXException {
+    super.generate(pController, pSource);
+    getEnumClass(pController);
+  }
+
+    public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		return true;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/FacetImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/FacetImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/FacetImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSType;
+
+/** 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class FacetImpl implements Facet {
+  private final Facet.Type type;
+  private final String[] values;
+  private final String value;
+  private final Long numValue;
+
+  /** <p>Creates a new enumeration facet.</p>
+   */
+  public FacetImpl(XSType pType, XSEnumeration[] pEnumerations) {
+    type = Facet.ENUMERATION;
+    values = new String[pEnumerations.length];
+    for (int i = 0;  i < pEnumerations.length;  i++) {
+      values[i] = pEnumerations[i].getValue();
+    }
+    value = null;
+    numValue = null;
+  }
+
+  public Type getType() { return type; }
+  public String[] getValues() {
+    if (values == null) {
+      throw new IllegalStateException("The facet type " + type + " doesn't support the getValues() method.");
+    }
+    return values;
+  }
+
+  public String getValue() {
+    if (value == null) {
+      throw new IllegalStateException("The facet type " + type + " doesn't support the getValue() method.");
+    }
+    return value;
+  }
+
+  public long getNumValue() {
+    if (numValue == null) {
+      throw new IllegalStateException("The facet type " + type + " doesn't support the getNumValue() method.");
+    }
+    return numValue.longValue();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/GlobalContext.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/GlobalContext.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/GlobalContext.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClassOwner;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class GlobalContext extends AbstractContext {
+	/** <p>Creates a new, global class context.</p>
+	 */
+	public GlobalContext(XsQName pQName, XSObject pJAXBClassOwner,
+						 String pPrefix, String pSuffix, SchemaSG pSchemaSG)
+			throws SAXException {
+		Locator locator;
+		if (pJAXBClassOwner instanceof XSType) {
+			XSType type = (XSType) pJAXBClassOwner;
+			if (type.isBuiltin()) {
+				locator = null;
+			} else {
+				locator = type.getLocator();
+			}
+		} else {
+			locator = pJAXBClassOwner.getLocator();
+		}
+
+		if (pQName == null) {
+			throw new NullPointerException("The XsQName argument must not be null.");
+		}
+		setName(pQName);
+		if (pJAXBClassOwner == null) {
+			throw new NullPointerException("The XSObject argument must not be null.");
+		}
+		
+		JAXBClassOwner jaxbClassOwner = null;
+		JAXBSchemaBindings schemaBindings = null;
+		
+		if (pJAXBClassOwner instanceof JAXBClassOwner) {
+			jaxbClassOwner = (JAXBClassOwner) pJAXBClassOwner;
+			schemaBindings = jaxbClassOwner.getJAXBSchemaBindings();
+		}
+		
+		String packageName = getPackageName(pSchemaSG, schemaBindings, locator, pQName);
+		String className = null, implementationName = null;
+		JAXBClass jaxbClass = (jaxbClassOwner == null) ? null : jaxbClassOwner.getJAXBClass();
+		if (jaxbClass != null) {
+			className = jaxbClass.getName();
+			implementationName = jaxbClass.getImplClass();
+		}
+		
+		if (className == null) {
+			String prefix = null, suffix = null;
+			className = getClassNameFromLocalName(locator, pQName.getLocalName(), pSchemaSG);
+			if (prefix == null) { prefix = pPrefix; }
+			if (prefix != null) className = prefix + className;
+			if (suffix == null) { suffix = pSuffix; }
+			if (suffix != null) className += suffix;
+		}
+		if (className.equals("EmailDetailsType")) {
+			throw new IllegalStateException();
+		}
+		
+		JavaQName xmlInterfaceName = JavaQNameImpl.getInstance(packageName, className);
+		setXMLInterfaceName(xmlInterfaceName);
+		
+		if (implementationName == null) {
+			setXMLImplementationName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+					xmlInterfaceName.getClassName() + "Impl"));
+		} else {
+			setXMLImplementationName(JavaQNameImpl.getInstance(implementationName));
+		}
+		setXMLHandlerName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+				xmlInterfaceName.getClassName() + "Handler"));
+		setXMLSerializerName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+				xmlInterfaceName.getClassName() + "Driver"));
+		setXMLValidatorName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+				xmlInterfaceName.getClassName() + "Validator"));
+		setPMName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+				xmlInterfaceName.getClassName() + "PM"));
+	}
+	
+	public boolean isGlobal() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBAttributeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBAttributeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBAttributeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.AttributeSGChain;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard.ProcessContents;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+class JAXBAttributeSG extends JAXBSGItem implements AttributeSGChain {
+	private final boolean isRequired, isWildcard;
+	private final XsQName name;
+	private final XsNamespaceList namespaceList;
+	private final XsTWildcard.ProcessContents processContents;
+	private XSAttribute xsAttribute;
+	private XSWildcard xsWildcard;
+	private final TypeSG typeSG;
+	private PropertySG propertySG;
+	
+	
+	protected JAXBAttributeSG(SchemaSG pSchema, XSAttribute pAttribute, Context pClassContext) throws SAXException {
+		super(pSchema.getFactory(), pSchema, pAttribute);
+		xsAttribute = pAttribute;
+		xsWildcard = null;
+		isRequired = !pAttribute.isOptional();
+		name = pAttribute.getName();
+        XSType type = pAttribute.getType();
+        if (type == null) {
+            throw new IllegalStateException("The attribute type must not be null.");
+        }
+        if (type.isGlobal()) {
+        	typeSG = getFactory().getTypeSG(type);
+            if (typeSG == null) {
+            	throw new IllegalStateException("Unknown global type: " + type.getName());
+            }
+        } else {
+        	typeSG = getFactory().getTypeSG(pAttribute.getType(), pClassContext, name);
+        }
+		isWildcard = false;
+		namespaceList = null;
+		processContents = null;
+	}
+	
+	protected JAXBAttributeSG(SchemaSG pSchema, XSWildcard pWildcard, Context pClassContext) throws SAXException {
+		super(pSchema.getFactory(), pSchema, pWildcard);
+		xsWildcard = pWildcard;
+		xsAttribute = null;
+		isRequired = false;
+		name = null;
+		typeSG = null;
+		isWildcard = true;
+		namespaceList = pWildcard.getNamespaceList();
+		processContents = pWildcard.getProcessContents();
+	}
+	
+	public Object newPropertySGChain(AttributeSG pController) {
+		PropertySGChain result;
+		if (xsWildcard != null) {
+			result = new AnyAttributePropertySG(pController, xsWildcard);
+			xsWildcard = null;
+		} else if (xsAttribute != null) {
+			result = new JAXBPropertySG(pController, xsAttribute);
+			xsAttribute = null;  // Make this available for garbage collection
+		} else {
+			throw new IllegalStateException("PropertySG is already created.");
+		}
+		return result;
+	}
+	
+	public void init(AttributeSG pController) throws SAXException {
+		PropertySGChain chain = (PropertySGChain) pController.newPropertySGChain();
+		propertySG = new PropertySGImpl(chain);
+		propertySG.init();
+	}
+	
+	public PropertySG getPropertySG(AttributeSG pController) { return propertySG; }
+	public TypeSG getTypeSG(AttributeSG pController) { return typeSG; }
+	public SGFactory getFactory(AttributeSG pController) { return getFactory(); }
+	public SchemaSG getSchema(AttributeSG pController) { return getSchema(); }
+	public Locator getLocator(AttributeSG pController) { return getLocator(); }
+	public XsQName getName(AttributeSG pController) { return name; }
+	
+	public boolean isRequired(AttributeSG pAttrController) { return isRequired; }
+	
+	public void forAllValues(AttributeSG pController, JavaMethod pMethod,
+							 DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		pController.getPropertySG().forAllValues(pMethod, pElement, pSGlet);
+	}
+	
+	public void forAllNonNullValues(AttributeSG pController, JavaMethod pMethod,
+									DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		pController.getPropertySG().forAllNonNullValues(pMethod, pElement, pSGlet);
+	}
+
+	public boolean isWildcard(AttributeSG pController) {
+		return isWildcard;
+	}
+
+	public XsNamespaceList getNamespaceList(AttributeSG pController) {
+		return namespaceList;
+	}
+
+	public ProcessContents getProcessContents(AttributeSG pController) {
+		return processContents;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexContentTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexContentTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexContentTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSGChain;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.types.XSAnyType;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/** Default implementation of
+ * {@link org.apache.ws.jaxme.generator.sg.ComplexContentSG}.
+ */
+public class JAXBComplexContentTypeSG implements ComplexContentSGChain {
+    private static final Logger log = LoggerAccess.getLogger(JAXBComplexContentTypeSG.class);
+
+    private static class Particle {
+        private final GroupSG[] stack;
+        private final ParticleSG particle;
+        Particle(GroupSG[] pStack, ParticleSG pParticle) {
+            stack = pStack;
+            particle = pParticle;
+        }
+        ParticleSG getParticleSG() { return particle; }
+        Object[] getStack() { return stack; }
+        GroupSG getClosestCommonAnchestor(Particle pParticle) {
+            int len = Math.min(stack.length, pParticle.stack.length);
+            GroupSG anchestor = stack[0];
+            for (int i = 1;  i < len;  i++) {
+                if (stack[i] != pParticle.stack[i]) {
+                    break;
+                }
+            }
+            return anchestor;
+        }
+    }
+
+    private final boolean isEmpty, isMixed;
+    private final ParticleSG rootParticle;
+
+    private boolean isInitialized;
+    private final Locator locator;
+    private final List elementParticles = new ArrayList();
+    private Particle[] elementParticleArray;
+    private final List mixedContentParticles = new ArrayList();
+    private final List groupParticlesWithMultiplicityGreaterOne = new ArrayList();
+    private final List wildcardParticles = new ArrayList();
+    private final List stack = new ArrayList();
+
+	protected JAXBComplexContentTypeSG(ComplexTypeSG pComplexTypeSG, XSType pType) throws SAXException {
+		if (pType == XSAnyType.getInstance()) {
+			throw new SAXException("The type xs:anyType is not supported.");
+		}
+		locator = pType.getLocator();
+		if (pType.getComplexType().isEmpty()) {
+			isEmpty = true;
+			isMixed = false;
+			rootParticle = null;
+		} else {
+			XSParticle particle = pType.getComplexType().getParticle();
+			if (particle == null) {
+				throw new NullPointerException("Missing group particle for type = " + pType.getName());
+			}
+			if (particle.isGroup()) {
+				rootParticle = newParticleSG(pComplexTypeSG.getTypeSG().getFactory(), particle, pComplexTypeSG.getClassContext());
+			} else {
+				throw new IllegalStateException("Expected internal group");
+			}
+			isEmpty = false;
+			isMixed = pType.getComplexType().isMixed();
+		}
+	}
+
+	protected ParticleSG newParticleSG(SGFactory pFactory, XSParticle pParticle, Context pContext) throws SAXException {
+		JAXBParticleSG chain = new JAXBParticleSG(pFactory, pParticle, pContext);
+		ParticleSGImpl result = new ParticleSGImpl(chain);
+		result.init();
+		return result;
+	}
+
+    public Locator getLocator(ComplexContentSG pController) { return locator; }
+
+	public void init(ComplexContentSG pController) throws SAXException {
+    }
+
+    private void initialize(ComplexContentSG pController) throws SAXException {
+        if (!isInitialized  &&  !isEmpty) {
+            isInitialized = true;
+            verify(pController);
+        }
+    }
+
+    private Particle[] getLocalElementParticles(ComplexContentSG pController)
+            throws SAXException {
+        initialize(pController);
+        return elementParticleArray;
+    }
+
+	public ParticleSG[] getElementParticles(ComplexContentSG pController)
+			throws SAXException {
+		Particle[] particles = getLocalElementParticles(pController);
+		if (particles == null) {
+			return new ParticleSG[0];
+		}
+		ParticleSG[] result = new ParticleSG[particles.length];
+		for (int i = 0;  i  < result.length;  i++) {
+			result[i] = particles[i].getParticleSG();
+		}
+		return result;
+	}
+
+	public ParticleSG getRootParticle(ComplexContentSG pController) {
+        return rootParticle;
+	}
+	
+	public boolean isEmpty(ComplexContentSG pController) {
+		return isEmpty;
+	}
+	
+	public boolean isMixed(ComplexContentSG pController) {
+		return isMixed;
+	}
+
+    
+    private void findParticles(GroupSG[] pStack, ParticleSG pParticle) throws SAXException {
+        if (pParticle.isGroup()) {
+            if (pParticle.isMultiple()) {
+                groupParticlesWithMultiplicityGreaterOne.add(new Particle(pStack, pParticle));
+            } else if (isMixed) {
+				mixedContentParticles.add(new Particle(pStack, pParticle));
+			} else {
+                findParticles(pParticle.getGroupSG());
+            }
+        } else if (pParticle.isWildcard()) {
+            wildcardParticles.add(new Particle(pStack, pParticle));
+        } else if (pParticle.isElement()) {
+            Particle p = new Particle(pStack, pParticle);
+            elementParticles.add(p);
+        } else {
+            throw new SAXParseException("Invalid particle type", pParticle.getLocator());
+        }
+    }
+
+    private void findParticles(GroupSG pGroup) throws SAXException {
+        stack.add(pGroup);
+        ParticleSG[] particles = pGroup.getParticles();
+        GroupSG[] groups = (GroupSG[]) stack.toArray(new GroupSG[stack.size()]);
+        for (int i = 0;  i < particles.length;  i++) {
+            findParticles(groups, particles[i]);
+        }
+        stack.remove(stack.size()-1);
+    }
+
+    /** Verifies the contents of a complex type with complex content, according
+     * to the JAXB 1.0 specification, 5.9.7.
+     */
+    private void verify(ComplexContentSG pController) throws SAXException {
+        findParticles(new GroupSG[0], pController.getRootParticle());
+
+        /* 5.9.7, 1) If {content type} is mixed, bind the entire content model
+         * to a general content property with the content-property name "content".
+         * See Section 5.9.4, "Bind mixed content" for more details.
+         */
+        if (pController.isMixed()) {
+			// Make sure, that all groups have the "general content property"
+        }
+        /* 5.9.7, 2) If (1) a particle has {max occurs} > 1 and (2) its term
+         * is a model group, then that particle and its descendants are mapped
+         * to one general content property that represents them. See Section
+         * 5.9.6, "Bind a repeating occurrence model group" for details.
+         */
+        if (groupParticlesWithMultiplicityGreaterOne.size() > 0) {
+            Particle particle = (Particle) groupParticlesWithMultiplicityGreaterOne.get(0);
+            throw new SAXParseException("Model groups with maxOccurs > 1 are not yet supported.",
+                                        particle.getParticleSG().getLocator());
+        }
+        /* 5.9.7, 3) Process all remaining particles 1) whose {term} are
+         * wildcard particles and (2) that did not belong to a repeating
+         * occurrence model group bound in step 2. If there is only one
+         * wildcard, bind it as specified in Section 5.9.5, "Bind wildcard
+         * schema component". If there is more than one, then fallback to
+         * representing the entire content model as a single general
+         * content property.
+         */
+        if (wildcardParticles.size() > 0) {
+            Particle particle = (Particle) wildcardParticles.get(0);
+            throw new SAXParseException("Wildcards are unsupported",
+                                        particle.getParticleSG().getLocator());
+        }
+        /* 5.9.7, 4) Process all particles (1) whose {term} are element
+         * declarations and (2) that do not belong to a repeating occurrence
+         * model group bound in step 2
+         * 
+         * First we say a particle has a label L, if it refers to an element
+         * declaration whose {name} is L. Then, for all the possible pair of
+         * particles P and Q in this set, ensure the following constraints are
+         * met:
+         * a) If P and Q have the same label, then they must refer to the same
+         * element declaration.
+         * b) If P and Q refer to the same element reference, then its closest
+         * common ancestor particle may not have sequence as its {term}.
+         * 
+         * If either of the above constraints are violated, then the binding
+         * compiler must report a property naming collision, that can be
+         * corrected via customization.
+         */
+        elementParticleArray = (Particle[]) elementParticles.toArray(new Particle[elementParticles.size()]);
+        for (int i = 0;  i < elementParticleArray.length;  i++) {
+            Particle pParticle = elementParticleArray[i];
+            ParticleSG p = pParticle.getParticleSG();
+            String name = p.getPropertySG().getXMLFieldName();
+            for (int j = i+1;  j < elementParticles.size();  j++) {
+                Particle qParticle = elementParticleArray[j];
+                ParticleSG q = qParticle.getParticleSG();
+                if (name.equals(q.getPropertySG().getXMLFieldName())) {
+                    ObjectSG pObject = p.getObjectSG();
+                    ObjectSG qObject = q.getObjectSG();
+                    if (!pObject.isGlobal()  ||  !qObject.isGlobal()  ||
+                        pObject != qObject) {
+                        throw new SAXParseException("Multiple element particles named " + name
+                                                    + ", which aren't references to "
+                                                    + " a common global element, are present in a common"
+                                                    + " complex type. (JAXB 1.0, 5.9.7.4.a) Use jaxb:property/@name"
+                                                    + " for customization.", pController.getLocator());
+                    }
+                    GroupSG group = pParticle.getClosestCommonAnchestor(pParticle);
+                    if (group.isSequence()) {
+                        throw new SAXParseException("Multiple element particles named " + name
+                                                    + " are contained in a common sequence."
+                                                    + " (JAXB 1.0, 5.9.7.4.b) Use jaxb:property/@name"
+                                                    + " for customization.", pController.getLocator());
+                    }
+                }
+            }
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBComplexTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,341 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.AttributeSGChain;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSGChain;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.AllHandlerSG;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.BeanGeneratingVisitor;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.ChoiceHandlerSG;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.DriverGeneratingVisitor;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.EmptyElementHandlerSG;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.HandlerSG;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.ParticleWalker;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.SequenceHandlerSG;
+import org.apache.ws.jaxme.generator.sg.impl.ccsg.SimpleContentHandlerSG;
+import org.apache.ws.jaxme.impl.JMSAXDriver;
+import org.apache.ws.jaxme.impl.JMSAXElementParser;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class JAXBComplexTypeSG implements ComplexTypeSGChain {
+    private final static Logger log = LoggerAccess.getLogger(JAXBComplexTypeSG.class);
+	private final TypeSG typeSG;
+	private final XSType xsType;
+	private final boolean hasSimpleContent;
+	private final Context classContext;
+	private SimpleContentSG simpleContentSG;
+	private ComplexContentSG complexContentSG;
+	private AttributeSG[] attributes;
+	
+	protected JAXBComplexTypeSG(TypeSG pTypeSG, XSType pType) throws SAXException {
+		final String mName = "<init>(XSType)";
+		log.finest(mName, "->", new Object[]{pTypeSG, pType});
+		typeSG = pTypeSG;
+		xsType = pType;
+		XSComplexType complexType= pType.getComplexType();
+		hasSimpleContent = complexType.hasSimpleContent();
+		String suffix = pTypeSG.isGlobalType() ? null : "Type"; 
+		classContext = new GlobalContext(pTypeSG.getName(), pType, null, suffix, pTypeSG.getSchema());
+		log.finest(mName, "<-", classContext);
+	}
+	
+	/** <p>Constructor for a local type, which is embedded into the enclosing
+	 * <code>pContext</code>.</p>
+	 */
+	protected JAXBComplexTypeSG(TypeSG pTypeSG, XSType pType, Context pContext) throws SAXException {
+		final String mName = "<init>(XSType)";
+		log.finest(mName, "->", new Object[]{pTypeSG, pType, pContext});
+		typeSG = pTypeSG;
+		xsType = pType;
+		XSComplexType complexType= pType.getComplexType();
+		hasSimpleContent = complexType.hasSimpleContent();
+		classContext = new LocalContext(pContext, pTypeSG.getName().getLocalName(), pType, null, "Type",
+				pTypeSG.getSchema());
+		log.finest(mName, "<-", classContext);
+	}
+	
+	public Object newAttributeSG(ComplexTypeSG pController, XSAttribute pAttribute) throws SAXException {
+		return new JAXBAttributeSG(typeSG.getSchema(), pAttribute, classContext);
+	}
+
+	public Object newAttributeSG(ComplexTypeSG pController, XSWildcard pWildcard) throws SAXException {
+		return new JAXBAttributeSG(typeSG.getSchema(), pWildcard, classContext);
+	}
+
+	private AttributeSG[] initAttributes(ComplexTypeSG pController) throws SAXException {
+		XSAttributable[] xsAttributes = xsType.getComplexType().getAttributes();
+		List attributeList = new ArrayList();
+		for (int i = 0;  i < xsAttributes.length;  i++) {
+			AttributeSGChain attrChain;
+			if (xsAttributes[i] instanceof XSAttribute) {
+				XSAttribute attr = (XSAttribute) xsAttributes[i];
+				attrChain = (AttributeSGChain) pController.newAttributeSG(attr);
+			} else if (xsAttributes[i] instanceof XSWildcard) {
+				boolean isSupportingExtensions = false;
+				SchemaReader schemaReader = pController.getTypeSG().getFactory().getGenerator().getSchemaReader();
+				if (schemaReader instanceof JAXBSchemaReader) {
+					isSupportingExtensions = ((JAXBSchemaReader) schemaReader).isSupportingExtensions();
+				}
+				if (isSupportingExtensions) {
+					XSWildcard wildcard = (XSWildcard) xsAttributes[i];
+					attrChain = (AttributeSGChain) pController.newAttributeSG(wildcard);
+				} else {
+					throw new SAXParseException("Extensions must be enabled to support wildcard attributes (JAXB 1.0, App. E.2.1.1)",
+							((XSWildcard) xsAttributes[i]).getLocator());
+				}
+			} else {
+				throw new IllegalStateException("Unknown attribute type: " + xsAttributes[i].getClass().getName());
+			}
+			AttributeSG attrSG = new AttributeSGImpl(attrChain);
+			attrSG.init();
+			attributeList.add(attrSG);
+		}
+		return (AttributeSG[]) attributeList.toArray(new AttributeSG[attributeList.size()]);
+	}
+	
+	public void addAttributeSG(ComplexTypeSG pController, AttributeSG pAttribute) throws SAXException {
+		AttributeSG[] result = new AttributeSG[attributes.length+1];
+		System.arraycopy(attributes, 0, result, 0, attributes.length);
+		result[attributes.length] = pAttribute;
+		attributes = result;
+		pAttribute.init();
+	}
+	
+	public void init(ComplexTypeSG pController) throws SAXException {
+		attributes = initAttributes(pController);
+		if (pController.hasSimpleContent()) {
+			SimpleContentSGChain chain = (SimpleContentSGChain) pController.newSimpleContentTypeSG();
+			simpleContentSG = new SimpleContentSGImpl(chain);
+			simpleContentSG.init();
+		} else {
+			ComplexContentSGChain chain = (ComplexContentSGChain) pController.newComplexContentTypeSG();
+			complexContentSG = new ComplexContentSGImpl(chain);
+			complexContentSG.init();
+		}
+	}
+
+	public boolean hasSimpleContent(ComplexTypeSG pController) { return hasSimpleContent; }
+	public TypeSG getTypeSG(ComplexTypeSG pController) { return typeSG; }
+	
+	public boolean hasAttributes(ComplexTypeSG pController) {
+		return attributes.length != 0;
+	}
+	
+	public AttributeSG[] getAttributes(ComplexTypeSG pController) {
+		return attributes;
+	}
+	
+	public Context getClassContext(ComplexTypeSG pController) { return classContext; }
+	public Locator getLocator(ComplexTypeSG pController) { return xsType.getLocator(); }
+	
+	public JavaSource getXMLInterface(ComplexTypeSG pController) throws SAXException {
+		final String mName = "getXMLInterface";
+		log.finest(mName, "->");
+		JavaQName qName = pController.getClassContext().getXMLInterfaceName();
+		JavaSourceFactory jsf = pController.getTypeSG().getSchema().getJavaSourceFactory();
+		JavaSource js = jsf.newJavaSource(qName, JavaSource.PUBLIC);
+		js.setType(JavaSource.INTERFACE);
+		createXMLBean(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+
+	private void createXMLBean(ComplexTypeSG pController, JavaSource pJs)
+			throws SAXException {
+		if (pJs.isInterface()) {
+			if (pController.getTypeSG().isExtension()) {
+				TypeSG extType = pController.getTypeSG().getExtendedType();
+				if (extType.isComplex()) {
+					pJs.addExtends(extType.getComplexTypeSG().getClassContext().getXMLInterfaceName());
+				}
+			}
+		} else {
+			SerializableSG.makeSerializable(pController.getTypeSG().getSchema(), pJs);
+			if (pController.getTypeSG().isExtension()) {
+				TypeSG extType = pController.getTypeSG().getExtendedType();
+				if (extType.isComplex()) {
+					pJs.addExtends(extType.getComplexTypeSG().getClassContext().getXMLImplementationName());
+				}
+			}
+		}
+		BeanGeneratingVisitor visitor = new BeanGeneratingVisitor(pJs);
+		new ParticleWalker(visitor).walk(pController);
+	}
+
+	public JavaSource getXMLInterface(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
+		final String mName = "getXMLInterface(JavaSource)";
+		log.finest(mName, "->", pSource.getQName());
+		JavaQName qName = pController.getClassContext().getXMLInterfaceName();
+		JavaSource js = pSource.newJavaInnerClass(qName.getClassName(), JavaSource.PUBLIC);
+		js.setType(JavaSource.INTERFACE);
+		createXMLBean(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+	
+	public JavaSource getXMLImplementation(ComplexTypeSG pController) throws SAXException {
+		final String mName = "getXMLImplementation(JavaQName)";
+		log.finest(mName, "->", typeSG.getName());
+		JavaSourceFactory jsf = pController.getTypeSG().getSchema().getJavaSourceFactory();
+		JavaSource js = jsf.newJavaSource(pController.getClassContext().getXMLImplementationName(), JavaSource.PUBLIC);
+		js.addImplements(pController.getClassContext().getXMLInterfaceName());
+		createXMLBean(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+	
+	public JavaSource getXMLImplementation(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
+		final String mName = "getXMLImplementation(JavaQName,JavaSource)";
+		log.finest(mName, "->", pSource.getQName());
+		JavaSource js = pSource.newJavaInnerClass(pController.getClassContext().getXMLImplementationName().getInnerClassName(), JavaSource.PUBLIC);
+		js.setStatic(true);
+		js.addImplements(pController.getClassContext().getXMLInterfaceName());
+		createXMLBean(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+
+	private void createXMLSerializer(ComplexTypeSG pController, JavaSource pSource)
+			throws SAXException {
+		pSource.addImplements(JMSAXDriver.class);
+		DriverGeneratingVisitor visitor = new DriverGeneratingVisitor(pSource);
+		new ParticleWalker(visitor).walk(pController);
+	}
+
+	public JavaSource getXMLSerializer(ComplexTypeSG pController) throws SAXException {
+		final String mName = "getXMLSerializer";
+		log.finest(mName, "->", typeSG.getName());
+		JavaQName xmlSerializerName = pController.getClassContext().getXMLSerializerName();
+		JavaSourceFactory jsf = typeSG.getSchema().getJavaSourceFactory();
+		JavaSource js = jsf.newJavaSource(xmlSerializerName, JavaSource.PUBLIC);
+		createXMLSerializer(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+	
+	public JavaSource getXMLSerializer(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
+		final String mName = "getXMLSerializer(JavaSource)";
+		log.finest(mName, "->", pSource.getQName());
+		JavaSource js = pSource.newJavaInnerClass(pController.getClassContext().getXMLSerializerName().getInnerClassName(), JavaSource.PUBLIC);
+		js.setStatic(true);
+		createXMLSerializer(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+
+	private HandlerSG newHandlerSG(ComplexTypeSG pController,
+								   JavaSource pJs)
+			throws SAXException {
+		if (pController.hasSimpleContent()) {
+			return new SimpleContentHandlerSG(pController, pJs);
+		} else {
+			ComplexContentSG ccSG = pController.getComplexContentSG();
+			if (ccSG.isEmpty()) {
+				return new EmptyElementHandlerSG(pController, pJs);
+			} else {
+				GroupSG group = ccSG.getRootParticle().getGroupSG();
+				if (group.isSequence()) {
+					return new SequenceHandlerSG(pController, pJs);
+				} else if (group.isChoice()) {
+					return new ChoiceHandlerSG(pController, pJs);
+				} else if (group.isAll()) {
+					return new AllHandlerSG(pController, pJs);
+				} else {
+					throw new IllegalStateException("Invalid group type");
+				}
+			}
+		}
+	}
+
+	private void createXMLHandler(ComplexTypeSG pController, JavaSource pJs) throws SAXException {
+		pJs.addExtends(JMSAXElementParser.class);
+		HandlerSG handlerSG = newHandlerSG(pController, pJs);
+		handlerSG.generate();
+	}
+
+	public JavaSource getXMLHandler(ComplexTypeSG pController, JavaQName pQName) throws SAXException {
+		final String mName = "getXMLHandler";
+		log.finest(mName, "->", typeSG.getName());
+		JavaSourceFactory jsf = typeSG.getSchema().getJavaSourceFactory();
+		JavaSource js = jsf.newJavaSource(pQName, JavaSource.PUBLIC);
+		createXMLHandler(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+
+    public JavaSource getXMLHandler(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
+		final String mName = "getXMLHandler(JavaSource)";
+		log.finest(mName, "->", pSource.getQName());
+		JavaSource js = pSource.newJavaInnerClass(pController.getClassContext().getXMLHandlerName().getInnerClassName(), JavaSource.PUBLIC);
+		js.setStatic(true);
+		createXMLHandler(pController, js);
+		log.finest(mName, "<-", js.getQName());
+		return js;
+	}
+	
+	public SimpleContentSG getSimpleContentSG(ComplexTypeSG pController) {
+		if (simpleContentSG == null) {
+			throw new IllegalStateException("This complex type doesn't have simple content.");
+		}
+		return simpleContentSG;
+	}
+	
+	public ComplexContentSG getComplexContentSG(ComplexTypeSG pController) {
+		if (complexContentSG == null) {
+			throw new IllegalStateException("This complex type doesn't have complex content.");
+		}
+		return complexContentSG;
+	}
+
+	public Object newComplexContentTypeSG(ComplexTypeSG pController) throws SAXException {
+		return new JAXBComplexContentTypeSG(pController, xsType);
+	}
+	
+	public Object newSimpleContentTypeSG(ComplexTypeSG pController) throws SAXException {
+		return new JAXBSimpleContentTypeSG(pController, xsType);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBGroupSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBGroupSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBGroupSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.GroupSGChain;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSGChain;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBGroupSG extends JAXBSGItem implements GroupSGChain {
+	private ParticleSG[] particles;
+	private final boolean isGlobal, isAll, isSequence, isChoice;
+	private final Context classContext;
+	private final XsQName qName;
+	
+	/** <p>Creates a new, global group.</p>
+	 */
+	protected JAXBGroupSG(SGFactory pFactory, SchemaSG pSchema, XSGroup pGroup) throws SAXException {
+		super(pFactory, pSchema, pGroup);
+		isGlobal = true;
+		qName = pGroup.getName();
+		isAll = pGroup.isAll();
+		isSequence = pGroup.isSequence();
+		isChoice = pGroup.isChoice();
+		classContext = new GlobalContext(pGroup.getName(), pGroup, null, "Group", pSchema);
+	}
+	
+	/** <p>Creates a new, local group.</p>
+	 */
+	protected JAXBGroupSG(SGFactory pFactory, SchemaSG pSchema, XSGroup pGroup, Context pContext)
+	throws SAXException {
+		super(pFactory, pSchema, pGroup);
+		isGlobal = pGroup.isGlobal();
+		qName = isGlobal ? pGroup.getName() : null;
+		isAll = pGroup.isAll();
+		isSequence = pGroup.isSequence();
+		isChoice = pGroup.isChoice();
+		classContext = pContext;
+	}
+	
+	public Object newParticleSG(GroupSG pController, XSParticle pParticle) throws SAXException {
+		return new JAXBParticleSG(pController.getFactory(), pParticle, classContext);
+	}
+	
+	public Context getClassContext(GroupSG pController) { return classContext; }
+	
+	public SGFactory getFactory(GroupSG pController) { return getFactory(); }
+	public SchemaSG getSchema(GroupSG pController) { return getSchema(); }
+	public Locator getLocator(GroupSG pController) { return getLocator(); }
+	public ParticleSG[] getParticles(GroupSG pController) throws SAXException {
+		if (particles == null) {
+			XSParticle[] xsParticles = ((XSGroup) getXSObject()).getParticles();
+			particles = new ParticleSG[xsParticles.length];
+			for (int i = 0;  i < xsParticles.length;  i++) {
+				ParticleSGChain chain = (ParticleSGChain) pController.newParticleSG(xsParticles[i]);
+				ParticleSG particle = new ParticleSGImpl(chain);
+				particle.init();
+				particles[i] = particle;
+			}
+		}
+		return particles;
+	}
+	
+	public void init(GroupSG pController) throws SAXException {
+	}
+	
+	public boolean isAll(GroupSG pController) { return isAll; }
+	public boolean isGlobal(GroupSG pController) { return isGlobal; }
+	public boolean isChoice(GroupSG pController) { return isChoice; }
+	public boolean isSequence(GroupSG pController) { return isSequence; }
+	
+	public XsQName getName(GroupSG pController) {
+		if (qName == null) {
+			throw new IllegalStateException("Attempt to obtain a local groups name.");
+		}
+		return qName;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBObjectSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBObjectSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBObjectSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import javax.xml.bind.Element;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.JMElement;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSGChain;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBObjectSG extends JAXBSGItem implements ObjectSGChain {
+  private final static Logger log = LoggerAccess.getLogger(JAXBObjectSG.class);
+  private final XSType type;
+  private final TypeSG typeSG;
+  private final XsQName name;
+  private final Context classContext;
+  private final boolean global;
+
+  /** <p>Creates a new, local instance of JAXBObjectSG, generating
+   * the given attribute within the given {@link Context}.</p>
+   */
+  public JAXBObjectSG(SGFactory pFactory, SchemaSG pSchema, XSAttribute pAttribute,
+                       Context pClassContext) throws SAXException {
+    this(pFactory, pSchema, (XSObject) pAttribute, pClassContext);
+  }
+
+  /** <p>Creates a new, global instance of JAXBObjectSG, generating
+   * the given element.</p>
+   */
+  public JAXBObjectSG(SGFactory pFactory, SchemaSG pSchema, XSElement pElement) throws SAXException {
+    this(pFactory, pSchema, (XSObject) pElement, null);
+  }
+
+  /** <p>Creates a new, local instance of JAXBObjectSG, generating
+   * the given element within the given {@link Context}.</p>
+   */
+  public JAXBObjectSG(SGFactory pFactory, SchemaSG pSchema, XSElement pElement,
+                       Context pClassContext) throws SAXException {
+    this(pFactory, pSchema, (XSObject) pElement, pClassContext);
+  }
+
+  /** <p>Creates a new, local instance of JAXBObjectSG, which
+   * is generated within the given {@link Context}.</p>
+   */
+  private JAXBObjectSG(SGFactory pFactory, SchemaSG pSchema, XSObject pObject,
+  		               Context pClassContext) throws SAXException {
+  	super(pFactory, pSchema, pObject);
+    final String mName = "<init>(XSObject,Context)";
+    boolean isClassGlobal;
+    if (pObject instanceof XSElement) {
+      XSElement element = (XSElement) pObject;
+      log.finest(mName, "->", new Object[]{element.getName(), pClassContext});
+      type = element.getType();
+      name = element.getName();
+      global = element.isGlobal();
+      isClassGlobal = !type.isSimple()  &&  (type.isGlobal()  ||  global);
+    } else {
+      throw new IllegalStateException("Unknown object type: " + pObject.getClass().getName());
+    }
+
+    Context myClassContext;
+    final boolean useTypesContext = pClassContext != null;
+    if (useTypesContext) {
+      myClassContext = pClassContext;
+    } else {
+      myClassContext = new GlobalContext(name, pObject, null, null, pSchema);
+    }
+
+    if (isClassGlobal) {
+      if (type.isGlobal()) {
+        typeSG = pFactory.getTypeSG(type);
+      } else {
+        typeSG = pFactory.getTypeSG(type, name);
+      }
+    } else {
+      typeSG = pFactory.getTypeSG(type, myClassContext, name);
+    }
+
+    if (useTypesContext) {
+      if (typeSG.isComplex()) {
+        classContext = typeSG.getComplexTypeSG().getClassContext();
+      } else {
+        classContext = pClassContext;
+      }
+    } else if (typeSG.isComplex()) {
+      classContext = myClassContext;
+      Context tctx = typeSG.getComplexTypeSG().getClassContext();
+      AbstractContext ctx = (AbstractContext) classContext;
+      ctx.setPMName(tctx.getPMName());
+      ctx.setXMLSerializerName(tctx.getXMLSerializerName());
+      ctx.setXMLValidatorName(tctx.getXMLValidatorName());
+    } else {
+      classContext = null;
+    }
+    log.finest(mName, "<-", new Object[]{typeSG, classContext});
+  }
+
+  /** <p>Creates a new instance of JAXBObjectSG generating the given simple
+   * content <code>pContent</code> of the given complex type
+   * <code>pComplexType</code>.</p>
+   */
+  public JAXBObjectSG(SGFactory pFactory, SchemaSG pSchema, TypeSG pComplexType,
+                       XSSimpleContentType pContainer, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+    global = false;
+    type = pType;
+    name = null;
+    classContext = pComplexType.getComplexTypeSG().getClassContext();
+    typeSG = pFactory.getTypeSG(type, classContext, null);
+  }
+
+  /** <p>Creates a new instance of JAXBObjectSG generating the given
+   * wildcard object.</p>
+   */
+  public JAXBObjectSG(SGFactory pFactory, SchemaSG pSchema, XSAny pAny) {
+      super(pFactory, pSchema, pAny);
+      type = null;
+      name = null;
+      classContext = null;
+      typeSG = null;
+      global = false;
+  }
+
+  public void init(ObjectSG pController) throws SAXException {
+  }
+
+  public TypeSG getTypeSG(ObjectSG pController) {
+    if (typeSG == null) {
+      throw new NullPointerException("ObjectSG not initialized");
+    }
+    return typeSG;
+  }
+
+  public Locator getLocator(ObjectSG pController) { return getLocator(); }
+  public SGFactory getFactory(ObjectSG pController) { return getFactory(); }
+  public SchemaSG getSchema(ObjectSG pController) { return getSchema(); }
+  public Context getClassContext(ObjectSG pController) { return classContext; }
+  public XsQName getName(ObjectSG pController) {
+    if (name == null) {
+      throw new IllegalStateException("The content object of a complex type with simple content doesn't have an XML Schema name.");
+    }
+    return name;
+  }
+
+  public JavaSource getXMLInterface(ObjectSG pController) throws SAXException {
+    final String mName = "getXMLInterface";
+    log.finest(mName, "->", pController.getName());
+    if (!pController.getTypeSG().isComplex()) {
+      log.finest(mName, "<-", "null");
+      return null;
+    }
+
+    JavaQName xmlInterfaceName = pController.getClassContext().getXMLInterfaceName();
+    JavaSourceFactory jsf = getSchema().getJavaSourceFactory();
+    JavaSource js = jsf.newJavaSource(xmlInterfaceName, JavaSource.PUBLIC);
+    js.setType(JavaSource.INTERFACE);
+    js.addExtends(Element.class);
+
+    TypeSG myTypeSG = pController.getTypeSG();
+    ComplexTypeSG complexTypeSG = myTypeSG.getComplexTypeSG();
+    if (myTypeSG.isGlobalClass()) {
+      js.addExtends(complexTypeSG.getClassContext().getXMLInterfaceName());
+    }
+    log.finest(mName, "<-", xmlInterfaceName);
+    return js;
+  }
+
+  public JavaSource getXMLImplementation(ObjectSG pController) throws SAXException {
+    final String mName = "getXMLImplementation";
+    log.finest(mName, "->", pController.getName());
+    if (!pController.getTypeSG().isComplex()) {
+      log.finest(mName, "<-", "null");
+      return null;
+    }
+
+    JavaQName xmlImplementationName = pController.getClassContext().getXMLImplementationName();
+    JavaSourceFactory jsf = getSchema().getJavaSourceFactory();
+    JavaSource js = jsf.newJavaSource(xmlImplementationName, JavaSource.PUBLIC);
+    SerializableSG.makeSerializable(pController.getSchema(), js);
+    js.addImplements(pController.getClassContext().getXMLInterfaceName());
+    js.addImplements(JMElement.class);
+
+    TypeSG myTypeSG = pController.getTypeSG();
+    ComplexTypeSG complexTypeSG = myTypeSG.getComplexTypeSG();
+    if (myTypeSG.isGlobalClass()) {
+      js.addExtends(complexTypeSG.getClassContext().getXMLImplementationName());
+    }
+
+    JavaField myName = js.newJavaField("__qName", QName.class, JavaSource.PRIVATE);
+    myName.setStatic(true);
+    myName.setFinal(true);
+    XsQName qName = pController.getName();
+    String prefix = qName.getPrefix();
+    if (prefix == null) {
+	    myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
+	                   ", ", JavaSource.getQuoted(qName.getLocalName()), ")");
+    } else {
+        myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
+                	   ", ", JavaSource.getQuoted(qName.getLocalName()), ", ",
+					   JavaSource.getQuoted(prefix), ")");
+    }
+
+    JavaMethod getQName = js.newJavaMethod("getQName", QName.class, JavaSource.PUBLIC);
+    getQName.addLine("return ", myName, ";");
+
+    return js;
+  }
+
+  public JavaSource getXMLSerializer(ObjectSG pController) throws SAXException {
+    final String mName = "getXMLSerializer";
+    log.finest(mName, "->", pController.getName());
+    TypeSG myTypeSG = pController.getTypeSG();
+	JavaSource result = myTypeSG.getComplexTypeSG().getXMLSerializer();
+	log.finest(mName, "<-", result.getQName());
+	return result;
+  }
+
+    public JavaSource getXMLHandler(ObjectSG pController) throws SAXException {
+        final String mName = "getXMLHandler";
+        log.finest(mName, "->", pController.getName());
+        TypeSG myTypeSG = pController.getTypeSG();
+        if (!myTypeSG.isComplex()) {
+            log.finest(mName, "<-", null);
+            return null;
+        } else if (myTypeSG.isGlobalClass()) {
+			return null;
+        } else {
+            JavaQName xmlHandlerName = pController.getClassContext().getXMLHandlerName();
+			return myTypeSG.getComplexTypeSG().getXMLHandler(xmlHandlerName);
+        }
+    }
+
+  public void generate(ObjectSG pController) throws SAXException {
+    final String mName = "generate";
+    log.finest(mName, "->", pController.getName());
+    pController.getXMLInterface();
+    pController.getXMLImplementation();
+
+    TypeSG myTypeSG = pController.getTypeSG();
+    if (myTypeSG.isGlobalClass()  &&  !myTypeSG.isGlobalType()) {
+      myTypeSG.generate();
+    }
+    log.finest(mName, "<-");
+  }
+
+  public boolean isGlobal(ObjectSG pController) throws SAXException {
+   return global;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBParticleSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBParticleSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBParticleSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSGChain;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBParticleSG implements ParticleSGChain {
+    private final int minOccurs, maxOccurs;
+    private final XSParticle.Type type;
+    private PropertySG propertySG;
+    private final GroupSG groupSG;
+    private final ObjectSG objectSG;
+    private final Locator locator;
+    private XSElement element;
+    private XSAny wildcard;
+
+    /** <p>Creates a new instance of JAXBParticleSG.java.</p>
+     */
+    public JAXBParticleSG(SGFactory pFactory, XSParticle pParticle,
+    					  Context pClassContext) throws SAXException {
+        minOccurs = pParticle.getMinOccurs();
+        maxOccurs = pParticle.getMaxOccurs();
+        type = pParticle.getType();
+        if (pParticle.isGroup()) {
+            groupSG = pFactory.getGroupSG(pParticle.getGroup(), pClassContext);
+            objectSG = null;
+	    } else if (pParticle.isElement()) {
+            element = pParticle.getElement();
+            if (element.isGlobal()) {
+                objectSG = pFactory.getObjectSG(element);
+            } else {
+            	objectSG = pFactory.getObjectSG(element, pClassContext);
+            }
+	        groupSG = null;
+		} else if (pParticle.isWildcard()) {
+	        objectSG = pFactory.getObjectSG(pParticle.getWildcard(), pClassContext);
+	        groupSG = null;
+	        wildcard = pParticle.getWildcard();
+	    } else {
+	        throw new IllegalStateException("Particle is neither group, nor element, or wildcard.");
+	    }
+        locator = pParticle.getLocator();
+    }
+
+    public Object newPropertySGChain(ParticleSG pController) throws SAXException {
+        PropertySGChain result;
+        if (element != null) {
+            result = new JAXBPropertySG(objectSG, element);
+            element = null;
+        } else if (wildcard != null) {
+            result = new AnyElementPropertySG(objectSG, wildcard);
+            wildcard = null;
+        } else {
+            throw new IllegalStateException("A new PropertySGChain cannot be obtained.");
+        }
+        if (maxOccurs > 1  ||  maxOccurs == -1) {
+			// Dirty trick: We do not yet have the PropertySG available,
+			// so we fake one.
+			PropertySG pSG = new PropertySGImpl(result);
+			if ("indexed".equals(pSG.getCollectionType())) {
+				result = new ArrayPropertySG(result, objectSG, minOccurs, maxOccurs);
+			} else {
+				result = new MultiplePropertySG(result, objectSG, minOccurs, maxOccurs);
+			}
+        }
+        return result;
+    }
+
+    public void init(ParticleSG pController) throws SAXException {
+    }
+
+    public Locator getLocator(ParticleSG pController) { return locator; }
+    public int getMinOccurs(ParticleSG pController) { return minOccurs; }
+    public int getMaxOccurs(ParticleSG pController) { return maxOccurs; }
+    public boolean isMultiple(ParticleSG pController) { return maxOccurs == -1  ||  maxOccurs > 1; }
+    public boolean isGroup(ParticleSG pController) { return type.equals(XSParticle.GROUP); }
+    public boolean isElement(ParticleSG pController) { return type.equals(XSParticle.ELEMENT); }
+    public boolean isWildcard(ParticleSG pController) { return type.equals(XSParticle.WILDCARD); }
+
+    public PropertySG getPropertySG(ParticleSG pController) throws SAXException {
+        if (propertySG == null) {
+			if (element != null  ||  wildcard != null) {
+				PropertySGChain chain = (PropertySGChain) pController.newPropertySGChain();
+				propertySG = new PropertySGImpl(chain);
+				propertySG.init();
+			} else {
+				throw new IllegalStateException("This particle has no PropertySG.");
+			}
+        }
+        return propertySG;
+    }
+
+    public ObjectSG getObjectSG(ParticleSG pController) {
+        if (objectSG == null) {
+            throw new IllegalStateException("This particle is neither an element nor a wildcard.");
+        }
+        return objectSG;
+    }
+
+    public GroupSG getGroupSG(ParticleSG pController) {
+        if (groupSG == null) {
+            throw new IllegalStateException("This particle is no group.");
+        }
+        return groupSG;
+    }
+
+    public void forAllNonNullValues(ParticleSG pController, JavaMethod pMethod,
+									DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+        if (pController.isElement()) {
+            PropertySG pSG = pController.getPropertySG();
+            boolean hasIsSetMethod = pSG.hasIsSetMethod();
+            if (hasIsSetMethod) {
+                pMethod.addIf(pSG.getXMLIsSetMethodName(), "()");
+            }
+            TypeSG typeSG = pController.getObjectSG().getTypeSG();
+            Object v = pController.getPropertySG().getValue(pElement);
+            if (typeSG.isComplex()) {
+                pSGlet.generate(pMethod, v);
+            } else {
+                typeSG.getSimpleTypeSG().forAllValues(pMethod, v, pSGlet);
+            }
+            if (hasIsSetMethod) {
+                pMethod.addEndIf();
+            }
+        } else {
+            // TODO: Implement support for wildcards and subgroups
+            throw new IllegalStateException("Wildcards and subgroups are not yet supported.");
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBPropertySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBPropertySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBPropertySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,241 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.util.JavaNamer;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBPropertyOwner;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class JAXBPropertySG implements PropertySGChain {
+	private final String propertyName;
+	private final String fieldName;
+	private final String collectionType;
+	private final boolean generateIsSetMethod;
+	private final String defaultValue;
+	private final TypeSG typeSG;
+
+	protected JAXBPropertySG(String pDefaultPropertyName, SchemaSG pSchema, XSObject pXSObject,
+							 String pDefaultValue, TypeSG pTypeSG) {
+        typeSG = pTypeSG;
+	    defaultValue = pDefaultValue;
+	    String myPropertyName = null;
+	    boolean myGeneratedIsSetMethod = pSchema.isGeneratingIsSetMethod();
+	    String myCollectionType = null;
+	    if (pXSObject instanceof JAXBPropertyOwner) {
+	        JAXBPropertyOwner jaxbPropertyOwner = (JAXBPropertyOwner) pXSObject;
+	        JAXBProperty jaxbProperty = jaxbPropertyOwner.getJAXBProperty();
+	        if (jaxbProperty != null) {
+	            myPropertyName = jaxbProperty.getName();
+                myCollectionType = jaxbProperty.getCollectionType();
+	            Boolean jaxbGeneratedIsSetMethod = jaxbProperty.isGenerateIsSetMethod();
+	            if (jaxbGeneratedIsSetMethod != null) {
+	                myGeneratedIsSetMethod = jaxbGeneratedIsSetMethod.booleanValue();
+	            }
+	        }
+	    }
+
+	    collectionType = myCollectionType == null ? pSchema.getCollectionType() : myCollectionType;
+		if (myPropertyName == null) {
+			myPropertyName = JavaNamer.convert(pDefaultPropertyName, pSchema);
+			myPropertyName = Character.toLowerCase(myPropertyName.charAt(0)) + myPropertyName.substring(1);
+		}
+		propertyName = myPropertyName;
+		fieldName = "_" + propertyName;
+	    generateIsSetMethod = myGeneratedIsSetMethod;
+	}
+
+	protected JAXBPropertySG(AttributeSG pAttribute, XSAttribute pXSAttribute) {
+	    this(pAttribute.getName().getLocalName(), pAttribute.getSchema(), pXSAttribute, pXSAttribute.getDefault(),
+	         pAttribute.getTypeSG());
+	}
+	
+    protected JAXBPropertySG(ObjectSG pElement, XSElement pXSElement) {
+        this(pElement.getName().getLocalName(), pElement.getSchema(), pXSElement, pXSElement.getDefault(),
+	         pElement.getTypeSG());
+	}
+	
+	protected JAXBPropertySG(TypeSG pComplexType, XSType pType) throws SAXException {
+	    this("value", pComplexType.getSchema(), pType, null,
+	         pComplexType.getComplexTypeSG().getSimpleContentSG().getContentTypeSG());
+	}
+
+	public void init(PropertySG pController) throws SAXException {}
+	
+	public boolean hasIsSetMethod(PropertySG pController) { return generateIsSetMethod; }
+	public String getCollectionType(PropertySG pController) { return collectionType; }
+	
+	public String getXMLFieldName(PropertySG pController) throws SAXException {
+		return fieldName;
+	}
+
+	public String getPropertyName(PropertySG pController) throws SAXException {
+		return propertyName;
+	}
+
+	public String getXMLGetMethodName(PropertySG pController) throws SAXException {
+		String prefix;
+        if (typeSG != null  &&  !typeSG.isComplex()  &&
+            typeSG.getSimpleTypeSG().getRuntimeType().equals(JavaQNameImpl.BOOLEAN)) {
+        	prefix = "is";
+        } else {
+        	prefix = "get";
+        }
+		String propName = pController.getPropertyName();
+		String methodName = prefix + Character.toUpperCase(propName.charAt(0)) + propName.substring(1);
+        if (methodName.equals("getClass")) {
+        	throw new SAXException("Method name getClass() conflicts with java.lang.Object.getClass(), use jaxb:property to customize the property name.");
+        }
+		return methodName;
+	}
+	
+	public String getXMLSetMethodName(PropertySG pController) throws SAXException {
+		String propName = pController.getPropertyName();
+		return "set" + Character.toUpperCase(propName.charAt(0)) + propName.substring(1);
+	}
+	
+	public String getXMLIsSetMethodName(PropertySG pController) throws SAXException {
+		String propName = pController.getPropertyName();
+		return hasIsSetMethod(pController) ?
+										   "isSet" + Character.toUpperCase(propName.charAt(0)) + propName.substring(1) : null;
+	}
+
+	public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
+		return typeSG.getXMLField(pSource, pController.getXMLFieldName(), defaultValue);
+	}
+	
+	public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		return typeSG.getXMLGetMethod(pSource, pController.getXMLFieldName(),
+									  pController.getXMLGetMethodName());
+	}
+	
+	public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		String propName = pController.getPropertyName();
+		String pName = "p" + Character.toUpperCase(propName.charAt(0)) + propName.substring(1);
+		return typeSG.getXMLSetMethod(pSource, pController.getXMLFieldName(),
+									  pName, pController.getXMLSetMethodName(),
+                                      pController.hasIsSetMethod());
+	}
+	
+	public JavaMethod getXMLIsSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		return typeSG.getXMLIsSetMethod(pSource, pController.getXMLFieldName(),
+				pController.getXMLIsSetMethodName());
+	}
+	
+	public void forAllNonNullValues(PropertySG pController, JavaMethod pMethod,
+									DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		boolean hasIsSetMethod = pController.hasIsSetMethod();
+		if (hasIsSetMethod) {
+			if (pElement == null) {
+				pMethod.addIf(pController.getXMLIsSetMethodName(), "()");
+			} else {
+				pMethod.addIf(pElement, ".", pController.getXMLIsSetMethodName(), "()");
+			}
+			if (typeSG.isComplex()) {
+				pSGlet.generate(pMethod, pController.getValue(pElement));
+			} else {
+				typeSG.getSimpleTypeSG().forAllValues(pMethod, pController.getValue(pElement), pSGlet);
+			}
+			pMethod.addEndIf();
+		} else {
+			if (typeSG.isComplex()) {
+				LocalJavaField f = pMethod.newJavaField(typeSG.getComplexTypeSG().getClassContext().getXMLInterfaceName());
+				f.addLine(pController.getValue(pElement));
+				pMethod.addIf(f, " != null");
+				pSGlet.generate(pMethod, pController.getValue(pElement));
+				pMethod.addEndIf();
+			} else {
+				typeSG.getSimpleTypeSG().forAllNonNullValues(pMethod, pController.getValue(pElement), pSGlet);
+			}
+		}
+	}
+	public void forAllValues(PropertySG pController, JavaMethod pMethod,
+							 DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		SimpleTypeSG simpleTypeSG = typeSG.getSimpleTypeSG();
+		simpleTypeSG.forAllValues(pMethod, pController.getValue(pElement), pSGlet);
+	}
+	
+	public Object getValue(PropertySG pController, DirectAccessible pElement) throws SAXException {
+		if (pElement == null) {
+			return new Object[]{pController.getXMLGetMethodName(), "()"};
+		} else {
+			return new Object[]{pElement, ".", pController.getXMLGetMethodName(), "()"};
+		}
+	}
+
+	public void generate(PropertySG pController, JavaSource pSource) throws SAXException {
+        if (typeSG != null  &&  !typeSG.isGlobalType()  &&  !typeSG.isGlobalClass()  &&  pSource.isInterface()) {
+            typeSG.generate(pSource);
+		}
+		pController.getXMLField(pSource);
+		pController.getXMLGetMethod(pSource);
+		pController.getXMLSetMethod(pSource);
+		if (hasIsSetMethod(pController)) {
+			pController.getXMLIsSetMethod(pSource);
+		}
+	}
+	
+	public void setValue(PropertySG pController, JavaMethod pMethod,
+                         DirectAccessible pElement, Object pValue, JavaQName pType)
+	        throws SAXException {
+		if (pType != null) {
+			pValue = new Object[]{"((", pType, ") ", pValue, ")"};
+		}
+		if (typeSG.isComplex()  ||  !typeSG.getSimpleTypeSG().isList()) {
+			if (pElement == null) {
+				pMethod.addLine(pController.getXMLSetMethodName(), "(", pValue, ");");
+			} else {
+				pMethod.addLine(pElement, ".", pController.getXMLSetMethodName(), "(", pValue, ");");
+			}
+		} else {
+			LocalJavaField list = pMethod.newJavaField(List.class);
+			list.addLine(pController.getValue(pElement));
+			pMethod.addLine(list, ".clear();");
+			pMethod.addLine(list, ".addAll(", pValue, ");");
+		}
+	}
+	
+	public void addValue(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, TypedValue pValue, JavaQName pType) throws SAXException {
+		pController.setValue(pMethod, pElement, pValue, pType);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.impl.Inliner;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSGChain;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSGChain;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.xs.SchemaTransformer;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBObjectFactoryImpl;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBXsObjectFactoryImpl;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBSGFactory implements SGFactoryChain {
+	private final static Logger log = LoggerAccess.getLogger(JAXBSGFactory.class);
+	private final Generator generator;
+	private SchemaSG schemaSG;
+	private Map groups = new HashMap();
+	private Map objects = new HashMap();
+	private Map types = new HashMap();
+	private List groupsByOrder = new ArrayList();
+	private List objectsByOrder = new ArrayList();
+	private List typesByOrder = new ArrayList();
+	
+	/** Creates a new instance for the given {@link Generator}.
+	 */
+    public JAXBSGFactory(Generator pGenerator) {
+		generator = pGenerator;
+	}
+	
+	public void init(SGFactory pController) {
+	}
+	
+	public Generator getGenerator(SGFactory pController) {
+		return generator;
+	}
+	
+	public GroupSG getGroupSG(SGFactory pController, XSGroup pGroup) throws SAXException {
+		GroupSG result = (GroupSG) groups.get(pGroup);
+		if (result == null) {
+			result = pController.newGroupSG(pGroup);
+			groups.put(pGroup, result);
+			groupsByOrder.add(result);
+			result.init();
+		}
+		return result;
+	}
+	
+	public GroupSG newGroupSG(SGFactory pController, XSGroup pGroup) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created");
+		}
+		return new GroupSGImpl(new JAXBGroupSG(pController, schemaSG, pGroup));
+	}
+	
+	public GroupSG getGroupSG(SGFactory pController, XSGroup pGroup, Context pClassContext) throws SAXException {
+		GroupSG result = pController.newGroupSG(pGroup, pClassContext);
+		result.init();
+		groupsByOrder.add(result);
+		return result;
+	}
+	
+	public GroupSG newGroupSG(SGFactory pController, XSGroup pGroup, Context pClassContext) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created");
+		}
+		return new GroupSGImpl(new JAXBGroupSG(pController, schemaSG, pGroup, pClassContext));
+	}
+	
+	
+	public Object newObjectSG(SGFactory pController, XSElement pElement) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created.");
+		}
+		return new JAXBObjectSG(pController, schemaSG, pElement);
+	}
+	
+	public ObjectSG getObjectSG(SGFactory pController, XSElement pElement) throws SAXException {
+		ObjectSG result = (ObjectSG) objects.get(pElement);
+		if (result == null) {
+			ObjectSGChain chain = (ObjectSGChain) pController.newObjectSG(pElement);
+			result = new ObjectSGImpl(chain);
+			objects.put(pElement, result);
+			objectsByOrder.add(result);
+			result.init();
+		}
+		return result;
+	}
+
+	public Object newObjectSG(SGFactory pController, XSAny pAny) {
+	    if (schemaSG == null) {
+	        throw new IllegalStateException("A schema has not yet been created.");
+	    }
+	    return new JAXBObjectSG(pController, schemaSG, pAny);
+	}
+
+	public ObjectSG getObjectSG(SGFactory pController, XSAny pAny, Context pContext) throws SAXException {
+	    ObjectSGChain chain = (ObjectSGChain) pController.newObjectSG(pAny);
+	    ObjectSG result = new ObjectSGImpl(chain);
+	    result.init();
+	    return result;
+	}
+
+	public Object newObjectSG(SGFactory pController, XSElement pElement, Context pContext) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created.");
+		}
+		return new JAXBObjectSG(pController, schemaSG, pElement, pContext);
+	}
+	
+	public ObjectSG getObjectSG(SGFactory pController, XSElement pElement, Context pContext) throws SAXException {
+		ObjectSGChain chain = (ObjectSGChain) pController.newObjectSG(pElement, pContext);
+		ObjectSG result = new ObjectSGImpl(chain);
+		result.init();
+		return result;
+	}
+	
+	public SchemaSG getSchemaSG(SGFactory pController, XSSchema pSchema) throws SAXException {
+		if (schemaSG == null) {
+			SchemaSGChain chain = (SchemaSGChain) pController.newSchemaSG(pSchema);
+			schemaSG = new SchemaSGImpl(chain);
+			schemaSG.init();
+		}
+		return schemaSG;
+	}
+	
+	public SchemaSG getSchemaSG(SGFactory pController) {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A factory has not yet been created.");
+		}
+		return schemaSG;
+	}
+	
+	public Object newSchemaSG(SGFactory pController, XSSchema pSchema) throws SAXException {
+		return new JAXBSchemaSG(pController, pSchema);
+	}
+	
+	public TypeSG getTypeSG(SGFactory pController, XSType pType) throws SAXException {
+		final String mName = "getTypeSG(XSType)";
+		TypeSG result = (TypeSG) types.get(pType);
+		if (result == null) {
+			log.finest(mName, "->", pType.getName());
+			TypeSGChain chain = (TypeSGChain) pController.newTypeSG(pType);
+			result = new TypeSGImpl(chain);
+			types.put(pType, result);
+			typesByOrder.add(result);
+			result.init();
+			log.finest(mName, "<-", new Object[]{chain, result});
+		}
+		return result;
+	}
+	
+	public Object newTypeSG(SGFactory pController, XSType pType) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created");
+		}
+		return new JAXBTypeSG(pController, schemaSG, pType);
+	}
+	
+	public TypeSG getTypeSG(SGFactory pController, XSType pType, Context pClassContext, XsQName pName) throws SAXException {
+		final String mName = "getTypeSG(XSType,ClassContext)";
+		log.finest(mName, "->", new Object[]{pType, pClassContext});
+        TypeSGChain chain = (TypeSGChain) pController.newTypeSG(pType, pClassContext, pName);
+		TypeSG result = new TypeSGImpl(chain);
+		typesByOrder.add(result);
+		result.init();
+		log.finest(mName, "<-", new Object[]{chain, result});
+		return result;
+	}
+	
+	public Object newTypeSG(SGFactory pController, XSType pType, Context pClassContext, XsQName pName) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created");
+		}
+		return new JAXBTypeSG(pController, schemaSG, pType, pClassContext, pName);
+	}
+	
+	public Object newTypeSG(SGFactory pController, XSType pType, XsQName pName) throws SAXException {
+		if (schemaSG == null) {
+			throw new IllegalStateException("A schema has not yet been created");
+		}
+		return new JAXBTypeSG(pController, schemaSG, pType, pName);
+	}
+	
+	public TypeSG getTypeSG(SGFactory pController, XSType pType, XsQName pName) throws SAXException {
+		TypeSGChain chain = (TypeSGChain) pController.newTypeSG(pType, pName);
+		TypeSG result = new TypeSGImpl(chain);
+		typesByOrder.add(result);
+		result.init();
+		return result;
+	}
+	
+	public XSParser newXSParser(SGFactory pController) throws SAXException {
+		XSParser parser = new JAXBParser();
+		XSContext context = parser.getContext();
+		context.setXsObjectFactory(pController.newXsObjectFactory());
+		context.setXSObjectFactory(pController.newXSObjectFactory());
+		return parser;
+	}
+	
+	public Facet newFacet(SGFactory pController, XSType pType, XSEnumeration[] pEnumerations) throws SAXException {
+		return new FacetImpl(pType, pEnumerations);
+	}
+	
+	public TypeSG[] getTypes(SGFactory pController) {
+		return (TypeSG[]) typesByOrder.toArray(new TypeSG[typesByOrder.size()]);
+	}
+	
+	public GroupSG[] getGroups(SGFactory pController) {
+		return (GroupSG[]) groupsByOrder.toArray(new GroupSG[groupsByOrder.size()]);
+	}
+	
+	public ObjectSG[] getObjects(SGFactory pController) {
+		return (ObjectSG[]) objectsByOrder.toArray(new ObjectSG[objectsByOrder.size()]);
+	}
+	
+	public XsObjectFactory newXsObjectFactory(SGFactory pController) throws SAXException {
+		return new JAXBXsObjectFactoryImpl(){
+			public XMLReader newXMLReader(boolean pValidating) throws ParserConfigurationException, SAXException{
+				XMLReader xr = super.newXMLReader(pValidating);
+				EntityResolver entityResolver = generator.getEntityResolver();
+				if (entityResolver != null) {
+					xr.setEntityResolver(entityResolver);
+				}
+				return xr;
+			}
+		};
+	}
+	
+	public XSObjectFactory newXSObjectFactory(SGFactory pController) throws SAXException {
+		return new JAXBObjectFactoryImpl(){
+			public SchemaTransformer getSchemaTransformer() {
+				Document[] bindings = generator.getBindings();
+				if (bindings == null  ||  bindings.length == 0) {
+					return null;
+				} else {
+					return new Inliner(bindings);
+				}
+			}
+		};
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGItem.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGItem.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSGItem.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.xml.sax.Locator;
+
+
+/** <p>Default implementation of {@link org.apache.ws.jaxme.generator.sg.SGItem}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class JAXBSGItem {
+  private final SGFactory factory;
+  private final XSObject object;
+  private final SchemaSG schema;
+
+  protected JAXBSGItem(SGFactory pFactory, SchemaSG pSchema, XSObject pObject) {
+    if (pSchema == null) {
+      throw new NullPointerException("The SchemaSG argument must not be null.");
+    }
+    if (pObject == null) {
+      throw new NullPointerException("The XSObject argument must not be null.");
+    }
+    factory = pFactory;
+    schema = pSchema;
+    object = pObject;
+  }
+
+  public SGFactory getFactory() { return factory; }
+  public SchemaSG getSchema() { return schema; }
+  public XSObject getXSObject() { return object; }
+  public Locator getLocator() { return getXSObject().getLocator(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaReader.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaReader.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaReader.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.impl.SchemaReaderImpl;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.util.DTDParser;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** The default, JAXB compliant, schema reader.
+ */
+public class JAXBSchemaReader extends SchemaReaderImpl {
+    private static final Logger log = LoggerAccess.getLogger(JAXBSchemaReader.class);
+    private boolean isSupportingExtensions = false;
+    private List sgFactoryChains = new ArrayList();
+
+    /** Returns whether vendor extensions are being supported.
+     */
+    public boolean isSupportingExtensions() {
+    	return isSupportingExtensions;
+    }
+
+    /** Sets whether vendor extensions are being supported.
+     */
+    public void setSupportingExtensions(boolean pSupportingExtensions) {
+    	isSupportingExtensions = pSupportingExtensions;
+    }
+
+    public void addSGFactoryChain(Class pChainClass) {
+    	final String mName = "addSGFactoryChain";
+    	if (pChainClass == null) {
+    		throw new NullPointerException("The pChainClass argument must not be null.");
+    	}
+    	log.finest(mName, "->", pChainClass.getName());
+    	sgFactoryChains.add(pChainClass);
+    	log.finest(mName, "<-", Integer.toString(sgFactoryChains.size()));
+    }
+
+    protected SGFactoryChain newSGFactoryChain(Generator pGenerator) {
+    	return new JAXBSGFactory(pGenerator);
+    }
+
+    public SGFactory getSGFactory() throws SAXException {
+    	final String mName = "getSGFactory";
+    	log.finest(mName, "->");
+    	SGFactoryChain chain = newSGFactoryChain(getGenerator());
+    	log.finest(mName, "Created instance of " + chain.getClass().getName());
+    	for (Iterator iter = sgFactoryChains.iterator();  iter.hasNext();  ) {
+    		Class c = (Class) iter.next();
+    		log.finest(mName, "Adding instance of " + c.getName());
+    		Object o;
+    		try {
+    			Constructor con = c.getConstructor(new Class[]{SGFactoryChain.class});
+    			o = con.newInstance(new Object[]{chain});
+    		} catch (NoSuchMethodException e) {
+    			throw new SAXException("The SGFactoryChain class " + c.getName() +
+    			" has no constructor taking the backing chain as an argument.");
+    		} catch (InvocationTargetException e) {
+    			Throwable t = e.getTargetException();
+    			String msg = "Failed to invoke the constructor of class " + c.getName() +
+				" with an argument of type " + chain.getClass().getName() +
+				": " + t.getClass().getName() + ", " + t.getMessage();
+    			if (t instanceof Exception) {
+    				throw new SAXException(msg, (Exception) t);
+    			} else {
+    				throw new SAXException(msg, e);
+    			}
+    		} catch (Exception e) {
+    			throw new SAXException("Failed to invoke the constructor of class " + c.getName() +
+    					" with an argument of type " + chain.getClass().getName() +
+						": " + e.getClass().getName() + ", " + e.getMessage(), e);
+    		}
+    		chain = (SGFactoryChain) o;
+    	}
+    	SGFactory result = new SGFactoryImpl(chain);
+    	result.init();
+    	log.finest(mName, "<-", result);
+    	return result;
+    }
+
+    /** Resets the schema readers internal state, allowing
+     * to parse multiple schemas with a single instance.
+     */
+    protected void reset() {
+    }
+
+    public SchemaSG parse(InputSource pSource) throws Exception {
+    	final String mName = "parse";
+    	reset();
+    	log.finest(mName, "->", pSource.getSystemId());
+    	SGFactory factory = getSGFactory();
+    	XSSchema schema;
+        if (Boolean.valueOf(getGenerator().getProperty("jaxme.dtd.input")).booleanValue()) {
+            DTDParser parser = new DTDParser();
+            String targetNamespace = getGenerator().getProperty("jaxme.dtd.targetNamespace");
+            if (targetNamespace != null  &&  !"".equals(targetNamespace)) {
+            	parser.setTargetNamespace(new XsAnyURI(targetNamespace));
+            }
+            schema = parser.parse(pSource);
+        } else {
+        	XSParser parser = factory.newXSParser();
+        	log.finest(mName, "Parser = " + parser + ", validating = " + getGenerator().isValidating());
+        	parser.setValidating(getGenerator().isValidating());
+        	schema = parser.parse(pSource);
+        }
+    	log.finest(mName, "Schema = " + schema);
+    	SchemaSG result = factory.getSchemaSG(schema);
+    	log.finest(mName, "<-", result);
+    	return result;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSchemaSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,603 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.XMLWriter;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.impl.XMLWriterImpl;
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.js.TextFile;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.util.DOMSerializer;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchema;
+import org.apache.ws.jaxme.xs.types.XSNCName;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBSchemaSG implements SchemaSGChain {
+  private final static Logger log = LoggerAccess.getLogger(JAXBSchemaSG.class);
+  private final Map elementsByName = new HashMap();
+  private final Map groupsByName = new HashMap();
+  private final Map typesByName = new HashMap();
+  private final SGFactory factory;
+  private final XSSchema xsSchema;
+  private final JavaSourceFactory javaSourceFactory = new JavaSourceFactory();
+  private TypeSG[] typesByOrder;
+  private ObjectSG[] elementsByOrder;
+  private ObjectSG[] objectsByOrder;
+  private GroupSG[] groupsByOrder;
+
+  /** <p>Creates a new instance of JAXBSchemaSG.</p>
+   */
+  public JAXBSchemaSG(SGFactory pFactory, XSSchema pSchema) {
+    factory = pFactory;
+    xsSchema = pSchema;
+    javaSourceFactory.setOverwriteForced(pFactory.getGenerator().isForcingOverwrite());
+    javaSourceFactory.setSettingReadOnly(pFactory.getGenerator().isSettingReadOnly());
+  }
+
+  public SchemaSG getSchema(SchemaSG pController) { return pController; }
+  public Locator getLocator(SchemaSG pController) { return xsSchema.getLocator(); }
+  public SGFactory getFactory(SchemaSG pController) { return factory; }
+  protected XSSchema getXSSchema() { return xsSchema; }
+
+  public void init(SchemaSG pController) throws SAXException {
+    final String mName = "init";
+    log.finest(mName, "->");
+
+    Object[] childs = getXSSchema().getChilds();
+
+    List elements = new ArrayList();
+    List types = new ArrayList();
+    List groups = new ArrayList();
+    List objects = new ArrayList();
+    for (int i = 0;  i < childs.length;  i++) {
+      Object o = childs[i];
+      log.finest(mName, "Child" + o);
+      if (o instanceof XSType) {
+        TypeSG typeSG = pController.getType(((XSType) o).getName());
+        if (typeSG == null) {
+          throw new IllegalStateException("TypeSG not created");
+        }
+        types.add(typeSG);
+      } else if (o instanceof XSGroup) {
+        GroupSG groupSG = pController.getGroup(((XSGroup) o).getName());
+        if (groupSG == null) {
+          throw new IllegalStateException("GroupSG not created");
+        }
+        groups.add(groupSG);
+      } else if (o instanceof XSElement) {
+        ObjectSG objectSG = pController.getElement(((XSElement) o).getName());
+        if (objectSG == null) {
+          throw new IllegalStateException("ObjectSG not created");
+        }
+        objects.add(objectSG);
+        elements.add(objectSG);
+      }
+    }
+
+    elementsByOrder = (ObjectSG[]) elements.toArray(new ObjectSG[elements.size()]);
+    typesByOrder = (TypeSG[]) types.toArray(new TypeSG[types.size()]);
+    groupsByOrder = (GroupSG[]) groups.toArray(new GroupSG[groups.size()]);
+    objectsByOrder = (ObjectSG[]) objects.toArray(new ObjectSG[objects.size()]);
+    log.finest(mName, "<-");
+  }
+
+  public TypeSG getType(SchemaSG pController, XsQName pName) throws SAXException {
+    TypeSG typeSG = (TypeSG) typesByName.get(pName);
+    if (typeSG != null) {
+      return typeSG;
+    }
+    XSType type = getXSSchema().getType(pName);
+    if (type == null) {
+      return null;
+    }
+    typeSG = pController.getFactory().getTypeSG(type);
+    typesByName.put(pName, typeSG);
+    return typeSG;
+  }
+
+  public GroupSG[] getGroups(SchemaSG pController) throws SAXException {
+    return groupsByOrder;
+  }
+
+  public GroupSG getGroup(SchemaSG pController, XsQName pName) throws SAXException {
+    GroupSG groupSG = (GroupSG) groupsByName.get(pName);
+    if (groupSG != null) {
+      return groupSG;
+    }
+    XSGroup group = getXSSchema().getGroup(pName);
+    if (group == null) {
+      return null;
+    }
+    groupSG = pController.getFactory().getGroupSG(group);
+    groupsByName.put(pName, groupSG);
+    return groupSG;
+  }
+
+  public TypeSG[] getTypes(SchemaSG pController) throws SAXException {
+    return typesByOrder;
+  }
+
+  public ObjectSG[] getObjects(SchemaSG pController) throws SAXException {
+    return objectsByOrder;
+  }
+
+  public ObjectSG getElement(SchemaSG pController, XsQName pName) throws SAXException {
+    ObjectSG objectSG = (ObjectSG) elementsByName.get(pName);
+    if (objectSG != null) {
+      return objectSG;
+    }
+    XSElement element = getXSSchema().getElement(pName);
+    if (element == null) {
+      return null;
+    }
+    objectSG = pController.getFactory().getObjectSG(element);
+    elementsByName.put(pName, objectSG);
+    return objectSG;
+  }
+
+  public String getCollectionType(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        String result = globalBindings.getCollectionType();
+        if (result != null) {
+          return result;
+        }
+      }
+    }
+    return ArrayList.class.getName();
+  }
+
+  public JavaSourceFactory getJavaSourceFactory(SchemaSG pController) {
+    return javaSourceFactory;
+  }
+
+  public void generate(SchemaSG pController) throws SAXException {
+    TypeSG[] types = pController.getTypes();
+    for (int i = 0;  i < types.length;  i++) {
+      types[i].generate();
+    }
+
+    ObjectSG[] objects = pController.getObjects();
+    for (int i = 0;  i < objects.length;  i++) {
+      objects[i].generate();
+    }
+
+    pController.generateJaxbProperties();
+  }
+
+  public ObjectSG[] getElements(SchemaSG pController) throws SAXException {
+    return elementsByOrder;
+  }
+
+  public boolean isBindingStyleModelGroup(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.isBindingStyleModelGroup();
+      }
+    }
+    return false;
+  }
+
+  public boolean isChoiceContentProperty(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.isChoiceContentProperty();
+      }
+    }
+    return false;
+  }
+
+  public boolean isFailFastCheckEnabled(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.isEnableFailFastCheck();
+      }
+    }
+    return false;
+  }
+
+  public boolean isJavaNamingConventionsEnabled(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.isEnableJavaNamingConventions();
+      }
+    }
+    return true;
+  }
+
+  public boolean isFixedAttributeConstantProperty(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.isFixedAttributeAsConstantProperty();
+      }
+    }
+    return false;
+  }
+
+  public boolean isGeneratingIsSetMethod(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.isGenerateIsSetMethod();
+      }
+    }
+    return false;
+  }
+
+  public boolean isUnderscoreWordSeparator(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return JAXBGlobalBindings.UnderscoreBinding.AS_WORD_SEPARATOR.equals(globalBindings.getUnderscoreBinding());
+      }
+    }
+    return true;
+  }
+
+  public JAXBJavaType[] getJAXBJavaTypes(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.getJavaType();
+      }
+    }
+    return new JAXBJavaType[0];
+  }
+
+  public XsQName[] getTypesafeEnumBase(SchemaSG pController) {
+    XSSchema schema = getXSSchema();
+    if (schema instanceof JAXBSchema) {
+      JAXBSchema jaxbSchema = (JAXBSchema) schema;
+      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+      if (globalBindings != null) {
+        return globalBindings.getTypesafeEnumBase();
+      }
+    }
+    return new XsQName[]{XSNCName.getInstance().getName()};
+  }
+
+  public Document getConfigFile(SchemaSG pController, String pPackageName, List pContextList)
+      throws SAXException {
+    final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    dbf.setNamespaceAware(true);
+    dbf.setValidating(false);
+    final DocumentBuilder db;
+    try {
+      db = dbf.newDocumentBuilder();
+    } catch (ParserConfigurationException e) {
+      throw new SAXException("Failed to create a DocumentBuilder: " + e.getMessage(), e);
+    }
+    final Document doc = db.newDocument();
+    final String uri = JAXBContextImpl.CONFIGURATION_URI;
+    final Element root = doc.createElementNS(uri, "Configuration");
+    root.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns", uri);
+    doc.appendChild(root);
+
+    for (Iterator iter = pContextList.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      Context ctx, typeCtx;
+      if (o instanceof ObjectSG) {
+		  ObjectSG oSG = (ObjectSG) o;
+		  ctx = oSG.getClassContext();
+		  typeCtx = oSG.getTypeSG().getComplexTypeSG().getClassContext();
+      } else {
+		  TypeSG tSG = (TypeSG) o;
+		  ctx = typeCtx = tSG.getComplexTypeSG().getClassContext();
+      }
+
+      String packageName = ctx.getXMLInterfaceName().getPackageName();
+      if (packageName == null) {
+        packageName = "";
+      }
+      if (!packageName.equals(pPackageName)) {
+        continue;
+      }
+
+      Element manager = doc.createElementNS(uri, "Manager");
+      root.appendChild(manager);
+      manager.setAttributeNS(null, "elementInterface", ctx.getXMLInterfaceName().toString());
+      manager.setAttributeNS(null, "elementClass", ctx.getXMLImplementationName().toString());
+      manager.setAttributeNS(null, "handlerClass", typeCtx.getXMLHandlerName().toString());
+      manager.setAttributeNS(null, "driverClass", typeCtx.getXMLSerializerName().toString());
+      manager.setAttributeNS(null, "validatorClass", ctx.getXMLValidatorName().toString());
+      if (o instanceof ObjectSG) {
+		  XsQName name = ((ObjectSG) o).getName();
+		  manager.setAttributeNS(null, "qName", name.toString());
+		  if (name.getPrefix() != null) {
+			  manager.setAttributeNS(null, "prefix", name.getPrefix());
+		  }
+      }
+    }
+    return doc;
+  }
+
+  protected String generateConfigFile(SchemaSG pController, String pPackageName, List pContextList) throws SAXException {
+    Document doc = pController.getConfigFile(pPackageName, pContextList);
+    StringWriter sw = new StringWriter();
+    XMLWriter xw = new XMLWriterImpl();
+    try {
+      xw.setWriter(sw);
+    } catch (JAXBException e) {
+      throw new SAXException(e);
+    }
+    DOMSerializer ds = new DOMSerializer();
+    ds.serialize(doc, xw);
+    return sw.toString();
+  }
+
+  public void generateJaxbProperties(SchemaSG pController) throws SAXException {
+    List contextList = new ArrayList();
+    ObjectSG[] elements = pController.getElements();
+    for (int i = 0;  i < elements.length;  i++) {
+    	if (elements[i].getTypeSG().isComplex()) {
+            contextList.add(elements[i]);
+    	}
+    }
+    TypeSG[] types = pController.getTypes();
+    for (int i = 0;  i < types.length;  i++) {
+      if (types[i].isComplex()) {
+        contextList.add(types[i]);
+      }
+    }
+
+
+    Set packages = new HashSet();
+    for (Iterator iter = contextList.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      Context ctx;
+      if (o instanceof ObjectSG) {
+        ctx = ((ObjectSG) o).getClassContext();
+      } else {
+        ctx = ((TypeSG) o).getComplexTypeSG().getClassContext();
+      }
+      String packageName = ctx.getXMLInterfaceName().getPackageName();
+      if (packages.contains(packageName)) {
+        continue;
+      }
+
+      TextFile textFile = pController.getJavaSourceFactory().newTextFile(packageName, "jaxb.properties");
+      textFile.addLine(JAXBContext.JAXB_CONTEXT_FACTORY + "=" + JAXBContextImpl.class.getName());
+      packages.add(packageName);
+
+      String configFile = generateConfigFile(pController, packageName, contextList);
+      TextFile confFile = pController.getJavaSourceFactory().newTextFile(packageName, "Configuration.xml");
+      confFile.setContents(configFile);
+
+      getObjectFactory(pController, packageName, contextList);
+    }
+  }
+
+  protected JavaSource getObjectFactory(SchemaSG pController, String pPackageName,
+		  								List pContextList)
+  		throws SAXException {
+    JavaQName qName = JavaQNameImpl.getInstance(pPackageName, "ObjectFactory");
+    JavaSource js = pController.getJavaSourceFactory().newJavaSource(qName, "public");
+    JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
+    JavaField properties = js.newJavaField("properties", Map.class, "private");
+
+    JavaConstructor jcon = js.newJavaConstructor("public");
+    jcon.addThrows(JAXBException.class);
+    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
+                 JAXBContext.class, ".newInstance(",
+                 JavaSource.getQuoted(pPackageName), ");");
+
+    JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
+    newInstanceMethod.addThrows(JAXBException.class);
+    Parameter pElementInterface = newInstanceMethod.addParam(Class.class, "pElementInterface");
+    newInstanceMethod.addLine("return ", jf, ".getManager(", pElementInterface, ").getElementJ();");
+
+    {
+      JavaMethod getPropertyMethod = js.newJavaMethod("getProperty", Object.class, "public");
+      Parameter pName = getPropertyMethod.addParam(String.class, "pName");
+      getPropertyMethod.addIf(properties, " == null");
+      getPropertyMethod.addLine("return null;");
+      getPropertyMethod.addEndIf();
+      getPropertyMethod.addLine("return ", properties, ".get(", pName, ");");
+    }
+
+    {
+      JavaMethod setPropertyMethod = js.newJavaMethod("setProperty", void.class, "public");
+      Parameter pName = setPropertyMethod.addParam(String.class, "pName");
+      Parameter pValue = setPropertyMethod.addParam(Object.class, "pValue");
+      setPropertyMethod.addIf(properties, " == null");
+      setPropertyMethod.addLine(properties, " = new ", HashMap.class, "();");
+      setPropertyMethod.addEndIf();
+      setPropertyMethod.addLine(properties, ".put(", pName, ", ", pValue, ");");
+    }
+
+    Set contextSet = new HashSet();
+    for (Iterator iter = pContextList.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      TypeSG typeSG;
+      if (o instanceof ObjectSG) {
+        ObjectSG objectSG = ((ObjectSG) o);
+        typeSG = objectSG.getTypeSG();
+        generateCreateMethod(js, null, objectSG.getClassContext());
+        //NB: we don't have to check for duplicate element names since that would violate the XSD spec
+      } else if (o instanceof TypeSG) {
+        typeSG = (TypeSG) o;
+      } else {
+        continue;
+      }
+
+	  generateCreateMethod(js, contextSet, typeSG, null);
+    }
+    
+    return js;
+  }
+
+  private void generateCreateMethod(JavaSource pJs, Set pContextSet,
+		  							TypeSG pType, String pPrefix) throws SAXException {
+	  if (!pType.isComplex()  ||  pContextSet.contains(pType)) {
+		  return;
+	  }
+	  // many global elements may have the same global complex type so must check first
+	  String prefix = generateCreateMethod(pJs, pPrefix, pType.getComplexTypeSG().getClassContext());
+	  pContextSet.add(pType);
+	  generateCreateMethods(pJs, pType, prefix, pContextSet);
+  }
+
+  /** Generate create methods for the given particle.
+   */
+  private void generateCreateMethods(JavaSource pJs, ParticleSG pParticle,
+		  							String pName, Set pContextSet)
+  		throws SAXException {
+	  if (pParticle.isGroup()) {
+		  GroupSG group = pParticle.getGroupSG();
+		  generateCreateMethods(pJs, group.getParticles(), pName, pContextSet);
+	  } else if (pParticle.isElement()) {
+		  ObjectSG oSG = pParticle.getObjectSG();
+		  if (oSG.isGlobal()) {
+			  return;  // Will be generated elsewhere
+		  }
+		  TypeSG tSG = oSG.getTypeSG();
+		  if (tSG.isGlobalType()) {
+			  return;  // Will be generated elsewhere
+		  }
+		  generateCreateMethod(pJs, pContextSet, tSG, pName);
+	  } else if (pParticle.isWildcard()) {
+		  throw new IllegalStateException("TODO: Add support for wildcards here.");
+	  } else {
+		  throw new IllegalStateException("Invalid class type");
+	  }
+  }
+
+  /** Generate create methods for the given particles.
+   */
+  private void generateCreateMethods(JavaSource pJs, ParticleSG[] pParticles,
+		  							 String pName, Set pContextSet)
+  		throws SAXException {
+	  for (int i = 0;  i < pParticles.length;  i++) {
+		  generateCreateMethods(pJs, pParticles[i], pName, pContextSet);
+	  }
+  }
+
+  /** Generate create methods for the content.
+   */
+  private void generateCreateMethods(JavaSource pJs, TypeSG pType,
+		  							 String pName, Set pContextSet)
+  		throws SAXException {
+	  ComplexTypeSG ctSG = pType.getComplexTypeSG();
+	  if (ctSG.hasSimpleContent()) {
+		  return; // No elements contained
+	  }
+	  ComplexContentSG ccSG = ctSG.getComplexContentSG();
+	  if (ccSG.isEmpty()) {
+		  return;
+	  }
+	  ParticleSG particle = ccSG.getRootParticle();
+	  generateCreateMethods(pJs, particle, pName, pContextSet);
+  }
+
+  /**
+   * Generic util method for generating the create<NAME> methods for the object factory.
+   * @param pSource the java source object to add the method
+   * @param pContext the Class Context from either an ObjectSG or a TypeSG
+   */
+  private String generateCreateMethod(JavaSource pSource, String pPrefix,
+		  							  Context pContext) {
+    JavaQName resultName = pContext.getXMLInterfaceName();
+    String className = resultName.isInnerClass() ? resultName.getInnerClassName() : resultName.getClassName();
+	String result = Character.toUpperCase(className.charAt(0)) + className.substring(1);
+	boolean anonymous = pPrefix != null;
+	if (anonymous) {
+		result = pPrefix + result;
+	}
+    String methodName = "create" + result;
+    JavaMethod createMethod = pSource.newJavaMethod(methodName, resultName, "public");
+    createMethod.addThrows(JAXBException.class);
+	if (anonymous) {
+		createMethod.addLine("return new ", pContext.getXMLImplementationName(), "();");
+	} else {
+		createMethod.addLine("return (", resultName, ") newInstance(", resultName, ".class);");
+	}
+	return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSimpleContentTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSimpleContentTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBSimpleContentTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBSimpleContentTypeSG implements SimpleContentSGChain {
+  private XSType xsType;
+  private PropertySG propertySG;
+  private final TypeSG typeSG, contentTypeSG;
+
+  /** <p>Creates a new instance of JAXBSimpleContentSG.java.</p>
+   */
+  protected JAXBSimpleContentTypeSG(ComplexTypeSG pComplexTypeSG, XSType pType) throws SAXException {
+    xsType = pType;
+    typeSG = pComplexTypeSG.getTypeSG();
+    XSType theSimpleType = pType.getComplexType().getSimpleContent().getType();
+    contentTypeSG = typeSG.getFactory().getTypeSG(theSimpleType, pComplexTypeSG.getClassContext(), null);
+  }
+
+  public Object newPropertySGChain(SimpleContentSG pController) throws SAXException {
+    if (xsType == null) {
+      throw new IllegalStateException("A new PropertySG has already been created.");
+    }
+    PropertySGChain result = new JAXBPropertySG(typeSG, xsType);
+    xsType = null;  // Make this available to garbage collection.
+    return result;
+  }
+
+  public void init(SimpleContentSG pController) throws SAXException {
+    PropertySGChain chain = (PropertySGChain) pController.newPropertySGChain();
+    propertySG = new PropertySGImpl(chain);
+    propertySG.init();
+  }
+
+  public PropertySG getPropertySG(SimpleContentSG pController) throws SAXException { return propertySG; }
+  public TypeSG getTypeSG(SimpleContentSG pController) throws SAXException { return typeSG; }
+  public TypeSG getContentTypeSG(SimpleContentSG pController) throws SAXException { return contentTypeSG; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,735 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSGChain;
+import org.apache.ws.jaxme.generator.types.Base64BinarySG;
+import org.apache.ws.jaxme.generator.types.BooleanSG;
+import org.apache.ws.jaxme.generator.types.ByteSG;
+import org.apache.ws.jaxme.generator.types.DateSG;
+import org.apache.ws.jaxme.generator.types.DateTimeSG;
+import org.apache.ws.jaxme.generator.types.DecimalSG;
+import org.apache.ws.jaxme.generator.types.DoubleSG;
+import org.apache.ws.jaxme.generator.types.DurationSG;
+import org.apache.ws.jaxme.generator.types.FloatSG;
+import org.apache.ws.jaxme.generator.types.HexBinarySG;
+import org.apache.ws.jaxme.generator.types.IDREFSG;
+import org.apache.ws.jaxme.generator.types.IDSG;
+import org.apache.ws.jaxme.generator.types.IntSG;
+import org.apache.ws.jaxme.generator.types.IntegerSG;
+import org.apache.ws.jaxme.generator.types.ListTypeSGImpl;
+import org.apache.ws.jaxme.generator.types.LongSG;
+import org.apache.ws.jaxme.generator.types.QNameSG;
+import org.apache.ws.jaxme.generator.types.ShortSG;
+import org.apache.ws.jaxme.generator.types.StringSG;
+import org.apache.ws.jaxme.generator.types.TimeSG;
+import org.apache.ws.jaxme.generator.types.UnionTypeSGImpl;
+import org.apache.ws.jaxme.generator.types.UnsignedIntSG;
+import org.apache.ws.jaxme.generator.types.UnsignedShortSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBEnumeration;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchema;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSimpleType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumClass;
+import org.apache.ws.jaxme.xs.types.XSAnySimpleType;
+import org.apache.ws.jaxme.xs.types.XSAnyURI;
+import org.apache.ws.jaxme.xs.types.XSBase64Binary;
+import org.apache.ws.jaxme.xs.types.XSBoolean;
+import org.apache.ws.jaxme.xs.types.XSByte;
+import org.apache.ws.jaxme.xs.types.XSDate;
+import org.apache.ws.jaxme.xs.types.XSDateTime;
+import org.apache.ws.jaxme.xs.types.XSDecimal;
+import org.apache.ws.jaxme.xs.types.XSDouble;
+import org.apache.ws.jaxme.xs.types.XSDuration;
+import org.apache.ws.jaxme.xs.types.XSEntity;
+import org.apache.ws.jaxme.xs.types.XSFloat;
+import org.apache.ws.jaxme.xs.types.XSGDay;
+import org.apache.ws.jaxme.xs.types.XSGMonth;
+import org.apache.ws.jaxme.xs.types.XSGMonthDay;
+import org.apache.ws.jaxme.xs.types.XSGYear;
+import org.apache.ws.jaxme.xs.types.XSGYearMonth;
+import org.apache.ws.jaxme.xs.types.XSHexBinary;
+import org.apache.ws.jaxme.xs.types.XSID;
+import org.apache.ws.jaxme.xs.types.XSIDREF;
+import org.apache.ws.jaxme.xs.types.XSInt;
+import org.apache.ws.jaxme.xs.types.XSInteger;
+import org.apache.ws.jaxme.xs.types.XSLanguage;
+import org.apache.ws.jaxme.xs.types.XSLong;
+import org.apache.ws.jaxme.xs.types.XSNCName;
+import org.apache.ws.jaxme.xs.types.XSNMToken;
+import org.apache.ws.jaxme.xs.types.XSName;
+import org.apache.ws.jaxme.xs.types.XSNegativeInteger;
+import org.apache.ws.jaxme.xs.types.XSNonNegativeInteger;
+import org.apache.ws.jaxme.xs.types.XSNonPositiveInteger;
+import org.apache.ws.jaxme.xs.types.XSNormalizedString;
+import org.apache.ws.jaxme.xs.types.XSNotation;
+import org.apache.ws.jaxme.xs.types.XSPositiveInteger;
+import org.apache.ws.jaxme.xs.types.XSQName;
+import org.apache.ws.jaxme.xs.types.XSShort;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.types.XSTime;
+import org.apache.ws.jaxme.xs.types.XSToken;
+import org.apache.ws.jaxme.xs.types.XSUnsignedByte;
+import org.apache.ws.jaxme.xs.types.XSUnsignedInt;
+import org.apache.ws.jaxme.xs.types.XSUnsignedLong;
+import org.apache.ws.jaxme.xs.types.XSUnsignedShort;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class JAXBTypeSG extends JAXBSGItem implements TypeSGChain {
+  private final static Logger log = LoggerAccess.getLogger(JAXBTypeSG.class);
+  private SimpleTypeSG simpleTypeSG;
+  private ComplexTypeSG complexTypeSG;
+  private final TypeSG restrictedType, extendedType;
+  private final Context classContext;
+  private final XSType xsType;
+  private boolean isGlobalClass;
+  private final XsQName name;
+  private Map properties;
+  private final XsSchemaHeader schemaHeader;
+
+  /** <p>Creates a new, global instance of JAXBTypeSG.</p>
+   */
+  protected JAXBTypeSG(SGFactory pFactory, SchemaSG pSchema, XSType pType)
+      throws SAXException {
+    this(pFactory, pSchema, pType, null, pType.getName());
+    isGlobalClass = true;
+  }
+
+  protected JAXBTypeSG(SGFactory pFactory, SchemaSG pSchema, XSType pType, XsQName pName) throws SAXException {
+    this(pFactory, pSchema, pType, null, pName);
+    isGlobalClass = true;
+  }
+
+  private TypeSG getReferencedType(SGFactory pFactory, Context pClassContext,
+  		                           XSType pReferencingType, XSType pReferencedType)
+          throws SAXException {
+      XsQName name = pReferencedType.getName();
+      TypeSG result;
+      if (pReferencedType.isGlobal()) {
+      	  result = pFactory.getTypeSG(pReferencedType);
+      	  if (result == null) {
+      	  	  throw new SAXParseException("Unknown global type " + name,
+      	  	  		                      pReferencingType.getLocator());
+      	  }
+      } else {
+      	  throw new IllegalStateException("A referenced type must be global.");
+      }
+      return result;
+  }
+
+  /** <p>Creates a new, local instance of JAXBTypeSG. Classes are generated
+   * into the given context.</p>
+   */
+  protected JAXBTypeSG(SGFactory pFactory, SchemaSG pSchema, XSType pType, Context pClassContext, XsQName pName)
+      throws SAXException {
+    super(pFactory, pSchema, pType);
+    name = pName;
+    xsType = pType;
+    if (pType.isSimple()) {
+      if (pType.getSimpleType().isRestriction()) {
+        XSType restrictedXsType = pType.getSimpleType().getRestrictedType();
+        restrictedType = getReferencedType(pFactory, pClassContext, pType, restrictedXsType);
+        extendedType = null;
+      } else {
+        restrictedType = extendedType = null;
+      }
+    } else {
+      if (pType.getComplexType().isRestriction()) {
+        restrictedType = getReferencedType(pFactory, pClassContext, pType, pType.getComplexType().getRestrictedType());
+        extendedType = null;
+      } else if (pType.getComplexType().isExtension()) {
+        extendedType = getReferencedType(pFactory, pClassContext, pType, pType.getComplexType().getExtendedType());
+        restrictedType = null;
+      } else {
+        restrictedType = extendedType = null;
+      }
+    }
+    classContext = pClassContext;
+    schemaHeader = pType.getSchemaHeader();
+  }
+
+  public Object newComplexTypeSG(TypeSG pController) throws SAXException {
+    return classContext == null ? new JAXBComplexTypeSG(pController, xsType) :
+                                   new JAXBComplexTypeSG(pController, xsType, classContext);
+  }
+
+
+  protected XSType getXSType() { return (XSType) getXSObject(); }
+  public XsQName getName(TypeSG pController) { return name; }
+  public boolean isGlobalType(TypeSG pController) { return getXSType().isGlobal(); }
+  public boolean isGlobalClass(TypeSG pController) { return isGlobalClass; }
+  public boolean isComplex(TypeSG pController) { return !getXSType().isSimple(); }
+  public Locator getLocator(TypeSG pController) { return getLocator(); }
+  public SGFactory getFactory(TypeSG pController) { return getFactory(); }
+  public SchemaSG getSchema(TypeSG pController) { return getSchema(); }
+  public boolean isExtension(TypeSG pController) { return extendedType != null; }
+  public TypeSG getExtendedType(TypeSG pController) {
+    if (extendedType == null) {
+      throw new IllegalStateException("This type is no extension.");
+    }
+    return extendedType;
+  }
+  public boolean isRestriction(TypeSG pController) { return restrictedType != null; }
+  public TypeSG getRestrictedType(TypeSG pController) {
+    if (restrictedType == null) {
+      throw new IllegalStateException("This type is no restriction.");
+    }
+    return restrictedType;
+  }
+
+  public void init(TypeSG pController) throws SAXException {
+    final String mName = "init";
+    log.finest(mName, "->");
+    if (pController.isComplex()) {
+      ComplexTypeSGChain chain = (ComplexTypeSGChain) pController.newComplexTypeSG();
+      complexTypeSG = new ComplexTypeSGImpl(chain);
+      complexTypeSG.init();
+    } else {
+      SimpleTypeSGChain chain = (SimpleTypeSGChain) pController.newSimpleTypeSG();
+      simpleTypeSG = new SimpleTypeSGImpl(chain);
+      simpleTypeSG.init();
+    }
+    log.finest(mName, "<-");
+  }
+
+  public ComplexTypeSG getComplexTypeSG(TypeSG pController) { return complexTypeSG; }
+  public SimpleTypeSG getSimpleTypeSG(TypeSG pController) { return simpleTypeSG; }
+
+  public void generate(TypeSG pController) throws SAXException {
+    final String mName = "generate";
+    log.finest(mName, "->", pController.getName());
+    if (pController.isComplex()) {
+      ComplexTypeSG myComplexTypeSG = pController.getComplexTypeSG();
+      myComplexTypeSG.getXMLInterface();
+      myComplexTypeSG.getXMLImplementation();
+      myComplexTypeSG.getXMLSerializer();
+      myComplexTypeSG.getXMLHandler(myComplexTypeSG.getClassContext().getXMLHandlerName());
+    } else {
+      pController.getSimpleTypeSG().generate();
+    }
+    log.finest(mName, "<-");      
+  }
+
+  public void generate(TypeSG pController, JavaSource pSource) throws SAXException {
+    final String mName = "generate(JavaSource)";
+    log.finest(mName, "->", new Object[]{pController.getName(), pSource.getQName()});
+    if (pController.isComplex()) {
+    } else {
+      pController.getSimpleTypeSG().generate(pSource);
+    }
+
+    log.finest(mName, "<-");
+  }
+
+  public JavaField getXMLField(TypeSG pController, JavaSource pSource, 
+                                 String pFieldName, String pDefaultValue) throws SAXException {
+    if (pSource.isInterface()) {
+      return null;
+    } else {
+      JavaQName runtimeType;
+      if (pController.isComplex() && pFieldName.equals("value") && pController.getComplexTypeSG().hasSimpleContent()) {
+        SimpleContentSG obj = pController.getComplexTypeSG().getSimpleContentSG();
+        runtimeType = obj.getContentTypeSG().getRuntimeType();
+        if (pController.isRestriction()) {
+          if (pController.getRestrictedType().isExtension()) {
+            runtimeType = pController.getRestrictedType().getExtendedType().getRuntimeType();
+          }
+        }
+      }
+      else {
+        runtimeType = pController.getRuntimeType();
+      } 
+      JavaField jf = pSource.newJavaField(pFieldName, runtimeType, JavaSource.PRIVATE);
+      if (!pController.isComplex()) {
+        Object o = pController.getSimpleTypeSG().getInitialValue(pSource);
+        if (o == null && pDefaultValue != null) {
+            o = pController.getSimpleTypeSG().getCastFromString(pDefaultValue);
+        }
+        if (o != null) {
+            jf.addLine(o);
+        }
+      }
+      return jf;
+    }
+  }
+
+  public JavaMethod getXMLGetMethod(TypeSG pController, JavaSource pSource,
+		  							String pFieldName, String pMethodName) throws SAXException {
+    JavaQName runtimeType;
+    if (pController.isComplex() && pFieldName.equals("value") && pController.getComplexTypeSG().hasSimpleContent()) {
+      SimpleContentSG obj = pController.getComplexTypeSG().getSimpleContentSG();
+      runtimeType = obj.getContentTypeSG().getRuntimeType();
+      if (pController.isRestriction()) {
+        if (pController.getRestrictedType().isExtension()) {
+          runtimeType = pController.getRestrictedType().getExtendedType().getRuntimeType();
+        }
+      }
+    }
+    else {
+      runtimeType = pController.getRuntimeType();
+    } 
+    JavaMethod jm = pSource.newJavaMethod(pMethodName, runtimeType, JavaSource.PUBLIC);
+    if (!pSource.isInterface()) {
+      jm.addLine("return " + pFieldName + ";");
+    }
+    return jm;
+  }
+
+  public JavaMethod getXMLSetMethod(TypeSG pController, JavaSource pSource,
+  		                            String pFieldName, String pParamName,
+  		                            String pMethodName,
+                                    boolean pSetIsSet) throws SAXException {
+  	if (pController.isComplex()) {
+  		JavaMethod jm = pSource.newJavaMethod(pMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
+  		JavaQName runtimeType;
+  		if (pFieldName.equals("value") && pController.getComplexTypeSG().hasSimpleContent()) {
+  			SimpleContentSG obj = pController.getComplexTypeSG().getSimpleContentSG();
+  			runtimeType = obj.getContentTypeSG().getRuntimeType();
+  			if (pController.isRestriction()) {
+  				if (pController.getRestrictedType().isExtension()) {
+  					runtimeType = pController.getRestrictedType().getExtendedType().getRuntimeType();
+  				}
+  			}
+  		}
+  		else {
+  			runtimeType = pController.getRuntimeType();
+  		}
+  		DirectAccessible param = jm.addParam(runtimeType, pParamName);
+  		if (!pSource.isInterface()) {
+  			jm.addLine(pFieldName, " = ", param, ";");
+  		}
+  		return jm;
+  	} else {
+  		JavaMethod jm = pController.getSimpleTypeSG().getXMLSetMethod(pSource, pFieldName, pParamName, pMethodName);
+  		if (pSetIsSet  &&  pController.getRuntimeType().isPrimitive()) {
+  			jm.addLine(getIsSetCheckFieldName(pFieldName), " = true;");
+        }
+        return jm;
+  	}
+  }
+
+  private String getIsSetCheckFieldName(String pFieldName) {
+  	return "has" + Character.toUpperCase(pFieldName.charAt(0)) + pFieldName.substring(1);
+  }
+
+  /** 
+   * The implementation of this method is temporarily experimental.
+   * isSet and unset methods will be implemented by a flag and corresponding default value if it exist. 
+   */
+  public JavaMethod getXMLIsSetMethod(TypeSG pController, JavaSource pSource,
+  		                              String pFieldName, String pMethodName)
+      throws SAXException {
+    JavaMethod jm = pSource.newJavaMethod(pMethodName, BooleanSG.BOOLEAN_TYPE, JavaSource.PUBLIC);
+    if (!pSource.isInterface()) {
+      if (pController.getRuntimeType().isPrimitive()) {
+      	JavaField jf = pSource.newJavaField(getIsSetCheckFieldName(pFieldName), BooleanSG.BOOLEAN_TYPE);
+        jm.addLine("return ", jf, ";");
+      } else {
+        jm.addLine("return (" + pFieldName + " != null);");
+      }
+    }
+    return jm;
+  }
+
+  public JavaQName getRuntimeType(TypeSG pController) throws SAXException {
+    if (pController.isComplex()) {
+      return pController.getComplexTypeSG().getClassContext().getXMLInterfaceName();
+    } else {
+      return pController.getSimpleTypeSG().getRuntimeType();
+    }
+  }
+
+  private SimpleTypeSGChain newSimpleTypeSGByJavaType(JAXBJavaType pJavaType,
+  		                                              SGFactory pFactory,
+                                                      SchemaSG pSchema,
+                                                      XSType pType)
+      throws SAXException {
+    JavaQName qName = JavaQNameImpl.getInstance(pJavaType.getName());
+    if (BooleanSG.BOOLEAN_TYPE.equals(qName)) {
+    	return new BooleanSG(pFactory, pSchema, pType);
+    } else if (BooleanSG.BOOLEAN_OBJECT_TYPE.equals(qName)) {
+    	BooleanSG result = new BooleanSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (ByteSG.BYTE_TYPE.equals(qName)) {
+    	return new ByteSG(pFactory, pSchema, pType);
+    } else if (ByteSG.BYTE_OBJECT_TYPE.equals(qName)) {
+    	ByteSG result = new ByteSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (ShortSG.SHORT_TYPE.equals(qName)) {
+    	return new ShortSG(pFactory, pSchema, pType);
+    } else if (ShortSG.SHORT_OBJECT_TYPE.equals(qName)) {
+        ShortSG result = new ShortSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (IntSG.INT_TYPE.equals(qName)) {
+    	return new IntSG(pFactory, pSchema, pType);
+    } else if (IntSG.INT_OBJECT_TYPE.equals(qName)) {
+    	IntSG result = new IntSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (LongSG.LONG_TYPE.equals(qName)) {
+    	return new LongSG(pFactory, pSchema, pType);
+    } else if (LongSG.LONG_OBJECT_TYPE.equals(qName)) {
+    	LongSG result = new LongSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (FloatSG.FLOAT_TYPE.equals(qName)) {
+    	return new FloatSG(pFactory, pSchema, pType);
+    } else if (FloatSG.FLOAT_OBJECT_TYPE.equals(qName)) {
+    	FloatSG result = new FloatSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (DoubleSG.DOUBLE_TYPE.equals(qName)) {
+    	return new DoubleSG(pFactory, pSchema, pType);
+    } else if (DoubleSG.DOUBLE_OBJECT_TYPE.equals(qName)) {
+        DoubleSG result = new DoubleSG(pFactory, pSchema, pType);
+        result.setNullable(true);
+        return result;
+    } else if (StringSG.STRING_TYPE.equals(qName)) {
+    	return new StringSG(pFactory, pSchema, pType);
+    } else if (IntegerSG.INTEGER_TYPE.equals(qName)) {
+    	return new IntegerSG(pFactory, pSchema, pType);
+    } else if (DecimalSG.DECIMAL_TYPE.equals(qName)) {
+    	return new DecimalSG(pFactory, pSchema, pType);
+    } else if (QNameSG.QNAME_TYPE.equals(qName)) {
+    	return new QNameSG(pFactory, pSchema, pType);
+    } else if (DateTimeSG.CALENDAR_TYPE.equals(qName)) {
+    	return new DateTimeSG(pFactory, pSchema, pType);
+    } else {
+    	return null;
+    }
+  }
+
+  private SimpleTypeSGChain newGlobalAtomicTypeSG(SGFactory pFactory,
+  		                                          SchemaSG pSchema,
+  		                                          XSType pType)
+      throws SAXException {
+  	if (!pType.isGlobal()) {
+  		return null;
+    }
+    XsQName myName = pType.getName();
+    if (myName.equals(XSNotation.getInstance().getName())    ||
+        myName.equals(XSGYearMonth.getInstance().getName())  ||
+        myName.equals(XSGYear.getInstance().getName())       ||
+        myName.equals(XSGMonthDay.getInstance().getName())   ||
+        myName.equals(XSGMonth.getInstance().getName())      ||
+        myName.equals(XSGDay.getInstance().getName())) {
+      throw new SAXException("The type " + myName + " is not supported.");
+    } else if (myName.equals(XSIDREF.getInstance().getName())) {
+      return new IDREFSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSID.getInstance().getName())) {
+      return new IDSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSByte.getInstance().getName())) {
+      return new ByteSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSShort.getInstance().getName())) {
+      return new ShortSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSInt.getInstance().getName())) {
+      return new IntSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSLong.getInstance().getName())) {
+      return new LongSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSUnsignedByte.getInstance().getName())  ||
+                myName.equals(XSUnsignedShort.getInstance().getName())) {
+      return new UnsignedShortSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSUnsignedInt.getInstance().getName())) {
+      return new UnsignedIntSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSInteger.getInstance().getName())             ||
+                myName.equals(XSNonPositiveInteger.getInstance().getName())  ||
+                myName.equals(XSNegativeInteger.getInstance().getName())     ||
+                myName.equals(XSUnsignedLong.getInstance().getName())        ||
+                myName.equals(XSPositiveInteger.getInstance().getName())     ||
+                myName.equals(XSNonNegativeInteger.getInstance().getName())) {
+      return new IntegerSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSDecimal.getInstance().getName())) {
+      return new DecimalSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSQName.getInstance().getName())) {
+      return new QNameSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSDouble.getInstance().getName())) {
+      return new DoubleSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSFloat.getInstance().getName())) {
+      return new FloatSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSHexBinary.getInstance().getName())) {
+      return new HexBinarySG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSBase64Binary.getInstance().getName())) {
+      return new Base64BinarySG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSBoolean.getInstance().getName())) {
+      return new BooleanSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSDate.getInstance().getName())) {
+      return new DateSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSDateTime.getInstance().getName())) {
+      return new DateTimeSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSTime.getInstance().getName())) {
+      return new TimeSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSDuration.getInstance().getName())) {
+      return new DurationSG(pFactory, pSchema, pType);
+    } else if (myName.equals(XSAnySimpleType.getInstance().getName())     ||
+                myName.equals(XSString.getInstance().getName())            ||
+                myName.equals(XSAnyURI.getInstance().getName())            ||
+                myName.equals(XSNormalizedString.getInstance().getName())  ||
+                myName.equals(XSToken.getInstance().getName())             ||
+                myName.equals(XSLanguage.getInstance().getName())          ||
+                myName.equals(XSName.getInstance().getName())              ||
+                myName.equals(XSNMToken.getInstance().getName())           ||
+                myName.equals(XSNCName.getInstance().getName())            ||
+                myName.equals(XSEntity.getInstance().getName())) {
+      return new StringSG(pFactory, pSchema, pType);
+    } else {
+      return null;
+    }
+  }
+
+  private SimpleTypeSGChain newAtomicTypeRestriction(TypeSG pController,
+                                                     SGFactory pFactory,
+                                                     SchemaSG pSchema,
+                                                     XSType pType)
+      throws SAXException {
+  	XSSimpleType simpleType = pType.getSimpleType();
+    SimpleTypeSGChain result = newSimpleTypeSG(pController, pFactory, pSchema, simpleType.getRestrictedType());
+    result = new SimpleTypeRestrictionSG(result, pType, simpleType);
+    
+    if (simpleType.getEnumerations().length > 0) {
+        boolean generateTypesafeEnumClass = false;
+        String className = null;
+        
+        if (simpleType instanceof JAXBSimpleType) {
+            JAXBSimpleType jaxbSimpleType = (JAXBSimpleType) simpleType;
+            JAXBTypesafeEnumClass jaxbTypesafeEnumClass = jaxbSimpleType.getJAXBTypesafeEnumClass();
+            if (jaxbTypesafeEnumClass != null) {
+                generateTypesafeEnumClass = true;
+                className = jaxbTypesafeEnumClass.getName();
+            }
+        }
+        
+        if (!generateTypesafeEnumClass) {
+            XSEnumeration[] enumerations = simpleType.getEnumerations();
+            for (int i = 0;  i < enumerations.length;  i++) {
+                XSEnumeration enumeration = enumerations[i];
+                if (enumeration instanceof JAXBEnumeration) {
+                    JAXBEnumeration jaxbEnumeration = (JAXBEnumeration) enumeration;
+                    if (jaxbEnumeration.getJAXBTypesafeEnumMember() != null) {
+                        generateTypesafeEnumClass = true;
+                        break;
+                    }
+                }
+            }
+        }
+        
+        if (!generateTypesafeEnumClass  &&  pType.isGlobal()) {
+            XsQName[] qNames = new XsQName[]{XSNMToken.getInstance().getName()};
+            XSSchema xsSchema = xsType.getXSSchema();
+            if (xsSchema instanceof JAXBSchema) {
+                JAXBSchema jaxbSchema = (JAXBSchema) xsSchema;
+                JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
+                if (globalBindings != null) {
+                    qNames = globalBindings.getTypesafeEnumBase();
+                }
+            }
+            
+            for (XSType restrType = xsType;  !generateTypesafeEnumClass;  ) {
+                restrType = restrType.getSimpleType().getRestrictedType();
+                if (restrType.isGlobal()) {
+                    for (int i = 0;  i < qNames.length;  i++) {
+                        if (qNames[i].equals(restrType.getName())) {
+                            generateTypesafeEnumClass = true;
+                            break;
+                        }
+                    }
+                    if (XSAnySimpleType.getInstance().getName().equals(restrType.getName())) {
+                        break;
+                    }
+                }
+            }
+        }
+        
+        JAXBSchemaBindings jaxbSchemaBindings;
+        if (xsType instanceof JAXBType) {
+            jaxbSchemaBindings = ((JAXBType) xsType).getJAXBSchemaBindings();
+        } else {
+            jaxbSchemaBindings = null;
+        }
+        
+        if (generateTypesafeEnumClass) {
+            if (className == null) {
+                XsQName qName = pType.isGlobal() ? pType.getName() : pController.getName();
+                className = AbstractContext.getClassNameFromLocalName(pController.getLocator(),
+                        qName.getLocalName(),
+                        pSchema) + "Class";
+            }
+            JavaQName qName;
+            if (classContext == null) {
+                String packageName = AbstractContext.getPackageName(pSchema,
+                        jaxbSchemaBindings,
+                        pController.getLocator(),
+                        pController.getName());
+                qName = JavaQNameImpl.getInstance(packageName, className);
+            } else {
+                JavaQName elementClassName = classContext.getXMLInterfaceName();
+                if (elementClassName == null) {
+                    elementClassName = classContext.getXMLImplementationName();
+                }
+                qName = JavaQNameImpl.getInstance(elementClassName.getPackageName(), className);
+            }
+            result = new EnumerationSG(result, qName, pType);
+        }
+    }
+    
+    return result;
+  }
+
+  private JAXBJavaType findJavaType(SchemaSG pSchema, XSType pType)
+      throws SAXException {
+    JAXBJavaType[] globalJavaTypes = pSchema.getJAXBJavaTypes();
+    
+    for (XSType currentType = pType;  currentType != null;  ) {
+    	if (currentType instanceof JAXBType) {
+    		JAXBType jaxbType = (JAXBType) currentType;
+    		JAXBJavaType jaxbJavaType = jaxbType.getJAXBJavaType();
+    		if (jaxbJavaType == null) {
+    			return jaxbJavaType;
+    		}
+    	}
+        for (int i = 0;  i < globalJavaTypes.length;  i++) {
+            if (globalJavaTypes[i].getXmlType().equals(currentType.getName())) {
+        		return globalJavaTypes[i];
+            }
+        }
+        XSSimpleType simpleType = currentType.getSimpleType();
+        if (simpleType.isRestriction()) {
+        	currentType = simpleType.getRestrictedType();
+        } else {
+        	currentType = null;
+        }
+    }
+    return null;
+  }
+
+  private SimpleTypeSGChain newSimpleTypeSG(TypeSG pController, SGFactory pFactory,
+  		                                    SchemaSG pSchema, XSType pType) throws SAXException {
+    if (!pType.isSimple()) {
+      throw new IllegalStateException("Expected a simple type");
+    }
+
+    JAXBJavaType javaType = findJavaType(pSchema, pType);
+    SimpleTypeSGChain result;
+    if (javaType == null  ||  javaType.getName() == null) {
+        XSSimpleType simpleType = pType.getSimpleType();
+        JavaQName runtimeType;
+        if (simpleType.isAtomic()) {
+        	result = newGlobalAtomicTypeSG(pFactory, pSchema, pType);
+            if (result == null) {
+                if (!simpleType.isRestriction()) {
+                    throw new SAXParseException("Atomic type must be either a builtin or a restriction of another atomic type",
+                                                pType.getLocator());
+                }
+                TypeSG type = pSchema.getType(simpleType.getRestrictedType().getName());
+                runtimeType = type.getSimpleTypeSG().getRuntimeType();
+                result = newAtomicTypeRestriction(pController, pFactory, pSchema, pType);
+            } else {
+                SimpleTypeSG simpleTypeSG = new SimpleTypeSGImpl(result);
+                simpleTypeSG.init();
+            	runtimeType = simpleTypeSG.getRuntimeType();
+            }
+            if (javaType == null) {
+                JAXBJavaType[] globalJavaTypes = pSchema.getJAXBJavaTypes();
+                for (int i = 0;  i < globalJavaTypes.length;  i++) {
+                	if (runtimeType.equals(globalJavaTypes[i].getName())) {
+                        javaType = globalJavaTypes[i];
+                        break;
+                    }
+                }
+            }
+        } else if (simpleType.isList()) {
+        	result = new ListTypeSGImpl(pFactory, pSchema, pType, classContext, pController.getName());
+        } else if (simpleType.isUnion()) {
+            result = new UnionTypeSGImpl(pFactory, pSchema, pType, classContext, pController.getName());
+        } else {
+            throw new IllegalStateException("Simple type " + pType + " is neither of atomic, list, or union");
+        }
+    } else {
+        result = newSimpleTypeSGByJavaType(javaType, pFactory, pSchema, pType);
+    }
+
+    if (javaType != null  &&
+        (javaType.getParseMethod() != null  ||  javaType.getPrintMethod() != null)) {
+    	result = new ParsePrintSG(result, javaType);
+    }
+    return result;
+  }
+
+  public Object newSimpleTypeSG(TypeSG pController) throws SAXException {
+    final String mName = "newSimpleTypeSG";
+    log.finest(mName, "->");
+    SchemaSG schema = pController.getSchema();
+    SimpleTypeSGChain result = newSimpleTypeSG(pController, schema.getFactory(), schema, xsType);
+    log.finest(mName, "<-", result);
+    return result;
+  }
+
+  public Object getProperty(TypeSG pController, String pName) {
+    if (properties == null) {
+      return null;
+    }
+    return properties.get(pName);
+  }
+
+  public void setProperty(TypeSG pController, String pName, Object pValue) {
+    if (properties == null) {
+      properties = new HashMap();
+    }
+    properties.put(pName, pValue);
+  }
+
+  public XsSchemaHeader getSchemaHeader(TypeSG pController) {
+  	return schemaHeader;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSGFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSGFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSGFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBAppinfoImpl;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBXsObjectFactoryImpl;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JaxMeSGFactory extends JAXBSGFactory {
+  public class JaxMeAppinfoImpl extends JAXBAppinfoImpl {
+    JaxMeAppinfoImpl(XsObject pParent) {
+      super(pParent);
+    }
+
+    public ContentHandler getChildHandler(String pQName, String pNamespaceURI, String pLocalName) throws SAXException {
+      List myAnnotationClasses = getAnnotationClasses();
+      for (int i = 0;  i < myAnnotationClasses.size();  i +=3) {
+        if (((String) myAnnotationClasses.get(i)).equals(pNamespaceURI)  &&
+            ((String) myAnnotationClasses.get(i+1)).equals(pLocalName)) {
+          Class c = (Class) myAnnotationClasses.get(i+2);
+          Object o;
+          try {
+            Constructor con = c.getConstructor(new Class[]{JaxMeXsObjectFactory.class, Locator.class});
+            o = con.newInstance(new Object[]{this, getLocator()});
+          } catch (NoSuchMethodException e) {
+            throw new SAXException("Invalid appinfo class " + c.getClass().getName() +
+                                    ": Doesn't have a constructor taking the arguments " +
+                                    JaxMeXsObjectFactory.class.getName() + " and " +
+                                    Locator.class.getName());
+          } catch (InvocationTargetException e) {
+            Throwable t = e.getTargetException();
+            String msg = "Failed to create appinfo element of class " + c.getClass().getName() +
+                         ": " + t.getClass().getName() + ", " + t.getMessage();
+            if (t instanceof Exception) {
+              throw new SAXException(msg, (Exception) t);
+            } else {
+              throw new SAXException(msg, e);
+            }
+          } catch (Exception e) {
+            throw new SAXException("Failed to create appinfo element of class " + c.getClass().getName() +
+                                    ": " + e.getClass().getName());
+          }
+          return getObjectFactory().newXsSAXParser(o);
+        }
+      }
+      return super.getChildHandler(pQName, pNamespaceURI, pLocalName);
+    }
+  }
+
+  public class JaxMeXsObjectFactory extends JAXBXsObjectFactoryImpl {
+    public XsEAppinfo newXsEAppinfo(XsObject pParent) {
+      return new JaxMeAppinfoImpl(pParent);
+    }
+  }
+
+  public JaxMeSGFactory(Generator pGenerator) {
+    super(pGenerator);
+  }
+
+  private List annotationClasses = new ArrayList();
+  protected List getAnnotationClasses() {
+    return annotationClasses;
+  }
+
+  public void addAnnotationClass(String pNamespaceURI, String pLocalName, Class pClass) {
+    if (pNamespaceURI == null  ||  pNamespaceURI.length() == 0) {
+      throw new NullPointerException("A nonempty namespace URI must be given.");
+    }
+    if (pLocalName == null  ||  pLocalName.length() == 0) {
+      throw new NullPointerException("A nonempty local name must be given.");
+    }
+    if (pClass == null) {
+      throw new NullPointerException("An annotation class must be given.");
+    }
+    annotationClasses.add(pNamespaceURI);
+    annotationClasses.add(pLocalName);
+    annotationClasses.add(pClass);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSchemaReader.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSchemaReader.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JaxMeSchemaReader.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBAppinfoImpl;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBGlobalBindingsImpl;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBXsObjectFactoryImpl;
+import org.apache.ws.jaxme.xs.parser.XsObjectCreator;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JaxMeSchemaReader extends JAXBSchemaReader {
+    public static final String JAXME_SCHEMA_URI = "http://ws.apache.org/jaxme/namespaces/jaxme2";
+    public static final String XJC_SCHEMA_URI = "http://java.sun.com/xml/ns/jaxb/xjc";
+    private XjcSerializable xjcSerializable;
+    private List xsObjectCreators = new ArrayList();
+
+    public JaxMeSchemaReader() {
+        setSupportingExtensions(true);
+    }
+
+    protected void reset() {
+    	super.reset();
+        xjcSerializable = null;
+    }
+
+    private XsObjectCreator[] append(XsObjectCreator[] pBase) {
+        XsObjectCreator[] baseResult = pBase;
+        List myXsObjectCreators = getXsObjectCreators();
+        List result;
+        if (baseResult == null  ||  baseResult.length == 0) {
+            result = myXsObjectCreators;
+        } else {
+            result = new ArrayList(baseResult.length + myXsObjectCreators.size());
+            result.addAll(Arrays.asList(baseResult));
+            result.addAll(myXsObjectCreators);
+        }
+        return (XsObjectCreator[]) myXsObjectCreators.toArray(new XsObjectCreator[myXsObjectCreators.size()]);
+    }
+
+    public class JaxMeAppinfoImpl extends JAXBAppinfoImpl {
+        JaxMeAppinfoImpl(XsObject pParent) {
+            super(pParent);
+        }
+
+        protected XsObjectCreator[] getXsObjectCreators() {
+            return append(super.getXsObjectCreators());
+        }
+    }
+
+    public class JaxMeGlobalBindingsImpl extends JAXBGlobalBindingsImpl {
+        protected JaxMeGlobalBindingsImpl(XsObject pParent) {
+            super(pParent);
+        }
+
+        protected XsObjectCreator[] getXsObjectCreators() {
+            return append(super.getXsObjectCreators());
+        }
+
+
+        protected XsObject getBeanByParent(XsObject pParent, Locator pLocator, XsQName pQName)
+        		throws SAXException {
+            if (XJC_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
+                if ("serializable".equals(pQName.getLocalName())) {
+                    if (getXjcSerializable() != null) {
+                        throw new LocSAXException("The element xjc:serializable was already specified.", pLocator);
+                    }
+                    XjcSerializable s = new XjcSerializable(pParent);
+                    setXjcSerializable(s);
+                    return s;
+                }
+            }
+            return super.getBeanByParent(pParent, pLocator, pQName);
+        }
+    }
+
+    public class JaxMeXsObjectFactory extends JAXBXsObjectFactoryImpl {
+        public XsEAppinfo newXsEAppinfo(XsObject pParent) {
+            return new JaxMeAppinfoImpl(pParent);
+        }
+        public JAXBGlobalBindings newJAXBGlobalBindings(XsObject pParent) {
+            return new JaxMeGlobalBindingsImpl(pParent);
+        }
+    }
+
+    protected List getXsObjectCreators() {
+        return xsObjectCreators;
+    }
+
+    public void addXsObjectCreator(XsObjectCreator pCreator) {
+        if (pCreator == null) {
+            throw new NullPointerException("The object creator must not be null.");
+        }
+        xsObjectCreators.add(pCreator);
+    }
+
+    public SGFactoryChain newSGFactoryChain(Generator pGenerator) {
+        SGFactoryChain result = super.newSGFactoryChain(pGenerator);
+        result = new SGFactoryChainImpl(result){
+            public XsObjectFactory newXsObjectFactory(SGFactory pFactory) {
+                return new JaxMeXsObjectFactory();
+            }
+        };
+        
+        return result;
+    }
+
+    public XjcSerializable getXjcSerializable() {
+        return xjcSerializable;
+    }
+
+    public void setXjcSerializable(XjcSerializable pXjcSerializable) {
+        xjcSerializable = pXjcSerializable;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/LocalContext.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/LocalContext.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/LocalContext.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClassOwner;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class LocalContext extends AbstractContext {
+  /** <p>Creates a new instance of LocalClassContext.java.</p>
+   */
+  public LocalContext(Context pContext, String pName, XSObject pJAXBClassOwner,
+                       String pPrefix, String pSuffix, SchemaSG pSchemaSG) throws SAXException {
+    if (pJAXBClassOwner == null) {
+      throw new NullPointerException("The XSObject argument must not be null.");
+    }
+
+    JAXBClassOwner jaxbClassOwner = null;
+    if (pJAXBClassOwner instanceof JAXBClassOwner) {
+      jaxbClassOwner = (JAXBClassOwner) pJAXBClassOwner;
+    }
+
+    String className = null, implementationName = null;
+    JAXBClass jaxbClass = (jaxbClassOwner == null) ? null : jaxbClassOwner.getJAXBClass();
+    if (jaxbClass != null) {
+      className = jaxbClass.getName();
+      implementationName = jaxbClass.getImplClass();
+    }
+
+    if (className == null) {
+      String prefix = null, suffix = null;
+      className = getClassNameFromLocalName(pJAXBClassOwner.getLocator(), pName, pSchemaSG);
+      if (prefix == null) { prefix = pPrefix; }
+      if (prefix != null) className = prefix + className;
+      if (suffix == null) { suffix = pSuffix; }
+      if (suffix != null) className += suffix;
+    }
+    JavaQName xmlInterfaceName = JavaQNameImpl.getInnerInstance(pContext.getXMLInterfaceName(), className);
+    setXMLInterfaceName(xmlInterfaceName);
+
+    if (implementationName == null) {
+      setXMLImplementationName(JavaQNameImpl.getInnerInstance(pContext.getXMLImplementationName(),
+                                                              className + "Impl"));
+    } else {
+      setXMLImplementationName(JavaQNameImpl.getInstance(implementationName));
+    }
+    setXMLHandlerName(JavaQNameImpl.getInnerInstance(pContext.getXMLHandlerName(), className + "Handler"));
+    setXMLSerializerName(JavaQNameImpl.getInnerInstance(pContext.getXMLSerializerName(), className + "Driver"));
+    setXMLValidatorName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+                                                  xmlInterfaceName.getClassName() + "Validator"));
+    setPMName(JavaQNameImpl.getInstance(xmlInterfaceName.getPackageName() + ".impl",
+                                        xmlInterfaceName.getClassName() + "PM"));
+  }
+
+  public boolean isGlobal() { return false; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/MultiplePropertySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/MultiplePropertySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/MultiplePropertySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.xml.sax.SAXException;
+
+
+/** <Implementation of a an objectSG for elements with multiplicity > 1.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class MultiplePropertySG extends PropertySGChainImpl {
+	protected static final JavaQName OBJECT_TYPE = JavaQNameImpl.getInstance(Object.class);
+	private final int minOccurs, maxOccurs;
+	private final ObjectSG objectSG;
+	
+	/** <p>Creates a new instance of MultipleObjectSG.</p>
+	 */
+	protected MultiplePropertySG(PropertySGChain pBase, ObjectSG pObjectSG, int pMinOccurs, int pMaxOccurs) {
+		super(pBase);
+		objectSG = pObjectSG;
+		maxOccurs = pMaxOccurs;
+		minOccurs = pMinOccurs;
+	}
+	
+	protected int getMinOccurs() { return minOccurs; }
+	protected int getMaxOccurs() { return maxOccurs; }
+	protected ObjectSG getObjectSG() { return objectSG; }
+	protected JavaQName getInstanceClass() throws SAXException {
+		return getObjectSG().getTypeSG().getRuntimeType();
+	}
+	protected boolean isAutoBoxing() throws SAXException {
+		return getInstanceClass().isPrimitive();
+	}
+	protected JavaQName getObjectClass() throws SAXException {
+		JavaQName result = getInstanceClass().getObjectType();
+		if (result == null) {
+			result = getInstanceClass();
+		}
+		return result;
+	}
+	protected Object asObject(Object pObject) throws SAXException {
+		if (isAutoBoxing()) {
+			return new Object[]{"new ", getObjectClass(), "(", pObject, ")"};
+		} else {
+			return pObject;
+		}
+	}
+
+	public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
+		String fieldName = pController.getXMLFieldName();
+		JavaField result = pSource.newJavaField(fieldName, List.class, JavaSource.PRIVATE);
+		result.addLine("new ", ArrayList.class, "()");
+		return result;
+	}
+	
+	public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		return null;
+	}
+	
+	public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
+		String fieldName = pController.getXMLFieldName();
+		String methodName = pController.getXMLGetMethodName();
+		JavaMethod result = pSource.newJavaMethod(methodName, List.class, JavaSource.PUBLIC);
+		result.addLine("return ", fieldName, ";");
+		return result;
+	}
+	
+	public void forAllValues(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		LocalJavaField list = pMethod.newJavaField(List.class);
+		list.addLine(pController.getValue(pElement));
+		DirectAccessible i = pMethod.addForList(list);
+		TypeSG typeSG = objectSG.getTypeSG();
+		Object v;
+		boolean isCasting = !OBJECT_TYPE.equals(typeSG.getRuntimeType());
+		if (isCasting  &&  pSGlet instanceof SGlet.TypedSGlet) {
+			isCasting = ((SGlet.TypedSGlet) pSGlet).isCasting();
+		}
+		if (isCasting) {
+			v = new Object[]{"(", typeSG.getRuntimeType(), ")", list, ".get(", i, ")"};
+		} else {
+			v = new Object[]{list, ".get(", i, ")"};
+		}
+		if (typeSG.isComplex()) {
+			pSGlet.generate(pMethod, v);
+		} else {
+			typeSG.getSimpleTypeSG().forAllValues(pMethod, v, pSGlet);
+		}
+		pMethod.addEndFor();
+	}
+	
+	public void forAllNonNullValues(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException {
+		LocalJavaField list = pMethod.newJavaField(List.class);
+		list.addLine(pController.getValue(pElement));
+		DirectAccessible i = pMethod.addForList(list);
+		TypeSG typeSG = objectSG.getTypeSG();
+		boolean isCasting = !OBJECT_TYPE.equals(typeSG.getRuntimeType());
+		JavaQName qName = typeSG.getRuntimeType();
+		if (isCasting  &&  pSGlet instanceof SGlet.TypedSGlet) {
+			SGlet.TypedSGlet typedSGlet = (SGlet.TypedSGlet) pSGlet;
+			isCasting = typedSGlet.isCasting();
+			if (typedSGlet.getType() != null) {
+				qName = typedSGlet.getType();
+			}
+		}
+		Object v = new Object[]{list, ".get(", i, ")"};
+		if (isCasting) {
+			if (qName.isPrimitive()) {
+				v = new Object[]{"((", qName.getObjectType(), ")", v, ").", qName.getPrimitiveConversionMethod(), "()"};
+			} else {
+				v = new Object[]{"(", qName, ")", v};
+			}
+		}
+		if (typeSG.isComplex()) {
+			pSGlet.generate(pMethod, v);
+		} else {
+			typeSG.getSimpleTypeSG().forAllNonNullValues(pMethod, v, pSGlet);
+		}
+		pMethod.addEndFor();
+	}
+	
+	public void setValue(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, Object pValue, JavaQName pType) throws SAXException {
+		if (pType != null) {
+			pValue = new Object[]{"(", pType, ") ", pValue};
+		}
+		LocalJavaField list = pMethod.newJavaField(List.class);
+		list.addLine(pController.getValue(pElement));
+		pMethod.addLine(list, ".clear();");
+		pMethod.addLine(list, ".addAll(", pValue, ");");
+	}
+	
+	public void addValue(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, TypedValue pValue, JavaQName pType) throws SAXException {
+		pMethod.addLine(pController.getValue(pElement), ".add(", asObject(pValue), ");");
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ParsePrintSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ParsePrintSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ParsePrintSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,157 @@
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.impl.SimpleTypeSGChainImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/** Simple type chain for implementing
+ * <code>jaxb:javaType/@parseMethod</code> and/or
+ * <code>jaxb:javaType/@printMethod</code>.
+ */
+public class ParsePrintSG extends SimpleTypeSGChainImpl {
+	private final JAXBJavaType javaType;
+
+    /** Creates a new instance, which generates code
+     * for the given type.
+	 */
+    public ParsePrintSG(SimpleTypeSGChain pType, JAXBJavaType pJavaType) {
+		super(pType);
+        javaType = pJavaType;
+	}
+
+    private JavaQName getType(SimpleTypeSG pController) {
+        if (javaType.getName() == null) {
+        	return pController.getRuntimeType();
+        } else {
+            return JavaQNameImpl.getInstance(javaType.getName());
+        }
+    }
+
+    private void addCall(SimpleTypeSG pController, List pList, String pMethod,
+                         JavaQName pType) {
+        int offset = pMethod.indexOf('.');
+        JavaQName qName;
+        String method;
+        if (offset == -1) {
+            qName = getType(pController);
+            method = pMethod;
+        } else {
+            qName = JavaQNameImpl.getInstance(pMethod.substring(0, offset));
+            method = pMethod.substring(offset+1);
+        }
+        pList.add(qName);
+        pList.add(".");
+        pList.add(method);
+    }
+
+    private DirectAccessible getValue(JavaMethod pMethod, Object pValue, JavaQName pType) {
+        if (pValue instanceof DirectAccessible) {
+        	return (DirectAccessible) pValue;
+        } else {
+            LocalJavaField s = pMethod.newJavaField(pType);
+            s.addLine(pValue);
+            return s;
+        }
+    }
+
+    private void addValues(List pList, DirectAccessible pValue, Object pData) {
+    	pList.add("(");
+        pList.add(pValue);
+        if (javaType.hasNsContext()) {
+            pList.add(", ");
+            pList.add(pData);
+            pList.add(".getNamespaceSupport()");
+        }
+        pList.add(")");
+    }
+
+    private TypedValue getParseCall(SimpleTypeSG pController, JavaMethod pMethod,
+                                Object pValue, Object pData)
+            throws SAXParseException {
+        JavaQName type = getType(pController);
+        DirectAccessible value = getValue(pMethod, pValue, JavaQNameImpl.getInstance(String.class));
+
+        String parseMethod = javaType.getParseMethod().trim();
+        List list = new ArrayList();
+        if (parseMethod.startsWith("new")
+            &&  parseMethod.length() > 3
+            &&  Character.isWhitespace(parseMethod.charAt(3))) {
+        	JavaQName qName = JavaQNameImpl.getInstance(parseMethod.substring(3).trim());
+            list.add("new ");
+            list.add(qName);
+        } else {
+            addCall(pController, list, parseMethod, type);
+        }
+        addValues(list, value, pData);
+		return new TypedValueImpl(list, type);
+    }
+
+    private TypedValue getPrintCall(SimpleTypeSG pController, JavaMethod pMethod,
+                                Object pValue, Object pData) {
+    	JavaQName type = getType(pController);
+        LocalJavaField f = pMethod.newJavaField(String.class);
+        DirectAccessible value = getValue(pMethod, pValue, type);
+        List list = new ArrayList();
+        addCall(pController, list, javaType.getPrintMethod(), type);
+        addValues(list, value, pData);
+        pMethod.addTry();
+        pMethod.addLine(f, " = ", list, ";");
+        DirectAccessible e = pMethod.addCatch(Exception.class);
+        pMethod.addLine(pData, ".printConversionEvent(pObject, ", 
+                        JavaSource.getQuoted("Failed to convert value "),
+                        " + ", value, " + ", JavaSource.getQuoted(": "),
+                        " + ", e, ".getClass().getName(), ", e, ");");
+        pMethod.addLine(f, " = null;");
+        pMethod.addEndTry();
+        return f;
+    }
+
+    public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod,
+    		                            Object pValue, Object pData)
+            throws SAXException {
+    	if (javaType.getParseMethod() == null) {
+    		return super.getCastFromString(pController, pMethod, pValue, pData);
+        } else {
+        	return getParseCall(pController, pMethod, pValue, pData);
+        }
+    }
+
+    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+            throws SAXException {
+    	if (javaType.getParseMethod() == null) {
+    		return super.getCastFromString(pController, pValue);
+        } else {
+        	throw new SAXParseException("Use of the parse method at compile time is unsupported.",
+        			                    javaType.getLocator());
+        }
+    }
+
+    public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod,
+                                  Object pValue, DirectAccessible pData)
+            throws SAXException {
+        if (javaType.getPrintMethod() == null) {
+        	return super.getCastToString(pController, pMethod, pValue, pData);
+        } else {
+        	return getPrintCall(pController, pMethod, pValue, pData);
+        }
+    }
+
+	public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		return true;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SerializableSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SerializableSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SerializableSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.io.Serializable;
+
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SerializableSG {
+    private static final JavaQName SERIALIZABLE_TYPE = JavaQNameImpl.getInstance(Serializable.class);
+
+    /** Makes the class <code>pSource</code> implementing the
+     * {@link Serializable} interface.
+     */
+    public static void makeSerializable(SchemaSG pSchema, JavaSource pSource) {
+        SchemaReader sr = pSchema.getFactory().getGenerator().getSchemaReader();
+        if (sr instanceof JaxMeSchemaReader) {
+            JaxMeSchemaReader jsr = (JaxMeSchemaReader) sr;
+            XjcSerializable xjcSerializable = jsr.getXjcSerializable();
+            if (xjcSerializable != null) {
+                if (!pSource.isImplementing(SERIALIZABLE_TYPE)) {
+                    pSource.addImplements(SERIALIZABLE_TYPE);
+                }
+                if (xjcSerializable.getUid() != null) {
+                    JavaField uid = pSource.newJavaField("serialVersionUID", JavaQNameImpl.LONG, JavaSource.PRIVATE);
+                    uid.setStatic(true);
+                    uid.setFinal(true);
+                    uid.addLine(xjcSerializable.getUid());
+                }
+            }
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SimpleTypeRestrictionSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SimpleTypeRestrictionSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/SimpleTypeRestrictionSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SimpleTypeRestrictionSG extends SimpleTypeSGChainImpl {
+  private XSSimpleType simpleType;
+  private XSType xsType;
+  private Facet[] facets;
+  private final AtomicTypeSG atomicTypeSG;
+
+  /** <p>Creates a new instance of SimpleTypeRestrictionSG.</p>
+   */
+  public SimpleTypeRestrictionSG(SimpleTypeSGChain o, XSType pType, XSSimpleType pSimpleType) {
+    super(o);
+    simpleType = pSimpleType;
+    if (pSimpleType.isAtomic()) {
+      atomicTypeSG = new AtomicTypeSGImpl(pSimpleType.getAtomicType());
+    } else {
+      atomicTypeSG = null;
+    }
+  }
+
+  public void init(SimpleTypeSG pController) throws SAXException {
+    super.init(pController);
+    List myFacets = new ArrayList();
+
+    XSEnumeration[] enumerations = simpleType.getEnumerations();
+    if (enumerations.length > 0) {
+      Facet f = new FacetImpl(xsType, enumerations);
+      myFacets.add(f);
+    }
+
+    simpleType = null;  // Make this available for garbage collection
+    xsType = null;      // Make this available for garbage collection
+    facets = (Facet[]) myFacets.toArray(new Facet[myFacets.size()]);
+  }
+
+  public Facet[] getFacets(SimpleTypeSG pController) {
+    return facets;
+  }
+
+  public AtomicTypeSG getAtomicType(SimpleTypeSG pController) {
+    if (atomicTypeSG == null) {
+      return super.getAtomicType(pController);
+    } else {
+      return atomicTypeSG;
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/XjcSerializable.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/XjcSerializable.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/XjcSerializable.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.sg.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+
+
+/** <p>An instance of this class may be used to specify that the
+ * generated classes should be serializable. The instance will
+ * also customize the serialization.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XjcSerializable extends XsObjectImpl {
+    protected XjcSerializable(XsObject pParent) {
+        super(pParent);
+    }
+
+    private String uid;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String pUid) {
+        uid = pUid;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/AllHandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/AllHandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/AllHandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.ValidationEvent;
+
+import org.apache.ws.jaxme.ValidationEvents;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.xml.sax.SAXException;
+
+
+/** Creates an instance of
+ * {@link org.apache.ws.jaxme.impl.JMSAXElementParser},
+ * or {@link org.apache.ws.jaxme.impl.JMSAXGroupParser},
+ * which parses an "all" group.
+ */
+public class AllHandlerSG extends GroupHandlerSG {
+	private JavaField childNumField;
+
+	/** Creates a new instance, which generates a handler for
+	 * the complex type <code>pTypeSG</code> by adding methods
+	 * and fields to the Java class <code>pJs</code>.
+	 */
+	public AllHandlerSG(ComplexTypeSG pType, JavaSource pJs)
+			throws SAXException {
+		super(pType, pJs);
+	}
+
+	AllHandlerSG(GroupHandlerSG pOuterHandler, ComplexTypeSG pType,
+				 ParticleSG pParticle, JavaSource pJs)
+			throws SAXException {
+		super(pOuterHandler, pType, pParticle, pJs);
+	}
+
+	protected int getState(int pParticleNum) { return pParticleNum; }
+
+	private JavaField getChildNumField() {
+		if (childNumField == null) {
+			childNumField = getJavaSource().newJavaField("__childNum", int.class, JavaSource.PRIVATE);
+			JavaComment jc = childNumField.newComment();
+			jc.addLine("Index of the particle being currently parsed");
+		}
+		return childNumField;
+	}
+
+	protected DirectAccessible getEndElementState() throws SAXException {
+		return getChildNumField();
+	}
+
+	protected void acceptParticle(JavaMethod pJm, int pNum) throws SAXException {
+		pJm.addIf(getStateField(), "[" + pNum, "]");
+		ParticleSG particle = particles[pNum];
+		if (particle.isElement()) {
+			pJm.addLine("getHandler().validationEvent(", ValidationEvent.class, ".WARNING, ",
+						JavaSource.getQuoted("The element " + particle.getObjectSG().getName() +
+										     " has already been defined."),
+					    ", ", ValidationEvents.class, ".EVENT_ALL_GROUP_REUSE, null);");
+		} else if (particle.isGroup()) {
+			pJm.addLine("getHandler().validationEvent(", ValidationEvent.class, ".WARNING, ",
+						JavaSource.getQuoted("The group " + GroupUtil.getGroupName(particle.getGroupSG()) +
+											 " has already been defined."),
+					    ", ", ValidationEvents.class, ".EVENT_ALL_GROUP_REUSE, null);");
+		} else if (particle.isWildcard()) {
+			throw new IllegalStateException("TODO: Add support for wildcards.");
+		} else {
+			throw new IllegalStateException("Invalid particle type");
+		}
+		pJm.addEndIf();
+		pJm.addLine(getChildNumField(), " = " + pNum + ";");
+		pJm.addLine(getStateField(), "[" + pNum, "] = true;");
+	}
+
+	public JavaMethod newStartElementMethod() throws SAXException {
+		JavaMethod result = super.newStartElementMethod();
+		LocalJavaField unmarshallerHandler = result.newJavaField(JMUnmarshallerHandlerImpl.class);
+		unmarshallerHandler.addLine("getHandler()");
+		handleStartElementStates(unmarshallerHandler, result, 0, particles.length-1);
+		result.addLine("return false;");
+		return result;
+	}
+
+	public JavaMethod newIsFinishedMethod() throws SAXException {
+		JavaMethod result = super.newIsFinishedMethod();
+		List requiredParticles = new ArrayList();
+		for (int i = 0;  i < particles.length;  i++) {
+			if (isRequiredParticle(particles[i])) {
+				if (requiredParticles.size() > 0) {
+					requiredParticles.add(" && ");
+				}
+				requiredParticles.add(new Object[]{getStateField(),
+												   "[" + i + "]"});
+			}
+		}
+		if (requiredParticles.size() == 0) {
+			result.addLine("return true;");
+		} else {
+			result.addLine("return ", requiredParticles, ";");
+		}
+		return result;
+	}
+
+	protected JavaField newStateField() throws SAXException {
+		JavaField jf = getJavaSource().newJavaField("__state", boolean[].class, JavaSource.PRIVATE);
+		jf.addLine("new ", boolean.class, "[" + particles.length + "]");
+		JavaComment jc = jf.newComment();
+		jc.addLine("This array indicates the state of the group. For any");
+		jc.addLine("possible child, the corresponding boolean value is set,");
+		jc.addLine("if the child is parsed.");
+		jc.addLine("If the same child occurs again, and the childs boolean");
+		jc.addLine("value is true, then an exception is thrown.");
+		jc.addLine("These are the indices, to which the child elements are");
+		jc.addLine("mapped:");
+		for (int i = 0;  i < particles.length;  i++) {
+			ParticleSG particle = particles[i];
+			if (particle.isGroup()) {
+				GroupSG group = particle.getGroupSG();
+				if (group.isGlobal()) {
+					jc.addLine(" " + i + " = The nested group " + group.getName());
+				} else {
+					jc.addLine(" " + i + " = An anonymous nested group.");
+				}
+			} else if (particle.isElement()) {
+				jc.addLine(" " + i + " = The child element " + particle.getObjectSG().getName());
+			} else if (particle.isWildcard()) {
+				throw new IllegalStateException("TODO: Add support for wildcards.");
+			} else {
+				throw new IllegalStateException("Invalid particle type.");
+			}
+		}
+		return jf;
+	}
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/BeanGeneratingVisitor.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/BeanGeneratingVisitor.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/BeanGeneratingVisitor.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,186 @@
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.PropertySGChainImpl;
+import org.apache.ws.jaxme.generator.sg.impl.PropertySGImpl;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.xml.sax.SAXException;
+
+
+/** Implementation of a
+ * {@link org.apache.ws.jaxme.generator.sg.impl.ccsg.ParticleVisitor},
+ * which generates a bean class.
+ */
+public class BeanGeneratingVisitor extends ParticleVisitorImpl {
+	private final JavaSource js;
+	private JavaMethod mixedContentMethod;
+	private boolean isMixed;
+	private ComplexTypeSG ct;
+
+	/** Creates a new instance generating methods into the
+	 * given class.
+	 * @param pJs Bean class being generated.
+	 */
+	public BeanGeneratingVisitor(JavaSource pJs) {
+		js = pJs;
+	}
+
+	private JavaSource getJavaSource() {
+		return js;
+	}
+
+	private boolean isInheritedAttribute(AttributeSG pAttr, AttributeSG[] pInheritedAttributes) throws SAXException {
+		if (pInheritedAttributes != null) {
+			String p = pAttr.getPropertySG().getPropertyName();
+			for (int i = 0;  i < pInheritedAttributes.length;  i++) {
+				if (pInheritedAttributes[i].getPropertySG().getPropertyName().equals(p)) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	private void generateAttributes(ComplexTypeSG pType) throws SAXException {
+		JavaSource js = getJavaSource();
+		AttributeSG[] myAttributes = pType.getAttributes();
+		AttributeSG[] inheritedAttributes = null;
+		if (pType.getTypeSG().isExtension()) {
+			TypeSG tSG = pType.getTypeSG().getExtendedType();
+			if (tSG.isComplex()) {
+				inheritedAttributes = tSG.getComplexTypeSG().getAttributes();
+			}
+		}
+		for (int i = 0;  i < myAttributes.length;  i++) {
+			AttributeSG attr = myAttributes[i];
+			if (!isInheritedAttribute(attr, inheritedAttributes)) {
+				attr.getPropertySG().generate(js);
+			}
+		}
+	}
+
+	public void emptyType(ComplexTypeSG pType) throws SAXException {
+		generateAttributes(pType);
+	}
+
+	public void simpleContent(ComplexTypeSG pType) throws SAXException {
+		generateAttributes(pType);
+		pType.getSimpleContentSG().getPropertySG().generate(getJavaSource());
+	}
+
+	protected JavaMethod getGetMixedContentMethod() {
+		if (mixedContentMethod == null) {
+			JavaSource js = getJavaSource();
+			JavaMethod jm = js.newJavaMethod("getContent", List.class, JavaSource.PUBLIC);
+			if (!js.isInterface()) {
+				JavaField mixedContentList = getJavaSource().newJavaField("content", List.class, JavaSource.PRIVATE);
+				mixedContentList.setFinal(true);
+				mixedContentList.addLine("new ", ArrayList.class, "()");
+				jm.addLine("return ", mixedContentList, ";");
+			}
+		}
+		return mixedContentMethod;
+	}
+
+	public void startComplexContent(ComplexTypeSG pType) throws SAXException {
+		pType.getComplexContentSG().getElementParticles(); // Triggers the content verification
+		ct = pType;
+		generateAttributes(pType);
+		if (pType.getComplexContentSG().isMixed()) {
+			isMixed = true;
+			getGetMixedContentMethod();
+		}
+	}
+
+	private boolean isInheritedParticle(ParticleSG pParticle) throws SAXException {
+		String propertyName = pParticle.getPropertySG().getPropertyName();
+		if (ct.getTypeSG().isExtension()) {
+			TypeSG extType = ct.getTypeSG().getExtendedType();
+			if (extType.isComplex()  &&  !extType.getComplexTypeSG().hasSimpleContent()) {
+				ParticleSG[] inheritedParticles = extType.getComplexTypeSG().getComplexContentSG().getElementParticles();
+				for (int i = 0;  i < inheritedParticles.length;  i++) {
+					if (inheritedParticles[i].getPropertySG().getPropertyName().equals(propertyName)) {
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+	}
+
+	private void elementParticle(GroupSG pGroupSG, ParticleSG pParticle) throws SAXException {
+		if (isInheritedParticle(pParticle)) {
+			return;
+		}
+		final JavaSource pJs = this.js;
+		final PropertySG elementSG = pParticle.getPropertySG();
+		if (isMixed) {
+			if (!pParticle.getObjectSG().getTypeSG().isComplex()) {
+				JavaQName qName = GroupUtil.getContentClass(pGroupSG, pParticle, pJs.getQName());
+				JavaSource js;
+				if (qName.isInnerClass()) {
+					js = pJs.newJavaInnerClass(qName.getInnerClassName(), JavaSource.PUBLIC);
+					if (!pJs.isInterface()) {
+						js.setStatic(true);
+					}
+				} else {
+					js = pJs.getFactory().newJavaSource(qName, JavaSource.PUBLIC);
+				}
+				if (pJs.isInterface()) {
+					js.setType(JavaSource.INTERFACE);
+				} else {
+					js.addImplements(GroupUtil.getContentClass(pGroupSG, pParticle, ct.getClassContext().getXMLInterfaceName()));
+				}
+				PropertySGChain chain = ((PropertySGImpl) elementSG).getHeadOfChain();
+				PropertySGChain head = new PropertySGChainImpl(chain){
+					public String getXMLFieldName(PropertySG pController) throws SAXException {
+						return "_value";
+					}
+					public String getPropertyName(PropertySG pController) throws SAXException {
+						return "value";
+					}
+				};
+				PropertySGImpl pSG = new PropertySGImpl(head);
+				pSG.generate(js);
+			}
+		} else {
+			elementSG.generate(pJs);
+		}
+
+		ObjectSG oSG = pParticle.getObjectSG();
+		TypeSG typeSG = oSG.getTypeSG();
+		if (!typeSG.isGlobalType()  &&  !typeSG.isGlobalClass()  &&  typeSG.isComplex()) {
+			ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();
+			if (pJs.isInterface()) {
+				complexTypeSG.getXMLInterface(pJs);
+			} else {
+				complexTypeSG.getXMLImplementation(pJs);
+			}
+        }
+	}
+
+	public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+		elementParticle(pGroup, pParticle);
+	}
+
+	public void complexElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+		elementParticle(pGroup, pParticle);
+	}
+
+	public void wildcardParticle(ParticleSG particle) {
+		throw new IllegalStateException("TODO: Add support for wildcards");
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ChoiceHandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ChoiceHandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ChoiceHandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import javax.xml.bind.ValidationEvent;
+
+import org.apache.ws.jaxme.ValidationEvents;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.xml.sax.SAXException;
+
+
+/** Creates an instance of
+ * {@link org.apache.ws.jaxme.impl.JMSAXElementParser},
+ * or {@link org.apache.ws.jaxme.impl.JMSAXGroupParser},
+ * which parses a choice group.
+ */
+public class ChoiceHandlerSG extends GroupHandlerSG {
+	private JavaField childNumField;
+
+	/** Creates a new instance, which generates a handler for
+	 * the complex type <code>pTypeSG</code> by adding methods
+	 * and fields to the Java class <code>pJs</code>.
+	 */
+	public ChoiceHandlerSG(ComplexTypeSG pType, JavaSource pJs)
+			throws SAXException {
+		super(pType, pJs);
+	}
+
+	ChoiceHandlerSG(GroupHandlerSG pOuterHandler, ComplexTypeSG pType,
+					ParticleSG pParticle, JavaSource pJs)
+			throws SAXException {
+		super(pOuterHandler, pType, pParticle, pJs);
+	}
+
+	protected int getState(int pParticleNum) { return pParticleNum; }
+
+	protected void acceptParticle(JavaMethod pJm, int pNum) throws SAXException {
+		pJm.addIf(getStateField());
+		ParticleSG particle = particles[pNum];
+		pJm.addIf(getChildNumField(), " != " + pNum);
+		pJm.addLine("getHandler().validationEvent(", ValidationEvent.class, ".WARNING, ",
+					JavaSource.getQuoted("Multiple different particles present in a choive group."),
+					", ", ValidationEvents.class, ".EVENT_CHOICE_GROUP_REUSE, null);");
+		if (!particles[pNum].isMultiple()) {
+			pJm.addElse();
+			if (particle.isElement()) {
+				pJm.addLine("getHandler().validationEvent(", ValidationEvent.class, ".WARNING, ",
+							JavaSource.getQuoted("The element " + particle.getObjectSG().getName() +
+											     " has already been defined."),
+							", ", ValidationEvents.class, ".EVENT_CHOICE_GROUP_REUSE, null);");
+			} else if (particle.isGroup()) {
+				pJm.addLine("getHandler().validationEvent(", ValidationEvent.class, ".WARNING, ",
+							JavaSource.getQuoted("The group " + GroupUtil.getGroupName(particle.getGroupSG()) +
+												 " has already been defined."),
+						    ", ", ValidationEvents.class, ".EVENT_CHOICE_GROUP_REUSE, null);");
+			} else if (particle.isWildcard()) {
+				throw new IllegalStateException("TODO: Add support for wildcards.");
+			} else {
+				throw new IllegalStateException("Invalid particle type");
+			}
+		}
+		pJm.addEndIf();
+		pJm.addEndIf();
+		pJm.addLine(getStateField(), " = true;");
+		pJm.addLine(getChildNumField(), " = " + pNum + ";");
+	}
+
+	public JavaMethod newStartElementMethod() throws SAXException {
+		JavaMethod result = super.newStartElementMethod();
+		LocalJavaField unmarshallerHandler = result.newJavaField(JMUnmarshallerHandlerImpl.class);
+		unmarshallerHandler.addLine("getHandler()");
+		handleStartElementStates(unmarshallerHandler, result, 0, particles.length-1);
+		result.addLine("return false;");
+		return result;
+	}
+
+	private JavaField getChildNumField() {
+		if (childNumField == null) {
+			childNumField = getJavaSource().newJavaField("__childNum", int.class, JavaSource.PRIVATE);
+			JavaComment jc = childNumField.newComment();
+			jc.addLine("Index of the particle being currently parsed");
+		}
+		return childNumField;
+	}
+
+	protected DirectAccessible getEndElementState() throws SAXException {
+		return getChildNumField();
+	}
+
+	public JavaMethod newIsFinishedMethod() throws SAXException {
+		JavaMethod result = super.newIsFinishedMethod();
+		Object o = isRequiredParticle(particle) ? (Object) getStateField() : "true";
+		result.addLine("return ", o, ";");
+		return result;
+	}
+
+	protected JavaField newStateField() throws SAXException {
+		JavaField jf = getJavaSource().newJavaField("__state", boolean.class, JavaSource.PRIVATE);
+		JavaComment jc = jf.newComment();
+		jc.addLine("Will be set to true, if the first child is parsed.");
+		jc.addLine("It is an error, if another child is parsed, and the");
+		jc.addLine("fields value is true.");
+		return jf;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/DriverGeneratingVisitor.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/DriverGeneratingVisitor.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/DriverGeneratingVisitor.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,196 @@
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.WildcardAttribute;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.impl.JMSAXDriverController;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/** Implementation of
+ * {@link org.apache.ws.jaxme.generator.sg.impl.ccsg.ParticleVisitor}
+ * for generating the driver class.
+ */
+public class DriverGeneratingVisitor extends ParticleVisitorImpl {
+	private final JavaSource js;
+
+	/** Creates a new instance, which writes methods into the
+	 * given class.
+	 */
+	public DriverGeneratingVisitor(JavaSource pJs) {
+		js = pJs;
+	}
+
+	/** This method builds a list of the names, which are being
+	 * used in the element. The list is used for generating the
+	 * method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXDriver#getPreferredPrefix(String)}.
+	 * @throws SAXException 
+	 */
+	protected List getNames(ComplexTypeSG pType) throws SAXException {
+		final List names = new ArrayList();
+		ParticleVisitor visitor = new ParticleVisitorImpl(){
+			private void addAttributes(ComplexTypeSG pType) {
+				AttributeSG[] myAttributes = pType.getAttributes();
+				for (int i = 0;  i < myAttributes.length;  i++) {
+					XsQName qName = myAttributes[i].getName();
+					if (qName != null) {
+						names.add(qName);
+					}
+				}
+			}
+			public void emptyType(ComplexTypeSG pType) {
+				addAttributes(pType);
+			}
+			public void simpleContent(ComplexTypeSG pType) {
+				addAttributes(pType);
+			}
+			public void startComplexContent(ComplexTypeSG pType) {
+				addAttributes(pType);
+			}
+			public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+				names.add(pParticle.getObjectSG().getName());
+			}
+			public void complexElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+				names.add(pParticle.getObjectSG().getName());
+			}
+		};
+		new ParticleWalker(visitor).walk(pType);
+		return names;
+	}
+
+	private JavaMethod newGetPreferredPrefixMethod(ComplexTypeSG pType) throws SAXException {
+		List names = getNames(pType);
+		Map uris = new HashMap();
+		for (Iterator iter = names.iterator();  iter.hasNext();  ) {
+			XsQName qName = (XsQName) iter.next();
+			String prefix = qName.getPrefix();
+			if (prefix != null) {
+				String uri = qName.getNamespaceURI();
+				if (uri == null) uri = "";
+				if (!uris.containsKey(uri)) {
+					uris.put(uri, prefix);
+				}
+			}
+		}
+
+		JavaMethod jm = js.newJavaMethod("getPreferredPrefix", String.class, JavaSource.PUBLIC);
+		DirectAccessible pURI = jm.addParam(String.class, "pURI");
+		if (!uris.isEmpty()) {
+			jm.addIf(pURI, " == null");
+			jm.addLine(pURI, " = \"\";");
+			jm.addEndIf();
+			boolean first = true;
+			for (Iterator iter = uris.entrySet().iterator();  iter.hasNext();  ) {
+				Map.Entry entry = (Map.Entry) iter.next();
+				String uri = (String) entry.getKey();
+				String prefix = (String) entry.getValue();
+				jm.addIf(first, pURI, ".equals(", JavaSource.getQuoted(uri), ")");
+				jm.addLine("return ", JavaSource.getQuoted(prefix), ";");      
+				first = false;
+			}
+			jm.addEndIf();
+		}
+		jm.addLine("return null;");
+		return jm;
+	}
+
+	private JavaMethod newGetAttributesMethod(ComplexTypeSG pType) throws SAXException {
+		JavaMethod jm = js.newJavaMethod("getAttributes", AttributesImpl.class, JavaSource.PUBLIC);
+		final DirectAccessible pController = jm.addParam(JMSAXDriverController.class, "pController");
+		DirectAccessible pObject = jm.addParam(Object.class, "pObject");
+		jm.addThrows(SAXException.class);
+		final LocalJavaField result = jm.newJavaField(AttributesImpl.class);
+		result.addLine("new ", AttributesImpl.class, "()");
+		AttributeSG[] myAttributes = pType.getAttributes();
+		if (myAttributes.length > 0) {
+			JavaQName elementInterface = pType.getClassContext().getXMLInterfaceName();
+			LocalJavaField element = jm.newJavaField(elementInterface);
+			element.addLine("(", elementInterface, ") ", pObject);
+			
+			for (int i = 0;  i < myAttributes.length;  i++) {
+				final AttributeSG attribute = myAttributes[i];
+				if (attribute.isWildcard()) {
+				    LocalJavaField anyAttributes = jm.newJavaField(WildcardAttribute[].class);
+				    anyAttributes.addLine(element, ".", attribute.getPropertySG().getXMLGetMethodName() + "Array", "()");
+				    DirectAccessible index = jm.addForArray(anyAttributes);
+				    LocalJavaField wildcardAttribute = jm.newJavaField(WildcardAttribute.class);
+				    wildcardAttribute.addLine(anyAttributes, "[", index, "]");
+					LocalJavaField qName = jm.newJavaField(QName.class);
+					qName.addLine(wildcardAttribute, ".getName()");
+					LocalJavaField uri = jm.newJavaField(String.class);
+					uri.addLine(qName, ".getNamespaceURI()");
+					LocalJavaField localPart = jm.newJavaField(String.class);
+					localPart.addLine(qName, ".getLocalPart()");
+					jm.addLine(result, ".addAttribute(", uri, ", ", localPart,
+							   ", ", pController, ".getAttrQName(this, ", uri, ", ", localPart,
+	                           "), \"CDATA\", ", wildcardAttribute, ".getValue());");
+					jm.addEndFor();
+				} else {
+					SGlet sgLet = new SGlet(){
+						public void generate(JavaMethod pMethod, Object pValue) throws SAXException {
+							String uri = JavaSource.getQuoted(attribute.getName().getNamespaceURI());
+							String localName = JavaSource.getQuoted(attribute.getName().getLocalName());
+							pMethod.addLine(result, ".addAttribute(", uri, ", ", localName,
+											", ", pController, ".getAttrQName(this, ", uri, ", ", localName, "), \"CDATA\", ",
+											attribute.getTypeSG().getSimpleTypeSG().getCastToString(pMethod, pValue, pController), ");");
+						}
+					};
+					attribute.forAllNonNullValues(jm, element, sgLet);
+				}
+			}
+		}
+		jm.addLine("return ", result, ";");
+		return jm;
+	}
+
+	private JavaMethod newMarshalChildsMethod(ComplexTypeSG pType) throws SAXException {
+		MarshalChildsMethodGeneratingVisitor visitor = new MarshalChildsMethodGeneratingVisitor(js);
+		new ParticleWalker(visitor).walk(pType);
+		return visitor.getMethod();
+	}
+
+	private void generate(ComplexTypeSG pType) throws SAXException {
+		newGetAttributesMethod(pType);
+		newGetPreferredPrefixMethod(pType);
+		newMarshalChildsMethod(pType);
+	}
+
+	public void emptyType(ComplexTypeSG pType) throws SAXException {
+		generate(pType);
+	}
+
+	public void simpleContent(ComplexTypeSG pType) throws SAXException {
+		generate(pType);
+	}
+
+	public void startComplexContent(ComplexTypeSG pType) throws SAXException {
+		generate(pType);
+	}
+
+	public void complexElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+		TypeSG tSG = pParticle.getObjectSG().getTypeSG();
+		if (tSG.isComplex()  &&  !tSG.isGlobalClass()) {
+			tSG.getComplexTypeSG().getXMLSerializer(js);
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/EmptyElementHandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/EmptyElementHandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/EmptyElementHandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.xml.sax.SAXException;
+
+
+/** Creates an instance of
+ * {@link org.apache.ws.jaxme.impl.JMSAXElementParser},
+ * which parses an empty element, aka empty group.
+ */
+public class EmptyElementHandlerSG extends HandlerSGImpl {
+	/** Creates a new instance, which generates a handler
+	 * for the given complex type.
+	 */
+	public EmptyElementHandlerSG(ComplexTypeSG pType, JavaSource pJs) {
+		super(pType, pJs);
+	}
+
+	public JavaMethod newStartElementMethod() throws SAXException {
+		JavaMethod result = super.newStartElementMethod();
+		result.addLine("return false;");
+		return result;
+	}
+
+	public JavaMethod newIsFinishedMethod() throws SAXException {
+		JavaMethod jm = super.newIsFinishedMethod();
+		jm.addLine("return true;");
+		return jm;
+	}
+
+	public JavaMethod newIsEmptyMethod() throws SAXException {
+		JavaMethod jm = super.newIsEmptyMethod();
+		jm.addLine("return ", ctSG.hasSimpleContent() ? "false" : "true", ";");
+		return jm;
+	}
+	
+	public JavaMethod newIsAtomicMethod() throws SAXException {
+		JavaMethod jm = super.newIsAtomicMethod();
+		jm.addLine("return ", ctSG.hasSimpleContent() ? "true" : "false", ";");
+		return jm;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupHandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupHandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupHandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,443 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.PropertySGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.PropertySGChainImpl;
+import org.apache.ws.jaxme.generator.sg.impl.PropertySGImpl;
+import org.apache.ws.jaxme.impl.JMSAXElementParser;
+import org.apache.ws.jaxme.impl.JMSAXGroupParser;
+import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+
+/** An instance of <code>GroupHandlerSG</code> is
+ * responsible for creating an instance of
+ * {@link org.apache.ws.jaxme.impl.JMSAXGroupParser},
+ * or {@link org.apache.ws.jaxme.impl.JMSAXElementParser}.<br>
+ * The {@link org.apache.ws.jaxme.generator.sg.ComplexContentSG}
+ * creates a <code>GroupHandlerSG</code> for any group,
+ * contained in the element.
+ */
+public abstract class GroupHandlerSG extends HandlerSGImpl {
+	protected final ComplexContentSG ccSG;
+	protected final ParticleSG particle;
+	protected final GroupSG group;
+	protected final ParticleSG[] particles;
+	private final Map groups = new HashMap();
+	private JavaField stateField;
+	private final boolean isMixed;
+	protected final GroupHandlerSG outerHandler;
+
+	/** Creates a new instance, which generates a handler for
+	 * the complex type <code>pTypeSG</code> by adding methods
+	 * and fields to the Java class <code>pJs</code>.
+	 */
+	protected GroupHandlerSG(ComplexTypeSG pType, JavaSource pJs) throws SAXException {
+		super(pType, pJs);
+		outerHandler = this;
+		ccSG = pType.getComplexContentSG();
+		particle = ccSG.getRootParticle();
+		group = particle.getGroupSG();
+		particles = group.getParticles();
+		isMixed = ccSG.isMixed();
+		findGroups(particles);
+	}
+
+	/** Creates a new instance, which generates a handler for
+	 * the group <code>pGroupSG</code> by adding methods and
+	 * fields to the Java class <code>pJs</code>.
+	 */
+	protected GroupHandlerSG(GroupHandlerSG pOuterHandler, ComplexTypeSG pType,
+							 ParticleSG pParticle, JavaSource pJs) throws SAXException {
+		super(pType, pJs);
+		outerHandler = pOuterHandler;
+		if (!pJs.isInnerClass()) {
+			throw new IllegalStateException("Expected inner class");
+		}
+		ccSG = null;
+		particle = pParticle;
+		group = particle.getGroupSG();
+		particles = group.getParticles();
+		isMixed = pType.getComplexContentSG().isMixed();
+		findGroups(particles);
+	}
+
+	protected abstract JavaField newStateField() throws SAXException;
+
+	protected JavaField getStateField() throws SAXException {
+		if (stateField == null) {
+			stateField = newStateField();
+		}
+		return stateField;
+	}
+
+	protected GroupHandlerSG getGroupHandlerSG(GroupSG pGroup) {
+		return (GroupHandlerSG) groups.get(pGroup);
+	}
+
+	private GroupHandlerSG newGroupHandlerSG(ParticleSG pParticle, String pName) throws SAXException {
+		JavaSource js = getJavaSource();
+		JavaInnerClass jic = js.newJavaInnerClass(pName, JavaSource.PUBLIC);
+		jic.addExtends(JMSAXGroupParser.class);
+		GroupSG group = pParticle.getGroupSG();
+		if (group.isSequence()) {
+			return new SequenceHandlerSG(outerHandler, ctSG, pParticle, jic);
+		} else if (group.isChoice()) {
+			return new ChoiceHandlerSG(outerHandler, ctSG, pParticle, jic);
+		} else if (group.isAll()) {
+			return new AllHandlerSG(outerHandler, ctSG, pParticle, jic);
+		} else {
+			throw new IllegalStateException("Invalid group type");
+		}
+	}
+
+	private GroupHandlerSG newGroupHandlerSG(ParticleSG pParticle) throws SAXException {
+		JavaSource js = getJavaSource();
+		String name = GroupUtil.getGroupName(pParticle.getGroupSG());
+		for (int i = 0;  ;  i++) {
+			String n = name;
+			if (i > 0) {
+				name += i;
+			}
+			n += "Handler";
+			if (js.getInnerClass(n) == null) {
+				GroupHandlerSG result = newGroupHandlerSG(pParticle, n);
+				result.newGetHandlerMethod(js);
+				return result;
+			}
+		}
+	}
+
+	public JavaMethod newAddAttributeMethod() throws SAXException {
+		if (ccSG == null) {
+			return null;
+		} else {
+			return super.newAddAttributeMethod();
+		}
+	}
+
+	private void findGroups(ParticleSG[] pParticles) throws SAXException {
+		for (int i = 0;  i < pParticles.length;  i++) {
+			ParticleSG particle = pParticles[i];
+			if (particle.isGroup()) {
+				GroupSG group = particle.getGroupSG();
+				if (!groups.containsKey(group)) {
+					GroupHandlerSG handler = newGroupHandlerSG(particle);
+					groups.put(group, handler);
+				}
+			} else if (particle.isElement()) {
+				TypeSG tSG = particle.getObjectSG().getTypeSG();
+				if (tSG.isComplex()  &&  !tSG.isGlobalClass()) {
+					tSG.getComplexTypeSG().getXMLHandler(outerHandler.getJavaSource());
+				}
+			}
+		}
+	}
+
+	protected boolean isRequiredParticle(ParticleSG particleSG) throws SAXException {
+		if (particleSG.getMinOccurs() == 0) {
+			return false;
+		} else {
+			if (particleSG.isGroup()) {
+				GroupSG group = particleSG.getGroupSG();
+				ParticleSG[] particles = group.getParticles();
+				if (group.isChoice()) {
+					for (int i = 0;  i < particles.length;  i++) {
+						if (!isRequiredParticle(particles[i])) {
+							return false;
+						}
+					}
+					return true;
+				} else {
+					for (int i = 0;  i < particles.length;  i++) {
+						if (isRequiredParticle(particles[i])) {
+							return true;
+						}
+					}
+					return false;
+				}
+			} else {
+				return true;
+			}
+		}
+	}
+
+	protected void handleStartOfChildElement(Object pUnmarshallerHandler,
+											 JavaMethod pJm, ParticleSG pParticle) {
+		ObjectSG oSG = pParticle.getObjectSG();
+		TypeSG tSG = oSG.getTypeSG();
+		if (tSG.isComplex()) {
+			JavaQName elementInterfaceClass = pParticle.getObjectSG().getClassContext().getXMLInterfaceName();
+			Object[] o, h;
+			if (oSG.getClassContext().isGlobal()) {
+				LocalJavaField manager = pJm.newJavaField(JMManager.class);
+				manager.addLine("getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(",
+						elementInterfaceClass, ".class)");
+				o = new Object[]{manager, ".getElementS();"};
+				h = new Object[]{manager, ".getHandler();"};
+			} else {
+				Context context = oSG.getClassContext();
+				o = new Object[]{" new ", context.getXMLImplementationName(), "()"};
+				h = new Object[]{" new ", context.getXMLHandlerName(), "()"};
+			}
+			LocalJavaField oField = pJm.newJavaField(Object.class);
+			oField.addLine(o);
+			LocalJavaField hField = pJm.newJavaField(JMSAXElementParser.class);
+			hField.addLine(h);
+			XsQName name = oSG.getName();
+			pJm.addLine(hField, ".init(", pUnmarshallerHandler, ", ", oField, ", ",
+					JavaSource.getQuoted(name.getNamespaceURI()), ", ",
+					JavaSource.getQuoted(name.getLocalName()),
+			", ", pUnmarshallerHandler, ".getLevel());");
+			pJm.addLine(hField, ".setAttributes(", getParamAttrs(), ");");
+			pJm.addLine(pUnmarshallerHandler, ".addElementParser(", hField, ");");
+		} else {
+			pJm.addLine(pUnmarshallerHandler, ".addSimpleAtomicState();");
+		}
+	}
+
+	protected abstract void acceptParticle(JavaMethod pJm, int pNum) throws SAXException;
+
+	protected void handleStartElementStates(Object pUnmarshallerHandler,
+											JavaMethod pJm, int pFrom,
+											int pTo) throws SAXException {
+		if (pFrom < 0  ||  pFrom >= particles.length  ||
+		    pTo < 0  ||  pTo >= particles.length  ||  pTo < pFrom) {
+			return;
+		}
+		for (int i = pFrom;  i <= pTo;  i++) {
+			ParticleSG particle = particles[i];
+			if (particle.isElement()) {
+				ObjectSG oSG = particle.getObjectSG();
+				XsQName name = oSG.getName();
+				Object uriCondition;
+				if ("".equals(name.getNamespaceURI())) {
+					uriCondition = new Object[]{"(", getParamNamespaceURI(),
+							" == null  ||  ",
+							getParamNamespaceURI(),
+					".length() == 0)"};
+				} else {
+					uriCondition = new Object[]{JavaSource.getQuoted(name.getNamespaceURI()),
+							".equals(", getParamNamespaceURI(), ")"};
+				}
+				pJm.addIf(i == pFrom, uriCondition, "  &&  ",
+						  JavaSource.getQuoted(name.getLocalName()),
+						  ".equals(", getParamLocalName(), ")");
+				acceptParticle(pJm, i);
+				handleStartOfChildElement(pUnmarshallerHandler, pJm, particle);
+				pJm.addLine("return true;");
+			} else if (particle.isGroup()) {
+				GroupSG gSG = particle.getGroupSG();
+				GroupHandlerSG handlerSG = getGroupHandlerSG(gSG);
+				pJm.addIf(i == pFrom,
+						  pUnmarshallerHandler, ".testGroupParser(new ",
+						  handlerSG.getJavaSource().getQName(), "(), ",
+						  getParamNamespaceURI(), ", ", getParamLocalName(),
+						  ", ", getParamQName(), ", ", getParamAttrs(), ")");
+				acceptParticle(pJm, i);
+				pJm.addLine("return true;");
+			} else if (particle.isWildcard()) {
+				throw new IllegalStateException("TODO: Add support for wildcards");
+			} else {
+				throw new IllegalStateException("Invalid particle type");
+			}
+		}
+		pJm.addEndIf();
+	}
+
+	protected abstract int getState(int pParticleNum);
+	protected abstract DirectAccessible getEndElementState() throws SAXException;
+
+	public JavaMethod newEndElementMethod() throws SAXException {
+		JavaMethod result = super.newEndElementMethod();
+		JavaQName elementInterface = ctSG.getClassContext().getXMLInterfaceName();
+		LocalJavaField element = result.newJavaField(elementInterface);
+		element.addLine("(", elementInterface, ") result");
+		result.addSwitch(getEndElementState());
+		for (int i = 0;  i < particles.length;  i++) {
+			result.addCase(new Integer(getState(i)));
+			ParticleSG particle = particles[i];
+			handleEndElementState(result, element, particle);
+		}
+		result.addDefault();
+		result.addThrowNew(IllegalStateException.class,
+						   JavaSource.getQuoted("Illegal state: "), " + ",
+						   getEndElementState());
+		result.addEndSwitch();
+		return result;
+	}
+
+	private void handleEndElementState(JavaMethod pJm, LocalJavaField pElement,
+									   ParticleSG pParticle) throws SAXException {
+		if (pParticle.isElement()) {
+			ObjectSG oSG = pParticle.getObjectSG();
+			TypeSG childType = oSG.getTypeSG();
+			XsQName name = oSG.getName();
+			Object[] uriCondition;
+			if ("".equals(name.getNamespaceURI())) {
+				uriCondition = new Object[]{
+					getParamNamespaceURI(), " == null  ||  ",
+					getParamNamespaceURI(), ".length() == 0"
+				};
+			} else {
+				uriCondition = new Object[]{
+					JavaSource.getQuoted(name.getNamespaceURI()), ".equals(",
+					getParamNamespaceURI(), ")"
+				};
+			}
+			pJm.addIf(uriCondition, "  &&  ", JavaSource.getQuoted(name.getLocalName()),
+					".equals(", getParamLocalName(), ")");
+			JavaQName type;
+			TypedValue v = getParamResult();
+			if (childType.isComplex()) {
+				type = childType.getComplexTypeSG().getClassContext().getXMLInterfaceName();
+				if (isMixed) {
+					pJm.addLine(pElement, ".getContent().add(", v, ");");
+				} else {
+					pParticle.getPropertySG().addValue(pJm, pElement, v, type);
+				}
+			} else {
+				PropertySG pSG;
+				DirectAccessible element;
+				if (isMixed) {
+					LocalJavaField f = pJm.newJavaField(GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLInterfaceName()));
+					f.addLine("new ", GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLImplementationName()), "()");
+					PropertySGChain chain = ((PropertySGImpl) pParticle.getPropertySG()).getHeadOfChain();
+					PropertySGChain head = new PropertySGChainImpl(chain){
+						public String getXMLFieldName(PropertySG pController) throws SAXException {
+							return "_value";
+						}
+						public String getPropertyName(PropertySG pController) throws SAXException {
+							return "value";
+						}
+					};
+					pSG = new PropertySGImpl(head);
+					element = f;
+				} else {
+					pSG = pParticle.getPropertySG();
+					element = pElement;
+				}
+				createSimpleTypeConversion(pJm, childType, v,
+										   oSG.getName().toString(),
+										   pSG, element);
+				if (isMixed) {
+					pJm.addLine(pElement, ".getContent().add(", element, ");");
+				}
+			}
+			pJm.addLine("return;");
+			pJm.addEndIf();
+			pJm.addBreak();
+		} else if (pParticle.isGroup()) {
+			pJm.addThrowNew(IllegalStateException.class,
+							JavaSource.getQuoted("This case should be handled by a nested group parser."));
+		} else if (pParticle.isWildcard()) {
+			throw new IllegalStateException("TODO: Add support for wildcards.");
+		} else {
+			throw new IllegalStateException("Invalid particle type");
+		}
+	}
+
+	public JavaMethod newIsAtomicMethod() throws SAXException {
+		return null;
+	}
+
+	public JavaMethod newIsEmptyMethod() throws SAXException {
+		return null;
+	}
+
+	protected JavaMethod newIsMixedMethod() throws SAXException {
+		if (!isMixed) {
+			return null;
+		}
+		JavaMethod jm = getJavaSource().newJavaMethod("isMixed", boolean.class, JavaSource.PUBLIC);
+		jm.addLine("return true;");
+		return jm;
+	}
+
+	protected JavaMethod newAddTextMethod() throws SAXException {
+		if (!isMixed) {
+			return null;
+		}
+		JavaMethod jm = getJavaSource().newJavaMethod("addText", void.class, JavaSource.PUBLIC);
+		Parameter buffer = jm.addParam(char[].class, "pBuffer");
+		Parameter offset = jm.addParam(int.class, "pOffset");
+		Parameter length = jm.addParam(int.class, "pLength");
+		if (ccSG == null) {
+			jm.addLine(outerHandler.getJavaSource().getQName(), ".this.addText(",
+					   buffer, ", ", offset, ", ", length, ");");
+		} else {
+			JavaQName elementInterface = ctSG.getClassContext().getXMLInterfaceName();
+			LocalJavaField element = jm.newJavaField(elementInterface);
+			element.addLine("(", elementInterface, ") result");
+			Object s = new Object[]{"new ", String.class, "(", buffer, ", ",
+									offset, ", ", length, ")"};
+			LocalJavaField list = jm.newJavaField(List.class);
+			list.addLine(element, ".getContent()");
+			jm.addIf(list, ".size() > 0");
+			LocalJavaField o = jm.newJavaField(Object.class);
+			o.addLine(list, ".get(", list, ".size()-1)");
+			jm.addIf(o, " instanceof ", String.class);
+			jm.addLine(list, ".set(", list, ".size()-1, ",
+					   "((", String.class, ") ", o, ") + ", s, ");");
+			jm.addLine("return;");
+			jm.addEndIf();
+			jm.addEndIf();
+			jm.addLine(list, ".add(", s, ");");
+		}
+		return jm;
+	}
+
+	private JavaMethod newGetHandlerMethod(JavaSource pOuter) throws SAXException {
+		JavaMethod result = getJavaSource().newJavaMethod("getHandler", JMUnmarshallerHandlerImpl.class, JavaSource.PUBLIC);
+		result.addLine("return ", pOuter.getQName(), ".this.getHandler();");
+		return result;
+	}
+
+	public void generate() throws SAXException {
+		super.generate();
+		newAddTextMethod();
+		newIsMixedMethod();
+		for (Iterator iter = groups.values().iterator();  iter.hasNext();  ) {
+			HandlerSG handler = (HandlerSG) iter.next();
+			handler.generate();
+		}
+	}
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupUtil.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupUtil.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupUtil.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,61 @@
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.util.JavaNamer;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.xml.sax.SAXException;
+
+
+/** Utility methods for handling groups.
+ */
+public class GroupUtil {
+	/** Returns a suggested name for the given group.
+	 */
+	public static String getGroupName(GroupSG pGroup) throws SAXException {
+		if (pGroup.isGlobal()) {
+			return JavaNamer.convert(pGroup.getName().getLocalName(), pGroup.getSchema());
+		} else {
+			String sep;
+			StringBuffer sb = new StringBuffer();
+			if (pGroup.isSequence()  ||  pGroup.isAll()) {
+				sep = "And";
+			} else {
+				sep = "Choice";
+			}
+			int num = 0;
+			ParticleSG[] groupParticles = pGroup.getParticles();
+			for (int i = 0;  i < groupParticles.length;  i++) {
+				ParticleSG particle = groupParticles[i];
+				if (particle.isElement()) {
+					if (num++ > 0) {
+						sb.append(sep);
+					}
+					String f = particle.getPropertySG().getPropertyName();
+					sb.append(Character.toUpperCase(f.charAt(0)) + f.substring(1));
+					if (num == 3) {
+						break;
+					}
+				}
+			}
+			if (sb.length() == 0) {
+				return "Group";
+			} else {
+				return sb.toString();
+			}
+		}
+	}
+
+	static JavaQName getContentClass(GroupSG pGroup, ParticleSG pParticle,
+									 JavaQName pQName) throws SAXException {
+		String name = pParticle.getPropertySG().getPropertyName();
+		name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
+		if (pGroup.isGlobal()) {
+			return JavaQNameImpl.getInstance(pQName.getPackageName(),
+											 getGroupName(pGroup) + name);
+		} else {
+			return JavaQNameImpl.getInnerInstance(pQName, name);
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.xml.sax.SAXException;
+
+
+/** Interface of an object, which generates instances
+ * of {@link org.apache.ws.jaxme.impl.JMSAXElementParser},
+ * or {@link org.apache.ws.jaxme.impl.JMSAXGroupParser}.
+ */
+public interface HandlerSG {
+	/** Returns the class being generated.
+	 */
+	public JavaSource getJavaSource();
+
+	/** Creates the handlers method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXElementParser#addAttribute(String, String, String)}.
+	 */
+	public JavaMethod newAddAttributeMethod() throws SAXException;
+
+	/** Creates the handlers method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXGroupParser#startElement(String, String, String, org.xml.sax.Attributes)}.
+	 */
+	public JavaMethod newStartElementMethod() throws SAXException;
+
+	/** Creates the handlers method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXGroupParser#endElement(String, String, String, Object)}.
+	 */
+	public JavaMethod newEndElementMethod() throws SAXException;
+
+	/** Creates the handlers method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXGroupParser#isFinished()}.
+	 */
+	public JavaMethod newIsFinishedMethod() throws SAXException;
+
+	/** Creates the handlers method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXElementParser#isEmpty()}.
+	 */
+	public JavaMethod newIsEmptyMethod() throws SAXException;
+
+	/** Creates the handlers method
+	 * {@link org.apache.ws.jaxme.impl.JMSAXElementParser#isAtomic()}.
+	 */
+	public JavaMethod newIsAtomicMethod() throws SAXException;
+
+	/** Invokes the various "newFooMethod" methods.
+	 */
+	public void generate() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSGImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSGImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/HandlerSGImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,254 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.ValidationEvents;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.types.StringSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/** Base implementation of
+ * {@link org.apache.ws.jaxme.generator.sg.impl.ccsg.HandlerSG},
+ * for derivation of various subclasses.
+ */
+public abstract class HandlerSGImpl implements HandlerSG {
+	protected final ComplexTypeSG ctSG;
+	private final JavaSource javaSource;
+	private DirectAccessible paramLocalName;
+	private DirectAccessible paramNamespaceURI;
+	private DirectAccessible paramResult;
+	private DirectAccessible paramQName;
+	private DirectAccessible paramAttrs;
+
+	protected HandlerSGImpl(ComplexTypeSG pType, JavaSource pJs) {
+		ctSG = pType;
+		javaSource = pJs;
+	}
+
+	/** Returns the class being generated.
+	 */
+	public JavaSource getJavaSource() {
+		return javaSource;
+	}
+
+	protected void setParamAttrs(DirectAccessible pParamAttrs) { paramAttrs = pParamAttrs; }
+
+	protected DirectAccessible getParamAttrs() { return paramAttrs; }
+
+	protected void setParamLocalName(DirectAccessible pParamLocalName) { paramLocalName = pParamLocalName; }
+
+	protected DirectAccessible getParamLocalName() { return paramLocalName; }
+
+	protected void setParamNamespaceURI(DirectAccessible pParamNamespaceURI) { paramNamespaceURI = pParamNamespaceURI; }
+
+	protected DirectAccessible getParamNamespaceURI() { return paramNamespaceURI; }
+
+	protected void setParamQName(DirectAccessible pParamQName) { paramQName = pParamQName; }
+
+	protected DirectAccessible getParamQName() { return paramQName; }
+
+	protected void setParamResult(DirectAccessible pParamResult) { paramResult = pParamResult; }
+
+	protected DirectAccessible getParamResult() { return paramResult; }
+
+	/** Returns the set of namespace URI's in <code>pAttributes</code>.
+	 */
+	private Set createSetOfExplicitURIs(AttributeSG[] pAttributes) {
+		Set result = new HashSet();
+		for (int i = 0;  i < pAttributes.length;  i++) {
+			AttributeSG attr = pAttributes[i];
+			if (!attr.isWildcard()) {
+				String uri = attr.getName().getNamespaceURI();
+				if (uri == null) { uri = ""; }
+				result.add(uri);
+			}
+		}
+		return result;
+	}
+
+	public JavaMethod newAddAttributeMethod() throws SAXException {
+		AttributeSG[] myAttributes = ctSG.getAttributes();
+		if (myAttributes.length == 0) {
+			return null;
+		}
+		
+		JavaMethod jm = getJavaSource().newJavaMethod("addAttribute", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+		DirectAccessible pURI = jm.addParam(String.class, "pURI");
+		DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
+		DirectAccessible pValue = jm.addParam(String.class, "pValue");
+		jm.addThrows(SAXException.class);
+		jm.addIf(pURI, " == null");
+		jm.addLine(pURI, " = \"\";");
+		jm.addEndIf();
+		
+		JavaQName resultType = ctSG.getClassContext().getXMLInterfaceName();
+		LocalJavaField result = jm.newJavaField(resultType);
+		result.addLine("(", resultType, ") result");
+
+		Set uris = createSetOfExplicitURIs(myAttributes);
+		boolean first = true;
+		for (Iterator iter = uris.iterator();  iter.hasNext();  ) {
+			String uri = (String) iter.next();
+			jm.addIf(first, JavaSource.getQuoted(uri), ".equals(", pURI, ")");
+			first = false;
+			boolean firstInNamespace = true;
+			for (int i = 0;  i < myAttributes.length;  i++) {
+				AttributeSG attr = myAttributes[i];
+				if (attr.isWildcard()) {
+					continue;
+				}
+				String jUri = attr.getName().getNamespaceURI();
+				if (jUri == null) { jUri = ""; }
+				if (!uri.equals(jUri)) {
+					continue;
+				}
+				
+				jm.addIf(firstInNamespace, JavaSource.getQuoted(attr.getName().getLocalName()), ".equals(", pLocalName, ")");
+				firstInNamespace = false;
+				createSimpleTypeConversion(jm, myAttributes[i].getTypeSG(), pValue,
+										   "@" + myAttributes[i].getName(),
+										   attr.getPropertySG(), result);
+				jm.addLine("return;");
+			}
+			if (!firstInNamespace) {
+				jm.addEndIf();
+			}
+		}
+		if (!first) {
+			jm.addEndIf();
+		}
+		
+		AttributeSG wildcard = null;
+		for (int i = 0;  i < myAttributes.length;  i++) {
+			if (myAttributes[i].isWildcard()) {
+				wildcard = myAttributes[i];
+				break;
+			}
+		}
+		if (wildcard == null) {
+			jm.addLine("super.addAttribute(", pURI, ", ", pLocalName, ", ", pValue, ");");
+		} else {
+			jm.addTry();
+			jm.addLine(result, ".", wildcard.getPropertySG().getXMLSetMethodName(), "(new ",
+					QName.class, "(", pURI, ", ", pLocalName, "), ", pValue, ");");
+			jm.addCatch(IllegalArgumentException.class);
+			jm.addLine("getHandler().validationEvent(", ValidationEvent.class, ".ERROR, ",
+					JavaSource.getQuoted("Invalid namespace for anyAttribute: '"),
+					" + ", pURI, " + ", JavaSource.getQuoted("', attribute name is '"),
+					" + ", pLocalName, " + ", JavaSource.getQuoted("'"),
+					", ", ValidationEvents.class, ".EVENT_UNKNOWN_ANY_ATTRIBUTE, null);");
+			jm.addEndTry();
+		}
+		return jm;
+	}
+
+	public JavaMethod newStartElementMethod() throws SAXException {
+		JavaSource js = getJavaSource();
+		JavaMethod jm = js.newJavaMethod("startElement", boolean.class, JavaSource.PUBLIC);
+		DirectAccessible pNamespaceURI = jm.addParam(String.class, "pNamespaceURI");
+		DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
+		DirectAccessible pQName = jm.addParam(String.class, "pQName");
+		DirectAccessible pAttr = jm.addParam(Attributes.class, "pAttr");
+		setParamNamespaceURI(pNamespaceURI);
+		setParamLocalName(pLocalName);
+		setParamQName(pQName);
+		setParamAttrs(pAttr);
+		setParamResult(null);
+		jm.addThrows(SAXException.class);
+		return jm;
+	}
+
+	public JavaMethod newEndElementMethod() throws SAXException {
+		JavaMethod jm = getJavaSource().newJavaMethod("endElement", void.class, JavaSource.PUBLIC);
+		DirectAccessible pNamespaceURI = jm.addParam(String.class, "pNamespaceURI");
+		DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
+		DirectAccessible pQName = jm.addParam(String.class, "pQName");
+		DirectAccessible pResult = jm.addParam(Object.class, "pResult");
+		setParamNamespaceURI(pNamespaceURI);
+		setParamLocalName(pLocalName);
+		setParamQName(pQName);
+		setParamAttrs(null);
+		setParamResult(pResult);
+		jm.addThrows(SAXException.class);
+		return jm;
+	}
+
+	public JavaMethod newIsFinishedMethod() throws SAXException {
+		JavaMethod jm = getJavaSource().newJavaMethod("isFinished", boolean.class, JavaSource.PUBLIC);
+		return jm;
+	}
+
+	public JavaMethod newIsEmptyMethod() throws SAXException {
+		JavaMethod jm = getJavaSource().newJavaMethod("isEmpty", boolean.class, JavaSource.PUBLIC);
+		return jm;
+	}
+	
+	public JavaMethod newIsAtomicMethod() throws SAXException {
+		JavaMethod jm = getJavaSource().newJavaMethod("isAtomic", boolean.class, JavaSource.PUBLIC);
+		return jm;
+	}
+
+	protected void createSimpleTypeConversion(JavaMethod pJm, TypeSG pType,
+											  TypedValue pValue, String pName,
+											  PropertySG pPropertySG,
+											  DirectAccessible pElement)
+			throws SAXException {
+		boolean causingParseConversionEvent = pType.getSimpleTypeSG().isCausingParseConversionEvent();
+		if (causingParseConversionEvent) {
+			pJm.addTry();
+		}
+		Object s = new Object[]{"(", StringSG.STRING_TYPE, ") ", pValue};
+		TypedValue result = new TypedValueImpl(pType.getSimpleTypeSG().getCastFromString(pJm, s, "getHandler()"),
+							   				   pType.getSimpleTypeSG().getRuntimeType());
+		pPropertySG.addValue(pJm, pElement, result, null);
+		if (causingParseConversionEvent) {
+			DirectAccessible e = pJm.addCatch(Exception.class);
+			pJm.addLine("getHandler().parseConversionEvent(",
+						JavaSource.getQuoted("Failed to convert value of " + pName + ": "),
+						" + ", pValue, ", ", e, ");");
+			pJm.addEndTry();
+		}
+	}
+
+	public void generate() throws SAXException {
+		newAddAttributeMethod();
+		newStartElementMethod();
+		newEndElementMethod();
+		newIsFinishedMethod();
+		newIsEmptyMethod();
+		newIsAtomicMethod();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/MarshalChildsMethodGeneratingVisitor.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/MarshalChildsMethodGeneratingVisitor.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/MarshalChildsMethodGeneratingVisitor.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,169 @@
+/**
+ * 
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.impl.JMSAXDriver;
+import org.apache.ws.jaxme.impl.JMSAXDriverController;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.Parameter;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+class MarshalChildsMethodGeneratingVisitor extends ParticleVisitorImpl {
+	private final Parameter element, controller, handler;
+	private ComplexTypeSG ctSG;
+	private LocalJavaField castedElement;
+	private final JavaMethod jm;
+	private boolean isMixed;
+	private Set mixedTypesMap;
+	private LocalJavaField object;
+
+	MarshalChildsMethodGeneratingVisitor(JavaSource pJs) {
+		jm = pJs.newJavaMethod("marshalChilds", void.class, JavaSource.PUBLIC);
+	    jm.addThrows(SAXException.class);
+		controller = jm.addParam(JMSAXDriverController.class, "pController");
+		handler = jm.addParam(ContentHandler.class, "pHandler");
+		element = jm.addParam(Object.class, "pObject");
+	}
+
+	public void simpleContent(ComplexTypeSG pType) throws SAXException {
+		JavaQName elementInterface = pType.getClassContext().getXMLInterfaceName();
+		castedElement = jm.newJavaField(elementInterface);
+	    castedElement.addLine("(", elementInterface, ") ", element);
+	    LocalJavaField chars = jm.newJavaField(String.class);
+	    SimpleContentSG simpleContent = pType.getSimpleContentSG();
+	    Object value = simpleContent.getPropertySG().getValue(castedElement);
+	    chars.addLine(simpleContent.getContentTypeSG().getSimpleTypeSG().getCastToString(jm, value, controller));
+	    jm.addIf(chars, " != null  &&  ", chars, ".length() > 0");
+	    LocalJavaField charArray = jm.newJavaField(char[].class);
+	    charArray.addLine(chars, ".toCharArray()");
+	    jm.addLine(handler, ".characters(", charArray, ", 0, ", charArray, ".length);");
+	    jm.addEndIf();
+	}
+
+	public void startComplexContent(ComplexTypeSG pType) throws SAXException {
+		ctSG = pType;
+		JavaQName elementInterface = pType.getClassContext().getXMLInterfaceName();
+		castedElement = jm.newJavaField(elementInterface);
+		castedElement.addLine("(", elementInterface, ") ", element);
+		isMixed = pType.getComplexContentSG().isMixed();
+		if (isMixed) {
+			LocalJavaField list = jm.newJavaField(List.class);
+			list.addLine(castedElement, ".getContent()");
+			DirectAccessible i = jm.addForList(list);
+			object = jm.newJavaField(Object.class);
+			object.addLine(list, ".get(", i, ")");
+			mixedTypesMap = new HashSet();
+			jm.addIf(object, " instanceof ", String.class);
+			LocalJavaField s = jm.newJavaField(String.class);
+			s.addLine("(", String.class, ") ", object);
+			jm.addLine(handler, ".characters(", s,
+					   ".toCharArray(), 0, ", s, ".length());");
+		}
+	}
+
+	public void endComplexContent(ComplexTypeSG pType) throws SAXException {
+		if (isMixed) {
+			jm.addElse();
+			jm.addThrowNew(IllegalStateException.class,
+						   JavaSource.getQuoted("Invalid type: "),
+						   " + ", object, ".getClass().getName()");
+			jm.addEndIf();
+			jm.addEndFor();
+		}
+	}
+
+	private void marshalSimpleValue(ObjectSG pObjectSG, JavaMethod pMethod, Object pValue) throws SAXException {
+		Object value = pObjectSG.getTypeSG().getSimpleTypeSG().getCastToString(pMethod, pValue, controller);
+		pMethod.addLine(controller, ".marshalSimpleChild(this, ",
+				JavaSource.getQuoted(pObjectSG.getName().getNamespaceURI()), ", ",
+				JavaSource.getQuoted(pObjectSG.getName().getLocalName()), ", ",
+				value, ");");
+	}
+
+	public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+		final ObjectSG oSG = pParticle.getObjectSG();
+		if (isMixed) {
+			JavaQName interfaceName = ctSG.getClassContext().getXMLInterfaceName();
+			JavaQName qName = GroupUtil.getContentClass(pGroup, pParticle, interfaceName);
+			if (mixedTypesMap.contains(qName)) {
+				return;
+			}
+			mixedTypesMap.add(qName);
+			jm.addElseIf(object, " instanceof ", qName);
+			Object value = new Object[]{"((", qName, ") ", object, ").getValue()"};
+			marshalSimpleValue(oSG, jm, value);
+		} else {
+			SGlet sgLet = new SGlet(){
+				public void generate(JavaMethod pMethod, Object pValue) throws SAXException {
+					marshalSimpleValue(oSG, pMethod, pValue);
+				}
+			};
+			pParticle.getPropertySG().forAllNonNullValues(jm, castedElement, sgLet);
+		}
+	}
+
+	private void marshalComplexValue(ObjectSG pObjectSG, JavaMethod pMethod,
+									 Object pValue) throws SAXException {
+		Context cc = pObjectSG.getTypeSG().getComplexTypeSG().getClassContext();
+		JavaQName serializerClass = cc.getXMLSerializerName();
+		LocalJavaField driver = pMethod.newJavaField(JMSAXDriver.class);
+		if (pObjectSG.getTypeSG().isGlobalClass()) {
+			JavaQName elementInterface;
+			if (pObjectSG.isGlobal()) {
+				elementInterface = pObjectSG.getClassContext().getXMLInterfaceName();
+			} else {
+				elementInterface = cc.getXMLInterfaceName();
+			}
+			driver.addLine(controller,
+					".getJMMarshaller().getJAXBContextImpl().getManagerS(",
+					elementInterface, ".class).getDriver()");
+		} else {
+			driver.addLine("new ", serializerClass, "();");
+		}
+		pMethod.addLine(controller, ".marshal(", driver,
+				", ", JavaSource.getQuoted(pObjectSG.getName().getNamespaceURI()),
+				", ", JavaSource.getQuoted(pObjectSG.getName().getLocalName()),
+				", ", pValue, ");");
+	}
+
+	public void complexElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+		final ObjectSG oSG = pParticle.getObjectSG();
+		if (isMixed) {
+			JavaQName qName = oSG.getTypeSG().getComplexTypeSG().getClassContext().getXMLInterfaceName();
+			if (mixedTypesMap.contains(qName)) {
+				return;
+			}
+			mixedTypesMap.add(qName);
+			jm.addElseIf(object, " instanceof ", qName);
+			Object value = new Object[]{"((", qName, ") ", object, ")"};
+			marshalComplexValue(oSG, jm, value);
+		} else {
+			SGlet sgLet = new SGlet(){
+				public void generate(JavaMethod pMethod, Object pValue) throws SAXException {
+					marshalComplexValue(oSG, pMethod, pValue);
+				}
+			};
+			pParticle.getPropertySG().forAllNonNullValues(jm, castedElement, sgLet);
+		}
+	}
+
+	JavaMethod getMethod() { return jm; }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitor.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitor.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitor.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,66 @@
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.xml.sax.SAXException;
+
+
+/** A <code>ParticleVisitor</code> iterates over a groups
+ * particles.
+ */
+public interface ParticleVisitor {
+	/** Invoked for an empty type.
+	 * @throws SAXException The visitor failed.
+	 */
+	void emptyType(ComplexTypeSG type) throws SAXException;
+	/** Invoked for a complex type with simple content.
+	 * @throws SAXException The visitor failed.
+	 */
+	void simpleContent(ComplexTypeSG type) throws SAXException;
+	/** Invoked to begin a sequence.
+	 * @throws SAXException The visitor failed.
+	 */
+	void startSequence(GroupSG group) throws SAXException;
+	/** Invoked to end a sequence.
+	 * @throws SAXException The visitor failed.
+	 */
+	void endSequence(GroupSG group) throws SAXException;
+	/** Invoked to start a choice group.
+	 * @throws SAXException The visitor failed.
+	 */
+	void startChoice(GroupSG group) throws SAXException;
+	/** Invoked to end a choice group.
+	 * @throws SAXException The visitor failed.
+	 */
+	void endChoice(GroupSG group) throws SAXException;
+	/** Invoked to start an all group.
+	 * @throws SAXException The visitor failed.
+	 */
+	void startAll(GroupSG group) throws SAXException;
+	/** Invoked to end an all group.
+	 * @throws SAXException The visitor failed.
+	 */
+	void endAll(GroupSG group) throws SAXException;
+	/** Invoked to start a complex content types
+	 * content.
+	 * @throws SAXException The visitor failed.
+	 */
+	void startComplexContent(ComplexTypeSG type) throws SAXException;
+	/** Invoked to end a complex content types content.
+	 * @throws SAXException The visitor failed.
+	 */
+	void endComplexContent(ComplexTypeSG type) throws SAXException;
+	/** Invoked to process an element with simple type.
+	 * @throws SAXException The visitor failed.
+	 */
+	void simpleElementParticle(GroupSG pGroup,ParticleSG particle) throws SAXException;
+	/** Invoked to process an element with complex type.
+	 * @throws SAXException The visitor failed.
+	 */
+	void complexElementParticle(GroupSG pGroup, ParticleSG particle) throws SAXException;
+	/** Invoked to process a wildcard particle.
+	 * @throws SAXException The visitor failed.
+	 */
+	void wildcardParticle(ParticleSG particle) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleVisitorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.xml.sax.SAXException;
+
+
+/** Default implementation of a
+ * {@link org.apache.ws.jaxme.generator.sg.impl.ccsg.ParticleVisitor},
+ * with methods doing nothing.
+ */
+public class ParticleVisitorImpl implements ParticleVisitor {
+	public void emptyType(ComplexTypeSG type) throws SAXException {
+	}
+
+	public void simpleContent(ComplexTypeSG type) throws SAXException {
+	}
+
+	public void startSequence(GroupSG group) throws SAXException {
+	}
+
+	public void endSequence(GroupSG group) {
+	}
+
+	public void startChoice(GroupSG group) {
+	}
+
+	public void endChoice(GroupSG group) {
+	}
+
+	public void startAll(GroupSG group) {
+	}
+
+	public void endAll(GroupSG group) {
+	}
+
+	public void startComplexContent(ComplexTypeSG type) throws SAXException {
+	}
+
+	public void endComplexContent(ComplexTypeSG type) throws SAXException {
+	}
+
+	public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
+	}
+
+	public void complexElementParticle(GroupSG pGroup, ParticleSG particle) throws SAXException {
+	}
+
+	public void wildcardParticle(ParticleSG particle) {
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleWalker.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleWalker.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/ParticleWalker.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,87 @@
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.xml.sax.SAXException;
+
+
+/** A <code>ParticleWalker</code> walks over a complex
+ * elements particles, invoking the given
+ * {@link org.apache.ws.jaxme.generator.sg.impl.ccsg.ParticleVisitor Particle Visitors}
+ * methods for any particle.
+ */
+public class ParticleWalker {
+	private final ParticleVisitor visitor;
+
+	/** Creates a new instance, walking over the given type.
+	 */
+	public ParticleWalker(ParticleVisitor pVisitor) {
+		visitor = pVisitor;
+	}
+
+	/** Walks over the given types particles.
+	 * @throws SAXException Walking over the particles failed.
+	 */
+	public void walk(ComplexTypeSG pType) throws SAXException {
+		if (pType.hasSimpleContent()) {
+			visitor.simpleContent(pType);
+		} else {
+			ComplexContentSG ccSG = pType.getComplexContentSG();
+			if (ccSG.isEmpty()) {
+				visitor.emptyType(pType);
+			} else {
+				visitor.startComplexContent(pType);
+				walkGroup(ccSG.getRootParticle().getGroupSG());
+				visitor.endComplexContent(pType);
+			}
+		}
+	}
+
+	/** Walks over the group.
+	 * @throws SAXException Walking over the group failed.
+	 */
+	private void walkGroup(GroupSG pGroup) throws SAXException {
+		if (pGroup.isSequence()) {
+			visitor.startSequence(pGroup);
+			walkParticles(pGroup);
+			visitor.endSequence(pGroup);
+		} else if (pGroup.isChoice()) {
+			visitor.startChoice(pGroup);
+			walkParticles(pGroup);
+			visitor.endChoice(pGroup);
+		} else if (pGroup.isAll()) {
+			visitor.startAll(pGroup);
+			walkParticles(pGroup);
+			visitor.endAll(pGroup);
+		} else {
+			throw new IllegalStateException("Invalid group type");
+		}
+	}
+
+	/** Walks over the groups particles.
+	 * @throws SAXException Walking over the groups particles failed.
+	 */
+	private void walkParticles(GroupSG pGroup) throws SAXException {
+		ParticleSG[] particles = pGroup.getParticles();
+		for (int i = 0;  i < particles.length;  i++) {
+			ParticleSG particle = particles[i];
+			if (particle.isElement()) {
+				TypeSG type = particle.getObjectSG().getTypeSG();
+				if (type.isComplex()) {
+					visitor.complexElementParticle(pGroup, particle);
+				} else {
+					visitor.simpleElementParticle(pGroup, particle);
+				}
+			} else if (particle.isGroup()) {
+				walkGroup(particle.getGroupSG());
+			} else if (particle.isWildcard()) {
+				visitor.wildcardParticle(particle);
+			} else {
+				throw new IllegalStateException("Invalid particle type");
+			}
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SequenceHandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SequenceHandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SequenceHandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.xml.sax.SAXException;
+
+
+/** Creates an instance of
+ * {@link org.apache.ws.jaxme.impl.JMSAXElementParser},
+ * or {@link org.apache.ws.jaxme.impl.JMSAXGroupParser},
+ * which parses a sequence.
+ */
+public class SequenceHandlerSG extends GroupHandlerSG {
+	/** Creates a new instance, which generates a handler for
+	 * the complex type <code>pTypeSG</code> by adding methods
+	 * and fields to the Java class <code>pJs</code>.
+	 */
+	public SequenceHandlerSG(ComplexTypeSG pTypeSG, JavaSource pJs)
+			throws SAXException {
+		super(pTypeSG, pJs);
+	}
+
+	SequenceHandlerSG(GroupHandlerSG pOuterHandler, ComplexTypeSG pTypeSG,
+					  ParticleSG pParticle, JavaSource pJs)
+			throws SAXException {
+		super(pOuterHandler, pTypeSG, pParticle, pJs);
+	}
+
+	protected DirectAccessible getEndElementState() throws SAXException {
+		return getStateField();
+	}
+
+	protected int getState(int pNum) {
+		return pNum+1;
+	}
+
+	private int fromState(int pState) {
+		return pState-1;
+	}
+
+	protected JavaField newStateField() throws SAXException {
+		JavaField jf = getJavaSource().newJavaField("__state", int.class, JavaSource.PRIVATE);
+		JavaComment jc = jf.newComment();
+		jc.addLine("The current state. The following values are valid states:");
+		jc.addLine(" 0 = Before parsing the element");
+		for (int i = 0;  i < particles.length;  i++) {
+			ParticleSG particle = particles[i];
+			if (particle.isGroup()) {
+				GroupSG group = particle.getGroupSG();
+				if (group.isGlobal()) {
+					jc.addLine(" " + getState(i) + " = While parsing the nested group " + group.getName());
+				} else {
+					jc.addLine(" " + getState(i) + " = While parsing the nested group " + GroupUtil.getGroupName(group));
+				}
+			} else if (particle.isElement()) {
+				jc.addLine(" " + getState(i) + " = While or after parsing the child element " + particle.getObjectSG().getName());
+			} else if (particle.isWildcard()) {
+				throw new IllegalStateException("TODO: Add support for wildcards.");
+			} else {
+				throw new IllegalStateException("Invalid particle type.");
+			}
+		}
+		
+		return jf;
+	}
+
+
+	protected void acceptParticle(JavaMethod pJm, int pNum) throws SAXException {
+		pJm.addLine(getStateField(), " = " + getState(pNum) + ";");
+	}
+
+	public JavaMethod newStartElementMethod() throws SAXException {
+		JavaMethod result = super.newStartElementMethod();
+		LocalJavaField unmarshallerHandler = result.newJavaField(JMUnmarshallerHandlerImpl.class);
+		unmarshallerHandler.addLine("getHandler()");
+		result.addSwitch(getStateField());
+		result.addCase(new Integer(0));
+		handleStartElementStates(unmarshallerHandler,
+								 result, getFirstValidParticle(0),
+								 getLastValidParticle(0));
+		result.addBreak();
+		for (int i = 0;  i < particles.length;  i++) {
+			int state = getState(i);
+			result.addCase(new Integer(state));
+			handleStartElementStates(unmarshallerHandler,
+									 result, getFirstValidParticle(state),
+									 getLastValidParticle(state));
+			result.addBreak();
+		}
+		result.addDefault();
+		result.addThrowNew(IllegalStateException.class,
+						   JavaSource.getQuoted("Invalid state: "),
+						   " + ", getStateField());
+		result.addEndSwitch();
+		result.addLine("return false;");
+		return result;
+	}
+
+	/** Assuming, we are currently in state <code>pState</code>,
+	 * returns the index of the first valid particle. Returns
+	 * -1, if there is no valid particle.
+	 */
+	private int getFirstValidParticle(int pState) {
+		if (pState == 0) {
+			return 0;
+		} else {
+			int i = fromState(pState);
+			ParticleSG particle = particles[i];
+			if (particle.isMultiple()) {
+				return i;
+			} else if (i+1 < particles.length) {
+				return i+1;
+			} else {
+				return -1;
+			}
+		}
+	}
+
+	/** Assuming, we are currently in state <code>pState</code>,
+	 * returns the index of the last valid particle. Returns
+	 * -1, if there is no valid particle.
+	 */
+	private int getLastValidParticle(int pState) throws SAXException {
+		int lastParticle;
+		if (pState == 0) {
+			lastParticle = 0;
+		} else {
+			lastParticle = fromState(pState)+1;
+			if (lastParticle >= particles.length) {
+				return fromState(pState);
+			}
+		}
+		while (lastParticle < particles.length-1) {
+			ParticleSG particle = particles[lastParticle];
+			if (isRequiredParticle(particle)) {
+				break;
+			} else {
+				++lastParticle;
+			}
+		}
+		return lastParticle;
+	}
+
+	public JavaMethod newIsFinishedMethod() throws SAXException {
+		JavaMethod result = super.newIsFinishedMethod();
+		result.addSwitch(getStateField());
+		boolean allOptional = true;
+		for (int i = particles.length-1;  i >= 0;  i--) {
+			ParticleSG particle = particles[i];
+			result.addCase(new Integer(getState(i)));
+			if (isRequiredParticle(particle)) {
+				allOptional = false;
+				break;
+			}
+		}
+		if (allOptional) {
+			result.addCase(new Integer(0));
+		}
+		result.addLine("return true;");
+		result.addDefault();
+		result.addLine("return false;");
+		result.addEndSwitch();
+		return result;
+	}
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.sg.impl.ccsg;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.xml.sax.SAXException;
+
+
+/** Creates an instance of
+ * {@link org.apache.ws.jaxme.impl.JMSAXElementParser},
+ * which parses a complex element with simple content.
+ */
+public class SimpleContentHandlerSG extends EmptyElementHandlerSG {
+	/** Creates a new instance, which generates a handler
+	 * for the given complex type.
+	 */
+	public SimpleContentHandlerSG(ComplexTypeSG pType, JavaSource pJs) {
+		super(pType, pJs);
+	}
+
+	public JavaMethod newEndElementMethod() throws SAXException {
+		JavaMethod result = super.newEndElementMethod();
+		JavaQName elementInterface = ctSG.getClassContext().getXMLInterfaceName();
+		LocalJavaField element = result.newJavaField(elementInterface);
+		element.addLine("(", elementInterface, ") result");
+		SimpleContentSG scSG = ctSG.getSimpleContentSG();
+		createSimpleTypeConversion(result, scSG.getContentTypeSG(),
+								   getParamResult(),
+								   scSG.getPropertySG().getPropertyName(),
+								   scSG.getPropertySG(), element);
+		return result;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.sg.impl.ccsg Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>This package contains helper classes for creating JaxMe's
+          marshallers and unmarshallers. The package name "ccsg" is
+          an abbreviation of <code>ComplexContentSG</code>.</p>
+    </body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.sg.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains JAXB source generation model implementation.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/sg/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.sg Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains JAXB source generation model interfaces.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import javax.xml.bind.DatatypeConverterInterface;
+
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AtomicTypeSGImpl extends SimpleTypeSGImpl {
+  private final AtomicTypeSG atomicTypeSG;
+
+  /** <p>Creates a new instance of AtomicTypeSGImpl.</p>
+   */
+  protected AtomicTypeSGImpl(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+    atomicTypeSG = new org.apache.ws.jaxme.generator.sg.impl.AtomicTypeSGImpl(pType.getSimpleType().getAtomicType());
+  }
+
+  public boolean isAtomic(SimpleTypeSG pController) { return true; }
+
+  protected abstract String getDatatypeName();
+  protected abstract JavaQName getDatatypeType();
+
+  public AtomicTypeSG getAtomicType(SimpleTypeSG pController) {
+    return atomicTypeSG;
+  }
+
+   public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			return new TypedValueImpl(new Object[] {
+					"javax.xml.bind.DatatypeConverter",
+					".parse" + getDatatypeName() + "(\"", pValue, "\")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
+  
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) throws SAXException {
+	Object value;
+	if (pData == null) {
+      JavaSource js = pMethod.getJavaSource();
+      while (js.isInnerClass()) {
+        js = ((JavaInnerClass) js).getOuterClass();
+      }
+      JavaField[] fields = js.getFields();
+      JavaQName qName = JavaQNameImpl.getInstance(DatatypeConverterInterface.class);
+      JavaField converter = null;
+      for (int i = 0;  i < fields.length;  i++) {
+        if (qName.equals(fields[i].getType())  &&  JavaSource.DEFAULT_PROTECTION.equals(fields[i].getProtection())  &&
+            fields[i].isStatic()  &&  fields[i].isFinal()) {
+          converter = fields[i];
+          break;
+        }
+      }
+      if (converter == null) {
+        converter = js.newJavaField("__dataTypeConverter", qName);
+        converter.setStatic(true);
+        converter.setFinal(true);
+        converter.addLine("new ", DatatypeConverterImpl.class, "()");
+      }
+      value = new Object[]{converter, ".parse" + getDatatypeName() + "(", pValue, ")"};
+    } else {
+      value = new Object[]{pData, ".getDatatypeConverter().parse" + getDatatypeName() + "(", pValue, ")"};
+    }
+	return new TypedValueImpl(value, getDatatypeType());
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
+    return getCastToString(pController, pValue, pData);
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
+    return new TypedValueImpl(new Object[]{pData, ".getDatatypeConverter().print" + getDatatypeName() + "(", pValue, ")"},
+						      String.class);
+  }
+
+  public Object getEqualsCheck(SimpleTypeSG pController, JavaMethod pMethod, Object pValue1, Object pValue2)
+      throws SAXException {
+    return new Object[]{pValue1, ".equals(", pValue2, ")"};
+  }
+
+  	public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		return true;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Base64BinarySG extends AtomicTypeSGImpl {
+  public static final JavaQName BYTE_ARRAY_TYPE = JavaQNameImpl.getInstance(byte[].class);
+
+  /** <p>Creates a new instance of Base64BinarySG.</p>
+   */
+  public Base64BinarySG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return BYTE_ARRAY_TYPE; }
+  protected String getDatatypeName() { return "Base64Binary"; }
+  protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class BooleanSG extends PrimitiveTypeSG {
+	/** The primitive boolean type.
+	 */
+	public static final JavaQName BOOLEAN_TYPE = JavaQNameImpl.getInstance(boolean.class);
+	/** The object boolean type.
+	 */
+	public static final JavaQName BOOLEAN_OBJECT_TYPE = JavaQNameImpl.getInstance(Boolean.class);
+
+  /** <p>Creates a new instance of BooleanSG.java.</p>
+   */
+  public BooleanSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected String getDatatypeName() { return "Boolean"; }
+  protected JavaQName getDatatypeType() { return BOOLEAN_TYPE; }
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return BOOLEAN_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return BOOLEAN_OBJECT_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new DatatypeConverterImpl().parseBoolean(pValue) ? Boolean.TRUE : Boolean.FALSE,
+			  					BOOLEAN_OBJECT_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+
+    public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		return false;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ByteSG extends PrimitiveTypeSG {
+  public static final JavaQName BYTE_TYPE = JavaQNameImpl.getInstance(byte.class);
+  public static final JavaQName BYTE_OBJECT_TYPE = JavaQNameImpl.getInstance(Byte.class);
+
+  /** <p>Creates a new instance of LongSG.</p>
+   */
+  public ByteSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return BYTE_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return BYTE_OBJECT_TYPE; }
+  protected String getDatatypeName() { return "Byte"; }
+  protected JavaQName getDatatypeType() { return BYTE_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Object[]{"((", BYTE_TYPE, ") ", new Byte(new DatatypeConverterImpl().parseByte(pValue)), ")"},
+			  					BYTE_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.util.Calendar;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.util.XsDateFormat;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DateSG extends DateTimeSG {
+  /** <p>Creates a new instance of DateSG.</p>
+   */
+  public DateSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected String getDatatypeName() { return "Date"; }
+  protected Class getFormatClass() { return XsDateFormat.class; }
+  
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			Calendar calendar = new DatatypeConverterImpl().parseDate(pValue);
+			return new TypedValueImpl(
+					new Object[] { "new java.util.GregorianCalendar("
+							+ calendar.get(Calendar.YEAR) + ","
+							+ calendar.get(Calendar.MONTH) + ","
+							+ calendar.get(Calendar.DAY_OF_MONTH) + ")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.text.ParsePosition;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.impl.JMUnmarshallerImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DateTimeSG extends AtomicTypeSGImpl {
+    public static final JavaQName CALENDAR_TYPE = JavaQNameImpl.getInstance(Calendar.class);
+    private static final JavaQName OBJECT_TYPE = JavaQNameImpl.getInstance(Object.class);
+    
+    /** <p>Creates a new instance of DurationSG.</p>
+     */
+    public DateTimeSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+        super(pFactory, pSchema, pType);
+    }
+
+    protected String getDatatypeName() { return "DateTime"; }
+	protected JavaQName getDatatypeType() { return CALENDAR_TYPE; }
+    protected Class getFormatClass() { return XsDateTimeFormat.class; }
+    public JavaQName getRuntimeType(SimpleTypeSG pController) { return CALENDAR_TYPE; }
+
+    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			Calendar calendar = new DatatypeConverterImpl().parseDate(pValue);
+			return new TypedValueImpl(
+					new Object[] { "new java.util.GregorianCalendar("
+							+ calendar.get(Calendar.YEAR) + ","
+							+ calendar.get(Calendar.MONTH) + ","
+							+ calendar.get(Calendar.DAY_OF_MONTH) + ")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
+
+    public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) throws SAXException {
+        boolean mayBeDate;
+        Object format;
+        if (pData == null) {
+            format = new Object[]{"new ", getFormatClass(), "()"};
+            mayBeDate = false;
+        } else {
+            format = new Object[]{"((", JMUnmarshallerImpl.class, ") ", pData,
+                    			  ".getJMUnmarshaller()).get" + getDatatypeName(), "Format()"};
+            mayBeDate = true;
+        }
+        if (!(pValue instanceof DirectAccessible)) {
+            LocalJavaField v = pMethod.newJavaField(String.class);
+            v.addLine(pValue);
+            pValue = v;
+        }
+        LocalJavaField pos = pMethod.newJavaField(ParsePosition.class);
+        pos.addLine("new ", ParsePosition.class, "(0)");
+        LocalJavaField cal = pMethod.newJavaField(mayBeDate ? OBJECT_TYPE : pController.getRuntimeType());
+        cal.addLine(format, ".parseObject(", pValue, ", ", pos, ");");
+        pMethod.addIf(cal, " == null");
+        pMethod.addThrowNew(IllegalArgumentException.class,
+                			JavaSource.getQuoted("Failed to parse dateTime "),
+              			  	" + ", pValue, " + ", JavaSource.getQuoted(" at: "),
+							" + ", pValue, ".substring(", pos, ".getErrorIndex())");
+        pMethod.addEndIf();
+        if (mayBeDate) {
+            LocalJavaField result = pMethod.newJavaField(pController.getRuntimeType());
+            pMethod.addIf(cal, " instanceof ", Calendar.class);
+            pMethod.addLine(result, " = (", Calendar.class, ") ", cal, ";");
+            pMethod.addElse();
+            pMethod.addLine(result, " = ", Calendar.class, ".getInstance();");
+            pMethod.addLine(result, ".setTime((", Date.class, ") ", cal, ");");
+            pMethod.addEndIf();
+            return result;
+        } else {
+            return cal;
+        }
+    }
+
+	public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
+		Object v = new Object[]{pData, ".getJMMarshaller().get" + getDatatypeName()
+								+ "Format().format(", pValue, ")"};
+		return new TypedValueImpl(v, StringSG.STRING_TYPE);
+	}
+
+	public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+		LocalJavaField f = pMethod.newJavaField(CALENDAR_TYPE);
+		f.addLine(pValue);
+		pMethod.addIf(f, " != null");
+		pSGlet.generate(pMethod, pValue);
+		pMethod.addEndIf();
+	}
+
+	public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+		pSGlet.generate(pMethod, pValue);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.math.BigDecimal;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DecimalSG extends AtomicTypeSGImpl {
+  static public final JavaQName DECIMAL_TYPE = JavaQNameImpl.getInstance(BigDecimal.class);
+
+  /** <p>Creates a new instance of DecimalSG.</p>
+   */
+  public DecimalSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return DECIMAL_TYPE; }
+  protected String getDatatypeName() { return "Decimal"; }
+  protected JavaQName getDatatypeType() { return DECIMAL_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+    	return new TypedValueImpl("new java.math.BigDecimal(\"" + pValue + "\")", DECIMAL_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(DECIMAL_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DoubleSG extends PrimitiveTypeSG {
+  public static final JavaQName DOUBLE_TYPE = JavaQNameImpl.getInstance(double.class);
+  public static final JavaQName DOUBLE_OBJECT_TYPE = JavaQNameImpl.getInstance(Double.class);
+
+  /** <p>Creates a new instance of DoubleSG.</p>
+   */
+  public DoubleSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return DOUBLE_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return DOUBLE_OBJECT_TYPE; }
+  protected String getDatatypeName() { return "Double"; }
+  protected JavaQName getDatatypeType() { return DOUBLE_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+    	return new TypedValueImpl(new Double(new DatatypeConverterImpl().parseDouble(pValue)) + "d", getDatatypeType());
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.util.Duration;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DurationSG extends AtomicTypeSGImpl {
+  public static final JavaQName DURATION_TYPE = JavaQNameImpl.getInstance(Duration.class);
+
+  /** <p>Creates a new instance of DateTimeSG.java.</p>
+   */
+  public DurationSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return DURATION_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) {
+      return new TypedValueImpl(new Object[]{DURATION_TYPE, ".valueOf(", pValue, ")"}, DURATION_TYPE);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+    	return new TypedValueImpl("org.apache.ws.jaxme.util.Duration.valueOf(\"" + pValue + "\")", DURATION_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
+    return new TypedValueImpl(new Object[]{pValue, ".toString()"}, String.class);
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(DURATION_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+
+  protected String getDatatypeName() { return "Duration"; }
+  protected JavaQName getDatatypeType() { return DURATION_TYPE; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class FloatSG extends PrimitiveTypeSG {
+  public static final JavaQName FLOAT_TYPE = JavaQNameImpl.getInstance(float.class);
+  public static final JavaQName FLOAT_OBJECT_TYPE = JavaQNameImpl.getInstance(Float.class);
+
+  /** <p>Creates a new instance of FloatSG.</p>
+   */
+  public FloatSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return FLOAT_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return FLOAT_OBJECT_TYPE; }
+  protected String getDatatypeName() { return "Float"; }
+  protected JavaQName getDatatypeType() { return FLOAT_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Float(new DatatypeConverterImpl().parseFloat(pValue)) + "f", FLOAT_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class HexBinarySG extends AtomicTypeSGImpl {
+  public static final JavaQName BYTE_ARRAY_TYPE = JavaQNameImpl.getInstance(byte[].class);
+
+  /** <p>Creates a new instance of HexBinarySG.</p>
+   */
+  public HexBinarySG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return BYTE_ARRAY_TYPE; }
+  protected String getDatatypeName() { return "HexBinary"; }
+  protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDREFSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDREFSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDREFSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class IDREFSG extends StringSG {
+  /** <p>Creates a new instance of IDREFSG.</p>
+   */
+  public IDREFSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IDSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class IDSG extends StringSG {
+
+  /** <p>Creates a new instance of IDSG.</p>
+   */
+  public IDSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class IntSG extends PrimitiveTypeSG {
+  public static final JavaQName INT_TYPE = JavaQNameImpl.getInstance(int.class);
+  public static final JavaQName INT_OBJECT_TYPE = JavaQNameImpl.getInstance(Integer.class);
+
+  /** <p>Creates a new instance of LongSG.</p>
+   */
+  public IntSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return INT_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return INT_OBJECT_TYPE; }
+  protected String getDatatypeName() { return "Int"; }
+  protected JavaQName getDatatypeType() { return INT_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Integer(new DatatypeConverterImpl().parseInt(pValue)), INT_TYPE);
+    } catch (NumberFormatException e) {
+      Locator locator;
+      try {
+        locator = getLocator();
+      } catch (Exception f) {
+        throw new SAXException("Failed to convert string value to integer: " + pValue);
+      }
+      throw new LocSAXException("Failed to convert string value to integer: " + pValue, locator);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.math.BigInteger;
+
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class IntegerSG extends AtomicTypeSGImpl {
+  public static final JavaQName INTEGER_TYPE = JavaQNameImpl.getInstance(BigInteger.class);
+
+  /** <p>Creates a new instance of IntegerSG.</p>
+   */
+  public IntegerSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return INTEGER_TYPE; }
+  protected String getDatatypeName() { return "Integer"; }
+  protected JavaQName getDatatypeType() { return INTEGER_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+    	return new TypedValueImpl("new java.math.BigInteger(\"" + pValue + "\")", INTEGER_TYPE);
+    } catch (NumberFormatException e) {
+      throw new LocSAXException("Failed to convert string value to BigInteger: " + pValue, getLocator());
+    }
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(INTEGER_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+
+  public void addValidation(SimpleTypeSG pController, JavaMethod pMethod,
+		  					final DirectAccessible pValue) {
+    AtomicTypeSG atomicType = pController.getAtomicType();
+    Long totalDigits = atomicType.getTotalDigits();
+    if (totalDigits != null) {
+      pMethod.addIf(pValue, ".signum()", " == -1");
+      pMethod.addIf(pValue, ".toString().length() - 1", " > ", totalDigits);
+      pMethod.addThrowNew(IllegalArgumentException.class,
+                          JavaSource.getQuoted("Length of " + totalDigits + " digits exceeded: "), " + ", pValue);
+      pMethod.addEndIf();
+      pMethod.addElse();
+      pMethod.addIf(pValue, ".toString().length()", " > ", totalDigits);
+      pMethod.addThrowNew(IllegalArgumentException.class,
+                          JavaSource.getQuoted("Length of " + totalDigits + " digits exceeded: "), " + ", pValue);
+      pMethod.addEndIf();
+      pMethod.addEndIf();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/JMChar.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/JMChar.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/JMChar.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JMChar extends XSString {
+  private static final JMChar theInstance = new JMChar();
+  private static final XsQName name = new XsQName(JaxMeSchemaReader.JAXME_SCHEMA_URI, "char");
+  private static final Long theLength = new Long(1);
+
+  protected JMChar() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSString.getInstance(); }
+
+  public Long getLength() { return theLength; }
+  public Long getMaxLength() { return theLength; }
+  public Long getMinLength() { return theLength; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ListTypeSGImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ListTypeSGImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ListTypeSGImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.ListTypeSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ListTypeSGImpl extends SimpleTypeSGImpl {
+  public static final JavaQName LIST_TYPE = JavaQNameImpl.getInstance(List.class);
+  public static final JavaQName ARRAYLIST_TYPE = JavaQNameImpl.getInstance(ArrayList.class);
+
+  private class InnerListTypeSG implements ListTypeSG {
+    private final Long length, minLength, maxLength;
+    public InnerListTypeSG(XSListType pListType) {
+      length = pListType.getLength();
+      maxLength = pListType.getMaxLength();
+      minLength = pListType.getMinLength();
+    }
+    public TypeSG getItemType() { return ListTypeSGImpl.this.getItemType(); }
+    public Long getLength() { return length; }
+    public Long getMaxLength() { return maxLength; }
+    public Long getMinLength() { return minLength; }
+  }
+
+  private final XSListType listType;
+  private final ListTypeSG listTypeSG;
+  private TypeSG itemType;
+  private final Context classContext;
+  private final XsQName name;
+  public boolean hasSetMethod(SimpleTypeSG pController) { return "indexed".equals(pController.getCollectionType()); }
+
+  public boolean isList(SimpleTypeSG pController) { return true; }
+
+  /** <p>Creates a new instance of ListTypeSG in the given {@link Context}.</p>
+   */
+  public ListTypeSGImpl(SGFactory pFactory, SchemaSG pSchemaSG, XSType pType,
+                         Context pClassContext, XsQName pName) throws SAXException {
+    super(pFactory, pSchemaSG, pType);
+    name = pName;
+    classContext = pClassContext;
+    listType = pType.getSimpleType().getListType();
+    listTypeSG = new InnerListTypeSG(listType);
+  }
+
+  public void init(SimpleTypeSG pController) throws SAXException {
+    itemType = getFactory().getTypeSG(listType.getItemType(), classContext, name);
+  }
+
+  protected TypeSG getItemType() {
+    return itemType;
+  }
+
+  public ListTypeSG getListType(SimpleTypeSG pController) {
+    return listTypeSG;
+  }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) {
+    if ("indexed".equals(pController.getCollectionType())) {
+      return JavaQNameImpl.getArray(itemType.getSimpleTypeSG().getRuntimeType());
+    } else {
+      return LIST_TYPE;
+    }
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    List list = new ArrayList();
+    for (StringTokenizer st = new StringTokenizer(pValue);  st.hasMoreElements();  ) {
+      if (list.size() > 0) {
+        list.add(", ");
+      }
+      list.add(itemType.getSimpleTypeSG().getCastFromString(st.nextToken()));
+    }
+
+    Object result = new Object[]{"new ", itemType.getSimpleTypeSG().getRuntimeType(), "[]{", list, "}"};
+    String collectionType = pController.getCollectionType();
+    if ("indexed".equals(collectionType)) {
+      return new TypedValueImpl(result, itemType.getSimpleTypeSG().getRuntimeType());
+    } else {
+      JavaQName myListType = JavaQNameImpl.getInstance(collectionType);
+      return new TypedValueImpl(new Object[]{"(new ", myListType, "(", Arrays.class, ".asList(", result, ")))"}, myListType);
+    }
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData)
+      throws SAXException {
+    LocalJavaField list = pMethod.newJavaField(LIST_TYPE);
+    String collectionType = pController.getCollectionType();
+    list.addLine("new ", ("indexed".equals(collectionType) ?
+                          ARRAYLIST_TYPE : JavaQNameImpl.getInstance(collectionType)), "()");
+    DirectAccessible st = pMethod.addForEnumeration(StringTokenizer.class, new Object[]{"new ", StringTokenizer.class, "(", pValue, ")"});
+    pMethod.addLine(list, ".add(", itemType.getSimpleTypeSG().getCastFromString(pMethod, new Object[]{st, ".nextToken()"}, pData),
+                    ");");
+    pMethod.addEndFor();
+
+    if ("indexed".equals(collectionType)) {
+      JavaQName iType = itemType.getSimpleTypeSG().getRuntimeType();
+      return new TypedValueImpl(new Object[]{"((", iType, ") ", list, ".toArray(new ", iType, "[", list, ".size()]))"},
+			  					itemType.getSimpleTypeSG().getRuntimeType());
+    } else {
+		JavaQName myListType = JavaQNameImpl.getInstance(collectionType);
+		return new TypedValueImpl(list, myListType);
+    }
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData)
+      throws SAXException {
+    String collectionType = pController.getCollectionType();
+    DirectAccessible value;
+    if (pValue instanceof DirectAccessible) {
+      value = (DirectAccessible) pValue;
+    } else {
+      LocalJavaField v = pMethod.newJavaField(pController.getRuntimeType());
+      v.addLine(pValue);
+      value = v;
+    }
+
+    LocalJavaField sb = pMethod.newJavaField(StringBuffer.class);
+    sb.addLine("new ", StringBuffer.class, "()");
+    Object v;
+    DirectAccessible loopVar;
+    if ("indexed".equals(collectionType)) {
+      loopVar = pMethod.addForArray(value);
+      v = new Object[]{value, "[", loopVar, "]"};
+    } else {
+      loopVar = pMethod.addForList(value);
+      v = new Object[]{"(", itemType.getSimpleTypeSG().getRuntimeType(), ") ", value, ".get(", loopVar, ")"};
+    }
+    pMethod.addIf(loopVar, " > 0");
+    pMethod.addLine(sb, ".append(' ');");
+    pMethod.addEndIf();
+    pMethod.addLine(sb, ".append(", itemType.getSimpleTypeSG().getCastToString(pMethod, v, pData), ");");
+    pMethod.addEndFor();
+    return new TypedValueImpl(new Object[]{sb, ".toString()"}, String.class);
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(LIST_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, f);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+
+  public Object getEqualsCheck(SimpleTypeSG pController, JavaMethod pMethod, Object pValue1, Object pValue2) throws SAXException {
+    throw new IllegalStateException("Not implemented");
+  }
+
+  public Object getInitialValue(SimpleTypeSG pController, JavaSource p0) throws SAXException {
+    String s = pController.getCollectionType();
+    JavaQName listClass = "indexed".equals(s) ? ARRAYLIST_TYPE : JavaQNameImpl.getInstance(s);
+    return new Object[]{"new ", listClass, "()"};
+  }
+
+    public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		return itemType.getSimpleTypeSG().isCausingParseConversionEvent();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class LongSG extends PrimitiveTypeSG {
+  public static final JavaQName LONG_TYPE = JavaQNameImpl.getInstance(long.class);
+  public static final JavaQName LONG_OBJECT_TYPE = JavaQNameImpl.getInstance(Long.class);
+
+  /** <p>Creates a new instance of LongSG.</p>
+   */
+  public LongSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return LONG_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return LONG_OBJECT_TYPE; }
+  protected String getDatatypeName() { return "Long"; }
+  protected JavaQName getDatatypeType() { return LONG_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Long(new DatatypeConverterImpl().parseLong(pValue)) + "l", LONG_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/PrimitiveTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/PrimitiveTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/PrimitiveTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class PrimitiveTypeSG extends AtomicTypeSGImpl {
+  /** <p>Creates a new instance of PrimitiveTypeSG.java.</p>
+   */
+  protected PrimitiveTypeSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected boolean isUnsigned() { return false; }
+  protected abstract JavaQName getObjectRuntimeType(SimpleTypeSG pController);
+  protected abstract JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController);
+  public JavaQName getRuntimeType(SimpleTypeSG pController) {
+    return pController.isNullable() ? getObjectRuntimeType(pController) : getPrimitiveRuntimeType(pController);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) throws SAXException {
+    TypedValue v = super.getCastFromString(pController, pMethod, pValue, pData);
+    if (pController.isNullable()) {
+		JavaQName objectType = getObjectRuntimeType(pController);
+		v = new TypedValueImpl(new Object[]{"new ", objectType, "(", v, ")"},
+			  			       objectType);
+    }
+    return v;
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
+    if (pController.isNullable()) {
+      pValue = new Object[]{pValue, "." + getPrimitiveRuntimeType(pController).getClassName() +"Value()"};
+    }
+    return super.getCastToString(pController, pValue, pData);
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    if (pController.isNullable()) {
+      LocalJavaField f = pMethod.newJavaField(getObjectRuntimeType(pController));
+      f.addLine(pValue);
+      pMethod.addIf(f, " != null");
+      pSGlet.generate(pMethod, pValue);
+      pMethod.addEndIf();
+    } else {
+      pSGlet.generate(pMethod, pValue);
+    }
+  }
+
+  public Object getEqualsCheck(SimpleTypeSG pController, JavaMethod pMethod, Object pValue1, Object pValue2) throws SAXException {
+    if (pController.isNullable()) {
+      return super.getEqualsCheck(pController, pMethod, pValue1, pValue2);
+    } else {
+      return new Object[]{pValue1, " == ", pValue2};
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/QNameSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/QNameSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/QNameSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class QNameSG extends AtomicTypeSGImpl {
+  public static final JavaQName QNAME_TYPE = JavaQNameImpl.getInstance(QName.class);
+
+  /** <p>Creates a new instance of QNameSG.</p>
+   */
+  public QNameSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected String getDatatypeName() { return "QName"; }
+  protected JavaQName getDatatypeType() { return QNAME_TYPE; }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return QNAME_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    QName qName = QName.valueOf(pValue);
+	Object result;
+	if(qName.getNamespaceURI() == null  ||  qName.getNamespaceURI().length() == 0) {
+      result = new Object[]{ "new ", QNAME_TYPE, "(", JavaSource.getQuoted(qName.getLocalPart()), ")" };
+    } else {
+      result = new Object[]{ "new ", QNAME_TYPE, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
+                            ", ", JavaSource.getQuoted(qName.getLocalPart()), ")" };
+    }
+	return new TypedValueImpl(result, QNAME_TYPE);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) throws SAXException {
+    return new TypedValueImpl(new Object[]{ pData, ".getDatatypeConverter().parseQName(", pValue, ", ", pData,
+                              ".getNamespaceSupport())" }, QNAME_TYPE);
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
+	  return new TypedValueImpl(new Object[]{ pData, ".getElementQName(this, ", pValue, ".getNamespaceURI(), ", pValue,
+			        							".getLocalPart())" }, String.class);
+  }
+  
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(QNAME_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ShortSG extends PrimitiveTypeSG {
+  public static final JavaQName SHORT_TYPE = JavaQNameImpl.getInstance(short.class);
+  public static final JavaQName SHORT_OBJECT_TYPE = JavaQNameImpl.getInstance(Short.class);
+
+  /** <p>Creates a new instance of LongSG.</p>
+   */
+  public ShortSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return SHORT_TYPE; }
+  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return SHORT_OBJECT_TYPE; }
+  protected String getDatatypeName() { return "Short"; }
+  protected JavaQName getDatatypeType() { return SHORT_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Object[]{"((", SHORT_TYPE, ")", new Short(new DatatypeConverterImpl().parseShort(pValue)), ")"},
+			  					SHORT_TYPE);
+	} catch (RuntimeException e) {
+		try {
+			throw new LocSAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue, getLocator());
+		} catch (Exception e1) {
+			throw new SAXException("Failed to convert string value to "
+					+ getDatatypeName() + " instance: " + pValue);
+		}
+	}
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/SimpleTypeSGImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/SimpleTypeSGImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/SimpleTypeSGImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.generator.sg.ListTypeSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.UnionTypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSGItem;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class SimpleTypeSGImpl extends JAXBSGItem implements SimpleTypeSGChain {
+  private boolean isNullable;
+
+  /** <p>Creates a new instance of SimpleTypeSGImpl.</p>
+   */
+  protected SimpleTypeSGImpl(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+    if (!pType.isSimple()) {
+      throw new IllegalStateException("The given type is complex.");
+    }
+  }
+
+  protected XSType getXSType() { return (XSType) super.getXSObject(); }
+  public SGFactory getFactory(SimpleTypeSG pController) { return getFactory(); }
+  public SchemaSG getSchema(SimpleTypeSG pController) { return getSchema(); }
+  public Locator getLocator(SimpleTypeSG pController) { return getLocator(); }
+  public boolean isAtomic(SimpleTypeSG pController) { return false; }
+  public boolean isList(SimpleTypeSG pController) { return false; }
+  public boolean isUnion(SimpleTypeSG pController) { return false; }
+  public boolean hasSetMethod(SimpleTypeSG pController) { return true; }
+  public void setNullable(SimpleTypeSG pController, boolean pNullable) {
+    setNullable(pNullable);
+  }
+  /** Sets whether the data type is nullable.
+   */
+  public void setNullable(boolean pNullable) { isNullable = pNullable; }
+  public boolean isNullable(SimpleTypeSG pController) { return isNullable; }
+
+  public void init(SimpleTypeSG pController) throws SAXException {
+  }
+
+  public String getCollectionType(SimpleTypeSG pController) {
+    return getSchema().getCollectionType();
+  }
+
+  public UnionTypeSG getUnionType(SimpleTypeSG pController) {
+    throw new IllegalStateException("This type is no union.");
+  }
+
+  public ListTypeSG getListType(SimpleTypeSG pController) {
+    throw new IllegalStateException("This type is no list.");
+  }
+
+  public AtomicTypeSG getAtomicType(SimpleTypeSG pController) {
+    throw new IllegalStateException("This type is not atomic.");
+  }
+
+  public Facet[] getFacets(SimpleTypeSG pController) {
+    return new Facet[0];
+  }
+
+  public Facet getFacet(SimpleTypeSG pController, Facet.Type pType) {
+    Facet[] facets = pController.getFacets();
+    for (int i = 0;  i < facets.length;  i++) {
+      Facet f = facets[i];
+      if (f.getType().equals(pType)) {
+        return f;
+      }
+    }
+    return null;
+  }
+
+  public void generate(SimpleTypeSG pController) {
+  }
+
+  public void generate(SimpleTypeSG pController, JavaSource pSource) {
+  }
+
+  public Object getInitialValue(SimpleTypeSG pController, JavaSource pSource) throws SAXException {
+    return null;
+  }
+
+  public JavaMethod getXMLSetMethod(SimpleTypeSG pController, JavaSource pSource,
+                                    String pFieldName, String pParamName, String pMethodName) throws SAXException {
+    if (pController.hasSetMethod()) {
+      JavaMethod jm = pSource.newJavaMethod(pMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
+      DirectAccessible param = jm.addParam(pController.getRuntimeType(), pParamName);
+      if (!pSource.isInterface()) {
+        pController.addValidation(jm, param);
+        jm.addLine(pFieldName, " = ", param, ";");
+      }
+      return jm;
+    } else {
+      return null;
+    }                                 
+  }
+
+  public void addValidation(SimpleTypeSG pController, JavaMethod pMethod, DirectAccessible pValue) throws SAXException {
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/StringSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/StringSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/StringSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.AtomicTypeSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class StringSG extends AtomicTypeSGImpl {
+  /** <p>Creates a new instance of StringTypeSG.java.</p>
+   */
+  public StringSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  /** The string type.
+   */
+  public final static JavaQName STRING_TYPE = JavaQNameImpl.getInstance(String.class);
+  protected String getDatatypeName() { return "String"; }
+  protected JavaQName getDatatypeType() { return STRING_TYPE; }
+
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return STRING_TYPE; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) {
+    return new TypedValueImpl(JavaSource.getQuoted(pValue), STRING_TYPE);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) {
+    return new TypedValueImpl(pValue, STRING_TYPE);
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
+    return new TypedValueImpl(pValue, STRING_TYPE);
+  }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(STRING_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+
+  	public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		final AtomicTypeSG atomicType = pController.getAtomicType();
+		/* See addValidation(SimpleTypeSG, JavaMethod, DirectAccessible) for
+		 * when an exception can be thrown.
+		 */
+		return atomicType.getLength() != null
+		   ||  atomicType.getMinLength() != null
+		   ||  atomicType.getMaxLength() != null;
+  	}
+
+    public void addValidation(SimpleTypeSG pController, JavaMethod pMethod, DirectAccessible pValue)
+			throws SAXException {
+		/* If you add additional checks here, you should possibly modify
+		 * the isCausingParseConversionEvent(SimpleTypeSG) method as well.
+		 */
+		final AtomicTypeSG atomicType = pController.getAtomicType();
+		Long length = atomicType.getLength();
+		Long maxLength = atomicType.getMaxLength();
+		Long minLength = atomicType.getMinLength();
+
+		if (minLength != null  &&  minLength.longValue() < 0) {
+			throw new LocSAXException("Negative value for minLength detected: " + minLength, getLocator());
+		}
+		if (maxLength != null) { 
+			if (maxLength.longValue() < 0) {
+				throw new LocSAXException("Negative value for maxLength detected: " + maxLength, getLocator());
+			}
+			if (minLength != null) {
+				if (maxLength.longValue() < minLength.longValue()) {
+					throw new LocSAXException("MaxLength value of " + maxLength + " is smaller than minLength value of " + minLength,
+							getLocator());
+				}
+				if (maxLength.longValue() == minLength.longValue()) {
+					length = maxLength;
+				}
+			}
+		}
+		if (length != null) { 
+			if (length.longValue() < 0) {
+				throw new LocSAXException("Negative value for length detected: " + length, getLocator());
+			}
+			if (maxLength != null) {
+				if (maxLength.longValue() < length.longValue()) {
+					throw new LocSAXException("MaxLength value of " + maxLength + " is smaller than length value of " + length,
+							getLocator());
+				}
+				maxLength = null;  // Avoid unnecessary checks
+			}
+			if (minLength != null) { 
+				if (minLength.longValue() > length.longValue()) { 
+					throw new LocSAXException("MinLength value of " + minLength + " is larger than length value of " + length,
+							getLocator());
+				}
+				minLength = null;  // Avoid unnecessary checks
+			}
+		}
+		
+		if (length != null  ||  maxLength != null  ||  minLength != null) {
+			if (pValue.isNullable()) {
+				pMethod.addIf(pValue, " != null");
+			}
+			if (maxLength != null) {
+				pMethod.addIf(pValue, ".length()", " > ", maxLength);
+				pMethod.addThrowNew(IllegalArgumentException.class,
+						JavaSource.getQuoted("Length of " + maxLength + " characters exceeded: "),
+											 " + ", pValue);
+				pMethod.addEndIf();
+			}
+			if (minLength != null) {
+				pMethod.addIf(pValue, ".length()", " < ", minLength);
+				pMethod.addThrowNew(IllegalArgumentException.class,
+						JavaSource.getQuoted("Minimum length of " + minLength + " characters not matched: "),
+											 " + ", pValue);
+				pMethod.addEndIf();
+			}
+			if (length != null) {
+				pMethod.addIf(pValue, ".length()", " != ", length);
+				pMethod.addThrowNew(IllegalArgumentException.class,
+						JavaSource.getQuoted("Length of " + length + " characters not matched: "),
+											 " + ", pValue);
+				pMethod.addEndIf();
+			}
+			if (pValue.isNullable()) {
+				pMethod.addEndIf();
+			}
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.util.Calendar;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.util.XsTimeFormat;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TimeSG extends DateTimeSG {
+
+  /** <p>Creates a new instance of TimeSG.</p>
+   */
+  public TimeSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected String getDatatypeName() { return "Time"; }
+  protected Class getFormatClass() { return XsTimeFormat.class; }
+  
+    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
+			throws SAXException {
+		try {
+			Calendar calendar = new DatatypeConverterImpl().parseTime(pValue);
+			return new TypedValueImpl(
+					new Object[] { "new java.util.GregorianCalendar("
+							+ calendar.get(Calendar.YEAR) + ","
+							+ calendar.get(Calendar.MONTH) + ","
+							+ calendar.get(Calendar.DAY_OF_MONTH) + ","
+							+ calendar.get(Calendar.HOUR_OF_DAY) + ","
+							+ calendar.get(Calendar.MINUTE) + ","
+							+ calendar.get(Calendar.SECOND) + ")" },
+					getDatatypeType());
+		} catch (RuntimeException e) {
+			try {
+				throw new LocSAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue, getLocator());
+			} catch (Exception e1) {
+				throw new SAXException("Failed to convert string value to "
+						+ getDatatypeName() + " instance: " + pValue);
+			}
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnionTypeSGImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnionTypeSGImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnionTypeSGImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGlet;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.UnionTypeSG;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class UnionTypeSGImpl extends SimpleTypeSGImpl {
+  public static final JavaQName OBJECT_TYPE = JavaQNameImpl.getInstance(Object.class);
+  private final XSUnionType unionType;
+  private final TypeSG[] memberTypes;
+  private final UnionTypeSG unionTypeSG;
+
+  /** <p>Creates a new instance of UnionTypeSG.</p>
+   */
+  public UnionTypeSGImpl(SGFactory pFactory, SchemaSG pSchema, XSType pType,
+                          Context pClassContext, XsQName pName) throws SAXException {
+    super(pFactory, pSchema, pType);
+    unionType = pType.getSimpleType().getUnionType();
+    XSType[] mTypes = unionType.getMemberTypes();
+    List members = new ArrayList();
+    for (int i = 0;  i < mTypes.length;  i++) {
+      TypeSG typeSG = getFactory().getTypeSG(mTypes[i], pClassContext, pName);
+      typeSG.getSimpleTypeSG().setNullable(true);
+      members.add(typeSG);
+    }
+    memberTypes = (TypeSG[]) members.toArray(new TypeSG[members.size()]);
+
+    unionTypeSG = new UnionTypeSG(){
+      public TypeSG[] getMemberTypes() { return UnionTypeSGImpl.this.getMemberTypes(); }
+    };
+  }
+
+  protected TypeSG[] getMemberTypes() { return memberTypes; }
+  public JavaQName getRuntimeType(SimpleTypeSG pController) { return OBJECT_TYPE; }
+  public boolean isUnion(SimpleTypeSG pController) { return true; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    Exception e = null;
+    for (int i = 0;  i < memberTypes.length;  i++) {
+      try {
+        return memberTypes[i].getSimpleTypeSG().getCastFromString(pValue);
+      } catch (Exception ex) {
+        if (i == 0) {
+          e = ex;
+        }
+      }
+    }
+    throw new LocSAXException("Failed to convert value " + pValue, getLocator(), e);
+  }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue,
+                                      Object pData) throws SAXException {
+    DirectAccessible value;
+    if (pValue instanceof DirectAccessible) {
+      value = (DirectAccessible) pValue;
+    } else {
+      LocalJavaField v = pMethod.newJavaField(String.class);
+      v.addLine(pValue);
+      value = v;
+    }
+
+    LocalJavaField result = pMethod.newJavaField(pController.getRuntimeType());
+    for (int i = 0;  i < memberTypes.length;  i++) {
+      pMethod.addTry();
+      pMethod.addLine(result, " = ", memberTypes[i].getSimpleTypeSG().getCastFromString(pMethod, value, pData), ";");
+      pMethod.addCatch(RuntimeException.class);
+    }
+    pMethod.addThrowNew(IllegalArgumentException.class,
+                        JavaSource.getQuoted("Invalid union value: "), " + ", pValue);
+    for (int i = 0;  i < memberTypes.length;  i++) {
+      pMethod.addEndTry();
+    }
+    return result;
+  }
+
+  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue,
+                                    DirectAccessible pData) throws SAXException {
+    DirectAccessible value;
+    if (pValue instanceof DirectAccessible) {
+      value = (DirectAccessible) pValue;
+    } else {
+      LocalJavaField v = pMethod.newJavaField(Object.class);
+      v.addLine(pValue);
+      value = v;
+    }
+
+    LocalJavaField result = pMethod.newJavaField(String.class);
+    for (int i = 0;  i < memberTypes.length;  i++) {
+      JavaQName memberRuntimeType = memberTypes[i].getSimpleTypeSG().getRuntimeType();
+      pMethod.addIf(i == 0, value, " instanceof ", memberRuntimeType);
+      Object v = OBJECT_TYPE.equals(memberRuntimeType) ?
+        (Object) value :
+        new Object[]{"((", memberRuntimeType, ") ", value, ")"};
+      pMethod.addLine(result, " = ", memberTypes[i].getSimpleTypeSG().getCastToString(pMethod, v, pData), ";");
+    }
+    pMethod.addElse();
+    pMethod.addThrowNew(IllegalStateException.class,
+                        JavaSource.getQuoted("Invalid union object type: "), " + ", value, ".getClass().getName()");
+    pMethod.addEndIf();
+
+    return result;
+  }
+
+  public UnionTypeSG getUnionType(SimpleTypeSG pController) { return unionTypeSG; }
+
+  public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    LocalJavaField f = pMethod.newJavaField(OBJECT_TYPE);
+    f.addLine(pValue);
+    pMethod.addIf(f, " != null");
+    pSGlet.generate(pMethod, pValue);
+    pMethod.addEndIf();
+  }
+
+  public void forAllValues(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, SGlet pSGlet) throws SAXException {
+    pSGlet.generate(pMethod, pValue);
+  }
+
+  public Object getEqualsCheck(SimpleTypeSG pController, JavaMethod pMethod, Object pValue1, Object pValue2) throws SAXException {
+    throw new IllegalStateException("Not implemented");
+  }
+
+    public boolean isCausingParseConversionEvent(SimpleTypeSG pController) {
+		for (int i = 0;  i < memberTypes.length;  i++) {
+			if (!memberTypes[i].getSimpleTypeSG().isCausingParseConversionEvent()) {
+				return false;
+			}
+		}
+		return true;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedIntSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedIntSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedIntSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class UnsignedIntSG extends LongSG {
+  /** <p>Creates a new instance of UnsignedIntSG.</p>
+   */
+  public UnsignedIntSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected boolean isUnsigned() { return true; }
+  protected String getDatatypeName() { return "UnsignedInt"; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Long(new DatatypeConverterImpl().parseUnsignedInt(pValue)) + "l", LONG_TYPE);
+    } catch (NumberFormatException e) {
+      throw new LocSAXException("Failed to convert string value to unsigned integer: " + pValue, getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedShortSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedShortSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/UnsignedShortSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.types;
+
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+import org.apache.ws.jaxme.js.impl.TypedValueImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class UnsignedShortSG extends IntSG {
+  /** <p>Creates a new instance of UnsignedShortSG.</p>
+   */
+  public UnsignedShortSG(SGFactory pFactory, SchemaSG pSchema, XSType pType) throws SAXException {
+    super(pFactory, pSchema, pType);
+  }
+
+  protected boolean isUnsigned() { return true; }
+  protected String getDatatypeName() { return "UnsignedShort"; }
+
+  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
+    try {
+      return new TypedValueImpl(new Integer(new DatatypeConverterImpl().parseUnsignedShort(pValue)), INT_TYPE);
+    } catch (NumberFormatException e) {
+      throw new LocSAXException("Failed to convert string value to unsigned short: " + pValue, getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/types/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.types Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+JaxMe type generation model implementations.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/DateFilter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/DateFilter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/DateFilter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.Writer;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+
+/** <p>Helper class, that filters a file by replacing certain
+ * patterns. Used by the test suite.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: DateFilter.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class DateFilter {
+  private File fromFile, toFile;
+  private boolean force;
+
+  public void setFromFile(File pFile) { fromFile = pFile; }
+  public File getFromFile() { return fromFile; }
+  public void setToFile(File pFile) { toFile = pFile; }
+  public File getToFile() { return toFile; }
+  public void setForce(boolean pForce) { force = pForce; }
+  public boolean getForce() { return force; }
+
+  public String validate() {
+    StringBuffer result = new StringBuffer();
+    if (fromFile == null) {
+      result.append("Input file (option fromFile) is not set.\n");
+    } else if (!fromFile.exists()) {
+      result.append("Input file " + fromFile + " doesn't exist.");
+    }
+    if (toFile == null) {
+      result.append("toFile is not set.\n");
+    }
+
+    if (result.length() > 0) {
+      return result.toString();
+    } else {
+      return null;
+    }
+  }
+
+  public boolean isRunning() {
+    if (getForce()) {
+      return true;
+    }
+
+    long l1 = fromFile.lastModified();
+    if (l1 == -1) {
+      return true;
+    }
+    long l2 = toFile.lastModified();
+    if (l2 == -1) {
+      return true;
+    }
+    return l2 <= l1;
+  }
+
+  public List getLines() throws IOException {
+    List result = new ArrayList();
+    BufferedReader br = new BufferedReader(new FileReader(getFromFile()));
+    for (;;) {
+      String s = br.readLine();
+      if (s == null) {
+        break;
+      }
+      result.add(s);
+    }
+    return result;
+  }
+
+  public Calendar getCalendar(String pDateTime, String pPattern)
+      throws ParseException {
+    DateFormat simpleFormat = new SimpleDateFormat(pPattern);
+    Calendar cal = Calendar.getInstance();
+    cal.setTime(simpleFormat.parse(pDateTime));
+    return cal;
+  }
+
+  public String replacePattern(String pPattern, String pSourceFormat,
+                                DateFormat pTargetFormat) throws ParseException {
+    return pTargetFormat.format(getCalendar(pPattern, pSourceFormat).getTime());
+  }
+
+  public String getDateTime(String pDateTime) throws ParseException {
+    return replacePattern(pDateTime, "yyyy-MM-dd HH:mm:ss",
+                           DateFormat.getDateTimeInstance());
+  }
+
+  public String getDate(String pDateTime) throws ParseException {
+    return replacePattern(pDateTime, "yyyy-MM-dd",
+                           DateFormat.getDateInstance());
+  }
+
+  public String getTime(String pDateTime) throws ParseException {
+    return replacePattern(pDateTime, "HH:mm:ss",
+                           DateFormat.getTimeInstance());
+  }
+
+  public void replace(List pLines, List fromStrings, List toStrings) {
+    for (ListIterator iter = pLines.listIterator();  iter.hasNext();  ) {
+      String s = (String) iter.next();
+      StringBuffer result = new StringBuffer();
+
+      while (s.length() > 0) {
+        boolean done = false;
+        for (int i = 0;  i < fromStrings.size();  i++) {
+          String from = (String) fromStrings.get(i);
+          if (s.startsWith(from)) {
+            result.append((String) toStrings.get(i));
+            s = s.substring(from.length());
+            done = true;
+            break;
+          }
+        }
+        if (!done) {
+          result.append(s.charAt(0));
+          s = s.substring(1);
+        }
+      }
+
+      iter.set(result.toString());
+    }
+  }
+
+  public void putLines(List pLines) throws IOException {
+	Writer fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(getToFile()), "UTF-8"));
+    for (Iterator iter = pLines.iterator();  iter.hasNext();  ) {
+      String s = (String) iter.next();
+      fw.write(s + "\n");
+    }
+    fw.close();
+  }
+
+  public void execute() throws IOException, ParseException {
+    if (!isRunning()) {
+      return;
+    }
+    List lines = getLines();
+
+    List fromStrings = new ArrayList();
+    List toStrings = new ArrayList();
+
+    fromStrings.add("2002-12-17 12:23:11");
+    toStrings.add(getDateTime("2002-12-17 12:23:11"));
+
+    fromStrings.add("2002-12-16 12:00:11");
+    toStrings.add(getDateTime("2002-12-16 12:00:11"));
+
+    fromStrings.add("2002-12-17");
+    toStrings.add(getDate("2002-12-17"));
+
+    fromStrings.add("2002-12-16");
+    toStrings.add(getDate("2002-12-16"));
+
+    fromStrings.add("12:23:11");
+    toStrings.add(getTime("12:23:11"));
+
+    fromStrings.add("12:00:11");
+    toStrings.add(getTime("12:00:11"));
+
+    replace(lines, fromStrings, toStrings);
+    putLines(lines);
+  }
+
+  public static void Usage(String pMsg) {
+    PrintStream ps = System.err;
+    if (pMsg != null) {
+      ps.println(pMsg);
+      ps.println();
+    }
+    ps.println("Usage: java " + DateFilter.class + " <options>");
+    ps.println();
+    ps.println("Possible options are:");
+    ps.println(" --fromFile <file>    Sets the input file");
+    ps.println(" --toFile <file>      Sets the output file");
+    ps.println(" --force              Forces overwriting of the output file");
+    System.exit(1);
+  }
+
+  public static void main(String[] args) throws Exception {
+    DateFilter filter = new DateFilter();
+    List argList = new ArrayList(Arrays.asList(args));
+    while (!argList.isEmpty()) {
+      String arg = (String) argList.remove(0);
+      String opt = null;
+      if (arg.startsWith("--")) {
+        opt = arg.substring(2);
+      } else if (arg.startsWith("-")) {
+        opt = arg.substring(1);
+      } else {
+        Usage("Unknown argument: " + arg);
+      }
+
+      if ("fromFile".equals(opt)) {
+        if (argList.isEmpty()) {
+          Usage("Option " + arg + " requires an argument: Input file");
+        }
+        filter.setFromFile(new File((String) argList.remove(0)));
+      } else if ("toFile".equals(opt)) {
+        if (argList.isEmpty()) {
+          Usage("Option " + arg + " requires an argument: Output file");
+        }
+        filter.setToFile(new File((String) argList.remove(0)));
+      } else if ("force".equals(opt)) {
+        filter.setForce(true);
+      } else {
+        Usage("Unknown option: " + opt);
+      }
+    }
+
+    String msg = filter.validate();
+    if (msg != null) {
+      Usage(msg);
+    } else {
+      filter.execute();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/JavaNamer.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/JavaNamer.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/JavaNamer.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.util;
+
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+
+
+/**
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class JavaNamer {
+  
+  /** punctuation characters defined in JAXB spec */
+  public static final char[] PUNCTUATION_CHARS = {'-', '.', ':', '_', '\u00B7', '\u0387', '\u06DD', '\u06DE'};
+
+  /**
+   * Check whether the given character is a punctuation one or not.
+   * 
+   * @param c character to check out
+   * @param pSchema hint for handling underscore
+   * @return true if c belongs to the punctuation characters, otherwise false.
+   */
+  public static boolean isPunctuationCharacter(char c, SchemaSG pSchema) {
+    for (int i = 0; i < PUNCTUATION_CHARS.length; i++) {
+      char pc = PUNCTUATION_CHARS[i];
+      if (pc == '_') {
+        if (!pSchema.isUnderscoreWordSeparator()) {
+          continue;
+        }
+      }
+      if (c == pc) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Convert a local part name in XML to a class or field name in Java.
+   * 
+   * @param pLocalName a given local name
+   * @param pSchema hint for following Java naming conventions and handling underscore
+   * @return the converted name based on the given hints.
+   */
+  
+  public static String convert(String pLocalName, SchemaSG pSchema) {
+    if (!pSchema.isJavaNamingConventionsEnabled()) {
+      return pLocalName;
+    }
+    StringBuffer result = new StringBuffer();
+    char c = pLocalName.charAt(0);
+    if (Character.isJavaIdentifierStart(c)) {
+      result.append(Character.toUpperCase(c));
+    } else {
+      result.append('_');
+    }
+    for (int i = 1;  i < pLocalName.length();  i++) {
+      c = pLocalName.charAt(i);
+      if (Character.isJavaIdentifierPart(c) && (c != '_')) {
+        result.append(c);
+      } else {
+        if (isPunctuationCharacter(c, pSchema)) {
+          i++;
+          c = pLocalName.charAt(i);
+          result.append(Character.toUpperCase(c));
+        } else {
+          result.append('_');
+        }
+      }
+    }
+    return result.toString();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/QNameUtil.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/QNameUtil.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/QNameUtil.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.generator.util;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** Utility class for working with instances of
+ * {@link javax.xml.namespace.QName}.
+ */
+public class QNameUtil {
+	/** Creates a new instance of {@link QName}, matching
+     * the given instance of {@link XsQName}.
+	 */
+    public static QName newQName(XsQName pXsQName) {
+        String prefix = pXsQName.getPrefix();
+        if (prefix == null) {
+        	return new QName(pXsQName.getNamespaceURI(), pXsQName.getLocalName());
+        } else {
+        	return new QName(pXsQName.getNamespaceURI(), pXsQName.getLocalName(),
+        			         pXsQName.getPrefix());
+        }
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/Reflect.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/Reflect.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/Reflect.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.util;
+
+
+
+/** <p>A set of utility methods for using Java reflection.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann
+ */
+public class Reflect {
+  /** <p>Assigns the value <code>pValue</code> to the beans
+   * <code>pBean</code> property <code>pPropertyName</code>.
+   * For example, if the property name is <samp>type</samp>
+   * and the String pValue is <samp>2</samp>, calls
+   * <pre>
+   *   pBean.setType("2");
+   * </pre>
+   * or
+   * <pre>
+   *   pBean.setType(2);
+   * </pre>
+   * if the respective method exists. Does nothing, if no
+   * matching method can be found.</p>
+   */
+  public static void assignBeanValue(Object pBean,
+                                       String pPropertyName,
+                                       String pValue)
+      throws IllegalAccessException, java.lang.reflect.InvocationTargetException {
+    assignBeanValue(pBean, pPropertyName, pValue, null);
+  }
+
+  /** <p>Assigns the value <code>pValue</code> to the beans
+   * <code>pBean</code> property <code>pPropertyName</code>.
+   * For example, if the property name is <samp>type</samp>
+   * and the String pValue is <samp>2</samp>, calls
+   * <pre>
+   *   pBean.setType("2");
+   * </pre>
+   * or
+   * <pre>
+   *   pBean.setType(2);
+   * </pre>
+   * if the respective method exists. Does nothing, if no
+   * matching method can be found.</p>
+   */
+  public static void assignBeanValue(Object pBean,
+                                       String pPropertyName,
+                                       String pValue,
+                                       ReflectResolver pResolver)
+      throws IllegalAccessException, java.lang.reflect.InvocationTargetException {
+    Class c = pBean.getClass();
+    java.lang.reflect.Method[] methods = c.getMethods();
+    String methodName = "set" + Character.toUpperCase(pPropertyName.charAt(0)) +
+      pPropertyName.substring(1);
+    for (int i = 0;  i < methods.length;  i++) {
+      java.lang.reflect.Method m = methods[i];
+      if (methodName.equals(m.getName())) {
+        Class[] parameterTypes = m.getParameterTypes();
+        if (parameterTypes.length == 1) {
+          Class parameterClass = parameterTypes[0];
+          Object[] parameters = null;
+          if (pResolver != null) {
+            parameters = pResolver.resolve(parameterClass, pValue);
+          }
+          if (parameters == null) {
+            if (parameterClass == String.class) {
+              parameters = new Object[]{pValue};
+            } else if (parameterClass == Long.class  ||
+                        parameterClass == long.class) {
+              parameters = new Object[]{new Long(pValue)};
+            } else if (parameterClass == Integer.class  ||
+                        parameterClass == int.class) {
+              parameters = new Object[]{new Integer(pValue)};
+            } else if (parameterClass == Short.class  ||
+                        parameterClass == short.class) {
+              parameters = new Object[]{new Short(pValue)};
+            } else if (parameterClass == Byte.class  ||
+                        parameterClass == byte.class) {
+              parameters = new Object[]{new Byte(pValue)};
+            } else if (parameterClass == Double.class  ||
+                        parameterClass == double.class) {
+              parameters = new Object[]{new Double(pValue)};
+            } else if (parameterClass == Float.class  ||
+                        parameterClass == float.class) {
+              parameters = new Object[]{new Float(pValue)};
+            } else if (parameterClass == Boolean.class  ||
+                        parameterClass == boolean.class) {
+              parameters = new Object[]{new Boolean(pValue)};
+            }
+          }
+          if (parameters != null) {
+            m.invoke(pBean, parameters);
+            return;
+          }
+        }
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/ReflectResolver.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/ReflectResolver.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/ReflectResolver.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.generator.util;
+
+/** <p>A helper class for <code>Reflect.assignBeanValue()</code>.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: ReflectResolver.java 231785 2004-02-16 23:39:59Z jochen $
+ * @see Reflect
+ */
+public interface ReflectResolver {
+  public Object[] resolve(Class pClass, String pValue);
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/generator/util/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.util Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains utility classes used by the <code>JaxMe</code> specific source generators.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/CharSetXMLWriter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/CharSetXMLWriter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/CharSetXMLWriter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+
+import javax.xml.bind.JAXBException;
+
+
+/** <p>A simple serializer for XML documents using the
+ * {@link java.nio.charset.Charset} from Java 1.4.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class CharSetXMLWriter extends XMLWriterImpl {
+  private CharsetEncoder charsetEncoder;
+
+  public void init(JMMarshallerImpl pController) throws JAXBException {
+    super.init(pController);
+    Charset charSet = Charset.forName(pController.getEncoding());
+    if (charSet.canEncode()) {
+      charsetEncoder = charSet.newEncoder();
+    }
+  }
+
+  public boolean canEncode(char c) {
+    return (charsetEncoder == null) ? false : charsetEncoder.canEncode(c);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/Configuration.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/Configuration.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/Configuration.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+
+
+/** <p>An instance of this class represents a config file.
+ * A JAXBContext requires an associated Configuration which
+ * is located through the classpath.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: Configuration.java 232067 2005-03-10 11:14:08 +0100 (Do, 10 Mrz 2005) jochen $
+ */
+public class Configuration {
+  JAXBContextImpl context;
+  Manager currentManager;
+  Map managers = new HashMap();
+  private Class jmMarshallerClass = JMMarshallerImpl.class;
+  private Class jmUnmarshallerClass = JMUnmarshallerImpl.class;
+  private Class jmValidatorClass = JMValidatorImpl.class;
+
+  public Configuration(JAXBContextImpl pContext) {
+    context = pContext;
+  }
+
+  public class Manager implements JMManager {
+    public class Property {
+      private String managerName;
+      private String value;
+
+      public String getName() { return managerName; }
+      public void setName(String pName) { managerName = pName; }
+      public String getValue() { return value; }
+      public void setValue(String pValue) { value = pValue; }
+      public void finish() throws SAXException {
+        if (managerName == null) {
+          throw new NullPointerException("Missing 'name' attribute in 'property' element.");
+        }
+        if (value == null) {
+          throw new NullPointerException("Missing 'value' attribute in 'property' element.");
+        }
+        if (properties == null) {
+          properties = new HashMap();
+        }
+        if (properties.put(managerName, value) != null) {
+          throw new IllegalStateException("The property " + managerName + " was specified more than once.");
+        }
+      }
+    }
+
+    private QName name;
+    private Class elementInterface;
+    private Class elementClass;
+    private Class handlerClass;
+    private Class driverClass;
+    private Class pmClass;
+	private String prefix;
+    private Map properties;
+
+	public String getPrefix() {
+		return prefix;
+	}
+	/** Sets the suggested prefix for the elements namespace.
+	 */
+	public void setPrefix(String prefix) {
+		this.prefix = prefix;
+	}
+	
+	public void setQName(QName pName) { name = pName; }
+    public QName getQName() { return name; }
+    public void setElementClass(String pElementClass) throws ClassNotFoundException {
+        elementClass = context.getClassLoader().loadClass(pElementClass);
+    }
+    public Class getElementClass() { return elementClass; }
+    public void setElementInterface(String pElementInterface) throws ClassNotFoundException {
+        elementInterface = context.getClassLoader().loadClass(pElementInterface);
+    }
+    public Class getElementInterface() { return elementInterface; }
+	public Class getHandlerClass() { return handlerClass; }
+	public void setHandlerClass(String pHandlerClass) throws ClassNotFoundException {
+        handlerClass = context.getClassLoader().loadClass(pHandlerClass);
+		if (!JMSAXElementParser.class.isAssignableFrom(handlerClass)) {
+			throw new IllegalStateException("The class " + handlerClass.getName()
+											+ " is not implementing "
+											+ JMSAXElementParser.class.getName());
+		}
+    }
+    public void setDriverClass(String pMarshallerClass) throws ClassNotFoundException {
+        driverClass = context.getClassLoader().loadClass(pMarshallerClass);
+		if (!JMSAXDriver.class.isAssignableFrom(driverClass)) {
+			throw new IllegalStateException("The class " + driverClass.getName()
+											+ " is not implementing "
+											+ JMSAXDriver.class.getName());
+		}
+    }
+	public Class getDriverClass() { return driverClass; }
+    public JMSAXDriver getDriver() throws SAXException {
+		try {
+			return (JMSAXDriver) driverClass.newInstance();
+		} catch (InstantiationException e) {
+			throw new SAXException("Unable to instantiate driver class " + driverClass.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new SAXException("Illegal access to driver class " + driverClass.getName(), e);
+		}
+	}
+	/** Sets the persistence manager class.
+	 */
+	public void setPmClass(String pPersistencyClass) throws ClassNotFoundException {
+        pmClass = context.getClassLoader().loadClass(pPersistencyClass);
+    }
+    public Class getPmClass() { return pmClass; }
+    public JAXBContextImpl getFactory() { return context; }
+    public Property createProperty() {
+      return new Property();
+    }
+    public String getProperty(String pName) {
+      if (pName == null) {
+        throw new IllegalArgumentException("The property name must not be null.");
+      }
+      if (properties == null) {
+        return null;
+      }
+      return (String) properties.get(pName);
+    }
+    public void finish() throws SAXException {
+      if (currentManager != this) {
+        throw new IllegalStateException("currentManager != this");
+      }
+      try {
+		  if (prefix != null) {
+			  name = new QName(name.getNamespaceURI(), name.getLocalPart(), prefix);
+		  }
+		  context.addManager(currentManager);
+		  currentManager = null;
+      } catch (Exception e) {
+        throw new SAXException(e.getMessage(), e);
+      }
+    }
+
+    public JMSAXElementParser getHandler() throws SAXException {
+		try {
+			return (JMSAXElementParser) handlerClass.newInstance();
+		} catch (InstantiationException e) {
+			throw new SAXException("Unable to instantiate handler class "
+								   + jmUnmarshallerClass.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new SAXException("Illegal access to handler class "
+								   + jmUnmarshallerClass.getName(), e);
+		}
+    }
+
+	public Object getElementJ() throws JAXBException {
+		try {
+			return elementClass.newInstance();
+		} catch (InstantiationException e) {
+			throw new JAXBException("Unable to instantiate handler class "
+								    + jmUnmarshallerClass.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new JAXBException("Illegal access to handler class "
+								    + jmUnmarshallerClass.getName(), e);
+		}
+    }
+
+	public Object getElementS() throws SAXException {
+		try {
+			return elementClass.newInstance();
+		} catch (InstantiationException e) {
+			throw new SAXException("Unable to instantiate handler class "
+								   + jmUnmarshallerClass.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new SAXException("Illegal access to handler class "
+								   + jmUnmarshallerClass.getName(), e);
+		}
+    }
+  }
+
+  /** <p>Creates a new Manager.</p>
+   */
+  public Manager createManager() {
+    if (currentManager != null) {
+      throw new IllegalStateException("currentManager != null");
+    }
+    currentManager = new Manager();
+    return currentManager;
+  }
+
+  /** <p>Sets the JMMarshaller class.</p>
+   */
+  public void setJMMarshallerClass(Class pJMMarshallerClass) {
+    jmMarshallerClass = pJMMarshallerClass;
+  }
+
+  /** <p>Returns the JMMarshaller class.</p>
+   */
+  public Class getJMMarshallerClass() {
+    return jmMarshallerClass;
+  }
+
+  /** <p>Sets the JMUnmarshaller class.</p>
+   */
+  public void setJMUnmarshallerClass(Class pJMUnmarshallerClass) {
+    jmUnmarshallerClass = pJMUnmarshallerClass;
+  }
+
+  /** <p>Returns the JMUnmarshaller class.</p>
+   */
+  public Class getJMUnmarshallerClass() {
+    return jmUnmarshallerClass;
+  }
+
+  /** <p>Sets the JMValidator class.</p>
+   */
+  public void setJMValidatorClass(Class pJMValidatorClass) {
+    jmValidatorClass = pJMValidatorClass;
+  }
+
+  public Class getJMValidatorClass() {
+    return jmValidatorClass;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/DatatypeConverterImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/DatatypeConverterImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/DatatypeConverterImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.ParsePosition;
+import java.util.Calendar;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.util.Base64Binary;
+import org.apache.ws.jaxme.util.Duration;
+import org.apache.ws.jaxme.util.HexBinary;
+import org.apache.ws.jaxme.xs.util.XsDateFormat;
+import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
+import org.apache.ws.jaxme.xs.util.XsTimeFormat;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DatatypeConverterImpl implements DatatypeConverterInterface {
+    public String parseString(String arg0) {
+        return arg0;
+    }
+    
+    public BigInteger parseInteger(String arg0) {
+        return new BigInteger(arg0);
+    }
+    
+    public int parseInt(String arg0) {
+        return Integer.parseInt(arg0);
+    }
+    
+    public long parseLong(String arg0) {
+        return Long.parseLong(arg0);
+    }
+    
+    public short parseShort(String arg0) {
+        return Short.parseShort(arg0);
+    }
+    
+    public BigDecimal parseDecimal(String arg0) {
+        return new BigDecimal(arg0);
+    }
+    
+    public float parseFloat(String arg0) {
+        return Float.parseFloat(arg0);
+    }
+    
+    public double parseDouble(String arg0) {
+        return Double.parseDouble(arg0);
+    }
+    
+    public boolean parseBoolean(String arg0) {
+        return Boolean.valueOf(arg0).booleanValue();
+    }
+    
+    public byte parseByte(String arg0) {
+        return Byte.parseByte(arg0);
+    }
+    
+    public QName parseQName(String arg0, NamespaceContext arg1) {
+        int offset = arg0.indexOf(':');
+        String uri;
+        String localName;
+        switch (offset) {
+            case -1:
+                localName = arg0;
+                uri = arg1.getNamespaceURI("");
+                if (uri == null) {
+                    // Should not happen, indicates an error in the NamespaceContext implementation
+                    throw new IllegalArgumentException("The default prefix is not bound.");
+                }
+                break;
+               case 0:
+                   throw new IllegalArgumentException("Default prefix must be indicated by not using a colon: " + arg0);
+                  default:
+                      String prefix = arg0.substring(0, offset);
+                      localName = arg0.substring(offset+1);
+                      uri = arg1.getNamespaceURI(prefix);
+                      if (uri == null) {
+                          throw new IllegalArgumentException("The prefix " + prefix + " is not bound.");
+                      }
+        }
+        return new QName(uri, localName);
+    }
+
+    public Calendar parseDateTime(String arg0) {
+        XsDateTimeFormat format = new XsDateTimeFormat();
+        ParsePosition pos = new ParsePosition(0);
+        Calendar cal = (Calendar) format.parseObject(arg0, pos);
+        if (cal == null) {
+            throw new IllegalArgumentException("Failed to parse dateTime " + arg0 +
+                    						   " at:" + arg0.substring(pos.getErrorIndex()));
+        }
+        return cal;
+    }
+
+    public byte[] parseBase64Binary(String arg0) {
+        try {
+            return Base64Binary.decode(arg0);
+        } catch (IOException e) {
+            throw new IllegalArgumentException("Failed to parse " + arg0 + ": " +
+                    e.getMessage());
+        }
+    }
+    
+    public byte[] parseHexBinary(String arg0) {
+        return HexBinary.decode(arg0);
+    }
+    
+    private static final long MAX_UNSIGNED_INT = (((long) Integer.MAX_VALUE) * 2) + 1; 
+    public long parseUnsignedInt(String arg0) {
+        long l = Long.parseLong(arg0);
+        if (l < 0) {
+            throw new IllegalArgumentException("Failed to parse UnsignedInt " + arg0 + ": result is negative");
+        }
+        if (l > MAX_UNSIGNED_INT) {
+            throw new IllegalArgumentException("Failed to parse UnsignedInt " + arg0 +
+                    ": result exceeds maximum value " + MAX_UNSIGNED_INT);
+        }
+        return l;
+    }
+    
+    private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
+    public int parseUnsignedShort(String arg0) {
+        int i = Integer.parseInt(arg0);
+        if (i < 0) {
+            throw new IllegalArgumentException("Failed to parse UnsignedShort " + arg0 + ": result is negative");
+        }
+        if (i > MAX_UNSIGNED_SHORT) {
+            throw new IllegalArgumentException("Failed to parse UnsignedShort " + arg0 +
+                    ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
+        }
+        return i;
+    }
+
+  	public Calendar parseTime(String arg0) {
+  	    XsTimeFormat format = new XsTimeFormat();
+  	    ParsePosition pos = new ParsePosition(0);
+  	    Calendar cal = (Calendar) format.parseObject(arg0, pos);
+  	    if (cal == null) {
+  	        throw new IllegalArgumentException("Failed to parse time " + arg0 +
+  	                						   " at:" + arg0.substring(pos.getErrorIndex()));
+  	    }
+  	    return cal;
+  	}
+
+  	public Calendar parseDate(String arg0) {
+  	    XsDateFormat format = new XsDateFormat();
+  	    ParsePosition pos = new ParsePosition(0);
+  	    Calendar cal = (Calendar) format.parseObject(arg0, pos);
+  	    if (cal == null) {
+  	        throw new IllegalArgumentException("Failed to parse date " + arg0 +
+  	                						   " at:" + arg0.substring(pos.getErrorIndex()));
+  	    }
+  	    return cal;
+  	}
+
+  	public String parseAnySimpleType(String arg0) {
+  	    return arg0;
+  	}
+  	
+  	public Duration parseDuration(String pDuration) {
+  	    return Duration.valueOf(pDuration);
+  	}
+  	
+  	public String printString(String arg0) {
+  	    return arg0;
+  	}
+  	
+  	public String printInteger(BigInteger arg0) {
+  	    return arg0.toString();
+  	}
+  	
+  	public String printInt(int arg0) {
+  	    return Integer.toString(arg0);
+  	}
+  	
+  	public String printLong(long arg0) {
+  	    return Long.toString(arg0);
+  	}
+  	
+  	public String printShort(short arg0) {
+  	    return Short.toString(arg0);
+  	}
+  	
+  	public String printDecimal(BigDecimal arg0) {
+  	    return arg0.toString();
+  	}
+  	
+  	public String printFloat(float arg0) {
+  	    return Float.toString(arg0);
+  	}
+  	
+  	public String printDouble(double arg0) {
+  	    return Double.toString(arg0);
+  	}
+
+  	public String printBoolean(boolean arg0) {
+  	    return (arg0 ? Boolean.TRUE : Boolean.FALSE).toString();
+  	}
+
+  	public String printByte(byte arg0) {
+  	    return Byte.toString(arg0);
+  	}
+
+  	public String printQName(QName arg0, NamespaceContext arg1) {
+  	    String prefix = arg1.getPrefix(arg0.getNamespaceURI());
+  	    if (prefix == null) {
+  	        throw new IllegalArgumentException("The namespace URI " +
+  	                						   arg0.getNamespaceURI() +
+                                          	   " is not bound.");
+  	    } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
+  	        return arg0.getLocalPart();
+  	    } else {
+  	        return prefix + ":" + arg0.getLocalPart();
+  	    }
+  	}
+
+    public String printDateTime(Calendar arg0) {
+        return new XsDateTimeFormat().format(arg0);
+    }
+
+    public String printBase64Binary(byte[] arg0) {
+        return Base64Binary.encode(arg0);
+    }
+
+  	public String printHexBinary(byte[] arg0) {
+  	    return HexBinary.encode(arg0);
+  	}
+
+  	public String printUnsignedInt(long arg0) {
+  	    return Long.toString(arg0);
+  	}
+
+  	public String printUnsignedShort(int arg0) {
+  	    return Integer.toString(arg0);
+  	}
+
+  	public String printTime(Calendar arg0) {
+  	    return new XsTimeFormat().format(arg0);
+  	}
+
+  	public String printDate(Calendar arg0) {
+  	    return new XsDateFormat().format(arg0);
+  	}
+
+  	public String printAnySimpleType(String arg0) {
+  	    return arg0;
+  	}
+
+  	public String printDuration(Duration pDuration) {
+  	    return pDuration.toString();
+  	}
+}
+
+

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JAXBContextImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JAXBContextImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JAXBContextImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,476 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.xml.bind.DatatypeConverter;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.MarshalException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.UnmarshalException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationException;
+import javax.xml.bind.Validator;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.JMMarshaller;
+import org.apache.ws.jaxme.JMUnmarshaller;
+import org.apache.ws.jaxme.JMValidator;
+import org.apache.ws.jaxme.PM;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.util.Configurator;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>JaxMe's implementation of a JAXBContext.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBContextImpl.java 232067 2005-03-10 11:14:08 +0100 (Do, 10 Mrz 2005) jochen $
+ */
+public class JAXBContextImpl extends JAXBContext {
+    /** The namespace of JaxMe's configuration files.
+     */
+	public static final String CONFIGURATION_URI = "http://ws.apache.org/jaxme/namespaces/jaxme2/configuration";
+	private static final SAXParserFactory spf;
+	private static final DatatypeConverterImpl datatypeConverter = new DatatypeConverterImpl();
+	private ClassLoader cl;
+	private String packageNames;
+	private Map managersByQName = new HashMap();
+	private Map managersByInterface = new HashMap();
+	private Class jmMarshallerClass;
+	private Class jmUnmarshallerClass;
+	private Class jmValidatorClass;
+
+	static {
+		spf = SAXParserFactory.newInstance();
+		spf.setValidating(false);
+		spf.setNamespaceAware(true);
+		DatatypeConverter.setDatatypeConverter(datatypeConverter);
+	}
+
+	protected JAXBContextImpl() {}
+
+	/** <p>Sets the ClassLoader to use.</p>
+	 */
+	protected void setClassLoader(ClassLoader pClassLoader) {
+		cl = pClassLoader;
+	}
+
+	/** <p>Returns the ClassLoader to use.</p>
+	 */
+	public ClassLoader getClassLoader() {
+		return cl;
+	}
+
+	/** <p>Sets the package names managed by this context.</p>
+	 */
+	protected void setPackageNames(String pPackageNames) {
+		packageNames = pPackageNames;
+	}
+
+	/** <p>Returns the package names managed by this context.</p>
+	 */
+	public String getPackageNames() {
+		return packageNames;
+	}
+
+	/** <p>Sets the JMMarshaller class to use.</p>
+	 */
+	protected void setJMMarshallerClass(Class pClass) {
+		jmMarshallerClass = pClass;
+	}
+
+	/** <p>Returns the JMMarshaller class to use.</p>
+	 */
+	public Class getJMMarshallerClass() {
+		return jmMarshallerClass;
+	}
+
+	/** <p>Sets the JMUnmarshaller class to use.</p>
+	 */
+	protected void setJMUnmarshallerClass(Class pClass) {
+		jmUnmarshallerClass = pClass;
+	}
+
+	/** <p>Sets the JMUnmarshaller class to use.</p>
+	 */
+	public Class getJMUnmarshallerClass() {
+		return jmUnmarshallerClass;
+	}
+
+	/** <p>Sets the JMValidator class to use.</p>
+	 */
+	protected void setJMValidatorClass(Class pClass) {
+		jmValidatorClass = pClass;
+	}
+
+	/** <p>Returns the JMValidator class to use.</p>
+	 */
+	public Class getJMValidatorClass() {
+		return jmValidatorClass;
+	}
+
+	public Marshaller createMarshaller() throws JAXBException {
+		Class c = getJMMarshallerClass();
+		try {
+			JMMarshaller marshaller = (JMMarshaller) c.newInstance();
+			marshaller.setJAXBContextImpl(this);
+			return marshaller;
+		} catch (InstantiationException e) {
+			throw new JAXBException("Failed to instantiate class " + c.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new JAXBException("Illegal access to class " + c.getName(), e);
+		} catch (ClassCastException e) {
+			throw new JAXBException("Class " + c.getName() +
+					" is not implementing " +
+					JMMarshaller.class.getName());
+		}
+	}
+
+	public Unmarshaller createUnmarshaller() throws JAXBException {
+		Class c = getJMUnmarshallerClass();
+		try {
+			JMUnmarshaller unmarshaller = (JMUnmarshaller) c.newInstance();
+			unmarshaller.setJAXBContextImpl(this);
+			return unmarshaller;
+		} catch (InstantiationException e) {
+			throw new JAXBException("Failed to instantiate class " + c.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new JAXBException("Illegal access to class " + c.getName(), e);
+		} catch (ClassCastException e) {
+			throw new JAXBException("Class " + c.getName() +
+					" is not implementing " +
+					JMUnmarshaller.class.getName());
+		}
+	}
+
+	public Validator createValidator() throws JAXBException {
+		Class c = getJMValidatorClass();
+		try {
+			JMValidator validator = (JMValidator) c.newInstance();
+			validator.setJAXBContextImpl(this);
+			return validator;
+		} catch (InstantiationException e) {
+			throw new JAXBException("Failed to instantiate class " + c.getName(), e);
+		} catch (IllegalAccessException e) {
+			throw new JAXBException("Illegal access to class " + c.getName(), e);
+		} catch (ClassCastException e) {
+			throw new JAXBException("Class " + c.getName() +
+					" is not implementing " +
+					JMValidator.class.getName());
+		}
+	}
+
+	protected JMManager getManagerByQName(QName pQName) {
+		return (JMManager) managersByQName.get(pQName);
+	}
+
+	protected JMManager getManagerByInterface(Class pElementInterface) {
+		return (JMManager) managersByInterface.get(pElementInterface);
+	}
+
+	/** Returns a Manager for the given QName.
+	 *
+	 * @throws JAXBException No Manager is registered for the
+	 *   given QName.
+	 */
+	public JMManager getManager(QName pQName) throws JAXBException {
+		JMManager manager = getManagerByQName(pQName);
+		if (manager == null) {
+			throw new JAXBException("A Manager for " + pQName + " is not declared.");
+		}
+		return manager;
+	}
+
+	/** Returns a Manager for the given element interface.
+	 * Same method than {@link #getManager(Class)}, except that it
+	 * throws a {@link JAXBException}.
+	 * @throws JAXBException No Manager is registered for the
+	 *   given QName.
+	 * @see #getManagerS(Class)
+	 */
+	public JMManager getManager(Class pElementInterface) throws JAXBException {
+		JMManager manager = getManagerByInterface(pElementInterface);
+		if (manager == null) {
+			throw new JAXBException("A Manager for " + pElementInterface.getName() +
+			" is not declared.");
+		}
+		return manager;
+	}
+
+	/** Returns a Manager for the given element interface.
+	 * Same method than {@link #getManager(Class)}, except that it
+	 * throws a {@link SAXException}.
+	 * @throws SAXException No Manager is registered for the
+	 *   given QName.
+	 * @see #getManager(Class)
+	 */
+	public JMManager getManagerS(Class pElementInterface) throws SAXException {
+		JMManager manager = getManagerByInterface(pElementInterface);
+		if (manager == null) {
+			throw new SAXException("A Manager for " + pElementInterface.getName() +
+								   " is not declared.");
+		}
+		return manager;
+	}
+
+  /** <p>Returns a new JMMarshaller.</p>
+   */
+  public JMMarshaller getJMMarshaller() throws MarshalException {
+    Class c = getJMMarshallerClass();
+    if (c == null) {
+      throw new MarshalException("A JMMarshaller class is not set.");
+    }
+    try {
+      return (JMMarshaller) c.newInstance();
+    } catch (Exception e) {
+      throw new MarshalException("Failed to instantiate JMMarshaller class " + c, e);
+    }
+  }
+
+  /** <p>Returns a new JMUnmarshaller.</p>
+   */
+  public JMUnmarshaller getJMUnmarshaller() throws UnmarshalException {
+    Class c = getJMUnmarshallerClass();
+    if (c == null) {
+      throw new UnmarshalException("A JMUnmarshaller class is not set.");
+    }
+    try {
+      return (JMUnmarshaller) c.newInstance();
+    } catch (Exception e) {
+      throw new UnmarshalException("Failed to instantiate JMUnmarshaller class " + c, e);
+    }
+  }
+
+  /** <p>Returns a new JMValidator.</p>
+   */
+  public JMValidator getJMValidator() throws ValidationException {
+    Class c = getJMValidatorClass();
+    if (c == null) {
+      throw new ValidationException("A JMValidator class is not set.");
+    }
+    try {
+      return (JMValidator) c.newInstance();
+    } catch (Exception e) {
+      throw new ValidationException("Failed to instantiate JMValidator class " + c, e);
+    }
+  }
+
+  /** <p>Returns a new instance of JMPM.</p>
+   */
+  public PM getJMPM(Class pElementInterface) throws PMException {
+    JMManager manager = getManagerByInterface(pElementInterface);
+    Class c = manager.getPmClass();
+    if (c == null) {
+      throw new PMException("No persistency class configured for " +
+                             pElementInterface.getName());
+    }
+    try {
+      PM pm = (PM) c.newInstance();
+      pm.init(manager);
+      return pm;
+    } catch (Exception e) {
+      e.printStackTrace(System.err);
+      throw new PMException("Could not instantiate persistence manager class " +
+                             c.getName(), e);
+    }
+  }
+
+  /** <p>Returns a new instance of JMPM.</p>
+   */
+  public PM getJMPM(QName pQName) throws PMException {
+    JMManager manager = getManagerByQName(pQName);
+    Class c = manager.getPmClass();
+    if (c == null) {
+      throw new PMException("No persistency class configured for " + pQName);
+    }
+    try {
+      PM pm = (PM) c.newInstance();
+      pm.init(manager);
+      return pm;
+    } catch (Exception e) {
+      throw new PMException("Could not instantiate persistence manager class " +
+                             c.getName(), e);
+    }
+  }
+
+  /** <p>Initializes the context by loading the configuration
+   * or the configurations from the given classpath.</p>
+   */
+  protected void init() throws JAXBException {
+    if (packageNames == null  ||  packageNames.length() == 0) {
+      packageNames = JAXBContextImpl.class.getName();
+      packageNames = packageNames.substring(0, packageNames.lastIndexOf('.'));
+    }
+    boolean first = true;
+    for (StringTokenizer st = new StringTokenizer(packageNames, ":");
+         st.hasMoreTokens();  ) {
+      String packageName = st.nextToken();
+      String configFileName = 
+        ((packageName.length() > 0) ?
+          (packageName.replace('.', '/') + '/') : "") + "Configuration.xml";
+      URL url = getClassLoader().getResource(configFileName);
+      if (url != null) {
+        InputStream istream = null;
+        try {
+          Configuration c = new Configuration(this);
+          Configurator configurator = new Configurator();
+          configurator.setNamespace(CONFIGURATION_URI);
+          configurator.setRootObject(c);
+          SAXParser sp = spf.newSAXParser();
+          XMLReader xr = sp.getXMLReader();
+          xr.setContentHandler(configurator);
+          istream = url.openStream();
+          InputSource isource = new InputSource(istream);
+          isource.setSystemId(url.toString());
+          xr.parse(isource);
+          istream.close();
+          istream = null;
+
+          if (first) {
+            first = false;
+            setJMMarshallerClass(c.getJMMarshallerClass());
+            setJMUnmarshallerClass(c.getJMUnmarshallerClass());
+            setJMValidatorClass(c.getJMValidatorClass());
+          }
+        } catch (IOException e) {
+          throw new JAXBException("Failed to load config file " + url, e);
+        } catch (SAXParseException e) {
+          Exception f = e.getException() == null ? e : e.getException();
+          throw new JAXBException("Failed to parse config file " + url +
+                                   " at line " + e.getLineNumber() +
+                                   ", column " + e.getColumnNumber() +
+                                   ": " + f.getMessage(), f);
+        } catch (SAXException e) {
+          Exception f = e.getException() == null ? e : e.getException();
+          String msg = "Failed to parse config file " + url +": " + f.getMessage();
+          throw new JAXBException(msg, f);
+        } catch (ParserConfigurationException e) {
+          throw new JAXBException("Failed to create a SAX Parser: " + e.getMessage(), e);
+        } finally {
+          if (istream != null) { try { istream.close(); } catch (Throwable ignore) {} }
+        }
+      }
+    }
+    if (first) {
+      throw new JAXBException("Unable to locate configuration file Configuration.xml in " + packageNames);
+    }
+  }
+
+  /** Creates a new instance of {@link javax.xml.bind.JAXBContext}.
+   * Invoked implicitly by
+   * {@link javax.xml.bind.JAXBContext#newInstance(java.lang.String)}.
+   */
+  public static JAXBContextImpl createContext() throws JAXBException {
+    return createContext(null, JAXBContextImpl.class.getClassLoader());
+  }
+
+  /** Invoked from the SAX handler when loading the config file.
+   */
+  public Configuration createConfiguration(Attributes pAttributes) throws JAXBException {
+    String className = pAttributes.getValue("", "className");
+    if (className == null  ||  className.length() == 0) {
+      return new Configuration(this);
+    } else {
+      try {
+        return (Configuration) cl.loadClass(className).newInstance();
+      } catch (Exception e) {
+        throw new JAXBException("Failed to instantiate Configuration class " + className, e);
+      }
+    }
+  }
+
+  private static boolean verbose = true;
+  private static void showException(Exception e) {
+    if (!verbose) { return; }
+    System.err.println("Exception catched in " + JAXBContextImpl.class.getName() +
+                       ".createContext().");
+    System.err.println("Set " + JAXBContextImpl.class.getName() +
+                       ".verbose = false to suppress this message.");
+    e.printStackTrace(System.err);
+  }
+
+  /** Creates a new instance of {@link javax.xml.bind.JAXBContext}.
+   * Invoked implicitly by
+   * {@link javax.xml.bind.JAXBContext#newInstance(String, ClassLoader)}
+   */
+  public static JAXBContextImpl createContext(String pPackageNames,
+                                              ClassLoader pClassLoader)
+      throws JAXBException {
+    try {
+       JAXBContextImpl result = new JAXBContextImpl();
+       result.setClassLoader(pClassLoader);
+       result.setPackageNames(pPackageNames);
+       result.init();
+       return result;
+    } catch (RuntimeException e) {
+      showException(e);
+      throw e;
+    } catch (JAXBException e) {
+      showException(e);
+      throw e;
+    }
+  }
+
+  /** Invoked from the SAX handler when reading the config file
+   * for adding another instance of JMManager.
+   */
+  public void addManager(JMManager pManager) throws JAXBException {
+    Class elementInterface = pManager.getElementInterface();
+    if (elementInterface == null) {
+      throw new JAXBException("The Manager must have its elementInterface set.");
+    }
+    if (managersByInterface.containsKey(elementInterface)) {
+      throw new JAXBException("A Manager for interface " +
+                               elementInterface.getName() +
+                               " is already set.");
+    }
+
+	if (pManager.getDriverClass() == null) {
+		throw new IllegalStateException("Missing driver class for " + pManager.getQName());
+	}
+	if (pManager.getHandlerClass() == null) {
+		throw new IllegalStateException("Missing driver class for " + pManager.getQName());
+	}
+	
+    QName qName = pManager.getQName();
+    if (qName != null  &&  managersByQName.containsKey(qName)) {
+      throw new JAXBException("A Manager for document type " + qName +
+                               " is already set.");
+    }
+
+    managersByInterface.put(elementInterface, pManager);
+    if (qName != null) {
+      managersByQName.put(qName, pManager);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMControllerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMControllerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMControllerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.text.Format;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.ValidationEventHandler;
+
+import org.apache.ws.jaxme.xs.util.XsDateFormat;
+import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
+import org.apache.ws.jaxme.xs.util.XsTimeFormat;
+
+
+
+/** <p>Common subclass for JMMarshallerImpl, JMUnmarshallerImpl and
+ * JMValidatorImpl.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JMControllerImpl.java 279090 2005-09-06 22:26:11 +0200 (Di, 06 Sep 2005) jochen $
+ */
+public abstract class JMControllerImpl {
+    /** Property prefix for users private settings:
+	 * "jaxme.private.". If a property
+	 * name starts with this prefix, then the property value is
+	 * stored in an internal Map.
+	 */
+	public static final String JAXME_PRIVATE = "jaxme.private.";
+	
+	/** Name of the property for setting the
+	 * {@link javax.xml.bind.DatatypeConverterInterface}: "jaxme.datatypeConverter".
+	 */
+	public static final String JAXME_DATATYPE_CONVERTER = "jaxme.datatypeConverter";
+	
+	/** Property for setting an instance of {@link java.text.Format},
+	 * which is being used for parsing and printing <code>xs:dateTime</code>
+	 * values. Defaults to an instance of
+	 * {@link org.apache.ws.jaxme.xs.util.XsDateTimeFormat}.
+	 */
+	public static final String JAXME_FORMAT_DATETIME = "jaxme.format.dateTime";
+	
+	/** Property for setting an instance of {@link java.text.Format},
+	 * which is being used for parsing and printing <code>xs:date</code>
+	 * values. Defaults to an instance of
+	 * {@link org.apache.ws.jaxme.xs.util.XsDateFormat}.
+	 */
+	public static final String JAXME_FORMAT_DATE = "jaxme.format.date";
+	
+	/** Property for setting an instance of {@link java.text.Format},
+	 * which is being used for parsing and printing <code>xs:time</code>
+	 * values. Defaults to an instance of
+	 * {@link org.apache.ws.jaxme.xs.util.XsTimeFormat}.
+	 */
+	public static final String JAXME_FORMAT_TIME = "jaxme.format.time";
+	
+	private Map privateMap;
+	private JAXBContextImpl context;
+	private DatatypeConverterInterface datatypeConverter = new DatatypeConverterImpl();
+	private Format dateTimeFormat, dateFormat, timeFormat;
+	
+	/** Sets the property <code>pProperty</code> to the value
+	 * <code>pValue</code>.
+	 */
+	public void setProperty(String pProperty, Object pValue)
+	throws PropertyException {
+		if (pProperty.startsWith(JAXME_PRIVATE)) {
+			if (privateMap == null) {
+				privateMap = new HashMap();
+			}
+			privateMap.put(pProperty, pValue);
+			return;
+		} else if (pProperty.equals(JAXME_DATATYPE_CONVERTER)) {
+			datatypeConverter = (DatatypeConverterInterface) pValue;
+			return;
+		} else if (JAXME_FORMAT_DATETIME.equals(pProperty)) {
+			setDateTimeFormat((Format) pValue);
+			return;
+		} else if (JAXME_FORMAT_DATE.equals(pProperty)) {
+			setDateFormat((Format) pValue);
+			return;
+		} else if (JAXME_FORMAT_TIME.equals(pProperty)) {
+			setTimeFormat((Format) pValue);
+			return;
+		}
+		
+		throw new PropertyException("Unknown property: " + pProperty);
+	}
+	
+	/** Returns the value for property <code>pProperty</code>.
+	 */
+	public Object getProperty(String pProperty) throws PropertyException {
+		if (pProperty.startsWith(JAXME_PRIVATE)) {
+			if (privateMap == null) { return null; }
+			return privateMap.get(pProperty);
+		} else if (pProperty.equals(JAXME_DATATYPE_CONVERTER)) {
+			return datatypeConverter;
+		} else if (JAXME_FORMAT_DATETIME.equals(pProperty)) {
+			return getDateTimeFormat();
+		} else if (JAXME_FORMAT_DATE.equals(pProperty)) {
+			return getDateFormat();
+		} else if (JAXME_FORMAT_TIME.equals(pProperty)) {
+			return getTimeFormat();
+		}
+		
+		throw new PropertyException("Unknown property: " + pProperty);
+	}
+	
+	protected ValidationEventHandler eventHandler;
+	
+	/** Returns a users event handler for validation events, if any.
+	 * Defaults to null.
+	 * @see #setEventHandler(ValidationEventHandler)
+	 */
+	public ValidationEventHandler getEventHandler() { return eventHandler; }
+	
+	/** Sets a users event handler for validation events.
+	 * Defaults to null.
+	 * @see #getEventHandler()
+	 */
+	public void setEventHandler(ValidationEventHandler pEventHandler) { eventHandler = pEventHandler; }
+	
+	/** Sets the marshallers or unmarshallers
+	 * {@link javax.xml.bind.JAXBContext}. This is used mainly as an
+	 * object factory.
+	 */
+	public void setJAXBContextImpl(JAXBContextImpl pContext) { context = pContext; }
+	/** Returns the marshallers or unmarshallers
+	 * {@link javax.xml.bind.JAXBContext}. This is used mainly as an
+	 * object factory.
+	 */
+	public JAXBContextImpl getJAXBContextImpl() { return context; }
+	
+	/** Sets the marshallers or unmarshallers datatype converter.
+	 * Defaults to an instance of {@link DatatypeConverterImpl}.
+	 */
+	public void setDatatypeConverter(DatatypeConverterInterface pConverter) { datatypeConverter = pConverter; }
+	/** Returns the marshallers or unmarshallers datatype converter.
+	 * Defaults to an instance of {@link DatatypeConverterImpl}.
+	 */
+	public DatatypeConverterInterface getDatatypeConverter() { return datatypeConverter; }
+	
+	/** <p>Sets the {@link java.text.Format} for parsing and printing
+	 * <code>xs:dateTime</code> values.</p>
+	 * @param pFormat An instance of {@link java.text.DateFormat} or an
+	 *   instance of {@link org.apache.ws.jaxme.xs.util.XsDateTimeFormat}
+	 *   (default).
+	 */
+	public void setDateTimeFormat(Format pFormat) {
+		dateTimeFormat = pFormat;
+	}
+	
+	/** <p>Returns the {@link java.text.Format} for parsing and printing
+	 * <code>xs:dateTime</code> values.</p>
+	 * @return An instance of {@link java.text.DateFormat} or an
+	 *   instance of {@link org.apache.ws.jaxme.xs.util.XsDateTimeFormat}
+	 *   (default).
+	 */
+	public Format getDateTimeFormat() {
+		if (dateTimeFormat == null) {
+			dateTimeFormat = new XsDateTimeFormat();
+		}
+		return dateTimeFormat;
+	}
+	
+	/** <p>Sets the {@link java.text.Format} for parsing and printing
+	 * <code>xs:date</code> values.</p>
+	 * @param pFormat An instance of {@link java.text.DateFormat} or an
+	 *   instance of {@link org.apache.ws.jaxme.xs.util.XsDateFormat}
+	 *   (default).
+	 */
+	public void setDateFormat(Format pFormat) {
+		dateFormat = pFormat;
+	}
+	
+	/** <p>Returns the {@link java.text.Format} for parsing and printing
+	 * <code>xs:date</code> values.</p>
+	 * @return An instance of {@link java.text.DateFormat} or an
+	 *   instance of {@link org.apache.ws.jaxme.xs.util.XsDateFormat}
+	 *   (default).
+	 */
+	public Format getDateFormat() {
+		if (dateFormat == null) {
+			dateFormat = new XsDateFormat();
+		}
+		return dateFormat;
+	}
+	
+	/** <p>Sets the {@link java.text.Format} for parsing and printing
+	 * <code>xs:date</code> values.</p>
+	 * @param pFormat An instance of {@link java.text.DateFormat} or an
+	 *   instance of {@link org.apache.ws.jaxme.xs.util.XsDateFormat}
+	 *   (default).
+	 */
+	public void setTimeFormat(Format pFormat) {
+		timeFormat = pFormat;
+	}
+	
+	/** <p>Returns the {@link java.text.Format} for parsing and printing
+	 * <code>xs:time</code> values.</p>
+	 * @return An instance of {@link java.text.DateFormat} or an
+	 *   instance of {@link org.apache.ws.jaxme.xs.util.XsTimeFormat}
+	 *   (default).
+	 */
+	public Format getTimeFormat() {
+		if (timeFormat == null) {
+			timeFormat = new XsTimeFormat();
+		}
+		return timeFormat;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMMarshallerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMMarshallerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMMarshallerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,433 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.MarshalException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.ws.jaxme.*;
+import org.apache.ws.jaxme.JMElement;
+import org.apache.ws.jaxme.JMMarshaller;
+import org.apache.ws.jaxme.util.DOMBuilder;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JMMarshallerImpl.java 232067 2005-03-10 11:14:08 +0100 (Do, 10 Mrz 2005) jochen $
+ */
+public class JMMarshallerImpl extends JMControllerImpl implements JMMarshaller {
+  /** Default value for {@link Marshaller#JAXB_ENCODING}.
+   * (UTF-8 encoding)
+   */
+  public static final String DEFAULT_JAXB_ENCODING = "UTF-8";
+
+  /** Default value for {@link #JAXME_INDENTATION_STRING}: Two blanks.
+   */
+  public static final String DEFAULT_JAXME_INDENTATION_STRING = "  ";
+
+  /** Default value for {@link #JAXME_INDENTATION_SEPARATOR}.
+   * ("\n", Line Feed)
+   */
+  public static final String DEFAULT_JAXME_INDENTATION_SEPARATOR = "\n";
+
+  /** Property name for setting the String used to indent
+   * the formatted output by one level.
+   * ("jaxme.indentation.string")
+   * Defaults to {@link #DEFAULT_JAXME_INDENTATION_STRING}.
+   *
+   * @see #setIndentationString
+   * @see #getIndentationString
+   */
+  public static final String JAXME_INDENTATION_STRING = "jaxme.indentation.string";
+
+  /** Property name for setting the String used as a
+   * line separator in the formatted output.
+   * ("jaxme.indentation.separator")
+   *
+   * @see #setIndentationSeparator
+   * @see #getIndentationSeparator
+   */
+  public static final String JAXME_INDENTATION_SEPARATOR = "jaxme.indentation.separator";
+
+  /** Property name for choosing whether the marshalled
+   * output should contain an XML declaration. The methods
+   * {@link #marshal(Object, OutputStream)} and
+   * {@link #marshal(Object, Writer)} recognize
+   * requests for XML declarations.
+   *
+   * @see #setXmlDeclaration(boolean)
+   * @see #getXmlDeclaration
+   */
+  public static final String JAXME_XML_DECLARATION = "jaxme.xml.declaration";
+
+  /** Property name for a SAX {@link ContentHandler} which is able to
+   * marshal a SAX stream into a character stream. The property value is
+   * an instance of {@link Class} implementing {@link XMLWriter}.
+   */
+  public static final String JAXME_XML_WRITER = "jaxme.xml.writer";
+
+  private static final Class xmlWriterClassDefault;
+
+  static {
+    Class c;
+    try {
+        c = Class.forName("org.apache.ws.jaxme.impl.CharSetXMLWriter");
+    } catch (Exception e) {
+        c = XMLWriterImpl.class;
+    }
+    xmlWriterClassDefault = c;
+  }
+
+  private String encoding = DEFAULT_JAXB_ENCODING;
+  private boolean indentation = true;
+  private String indentationString = DEFAULT_JAXME_INDENTATION_STRING;
+  private String indentationSeparator = DEFAULT_JAXME_INDENTATION_SEPARATOR;
+  private boolean xmlDeclaration = true;
+  private Class xmlWriterClass;
+  private String noNamespaceSchemaLocation, schemaLocation;
+
+  /** Sets the controllers encoding; to be used in
+   * marshalling. Defaults to {@link #DEFAULT_JAXB_ENCODING}.
+   *
+   * @param pEncoding Suggested encoding or null to restore
+   *    the default
+   */
+  public void setEncoding(String pEncoding) throws PropertyException {
+  	if (pEncoding == null) {
+  	  pEncoding = DEFAULT_JAXB_ENCODING;
+    }
+    encoding = pEncoding;
+  }
+
+  /** Returns the controllers encoding; to be used in
+   * marshalling. Defaults to {@link #DEFAULT_JAXB_ENCODING}.
+   */
+  public String getEncoding() { return encoding; }
+
+  /** Sets the controllers class implementing {@link XMLWriter}.
+   * Defaults to {@link XMLWriterImpl}.
+   *
+   * @param pClass A class implementing {@link XMLWriterImpl} or
+   *   null to restore the default.
+   */
+  public void setXMLWriterClass(Class pClass) throws PropertyException {
+    if (pClass == null) {
+      // Restore
+      xmlWriterClass = null;
+    } else if (XMLWriter.class.isAssignableFrom(pClass)  &&  !pClass.isInterface()) {
+      xmlWriterClass = pClass;
+    } else {
+      throw new PropertyException("The class " + pClass.getName() + " is not implementing " + XMLWriter.class.getName());
+    }
+  }
+
+  /** <p>Returns the controllers class implementing {@link XMLWriter}.
+   * Defaults to {@link XMLWriterImpl}.</p>
+   */
+  public Class getXMLWriterClass() {
+    return xmlWriterClass == null ? xmlWriterClassDefault : xmlWriterClass;
+  }
+
+  /** <p>Sets whether XML documents generated by the controller
+   * ought to be formatted. Defaults to true.</p>
+   */
+  public void setIndentation(boolean pIndentation) {
+    indentation = pIndentation;
+  }
+
+  /** <p>Returns whether XML documents generated by the controller
+   * ought to be formatted. Defaults to true.</p>
+   */
+  public boolean getIndentation() {
+    return indentation;
+  }
+
+  /** <p>Sets whether the methods <code>marshal(Object, Writer)</code>
+   * and <code>marshal(Object, OutputStream)</code> ought to emit an
+   * XML declaration.</p>
+   */
+  public void setXmlDeclaration(boolean pDeclaration) {
+    xmlDeclaration = pDeclaration;
+  }
+
+  /** <p>Returns whether the methods <code>marshal(Object, Writer)</code>
+   * and <code>marshal(Object, OutputStream)</code> ought to emit an
+   * XML declaration.</p>
+   */
+  public boolean getXmlDeclaration() { return xmlDeclaration; }
+
+  /** <p>Sets the string used to indent one level. Defaults to
+   * {@link #DEFAULT_JAXME_INDENTATION_STRING}. Equivalent to
+   * <code>setProperty(JAXME_INDENTATION_STRING, pStr)</code>.</p>
+   *
+   * @see #DEFAULT_JAXME_INDENTATION_STRING
+   * @see #setProperty
+   * @see #getProperty
+   */
+  public void setIndentationString(String pStr) { indentationString = pStr; }
+
+  /** <p>Returns the string used to indent one level. Defaults to
+   * {@link #DEFAULT_JAXME_INDENTATION_STRING}. Equivalent to
+   * <code>getProperty(JAXME_INDENTATION_STRING)</code>.</p>
+   *
+   * @see #DEFAULT_JAXME_INDENTATION_STRING
+   * @see #setProperty
+   * @see #getProperty
+   */
+  public String getIndentationString() { return indentationString; }
+
+  /** <p>Sets the string used as a line separator. Defaults to
+   * {@link #DEFAULT_JAXME_INDENTATION_SEPARATOR}. Equivalent to
+   * <code>setProperty(JAXME_INDENTATION_SEPARATOR, pStr)</code>.</p>
+   *
+   * @see #DEFAULT_JAXME_INDENTATION_SEPARATOR
+   * @see #setProperty
+   * @see #getProperty
+   */
+  public void setIndentationSeparator(String pStr) { indentationSeparator = pStr; }
+
+  /** <p>Returns the string used as a line separator. Defaults to
+   * {@link #DEFAULT_JAXME_INDENTATION_SEPARATOR}. Equivalent to
+   * <code>getProperty(JAXME_INDENTATION_SEPARATOR)</code>.</p>
+   *
+   * @see #DEFAULT_JAXME_INDENTATION_SEPARATOR
+   * @see #setProperty
+   * @see #getProperty
+   */
+  public String getIndentationSeparator() { return indentationSeparator; }
+
+  /** <p>Sets the schema location. The marshaller will use this to
+   * create an attribute <code>xsi:schemaLocation</code>. Equivalent
+   * to <code>setProperty(JAXB_SCHEMA_LOCATION, pValue)</code>.
+   * Defaults to null, in which case the attribute isn't created.</p>
+   * @see Marshaller#JAXB_SCHEMA_LOCATION
+   * @see #setProperty(String, Object)
+   * @see #getSchemaLocation()
+   */
+  public void setSchemaLocation(String pValue) throws PropertyException {
+    if (pValue != null  &&  noNamespaceSchemaLocation != null) {
+      throw new PropertyException("The properties schemaLocation and noNamespaceSchemaLocation are mutually exclusive.");
+    }
+    schemaLocation = pValue;
+  }
+
+  /** <p>Returns the schema location. The marshaller will use this to
+   * create an attribute <code>xsi:schemaLocation</code>. Equivalent
+   * to <code>setProperty(JAXB_SCHEMA_LOCATION, pValue)</code>.
+   * Defaults to null, in which case the attribute isn't created.</p>
+   * @see Marshaller#JAXB_SCHEMA_LOCATION
+   * @see #setProperty(String, Object)
+   * @see #setSchemaLocation(String)
+   */
+  public String getSchemaLocation() {
+  	return schemaLocation;
+  }
+
+  /** <p>Sets the schema location without namespace. The marshaller
+   * will use this to create an attribute <code>xsi:noNamespaceSchemaLocation</code>.
+   * Equivalent to <code>setProperty(JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
+   * pValue)</code>. Defaults to null, in which case the attribute isn't
+   * created.</p>
+   * @see Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   * @see #setProperty(String, Object)
+   * @see #getNoNamespaceSchemaLocation()
+   */
+  public void setNoNamespaceSchemaLocation(String pValue) throws PropertyException {
+    if (pValue != null  &&  noNamespaceSchemaLocation != null) {
+      throw new PropertyException("The properties schemaLocation and noNamespaceSchemaLocation are mutually exclusive.");
+    }
+    noNamespaceSchemaLocation = pValue;
+  }
+
+  /** <p>Returns the schema location. The marshaller will use this to
+   * create an attribute <code>xsi:noNamespaceSchemaLocation</code>. Equivalent
+   * to <code>setProperty(JAXB_SCHEMA_LOCATION, pValue)</code>.
+   * Defaults to null, in which case the attribute isn't created.</p>
+   * @see Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+   * @see #setProperty(String, Object)
+   * @see #setNoNamespaceSchemaLocation(String)
+   */
+  public String getNoNamespaceSchemaLocation() {
+    return noNamespaceSchemaLocation;
+  }
+
+  public void setProperty(String pProperty, Object pValue)
+      throws PropertyException {
+    if (pProperty.startsWith("jaxb.")) {
+      if (Marshaller.JAXB_ENCODING.equals(pProperty)) {
+        setEncoding((String) pValue);
+        return;
+      } else if (Marshaller.JAXB_FORMATTED_OUTPUT.equals(pProperty)) {
+        setIndentation(((Boolean) pValue).booleanValue());
+        return;
+      } else if (Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(pProperty)) {
+      	setNoNamespaceSchemaLocation((String) pValue);
+        return;
+      } else if (Marshaller.JAXB_SCHEMA_LOCATION.equals(pProperty)) {
+      	setSchemaLocation((String) pValue);
+        return;
+      }
+    } else if (pProperty.startsWith("jaxme.")) {
+      if (JAXME_XML_WRITER.equals(pProperty)) {
+        setXMLWriterClass((Class) pValue);
+        return;
+      } else if (JAXME_XML_DECLARATION.equals(pProperty)) {
+        setXmlDeclaration(((Boolean) pValue).booleanValue());
+        return;
+      } else if (JAXME_INDENTATION_SEPARATOR.equals(pProperty)) {
+        setIndentationSeparator((String) pValue);
+        return;
+      } else if (JAXME_INDENTATION_STRING.equals(pProperty)) {
+        setIndentationString((String) pValue);
+        return;
+      }
+    }
+    super.setProperty(pProperty, pValue);
+  }
+
+  public Object getProperty(String pProperty) throws PropertyException {
+    if (pProperty.startsWith("jaxb.")) {
+      if (Marshaller.JAXB_ENCODING.equals(pProperty)) {
+        return getEncoding();
+      } else if (Marshaller.JAXB_FORMATTED_OUTPUT.equals(pProperty)) {
+        return new Boolean(getIndentation());
+      }
+    } else if (pProperty.startsWith("jaxme.")) {
+      if (JAXME_INDENTATION_STRING.equals(pProperty)) {
+        return getIndentationString();
+      } else if (JAXME_XML_WRITER.equals(pProperty)) {
+        return getXMLWriterClass();
+      } else if (JAXME_XML_DECLARATION.equals(pProperty)) {
+        return getEncoding();
+      } else if (JAXME_INDENTATION_SEPARATOR.equals(pProperty)) {
+        return getIndentationSeparator();
+      }
+    }
+    return super.getProperty(pProperty);
+  }
+
+
+  /* Marshaller methods
+   */
+  public void marshal(Object pObject, OutputStream pStream) throws JAXBException {
+    Writer writer;
+    try {
+      writer = new OutputStreamWriter(pStream, getEncoding());
+    } catch(UnsupportedEncodingException e) {
+      throw new MarshalException("Unsupported encoding: " + getEncoding(), e);
+    }
+    marshal(pObject, writer);
+    try {
+      writer.close();
+    } catch (IOException e) {
+      throw new MarshalException(e);
+    }
+  }
+
+  public void marshal(Object pObject, ContentHandler pHandler) throws JAXBException {
+    JMElement element = (JMElement) pObject;
+	QName qName = element.getQName();
+    try {
+		JMManager manager = getJAXBContextImpl().getManager(qName);
+		JMSAXDriver driver = manager.getDriver();
+		JMSAXDriverController controller = new JMSAXDriverController(this, pHandler);
+		controller.marshal(driver, qName.getPrefix(), qName.getNamespaceURI(), qName.getLocalPart(), element);
+    } catch (SAXException e) {
+      throw new MarshalException(e);
+    }
+  }
+
+  public void marshal(Object pObject, Writer pWriter) throws JAXBException {
+    if (getXmlDeclaration()) {
+      try {
+        pWriter.write("<?xml version='1.0' encoding='" + getEncoding() + "'?>");
+        if (getIndentation()) {
+          pWriter.write(getIndentationSeparator());
+        }
+      } catch (IOException e) {
+        throw new MarshalException(e);
+      }
+    }
+    XMLWriter w;
+    Class c = getXMLWriterClass();
+    try {
+      w = (XMLWriter) c.newInstance();
+    } catch (Exception e) {
+      throw new JAXBException("Failed to instantiate XMLWriter class " + c.getName(), e);
+    }
+    w.init(this);
+    w.setWriter(pWriter);
+    marshal(pObject, w);
+  }
+
+  public void marshal(Object pObject, Node pNode) throws JAXBException {
+    DOMBuilder db = new DOMBuilder();
+    db.setTarget(pNode);
+    marshal(pObject, db);
+  }
+
+  public void marshal(Object pObject, Result pResult) throws JAXBException {
+    if (pResult instanceof SAXResult) {
+      ContentHandler ch = ((SAXResult) pResult).getHandler();
+      if (ch == null) {
+        throw new MarshalException("The SAXResult doesn't have its ContentHandler set.");
+      }
+      marshal(pObject, ch);
+    } else if (pResult instanceof StreamResult) {
+      StreamResult sr = (StreamResult) pResult;
+      Writer w = sr.getWriter();
+      if (w == null) {
+        OutputStream s = sr.getOutputStream();
+        if (s == null) {
+          throw new MarshalException("The StreamResult doesn't have its Writer or OutputStream set.");
+        }
+        marshal(pObject, s);
+      } else {
+        marshal(pObject, w);
+      }
+    } else if (pResult instanceof DOMResult) {
+      Node node = ((DOMResult) pResult).getNode();
+      if (node == null) {
+        throw new MarshalException("The DOMResult doesn't have its Node set.");
+      }
+      marshal(pObject, node);
+    } else {
+      throw new MarshalException("Unknown type of Result: " + pResult.getClass().getName() +
+                                  ", only SAXResult, StreamResult and DOMResult are supported.");
+    }
+  }
+
+  public Node getNode(java.lang.Object contentTree) throws JAXBException {
+    throw new UnsupportedOperationException("JaxMe doesn't support live DOM views");
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMPIImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMPIImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMPIImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import org.apache.ws.jaxme.JMPI;
+
+/** <p>Implementation of a processing instruction.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JMPIImpl implements JMPI {
+  private String target;
+  private String data;
+
+  /** <p>Creates a new JMPI.</p>
+   */
+  public JMPIImpl(String pTarget, String pData) {
+  	target = pTarget;
+  	data = pData;
+  }
+
+  public String getTarget() { return target; }
+  public String getData() { return data; }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriver.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriver.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriver.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.impl;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/** Interface of an object, which is able to convert another
+ * object into SAX events.
+ */
+public interface JMSAXDriver {
+	/** Returns the objects attributes.
+	 */
+	public AttributesImpl getAttributes(JMSAXDriverController pController, Object pObject) throws SAXException;
+
+	/** Creates the objects content into SAX events, which
+	 * are being fired into the given content handler.
+	 */
+	public void marshalChilds(JMSAXDriverController pController, ContentHandler pHandler, Object pObject) throws SAXException;
+
+	/** Returns a suggested prefix for the namespace
+	 * <code>pNamespaceURI</code>, or null, if no suggestion
+	 * is available.
+	 */
+	public String getPreferredPrefix(String pNamespaceURI);
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriverController.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriverController.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXDriverController.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2005  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.impl;
+
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.bind.ValidationEventLocator;
+import javax.xml.bind.helpers.PrintConversionEventImpl;
+import javax.xml.bind.helpers.ValidationEventLocatorImpl;
+
+import org.apache.ws.jaxme.XMLConstants;
+import org.apache.ws.jaxme.util.NamespaceSupport;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/** The controller is created by the
+ * {@link org.apache.ws.jaxme.JMMarshaller} for
+ * marshalling a given element.
+ */
+public class JMSAXDriverController {
+	private static final Attributes ZERO_ATTRIBUTES = new AttributesImpl();
+	private final JMMarshallerImpl marshaller;
+	private final DatatypeConverterInterface converter;
+	private final ContentHandler target;
+    private final NamespaceSupport nss = new NamespaceSupport();
+	private int cnt;
+
+	/** Returns the Marshaller, which created the controller.
+     */
+	public JMMarshallerImpl getJMMarshaller() {
+		return marshaller;
+	}
+
+	/** Returns the target handler, to which SAX events are
+	 * being fired.
+	 */
+	public ContentHandler getTarget() {
+		return target;
+	}
+
+    /** Returns an instance of NamespaceSupport.
+     */
+    public NamespaceSupport getNamespaceContext() {
+		return nss;
+    }
+
+	/** Creates a new instance with the given marshaller and target.
+	 */
+	public JMSAXDriverController(JMMarshallerImpl pMarshaller, ContentHandler pTarget) throws SAXException {
+		marshaller = pMarshaller;
+		target = pTarget;
+		converter = marshaller.getDatatypeConverter();
+	}
+
+	/** Returns the {@link DatatypeConverterInterface} being used for
+	 * conversion of atomic values.
+	 */
+	public DatatypeConverterInterface getDatatypeConverter() {
+		return converter;
+	}
+
+	protected String getNewPrefix(String pURI, String pSuggestedPrefix) {
+		if (pSuggestedPrefix == null  ||  pSuggestedPrefix.length() == 0) {
+			if (!nss.isPrefixDeclared("")) {
+				nss.declarePrefix("", pURI);
+				return "";
+			}
+			pSuggestedPrefix = "p";
+		}
+		String pc = pSuggestedPrefix;
+		for (;;) {
+			if (!nss.isPrefixDeclared(pc)) {
+				nss.declarePrefix(pc, pURI);
+				return pc;
+			}
+			pc = pSuggestedPrefix + ++cnt;
+		}
+	}
+
+	protected String getPreferredPrefix(JMSAXDriver pDriver, String pURI) {
+		if (pDriver != null) {
+			String prefix = pDriver.getPreferredPrefix(pURI);
+			if (prefix != null) {
+				return prefix;
+			}
+		}
+		if (XMLConstants.XML_SCHEMA_URI.equals(pURI)) {
+			return "xsi";
+		} else {
+			return null;
+		}
+	}
+
+	protected String getElementQName(JMSAXDriver pDriver, String pPrefix,
+									String pNamespaceURI, String pLocalName) throws SAXException {
+		if (pNamespaceURI == null) {
+			pNamespaceURI = "";
+		}
+		String prefix = nss.getPrefix(pNamespaceURI);
+		if (prefix == null) {
+			if (pPrefix != null) {
+				prefix = pPrefix;
+			} else {
+				prefix = getNewPrefix(pNamespaceURI, getPreferredPrefix(pDriver, pNamespaceURI));
+			}
+			nss.declarePrefix(prefix, pNamespaceURI);
+			getTarget().startPrefixMapping(prefix, pNamespaceURI);
+		}
+		if (prefix == null  ||  "".equals(prefix)) {
+			return pLocalName;
+		} else {
+			return prefix + ":" + pLocalName;
+		}
+	}
+
+	/** Returns the qualified name of the element <code>pLocalName</code>
+	 * in namespace <code>pNamespaceURI</code>. In other words, it attachs
+	 * a prefix, if required.
+	 */
+	public String getElementQName(JMSAXDriver pDriver, String pNamespaceURI,
+								  String pLocalName)
+			throws SAXException {
+		if (pNamespaceURI == null) {
+			pNamespaceURI = "";
+		}
+		String prefix = nss.getPrefix(pNamespaceURI);
+		if (prefix == null) {
+			prefix = getNewPrefix(pNamespaceURI, getPreferredPrefix(pDriver, pNamespaceURI));
+			nss.declarePrefix(prefix, pNamespaceURI);
+			getTarget().startPrefixMapping(prefix, pNamespaceURI);
+		}
+		if (prefix == null  ||  "".equals(prefix)) {
+			return pLocalName;
+		} else {
+			return prefix + ":" + pLocalName;
+		}
+	}
+
+	/** Returns the qualified name of the attribute <code>pLocalName</code>.
+	 * In other words, attachs a prefix, if required.
+	 */
+	public String getAttrQName(JMSAXDriver pDriver, String pNamespaceURI,
+							   String pLocalName) throws SAXException {
+		if (pNamespaceURI == null) {
+			pNamespaceURI = "";
+		}
+		String prefix = nss.getAttributePrefix(pNamespaceURI);
+		if (prefix == null) {
+			prefix = getPreferredPrefix(pDriver, pNamespaceURI);
+			if (prefix == null) {
+				prefix = getNewPrefix(pNamespaceURI, "p");
+			}
+			getTarget().startPrefixMapping(prefix, pNamespaceURI);
+		}
+		if (prefix == null  ||  "".equals(prefix)) {
+			return pLocalName;
+		} else {
+			return prefix + ":" + pLocalName;
+		}
+	}
+
+	protected void addSchemaLocationAttributes(JMSAXDriver pDriver,
+											   AttributesImpl pAttrs) throws SAXException {
+		JMMarshallerImpl m = getJMMarshaller();
+		String schemaLocation = m.getSchemaLocation();
+		String schemaLocationAttribute;
+		if (schemaLocation != null) {
+			schemaLocationAttribute = XMLConstants.XML_SCHEMA_NS_ATTR;
+		} else {
+			schemaLocation = m.getNoNamespaceSchemaLocation();
+			if (schemaLocation != null) {
+				schemaLocationAttribute = XMLConstants.XML_SCHEMA_NO_NS_ATTR;
+			} else {
+				schemaLocationAttribute = null;
+			}
+		}
+		if (schemaLocation != null) {
+			String qName = getAttrQName(pDriver, XMLConstants.XML_SCHEMA_URI, schemaLocationAttribute);
+			pAttrs.addAttribute(XMLConstants.XML_SCHEMA_URI, schemaLocationAttribute,
+								qName, "CDATA", schemaLocation);
+		}
+	}
+
+	/** Marshals the given object, creating a root element with
+	 * the given namespace URI and local name.
+	 * @param pElement The element being marshalled. It must be
+	 *    an instance of the class associated to this specific
+	 *    JMXmlSerializer.
+	 */
+	public void marshal(JMSAXDriver pDriver, String pPrefix,
+						String pNamespaceURI, String pLocalName,
+						Object pElement) throws SAXException {
+		int context = nss.getContext();
+		String qName = getElementQName(pDriver, pPrefix, pNamespaceURI, pLocalName);
+		AttributesImpl attrs = pDriver.getAttributes(this, pElement);
+		addSchemaLocationAttributes(pDriver, attrs);
+		ContentHandler h = getTarget();
+		h.startElement(pNamespaceURI, pLocalName, qName, attrs);
+		pDriver.marshalChilds(this, h, pElement);
+		h.endElement(pNamespaceURI, pLocalName, qName);
+		restoreContext(context);
+	}
+	
+	/** Marshals the given object, creating an element with
+	 * the given namespace URI and local name.
+	 * @param pElement The element being marshalled. It must be
+	 *    an instance of the class associated to this specific
+	 *    JMXmlSerializer.
+	 */
+	public void marshal(JMSAXDriver pDriver, String pNamespaceURI,
+						String pLocalName, Object pElement) throws SAXException {
+		int context = nss.getContext();
+		String qName = getElementQName(pDriver, pNamespaceURI, pLocalName);
+		AttributesImpl attrs = pDriver.getAttributes(this, pElement);
+		ContentHandler h = getTarget();
+		h.startElement(pNamespaceURI, pLocalName, qName, attrs);
+		pDriver.marshalChilds(this, h, pElement);
+		h.endElement(pNamespaceURI, pLocalName, qName);
+		restoreContext(context);
+	}
+
+	/** Called by the driver for creating a simple child.
+	 */
+	public void marshalSimpleChild(JMSAXDriver pDriver, String pNamespaceURI,
+								   String pLocalName, String pValue)
+			throws SAXException {
+		int context = nss.getContext();
+		String qName = getElementQName(pDriver, pNamespaceURI, pLocalName);
+		ContentHandler h = getTarget();
+		h.startElement(pNamespaceURI, pLocalName, qName, ZERO_ATTRIBUTES);
+		if (pValue != null  &&  pValue.length() > 0) {
+			h.characters(pValue.toCharArray(), 0, pValue.length());
+		}
+		h.endElement(pNamespaceURI, pLocalName, qName);
+		restoreContext(context);
+	}
+
+	private void restoreContext(int pContext) throws SAXException {
+		NamespaceSupport nss = getNamespaceContext();
+		ContentHandler h = getTarget();
+		for (;;) {
+			String prefix = nss.checkContext(pContext);
+			if (prefix == null) {
+				return;
+			}
+			h.endPrefixMapping(prefix);
+		}
+	}
+
+	public void printConversionEvent(Object pObject, String pMsg, Exception pException) throws SAXException {
+		ValidationEventHandler handler = getJMMarshaller().getEventHandler();
+		if (handler != null) {
+			ValidationEventLocator locator = new ValidationEventLocatorImpl(pObject);
+			PrintConversionEventImpl event = new PrintConversionEventImpl(ValidationEvent.FATAL_ERROR, pMsg, locator);
+			if (handler.handleEvent(event)) {
+				return;
+			}
+		}
+		throw new SAXException(pMsg, pException);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXElementParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXElementParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXElementParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,84 @@
+package org.apache.ws.jaxme.impl;
+
+import javax.xml.bind.ValidationEvent;
+
+import org.apache.ws.jaxme.ValidationEvents;
+import org.apache.ws.jaxme.XMLConstants;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/** A subclass of {@link org.apache.ws.jaxme.impl.JMSAXGroupParser}
+ * for parsing complex elements.
+ */
+public abstract class JMSAXElementParser extends JMSAXGroupParser {
+	private JMUnmarshallerHandlerImpl handler;
+	protected Object result;
+	private String namespaceURI, localName;
+    private int level;
+
+	public JMUnmarshallerHandlerImpl getHandler() {
+		return handler;
+	}
+
+	/** Returns, whether the element has atomic content.
+	 */
+	public boolean isAtomic() { return false; }
+
+	/** Returns, whether the element is empty.
+	 */
+	public boolean isEmpty() { return false; }
+
+	/** Returns the namespace URI of the element being parsed.
+     */
+    public String getNamespaceURI() { return namespaceURI; }
+    /** Returns the local name of the element being parsed.
+     */
+    public String getLocalName() { return localName; }
+    /** Returns the end elements level (number of nested
+     * elements enclosing this element).
+     */
+    public int getEndLevel() { return level; }
+
+	/** Initializes the element parser by setting the required data.
+	 */
+	public void init(JMUnmarshallerHandlerImpl pHandler, Object pObject,
+					 String pNamespaceURI, String pLocalName, int pLevel) {
+		handler = pHandler;
+		result = pObject;
+		namespaceURI = pNamespaceURI;
+        localName = pLocalName;
+        level = pLevel;
+	}
+
+	/** Sets the attribute with the namespace
+	 * <code>pNamespace</code> and the local name <code>pLocalName</code>
+	 * to the value <code>pValue</code>.
+	 */
+	public void addAttribute(String pNamespaceURI, String pLocalName,
+							 String pValue) throws SAXException {
+	  	if (javax.xml.XMLConstants.XML_NS_URI.equals(pNamespaceURI)
+			||  javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(pNamespaceURI)
+			||  XMLConstants.XML_SCHEMA_URI.equals(pNamespaceURI)) {
+			// Ignore attributes in the xsi namespace
+	    } else {
+			XsQName qName = new XsQName(pNamespaceURI, pLocalName);
+			handler.validationEvent(ValidationEvent.WARNING, ValidationEvents.EVENT_UNKNOWN_ATTRIBUTE,
+									"Unknown attribute '" + qName + "' with value '"
+									+ pValue + "'",  null);
+	    }
+	}
+
+	/** Invokes {@link #addAttribute(String, String, String)} for
+	 * all the attributes in the list <code>pAttrs</code>.
+	 */
+	public void setAttributes(Attributes pAttrs) throws SAXException {
+		if (pAttrs != null) {
+			for (int i = 0;  i < pAttrs.getLength();  i++) {
+				addAttribute(pAttrs.getURI(i), pAttrs.getLocalName(i),
+							 pAttrs.getValue(i));
+			}
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXGroupParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXGroupParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMSAXGroupParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+package org.apache.ws.jaxme.impl;
+
+import javax.xml.bind.ValidationEvent;
+
+import org.apache.ws.jaxme.ValidationEvents;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/** The {@link javax.xml.parsers.SAXParser} is controlling
+ * an internal stack of {@link JMSAXGroupParser} instances, one
+ * for any nested sequence, choice, or all group being parsed.<br>
+ * Note, that complex types with complex content are 
+ */
+public abstract class JMSAXGroupParser {
+	protected abstract JMUnmarshallerHandlerImpl getHandler();
+
+    /** Equivalent to
+     * {@link org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)}.
+     */
+    public abstract boolean startElement(String pNamespaceURI, String pLocalName, String pQName,
+                                         Attributes pAttrs) throws SAXException;
+    /** Roughly equivalent to
+     * {@link org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)}.
+     * @param pResult The object that has been parsed.
+     */
+    public abstract void endElement(String pNamespaceURI, String pLocalName,
+									String pQName, Object pResult) throws SAXException;
+
+    /** Returns, whether the group contents are valid.
+     */
+    public abstract boolean isFinished();
+
+    private boolean isEmpty(char[] pChars, int pOffset, int pLen) {
+        for (int i = 0;  i < pLen;  i++) {
+            if (!Character.isWhitespace(pChars[pOffset+i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+	/** Returns, whether the group supports mixed content.
+	 */
+	public boolean isMixed() {
+		return false;
+	}
+
+	/** Used for adding textual context. Valid only, if
+	 * {@link #isMixed()} returns true.
+	 * @param pChars Character buffer, as specified by
+	 * {@link org.xml.sax.ContentHandler#characters(char[], int, int)}.
+	 * @param pOffset Offset into buffer, as specified by
+	 * {@link org.xml.sax.ContentHandler#characters(char[], int, int)}.
+	 * @param pLen Length of relevant buffer part, as specified by
+	 * {@link org.xml.sax.ContentHandler#characters(char[], int, int)}.
+	 */
+	public void addText(char[] pChars, int pOffset, int pLen) throws SAXException {
+		if (!isEmpty(pChars, pOffset, pLen)) {
+			if (pLen > 100) {
+				pLen = 100;  // Keep the message approximately human readable.
+			}
+			getHandler().validationEvent(ValidationEvent.WARNING, "Unexpected non-whitespace characters: '" +
+										 new String(pChars, pOffset, pLen) + "'",
+										 ValidationEvents.EVENT_UNEXPECTED_TEXTUAL_CONTENTS,
+										 null);
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerHandlerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerHandlerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerHandlerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,397 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.DatatypeConverterInterface;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.bind.helpers.ParseConversionEventImpl;
+import javax.xml.bind.helpers.ValidationEventImpl;
+import javax.xml.bind.helpers.ValidationEventLocatorImpl;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.JMUnmarshaller;
+import org.apache.ws.jaxme.JMUnmarshallerHandler;
+import org.apache.ws.jaxme.Observer;
+import org.apache.ws.jaxme.ValidationEvents;
+import org.apache.ws.jaxme.util.NamespaceSupport;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/** <p>Implementation of a JMUnmarshallerHandler; the
+ * UnmarshallerHandler receives SAX events which he silently
+ * discards, as long as the first <code>startElement</code>
+ * event is seen. Depending on namespace URI and local name,
+ * the Unmarshallerhandler creates a new instance of JMHandler
+ * and from now on forwards all SAX events to the JMHandler.</p>
+ */
+public class JMUnmarshallerHandlerImpl implements JMUnmarshallerHandler {
+    /** State for parsing a simple, atomic element.
+     */
+    private static final int STATE_SIMPLE_ATOMIC = 1;
+    /** State for parsing a complex element. The outer
+     * {@link JMSAXGroupParser} will always be parsing
+     * a complex element.
+     */
+    private static final int STATE_COMPLEX_CONTENT = 3;
+    /** State for parsing an anonymous group. This is
+     * mostly comparable to parsing a complex element,
+     * except that the group doesn't have an outer
+     * start and end element.
+     */
+    private static final int STATE_GROUP = 4;
+
+	private final JMUnmarshaller unmarshaller;
+    private Locator locator;
+    private NamespaceSupport nss = new NamespaceSupport();
+    private final List groupParsers = new ArrayList();
+    private JMSAXGroupParser activeParser;
+    private int level;
+    private int endLevel;
+    private int state;
+    private final StringBuffer sb = new StringBuffer();
+	private Observer observer;
+	private Object result;
+
+    public int getLevel() { return level; }
+
+    /** Removes the currently active parser from the stack.
+     */
+    private boolean removeActiveParser() {
+        int size = groupParsers.size();
+        groupParsers.remove(--size);
+        if (size == 0) {
+            return false;
+        }
+        activeParser = (JMSAXGroupParser) groupParsers.get(--size);
+        if (activeParser instanceof JMSAXElementParser) {
+            state = STATE_COMPLEX_CONTENT;
+            endLevel = ((JMSAXElementParser) activeParser).getEndLevel();
+        } else {
+            state = STATE_GROUP;
+        }
+        return true;
+    }
+
+	/** Sets an observer, which will be notified, when the element has
+	 * been parsed.
+	 */
+	public void setObserver(Observer pObserver) {
+		observer = pObserver;
+	}
+
+	/** Returns the observer, which will be notified, when the element has
+	 * been parsed.
+	 */
+	public Observer getObserver() {
+		return observer;
+	}
+
+	/** Creates a new instance, controlled by the given
+     * {@link JMUnmarshaller}.
+     */
+    public JMUnmarshallerHandlerImpl(JMUnmarshaller pUnmarshaller) {
+        unmarshaller = pUnmarshaller;
+    }
+
+    /** Returns the {@link JMUnmarshaller}, which created this
+     * handler.
+     */
+    public JMUnmarshaller getJMUnmarshaller() {
+        return unmarshaller;
+    }
+
+    public void setDocumentLocator(Locator pLocator) {
+        locator = pLocator;
+    }
+
+    public void startDocument() throws SAXException {
+    }
+
+    public void endDocument() throws SAXException {
+    }
+
+    public void startPrefixMapping(String pPrefix, String pURI) throws SAXException {
+        nss.declarePrefix(pPrefix, pURI);
+    }
+
+    public void endPrefixMapping(String pPrefix) throws SAXException {
+        nss.undeclarePrefix(pPrefix);
+    }
+
+	/** Tests, whether the group parser accepts the element.
+	 * If so, adds the group parser to the stack.
+	 */
+	public boolean testGroupParser(JMSAXGroupParser pParser,
+								   String pNamespaceURI, String pLocalName,
+								   String pQName, Attributes pAttrs)
+			throws SAXException {
+		groupParsers.add(pParser);
+		activeParser = pParser;
+		state = STATE_GROUP;
+		if (pParser.startElement(pNamespaceURI, pLocalName, pQName, pAttrs)) {
+			return true;
+		} else {
+			removeActiveParser();
+			return false;
+		}
+	}
+
+	/** Adds a parser for an nested element to the stack of parsers.
+	 */
+	public void addElementParser(JMSAXElementParser pParser) {
+		endLevel = pParser.getEndLevel();
+		groupParsers.add(pParser);
+		activeParser = pParser;
+		state = STATE_COMPLEX_CONTENT;
+		if (pParser.isAtomic()) {
+			sb.setLength(0);
+		}
+	}
+
+    public void startElement(String pNamespaceURI, String pLocalName,
+                             String pQName, Attributes pAttrs) throws SAXException {
+		if (level++ == 0) {
+			JAXBContextImpl context = unmarshaller.getJAXBContextImpl();
+			JMManager manager;
+			QName qName = new QName(pNamespaceURI, pLocalName);
+			try {
+				manager = context.getManager(qName);
+			} catch (JAXBException e) {
+				throw new SAXException("Unable to instantiate manager for element " + qName, e);
+			}
+			Object o = manager.getElementS();
+			JMSAXElementParser parser = manager.getHandler();
+			parser.init(this, o, pNamespaceURI, pLocalName, 1);
+			parser.setAttributes(pAttrs);
+			groupParsers.clear();
+			result = o;
+			addElementParser(parser);
+		} else {
+			if (state == STATE_COMPLEX_CONTENT  ||  state == STATE_GROUP) {
+				for (;;) {
+					if (activeParser.startElement(pNamespaceURI, pLocalName, pQName, pAttrs)) {
+						return;
+					}
+					if (state == STATE_GROUP) {
+						if (removeActiveParser()) {
+							continue;
+						}
+					}
+					break;
+				}
+			}
+			QName qName = new QName(pNamespaceURI, pLocalName);
+			validationEvent(ValidationEvent.WARNING,
+					"Unexpected element: '" + qName + "'",
+					ValidationEvents.EVENT_UNEXPECTED_CHILD_ELEMENT,
+					null);
+		}
+    }
+
+    public void endElement(String pNamespaceURI, String pLocalName, String pQName) throws SAXException {
+		int lvl = level--;
+		switch (state) {
+			case STATE_GROUP:
+				while (state == STATE_GROUP) {
+					if (activeParser.isFinished()) {
+						removeActiveParser();
+					}
+				}
+				if (state != STATE_COMPLEX_CONTENT) {
+					break;
+				}
+			case STATE_COMPLEX_CONTENT:
+	            JMSAXElementParser elementParser = (JMSAXElementParser) activeParser;
+				if (lvl != endLevel) {
+					if (endLevel > lvl) {
+						validationEvent(ValidationEvent.ERROR,
+										"Premature endElement: " + new QName(pNamespaceURI, pLocalName),
+										ValidationEvents.EVENT_PREMATURE_END_ELEMENT,
+										null);
+						while (endLevel > lvl) {
+							terminateComplexType(pNamespaceURI, pLocalName, pQName, 
+												 elementParser);
+						}
+					} else {
+						throw new IllegalStateException("Expected level " + endLevel
+														+ ", got " + lvl);
+					}
+				}
+				if (elementParser.isAtomic()) {
+					elementParser.endElement(pNamespaceURI, pLocalName, pQName, sb.toString());
+				}
+	            if (pNamespaceURI.equals(elementParser.getNamespaceURI())  &&
+	                pLocalName.equals(elementParser.getLocalName())) {
+	                if (activeParser.isFinished()) {
+	                    terminateComplexType(pNamespaceURI, pLocalName, pQName,
+	                    					 elementParser);
+	                    return;
+	                }
+	            }
+				break;
+			case STATE_SIMPLE_ATOMIC: {
+				String s = sb.toString();
+				resetAtomicState();
+				activeParser.endElement(pNamespaceURI, pLocalName, pQName, s);
+				return;
+			}
+			default:
+				throw new IllegalStateException("Invalid state: " + state);
+        }
+        QName qName = new QName(pNamespaceURI, pLocalName);
+        validationEvent(ValidationEvent.WARNING,
+                        "Unexpected end element: '" + qName + "'",
+                        ValidationEvents.EVENT_PREMATURE_END_ELEMENT,
+                        null);
+    }
+
+    private void terminateComplexType(String pNamespaceURI, String pLocalName, String pQName,
+    								  JMSAXElementParser elementParser) throws SAXException {
+    	if (removeActiveParser()) {
+    		activeParser.endElement(pNamespaceURI, pLocalName, pQName, elementParser.result);
+    	} else {
+    		if (observer != null) {
+    			observer.notify(result);
+    		}
+    	}
+    }
+
+    public void characters(char[] pChars, int pOffset, int pLen) throws SAXException {
+        switch (state) {
+			case STATE_SIMPLE_ATOMIC:
+				sb.append(pChars, pOffset, pLen);
+				return;
+			case STATE_COMPLEX_CONTENT:
+				if (((JMSAXElementParser) activeParser).isAtomic()) {
+					sb.append(pChars, pOffset, pLen);
+					return;
+				}
+				// Fall through
+			case STATE_GROUP:
+				activeParser.addText(pChars, pOffset, pLen);
+				break;
+			default:
+				throw new IllegalStateException("Invalid state: " + state);
+		}
+    }
+
+    public void ignorableWhitespace(char[] pChars, int pStart, int pLen) throws SAXException {
+		characters(pChars, pStart, pLen);
+    }
+
+    public void processingInstruction(String pTarget, String pData) throws SAXException {
+		validationEvent(ValidationEvent.WARNING,
+                        "Don't know how to handle processing instructions.",
+                        ValidationEvents.EVENT_PROCESSING_INSTRUCTION,
+                        null);
+    }
+
+	/** Posts a {@link javax.xml.bind.ParseConversionEvent}.
+	 */
+	public void parseConversionEvent(String pMsg, Exception pException) throws SAXException {
+		ParseConversionEventImpl event = new ParseConversionEventImpl(ValidationEvent.FATAL_ERROR, pMsg, null);
+		handleEvent(event, pException);
+	}
+
+	/** Posts a {@link ValidationEvent}.
+	 */
+	public void validationEvent(int pSeverity, String pMsg, String pErrorCode,
+								Exception pException) throws SAXException {
+		org.apache.ws.jaxme.impl.ValidationEventImpl event = new org.apache.ws.jaxme.impl.ValidationEventImpl(pSeverity, pMsg, null);
+		event.setErrorCode(pErrorCode);
+		handleEvent(event, pException);
+	}
+
+	private void handleEvent(ValidationEventImpl pEvent, Exception pException) throws SAXException {
+		if (locator != null) {
+			pEvent.setLocator(new ValidationEventLocatorImpl(locator));
+		}
+		if (pException != null) {
+			pEvent.setLinkedException(pException);
+		}
+		ValidationEventHandler eventHandler;
+		try {
+			eventHandler = unmarshaller.getEventHandler();
+		} catch (JAXBException e) {
+			throw new SAXException(e);
+		}
+		if (eventHandler == null  ||  !eventHandler.handleEvent(pEvent)) {
+			String msg = pEvent.getMessage();
+			if (pEvent instanceof org.apache.ws.jaxme.impl.ValidationEventImpl) {
+				String errorCode = ((org.apache.ws.jaxme.impl.ValidationEventImpl) pEvent).getErrorCode();
+				if (errorCode != null) {
+					msg = errorCode + ": " + msg;
+				}
+			}
+			throw new SAXParseException(msg, locator, pException);
+		}
+	}
+
+	public void skippedEntity(String pName) throws SAXException {
+		validationEvent(ValidationEvent.WARNING,
+                        "Don't know how to handle skipped entities.",
+                        ValidationEvents.EVENT_SKIPPED_ENTITY,
+                        null);
+    }
+
+    public Object getResult() throws JAXBException, IllegalStateException {
+		if (groupParsers.size() > 0  ||  result == null) {
+			throw new IllegalStateException("Parsing the element is not yet finished.");
+		}
+		return result;
+    }
+
+	public NamespaceSupport getNamespaceSupport() {
+		return nss;
+	}
+
+	public Locator getDocumentLocator() {
+		return locator;
+	}
+
+	public DatatypeConverterInterface getDatatypeConverter() {
+		return unmarshaller.getDatatypeConverter();
+	}
+
+	/** Indicates, that the handler is parsing a simple, atomic element.
+	 */
+	public void addSimpleAtomicState() {
+		activeParser = null;
+		sb.setLength(0);
+		state = STATE_SIMPLE_ATOMIC;
+	}
+
+	/** Restores the state after parsing an atomic element.
+	 */
+	private void resetAtomicState() {
+		activeParser = (JMSAXGroupParser) groupParsers.get(groupParsers.size()-1);
+		if (activeParser instanceof JMSAXElementParser) {
+			state = STATE_COMPLEX_CONTENT;
+		} else {
+			state = STATE_GROUP;
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMUnmarshallerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.UnmarshalException;
+import javax.xml.bind.UnmarshallerHandler;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.ws.jaxme.JMUnmarshaller;
+import org.apache.ws.jaxme.util.DOMSerializer;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** JaxMe's {@link javax.xml.bind.Unmarshaller} implementation.
+ */
+public class JMUnmarshallerImpl extends JMControllerImpl implements JMUnmarshaller {
+    private static final SAXParserFactory spf;
+    static {
+        spf = SAXParserFactory.newInstance();
+        spf.setValidating(false);
+        spf.setNamespaceAware(true);
+    }
+    
+    private boolean validating;
+
+    public boolean isValidating() { return validating; }
+    public void setValidating(boolean pValidating) { validating = pValidating; }
+    
+    public Object unmarshal(URL pURL) throws JAXBException {
+        InputSource isource;
+        try {
+            isource = new InputSource(pURL.openStream());
+            isource.setSystemId(pURL.toString());
+        } catch (IOException e) {
+            throw new UnmarshalException("Failed to open URL " + pURL, e);
+        }
+        return unmarshal(isource);
+    }
+    
+    public Object unmarshal(File pFile) throws JAXBException {
+        InputSource isource;
+        try {
+            isource = new InputSource(new FileInputStream(pFile));
+            isource.setSystemId(pFile.toURL().toString());
+        } catch (IOException e) {
+            throw new UnmarshalException("Failed to open file " + pFile, e);
+        }
+        return unmarshal(isource);
+    }
+    
+    public Object unmarshal(InputStream pStream) throws JAXBException {
+        return unmarshal(new InputSource(pStream));
+    }
+    
+    public Object unmarshal(InputSource pSource) throws JAXBException {
+        UnmarshallerHandler uh = getUnmarshallerHandler();
+        try {
+            SAXParser sp = spf.newSAXParser();
+            XMLReader xr = sp.getXMLReader();
+            xr.setContentHandler(uh);
+            xr.parse(pSource);
+        } catch (SAXException e) {
+            if (e.getException() != null) {
+                throw new UnmarshalException(e.getException());
+            } else {
+                throw new UnmarshalException(e);
+            }
+        } catch (IOException e) {
+            throw new UnmarshalException(e);
+        } catch (ParserConfigurationException e) {
+            throw new UnmarshalException(e);
+        }
+        return uh.getResult();
+    }
+    
+    public Object unmarshal(Node pNode) throws JAXBException {
+        UnmarshallerHandler uh = getUnmarshallerHandler();
+        DOMSerializer ds = new DOMSerializer();
+        try {
+            ds.serialize(pNode, uh);
+        } catch (SAXException e) {
+            if (e.getException() != null) {
+                throw new UnmarshalException(e.getException());
+            } else {
+                throw new UnmarshalException(e);
+            }
+        }
+        return uh.getResult();
+    }
+    
+    public Object unmarshal(Source pSource) throws JAXBException {
+        if (pSource instanceof SAXSource) {
+            SAXSource ss = (SAXSource) pSource;
+            InputSource is = ss.getInputSource();
+            if (is == null) {
+                throw new UnmarshalException("The SAXResult doesn't have its InputSource set.");
+            }
+            XMLReader xr = ss.getXMLReader();
+            if (xr == null) {
+                return unmarshal(is);
+            } else {
+                UnmarshallerHandler uh = getUnmarshallerHandler();
+                xr.setContentHandler(uh);
+                try {
+                    xr.parse(is);
+                } catch (IOException e) {
+                    throw new JAXBException(e);
+                } catch (SAXException e) {
+                    if (e.getException() != null) {
+                        throw new JAXBException(e.getException());
+                    } else {
+                        throw new JAXBException(e);
+                    }
+                }
+                return uh.getResult();
+            }
+        } else if (pSource instanceof StreamSource) {
+            StreamSource ss = (StreamSource) pSource;
+            InputSource iSource = new InputSource();
+            iSource.setPublicId(ss.getPublicId());
+            iSource.setSystemId(ss.getSystemId());
+            Reader r = ss.getReader();
+            if (r == null) {
+                InputStream is = ss.getInputStream();
+                if (is == null) {
+                    throw new IllegalArgumentException("The StreamSource doesn't have its Reader or InputStream set.");
+                } else {
+                    iSource.setByteStream(is);
+                }
+            } else {
+                iSource.setCharacterStream(r);
+            }
+            return unmarshal(iSource);
+        } else if (pSource instanceof DOMSource) {
+            Node node = ((DOMSource) pSource).getNode();
+            if (node == null) {
+                throw new IllegalArgumentException("The DOMSource doesn't have its Node set.");
+            }
+            return unmarshal(node);
+        } else {
+            throw new IllegalArgumentException("Unknown type of Source: " + pSource.getClass().getName() +
+            ", only SAXSource, StreamSource and DOMSource are supported.");
+        }
+    }
+    
+    public UnmarshallerHandler getUnmarshallerHandler() {
+        return new JMUnmarshallerHandlerImpl(this);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMValidatorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMValidatorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/JMValidatorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.UnmarshallerHandler;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+import org.apache.ws.jaxme.JMValidator;
+
+
+/** Simple validator implementation. Works by creating a
+ * {@link javax.xml.bind.Marshaller}, which generates SAX events.
+ * The SAX events are piped into an instance of
+ * {@link javax.xml.bind.UnmarshallerHandler}.
+ */
+public class JMValidatorImpl extends JMControllerImpl implements JMValidator {
+    private class MyEventHandler implements ValidationEventHandler {
+        private boolean invalid;
+        public boolean handleEvent(ValidationEvent pEvent) {
+            invalid = true;
+            ValidationEventHandler eh = getEventHandler();
+            if (eh == null) {
+                return true;
+            } else {
+                return eh.handleEvent(pEvent);
+            }
+        }
+    }
+
+    public boolean validate(Object pObject) throws JAXBException {
+        JAXBContext jc = getJAXBContextImpl();
+        Marshaller m = jc.createMarshaller();
+        Unmarshaller u = jc.createUnmarshaller();
+        MyEventHandler eh = new MyEventHandler();
+        u.setEventHandler(eh);
+        UnmarshallerHandler uh = u.getUnmarshallerHandler();
+        m.marshal(pObject, uh);
+        return !eh.invalid;
+    }
+
+    public boolean validateRoot(Object pObject) throws JAXBException {
+        return validate(pObject);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/OrderedAttributeXMLWriter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/OrderedAttributeXMLWriter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/OrderedAttributeXMLWriter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.impl;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/** This is a subclass of {@link org.apache.ws.jaxme.impl.XMLWriterImpl},
+ * that writes the attributes ordered alphabetically. This is mainly
+ * useful for test purposes, when a canonical representation of the
+ * result is required for comparing against an expected value.
+ */
+public class OrderedAttributeXMLWriter extends XMLWriterImpl {
+    public void startElement(String pNamespaceURI, String pLocalName,
+                             String pQName, final Attributes pAttrs)
+            throws SAXException {
+        Integer[] attributeNumbers = new Integer[pAttrs.getLength()];
+        for (int i = 0;  i < attributeNumbers.length;  i++) {
+        	attributeNumbers[i] = new Integer(i);
+        }
+        Arrays.sort(attributeNumbers, new Comparator(){
+			public int compare(Object pNum1, Object pNum2) {
+                int i1 = ((Integer) pNum1).intValue();
+                int i2 = ((Integer) pNum2).intValue();
+                String uri1 = pAttrs.getURI(i1);
+                if (uri1 == null) {
+                	uri1 = "";
+                }
+                String uri2 = pAttrs.getURI(i2);
+                if (uri2 == null) {
+                	uri2 = "";
+                }
+                int result = uri1.compareTo(uri2);
+                if (result == 0) {
+                	result = pAttrs.getLocalName(i1).compareTo(pAttrs.getLocalName(i2));
+                }
+                return result;
+			}
+        });
+        AttributesImpl orderedAttributes = new AttributesImpl();
+        for (int i = 0;  i < attributeNumbers.length;  i++) {
+        	int num = attributeNumbers[i].intValue();
+            orderedAttributes.addAttribute(pAttrs.getURI(num), pAttrs.getLocalName(num),
+                                           pAttrs.getQName(num), pAttrs.getType(num),
+                                           pAttrs.getValue(num));
+        }
+        super.startElement(pNamespaceURI, pLocalName, pQName, orderedAttributes);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/PassThroughXMLWriter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/PassThroughXMLWriter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/PassThroughXMLWriter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+/** <p>A simple serializer for XML documents
+ * extending the default XMLWriter implementation, XMLWriterImpl.
+ * The basic difference against its parent is that this writer
+ * doesn't escape characters for reasons of the underlying
+ * encoding.</p>
+ *
+ * @author <a href="mailto:iasandcb at hotmail.com">Ias</a>
+ */
+public class PassThroughXMLWriter extends XMLWriterImpl {
+  public boolean canEncode(char c) {
+    return true;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/ValidationEventImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/ValidationEventImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/ValidationEventImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.impl;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** JaxMe's extension of the
+ * {@link javax.xml.bind.helpers.ValidationEventImpl} class,
+ * adding the {@link #getErrorCode()}.
+ */
+public class ValidationEventImpl extends javax.xml.bind.helpers.ValidationEventImpl {
+    private String errorCode;
+
+    /** Creates a new instance with the given severity, message,
+     * and locator.
+     */
+    public ValidationEventImpl(int pSeverity, String pMessage,
+                               ValidationEventLocator pLocator) {
+        super(pSeverity, pMessage, pLocator);
+    }
+    /** Creates a new instance with the given severity, message,
+     * locator, and throwable.
+     */
+    public ValidationEventImpl(int pSeverity, String pMessage,
+                               ValidationEventLocator pLocator,
+                               Throwable pLinkedException) {
+        super(pSeverity, pMessage, pLocator, pLinkedException);
+    }
+
+    /** Sets the error code.
+     */
+    public void setErrorCode(String pErrorCode) {
+        errorCode = pErrorCode;
+    }
+    /** Returns the error code.
+     */
+    public String getErrorCode() {
+        return errorCode;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/XMLWriterImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/XMLWriterImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/XMLWriterImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,359 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.impl;
+
+import org.apache.ws.jaxme.XMLWriter;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBException;
+
+
+/** <p>A simple serializer for XML documents.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XMLWriterImpl implements XMLWriter {
+  private JMMarshallerImpl m;
+  private Writer w;
+  private Locator l;
+  private java.util.Map delayedPrefixes;
+  int curIndent = 0;
+
+  private static final int STATE_OUTSIDE = 0;
+  private static final int STATE_IN_START_ELEMENT = 1;
+  private static final int STATE_IN_ELEMENT = 2;
+  private int state;
+
+  /** Creates a new JaxbXmlSerializer */
+  public XMLWriterImpl() {}
+
+  /** <p>Sets the JaxbXMLSerializers Marshaller.</p>
+   */
+  public void init(JMMarshallerImpl pMarshaller) throws JAXBException {
+    m = pMarshaller;
+  }
+
+  /** <p>Returns the JaxbXMLSerializers Marshaller.</p>
+   */
+  public JMMarshallerImpl getMarshaller() {
+    return m;
+  }
+
+  /** <p>Sets the JaxbXMLSerializers Writer.</p>
+   */
+  public void setWriter(Writer pWriter) throws JAXBException {
+    w = pWriter;
+  }
+  /** <p>Returns the JaxbXMLSerializers Writer.</p>
+   */
+  public Writer getWriter() {
+    return w;
+  }
+
+  /** Sets the locator.
+   *
+   * @param pLocator A locator for use in case of errors
+   * @see #getDocumentLocator
+   */
+  public void setDocumentLocator(Locator pLocator) { l = pLocator; }
+
+  /** Returns the locator
+   * @return A locator previously set with setDocumentLocator or null.
+   * @see #setDocumentLocator
+   */
+  public Locator getDocumentLocator() { return l; }
+
+  /**
+   * <p>Starts use of a namespace prefix.</p>
+   *
+   * @param namespaceURI The namespace URI
+   * @param prefix The prefix
+   * @throws SAXException Not actually thrown, just for compliance to the interface specification.
+   */
+  public void startPrefixMapping(String prefix, String namespaceURI)
+      throws SAXException {
+    if (delayedPrefixes == null) {
+      delayedPrefixes = new java.util.HashMap();
+    }
+    if ("".equals(prefix)) {
+      if (namespaceURI.equals(prefix)) {
+        return;
+      }
+      prefix = XMLConstants.XMLNS_ATTRIBUTE;
+    } else {
+      prefix = XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix;
+    }
+    delayedPrefixes.put(prefix, namespaceURI);
+  }
+
+  /** <p>Terminates use of a namespace prefix.</p>
+   *
+   * @param prefix The prefix being abandoned.
+   * @throws SAXException Not actually thrown, just for compliance to the interface specification.
+   */
+  public void endPrefixMapping(String prefix) throws SAXException {
+    if (delayedPrefixes != null) {
+      if ("".equals(prefix)) {
+        prefix = XMLConstants.XMLNS_ATTRIBUTE;
+      } else {
+        prefix = XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix;
+      }
+      delayedPrefixes.remove(prefix);
+    }
+  }
+
+  /** <p>Starts a document.</p>
+   * @throws SAXException Not actually thrown, just for compliance to the interface specification.
+   */
+  public void startDocument() throws SAXException {
+    if (delayedPrefixes != null) {
+      delayedPrefixes.clear();
+    }
+    state = STATE_OUTSIDE;
+    curIndent = 0;
+  }
+
+  /** <p>This method finishs the handlers action. After calling endDocument you
+   * may start a new action by calling startDocument again.</p>
+   *
+   * @throws SAXException Not actually thrown, just for compliance to the
+   *   interface specification.
+   */  
+  public void endDocument() throws SAXException {}
+
+  /** Calls the character method with the same arguments.
+   * @param ch A string of whitespace characters being inserted into the document.
+   * @param start The index of the first character.
+   * @param length The number of characters.
+   * @throws SAXException Thrown in case of an IOException.
+   */  
+  public void ignorableWhitespace(char[] ch, int start, int length)
+      throws SAXException {
+    characters(ch, start, length);
+  }
+
+  private void stopTerminator() throws java.io.IOException {
+    if (state == STATE_IN_START_ELEMENT) {
+      if (w != null) {
+        w.write('>');
+      }
+      state = STATE_IN_ELEMENT;
+    }
+  }
+
+  /** Inserts a string of characters into the document.
+   * @param ch The characters being inserted. A substring, to be precise.
+   * @param start Index of the first character
+   * @param length Number of characters being inserted
+   * @throws SAXException Thrown in case of an IOException
+   */  
+  public void characters(char[] ch, int start, int length) throws SAXException {
+    try {
+      stopTerminator();
+      if (w == null) return;
+      int end = start+length;
+      for (int i = start;  i < end;  i++) {
+        char c = ch[i];
+        switch (c) {
+          case '&':  w.write("&amp;"); break;
+          case '<':  w.write("&lt;");  break;
+          case '>':  w.write("&gt;");  break;
+          case '\n':
+          case '\r':
+          case '\t':
+             w.write(c); break;
+          default:
+            if (canEncode(c)) {
+              w.write(c);
+            } else {
+              w.write("&#");
+              w.write(Integer.toString(c));
+              w.write(";");
+            }
+            break;
+        }
+      }
+    } catch (IOException e) {
+      throw new SAXException(e);
+    }
+  }
+
+  public boolean canEncode(char c) {
+    return c > 31  &&  c < 127;
+  }
+
+
+  /** <p>Terminates an element.</p>
+   *
+   * @param namespaceURI The namespace URI, if any, or null
+   * @param localName The local name, without prefix, or null
+   * @param qName The qualified name, including a prefix, or null
+   * @throws SAXException Thrown in case of an IOException.
+   */
+  public void endElement(String namespaceURI, String localName, String qName)
+      throws SAXException {
+    if (m != null  &&  m. getIndentation()) {
+      --curIndent;
+    }
+    if (w != null) {
+      try {
+        if (state == STATE_IN_START_ELEMENT) {
+          w.write("/>");
+          state = STATE_OUTSIDE;
+        } else {
+          if (state == STATE_OUTSIDE) {
+            indentMe();
+          }
+          w.write("</");
+          w.write(qName);
+          w.write('>');
+        }
+        state = STATE_OUTSIDE;
+      } catch (java.io.IOException e) {
+        throw new SAXException(e);
+      }
+    }
+  }
+
+  private void indentMe() throws java.io.IOException {
+    if (w != null) {
+      if (m != null  &&  m.getIndentation()) {
+        String s = m.getIndentationSeparator();
+        if (s != null) {
+          w.write(s);
+        }
+        s = m.getIndentationString();
+        for (int i = 0;  i < curIndent;  i++) {
+          w.write(s);
+        }
+      }
+    }
+  }
+
+  private void writeCData(String v) throws java.io.IOException {
+    int len = v.length();
+    for (int j = 0;  j < len;  j++) {
+      char c = v.charAt(j);
+      switch (c) {
+        case '&':  w.write("&amp;");  break;
+        case '<':  w.write("&lt;");   break;
+        case '>':  w.write("&gt;");   break;
+        case '\'': w.write("&apos;"); break;
+        case '"':  w.write("&quot;"); break;
+        default:
+          if (canEncode(c)) {
+            w.write(c);
+          } else {
+            w.write("&#");
+            w.write(Integer.toString(c));
+            w.write(';');
+          }
+          break;
+      }
+    }
+  }
+
+  /** Starts a new element.
+   *
+   * @param namespaceURI The namespace URI, if any, or null
+   * @param localName The local name, without prefix, or null
+   * @param qName The qualified name, including a prefix, or null
+   * @param attr The element attributes
+   * @throws SAXException Thrown in case of an IOException.
+   */
+  public void startElement(String namespaceURI, String localName, String qName,
+                           Attributes attr) throws SAXException {
+    try {
+      stopTerminator();
+      if (m != null  &&  m.getIndentation()) {
+        if (curIndent > 0) {
+          indentMe();
+        }
+        curIndent++;
+      }
+
+      if (w != null) {
+        w.write('<');
+        w.write(qName);
+        if (attr != null) {
+          for (int i = attr.getLength();  i > 0;) {
+            w.write(' ');
+            String name = attr.getQName(--i);
+            w.write(name);
+            if (delayedPrefixes != null) {
+              delayedPrefixes.remove(name);
+            }
+            w.write("=\"");
+            writeCData(attr.getValue(i));
+            w.write('"');
+          }
+        }
+        if (delayedPrefixes != null  &&  delayedPrefixes.size() > 0) {
+          for (java.util.Iterator iter = delayedPrefixes.entrySet().iterator();
+               iter.hasNext();  ) {
+            java.util.Map.Entry entry = (java.util.Map.Entry) iter.next();
+            w.write(' ');
+            w.write((String) entry.getKey());
+            w.write("=\"");
+            w.write((String) entry.getValue());
+            w.write('"');
+          }
+          delayedPrefixes.clear();
+        }
+      }
+      state = STATE_IN_START_ELEMENT;
+    } catch (java.io.IOException e) {
+      throw new SAXException(e);
+    }
+  }
+
+  /** Not actually implemented, because I don't know how to skip entities.
+   *
+   * @param ent The entity being skipped.
+   * @throws SAXException Not actually thrown, just for compliance to the interface specification.
+   */  
+  public void skippedEntity(String ent) throws SAXException {
+    throw new SAXException("Don't know how to skip entities");
+  }
+    
+  /** Inserts a processing instruction.
+   *
+   * @param target The PI target
+   * @param data The PI data
+   * @throws SAXException Thrown in case of an IOException
+   */  
+  public void processingInstruction(String target, String data)
+      throws SAXException {
+    try {
+      stopTerminator();
+      if (w != null) {
+        w.write("<?");
+        w.write(target);
+        w.write(' ');
+        w.write(data);
+        w.write("?>");
+      }
+    } catch (java.io.IOException e) {
+      throw new SAXException(e);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Implementation of the <code>JaxMe</code> runtime engine.    
+    </p>
+        <p>
+The <code>JaxMe</code> runtime engine is used by the sources generated by JaxMe.
+The essential interfaces are contained in the 
+<a href='../package-summary.html'>root package</a>.
+This package contains the actual implementation used by <code>JaxMe</code>.
+Users will rarely use this code explicitly.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/BaseTestCase.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/BaseTestCase.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/BaseTestCase.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ws.jaxme.JMElement;
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+
+/** <p>A base class for JUnit tests.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: BaseTestCase.java 232102 2005-04-28 23:57:53Z jochen $
+ */
+public abstract class BaseTestCase extends TestCase {
+    protected BaseTestCase() {
+    }
+
+    protected BaseTestCase(String pName) {
+    	super(pName);
+    }
+
+    protected BaseTestCase(Class c) {
+    	this(c.getName());
+    }
+
+    protected String getNamespaceURI(JMElement pElement) {
+    	return pElement.getQName().getNamespaceURI();
+    }
+
+    protected String getPackageName(Class pClass) {
+        String className = pClass.getName();
+        int offset = className.lastIndexOf('.');
+        if (offset == -1) {
+        	throw new IllegalStateException("Unable to parse package name: " + className);
+        } else {
+        	return className.substring(0, offset);
+        }
+    }
+
+    protected JAXBContext getJAXBContext(Class pClass) throws JAXBException {
+        return JAXBContext.newInstance(getPackageName(pClass));
+    }
+
+    // Asserts equality of the two given byte arrays.
+    protected void assertEquals(byte[] pExpect, byte[] pGot) {
+    	if (pExpect.length != pGot.length) {
+    		fail("Expected " + pExpect.length + " bytes, got " + pGot.length);
+    	} else {
+    		for (int i = 0;  i < pExpect.length;  i++) {
+    			if (pExpect[i] != pGot[i]) {
+    				fail("Expected byte " + ((int) pExpect[i]) + " at offset " + i +
+    						", got byte " + ((int) pGot[i]));
+    			}
+    		}
+    	}
+    }
+
+    protected void unmarshalMarshalUnmarshal(Class pClass, String pXML, boolean pIndenting)
+			throws Exception {
+        Object o = unmarshal(pClass, pXML);
+        assertNotNull(o);
+        String s = marshal(o, pClass, pIndenting);
+        assertEquals(pXML, s);
+        Object comp = unmarshal(pClass, s);
+        assertNotNull(comp);
+    }
+
+	protected void unmarshalMarshalUnmarshal(Class pClass, String pXML) throws Exception {
+		unmarshalMarshalUnmarshal(pClass, pXML, true);
+    }
+
+    protected Object unmarshal(Class pClass, String pXML) throws JAXBException {
+        JAXBContext context = JAXBContext.newInstance(getPackageName(pClass));
+        Unmarshaller unmarshaller = context.createUnmarshaller();
+        return unmarshaller.unmarshal(new InputSource(new StringReader(pXML)));
+    }
+
+    protected String marshal(Object o, Class pClass) throws JAXBException {
+		return marshal(o, pClass, true);
+    }
+
+	protected String marshal(Object o, Class pClass, boolean pIndenting) throws JAXBException {
+        JAXBContext context = JAXBContext.newInstance(getPackageName(pClass));
+        Marshaller marshaller = context.createMarshaller();
+		marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, pIndenting ? Boolean.TRUE : Boolean.FALSE);
+        marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+        StringWriter sw = new StringWriter();
+        marshaller.marshal(o, sw);
+        return sw.toString();
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/DefaultValueTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/DefaultValueTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/DefaultValueTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+
+import org.apache.ws.jaxme.test.misc.defaults.Persons;
+import org.apache.ws.jaxme.test.misc.defaults.PersonsType.PersonType;
+import org.apache.ws.jaxme.test.misc.defaults.PersonsType.PersonType.NameType;
+import org.apache.ws.jaxme.test.misc.defaults.impl.PersonsTypeImpl.PersonTypeImpl.NameTypeImpl;
+import org.xml.sax.InputSource;
+
+/**
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class DefaultValueTest extends BaseTestCase {
+  public DefaultValueTest(String pName) {
+    super(pName);
+  }
+
+  private String getPersons() throws Exception {
+    return "<Persons xmlns=\"http://ws.apache.org/jaxme/test/misc/defaults\">\n"
+      + "  <Person>\n"
+      + "    <Name>\n"
+      + "      <Last>Lee</Last>\n"
+      + "    </Name>\n"
+      + "  </Person>\n"
+      + "  <Person Alias=\"Cb\">\n"
+      + "    <Age>30</Age>\n"
+      + "  </Person>\n"
+      + "</Persons>";
+  }
+
+  public void testDefaults() throws Exception {
+    String persons = getPersons();
+    InputSource isource = new InputSource(new StringReader(persons));
+    JAXBContext context =
+      JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.defaults");
+    Persons unmarshalledPersons =
+      (Persons) context.createUnmarshaller().unmarshal(isource);
+    List personList = unmarshalledPersons.getPerson();
+    Iterator i = personList.iterator();
+    i.hasNext();
+    PersonType person = (PersonType) i.next();
+    NameType name = person.getName();
+    assertEquals("Anonymous", name.getFirst());
+    assertEquals("Lee", name.getLast());
+    assertEquals("Ias", person.getAlias());
+    assertEquals(25, person.getAge());
+
+    i.hasNext();
+    person = (PersonType) i.next();
+    name = person.getName();
+    if (name == null) {
+        name = new NameTypeImpl();
+    }
+    assertEquals("Anonymous", name.getFirst());
+    assertEquals(null, name.getLast());
+    assertEquals("Cb", person.getAlias());
+    assertEquals(30, person.getAge());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EnumerationTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EnumerationTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EnumerationTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ws.jaxme.JMElement;
+import org.apache.ws.jaxme.JMUnmarshaller;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.apache.ws.jaxme.impl.JMSAXDriver;
+import org.apache.ws.jaxme.test.misc.enumeration.AllSimpleTypes;
+import org.apache.ws.jaxme.test.misc.enumeration.AllTypesElement;
+import org.apache.ws.jaxme.test.misc.enumeration.MyDoubleTypeClass;
+import org.apache.ws.jaxme.test.misc.enumeration.MyFloatTypeClass;
+import org.apache.ws.jaxme.test.misc.enumeration.MyIntTypeClass;
+import org.apache.ws.jaxme.test.misc.enumeration.MyLongTypeClass;
+import org.apache.ws.jaxme.test.misc.enumeration.MyShortTypeClass;
+import org.apache.ws.jaxme.test.misc.enumeration.MyStringTypeClass;
+import org.apache.ws.jaxme.test.misc.enumeration.impl.AllSimpleTypesImpl;
+import org.apache.ws.jaxme.test.misc.enumeration.impl.AllTypesElementImpl;
+import org.apache.ws.jaxme.test.misc.enumeration.impl.AllTypesElementTypeDriver;
+import org.xml.sax.InputSource;
+
+
+/** Test suite for enumerations generated by <code>xs:enum</code>.
+ */
+public class EnumerationTest extends BaseTestCase {
+	private JAXBContextImpl factory;
+
+	/** Creates a new test instance with the given name.
+	 */
+	public EnumerationTest(String arg) { super(arg); }
+
+	public void setUp() throws JAXBException {
+		factory = (JAXBContextImpl) JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.enumeration");
+	}
+
+	private JAXBContextImpl getFactory() {
+		return factory;
+	}
+
+	private AllSimpleTypes getAllSimpleTypesElement() {
+		AllSimpleTypes element = new AllSimpleTypesImpl();
+		element.setStringElem(MyStringTypeClass.FOO);
+		element.setIntElem(MyIntTypeClass.INT3);
+		element.setLongElem(MyLongTypeClass.LONG_NEGATIVE);
+		element.setShortElem(MyShortTypeClass.SHORT_POSITIVE);
+		element.setDoubleElem(MyDoubleTypeClass.DOUBLE_POSITIVE);
+		element.setFloatElem(MyFloatTypeClass.FLOAT_NEGATIVE);
+		return element;
+	}
+
+	private AllTypesElement getAllTypesElement() throws JAXBException {
+		AllTypesElement element = (AllTypesElement) getFactory().getManager(AllTypesElement.class).getElementJ();
+		element.setAllSimpleTypesElement(getAllSimpleTypesElement());
+		return element;
+	}
+
+	private String getAllTypesElementString() {
+		AllTypesElementImpl elem = new AllTypesElementImpl();
+		String uri = elem.getQName().getNamespaceURI();
+		return
+		"<ex:AllTypesElement xmlns:ex=\"" + uri + "\">\n" +
+		"  <ex:AllSimpleTypesElement>\n" +
+		"    <ex:StringElem>FOO</ex:StringElem>\n" +
+		"    <ex:IntElem>3</ex:IntElem>\n" +
+		"    <ex:LongElem>-23987982739273989</ex:LongElem>\n" +
+		"    <ex:ShortElem>3468</ex:ShortElem>\n" +
+		"    <ex:DoubleElem>3249239847982.234</ex:DoubleElem>\n" +
+		"    <ex:FloatElem>-24234.234</ex:FloatElem>\n" +
+		"  </ex:AllSimpleTypesElement>\n" +
+		"</ex:AllTypesElement>";
+	}
+
+	private void verifyAllSimpleTypesElement(AllSimpleTypes pElement) {
+		assertEquals(MyStringTypeClass.FOO, pElement.getStringElem());
+		assertEquals("FOO", pElement.getStringElem().getValue());
+		assertEquals("FOO", pElement.getStringElem().toString());
+		assertEquals(MyIntTypeClass.INT3, pElement.getIntElem());
+		assertEquals(3, pElement.getIntElem().getValue());
+		assertEquals("INT3", pElement.getIntElem().getName());
+		assertEquals("3", pElement.getIntElem().toString());
+		assertEquals(MyLongTypeClass.LONG_NEGATIVE, pElement.getLongElem());
+		assertEquals(-23987982739273989L, pElement.getLongElem().getValue());
+		assertEquals("LONG_NEGATIVE", pElement.getLongElem().getName());
+		assertEquals("-23987982739273989", pElement.getLongElem().toString());
+		assertEquals(MyShortTypeClass.SHORT_POSITIVE, pElement.getShortElem());
+		assertEquals(3468, pElement.getShortElem().getValue());
+		assertEquals("SHORT_POSITIVE", pElement.getShortElem().getName());
+		assertEquals("3468", pElement.getShortElem().toString());
+		assertEquals(MyDoubleTypeClass.DOUBLE_POSITIVE, pElement.getDoubleElem());
+		assertTrue(3249239847982.234 == pElement.getDoubleElem().getValue());
+		assertEquals("DOUBLE_POSITIVE", pElement.getDoubleElem().getName());
+		assertEquals("3249239847982.234", pElement.getDoubleElem().toString());
+		assertEquals(MyFloatTypeClass.FLOAT_NEGATIVE, pElement.getFloatElem());
+		assertTrue(Float.parseFloat("-24234.234") == pElement.getFloatElem().getValue());
+		assertEquals("FLOAT_NEGATIVE", pElement.getFloatElem().getName());
+		assertEquals("-24234.234", pElement.getFloatElem().toString());
+	}
+
+	private void verifyAllTypesElement(AllTypesElement pElement) {
+		verifyAllSimpleTypesElement(pElement.getAllSimpleTypesElement());
+	}
+
+	/** Test for unmarshalling of simple elements.
+	 */
+	public void testUnmarshalSimpleElements() throws Exception {
+		JMUnmarshaller jmUnmarshaller = (JMUnmarshaller) getFactory().createUnmarshaller();
+		StringReader sr = new StringReader(getAllTypesElementString());
+		AllTypesElement result = (AllTypesElement) jmUnmarshaller.unmarshal(new InputSource(sr));
+		verifyAllSimpleTypesElement(result.getAllSimpleTypesElement());
+	}
+
+	/** Test for unmarshalling of complex elements.
+	 */
+	public void testUnmarshalComplexElements() throws Exception {
+		JAXBContext myFactory = getFactory();
+		Unmarshaller unmarshaller = myFactory.createUnmarshaller();
+		StringReader sr = new StringReader(getAllTypesElementString());
+		AllTypesElement result = (AllTypesElement) unmarshaller.unmarshal(new InputSource(sr));
+		verifyAllTypesElement(result);
+	}
+
+	/** Test for marshalling of simple elements.
+	 */
+	public void testMarshalSimpleElements() throws Exception {
+		StringWriter sw = new StringWriter();
+		AllTypesElement element = getAllTypesElement();
+		Marshaller m = getFactory().createMarshaller();
+		m.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+		m.marshal(element, sw);
+		String expected = getAllTypesElementString();
+		String got = sw.toString();
+		assertEquals(expected, got);
+	}
+
+	/** Test for marshalling of complex elements.
+	 */
+	public void testMarshalComplexElements() throws Exception {
+		JAXBContext myFactory = getFactory();
+		Marshaller marshaller = myFactory.createMarshaller();
+		marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+		StringWriter sw = new StringWriter();
+		JMElement jmElement = (JMElement) getAllTypesElement();
+		assertNotNull(jmElement.getQName());
+		marshaller.marshal(jmElement, sw);
+		assertEquals(getAllTypesElementString(), sw.toString());
+	}
+
+	/** Test for proper creation of prefixes.
+	 */
+	public void testPrefixes() throws Exception {
+		AllTypesElementImpl el = new AllTypesElementImpl();
+		JMSAXDriver driver = new AllTypesElementTypeDriver();
+		assertEquals("ex", driver.getPreferredPrefix(el.getQName().getNamespaceURI()));
+		assertNull(driver.getPreferredPrefix("dummyURI"));
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EventsTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EventsTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/EventsTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,48 @@
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.ParseConversionEvent;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+import org.apache.ws.jaxme.test.misc.types.EAllSimpleTypeAttrs;
+import org.xml.sax.InputSource;
+
+
+/** Tests, whether various events are generated.
+ */
+public class EventsTest extends BaseTestCase {
+	private class Handler implements ValidationEventHandler {
+		private ValidationEvent event;
+		public boolean handleEvent(ValidationEvent pEvent) {
+			event = pEvent;
+			return false;
+		}
+	};
+
+	private ValidationEvent unmarshal(String pXML) throws JAXBException {
+		Handler h = new Handler();
+		JAXBContext context = JAXBContext.newInstance(getPackageName(EAllSimpleTypeAttrs.class));
+		Unmarshaller unmarshaller = context.createUnmarshaller();
+		unmarshaller.setEventHandler(h);
+		try {
+			unmarshaller.unmarshal(new InputSource(new StringReader(pXML)));
+		} catch (JAXBException e) {
+			return h.event;
+		}
+		return null;
+	}
+
+	/** Tests, whether a ConversionEvent is generated.
+	 */
+	public void testConversionEvents() throws JAXBException {
+		final String xml = "<ex:EAllSimpleTypeAttrs xmlns:ex='http://ws.apache.org/jaxme/test/misc/types' IntAttr=''/>";
+		ValidationEvent e = unmarshal(xml);
+		assertNotNull(e);
+		assertTrue(e instanceof ParseConversionEvent);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JaxbTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JaxbTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JaxbTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import org.apache.ws.jaxme.test.misc.jaxb.impl.SomeClass;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JaxbTest.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class JaxbTest extends BaseTestCase {
+  public JaxbTest(String name) {
+    super(name);
+  }
+
+  /** Verify that the interface "SomeClass" with the implementation
+   * "SomeClass" exists and has an attribute "SomeAttribute", and
+   * a child element "SomeElement".
+   */
+  public void testJaxbClass() {
+    org.apache.ws.jaxme.test.misc.jaxb.SomeClass sc = new SomeClass();
+    sc.setSomeAttribute("2");
+    sc.setSomeElement(2);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JiraTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JiraTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/JiraTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,279 @@
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.namespace.QName;
+
+import magoffin.matt.ieat.domain.impl.IngredientImpl;
+import net.dspc.commons.activitymodel.TransmissionData;
+import net.dspc.commons.activitymodel2.Body1;
+import net.dspc.commons.activitymodel2.Body2;
+import net.dspc.commons.activitymodel2.ObjectFactory;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.generator.util.JavaNamer;
+import org.apache.ws.jaxme.test.jira.jaxme65.Jaxme65;
+import org.apache.ws.jaxme.test.jira.jaxme65.Jaxme65Type;
+import org.apache.ws.jaxme.test.jira72.Jaxme72;
+import org.apache.ws.jaxme.test.misc.types.Jira62;
+import org.apache.ws.jaxme.test.misc.types.Row;
+import org.apache.ws.jaxme.test.misc.types.impl.RowImpl;
+import org.apache.ws.jaxme.test.misc.xsimport.a.Outer;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** Some excerpts from Jira bug reports.
+ */
+public class JiraTest extends BaseTestCase {
+	/** Creates a new instance with the given name.
+	 */
+    public JiraTest(String pName) {
+    	super(pName);
+    }
+
+    /** Test for <a href="http://issues.apache.org/jira/browse/JAXME-10">JAXME-10</a>
+     */
+    public void testJaxMe10() throws Exception {
+		final String input1 =
+            "<TransmissionData mail-id=\"mail456.test-account at dspc.net\" xmlns=\"http://commons.dspc.net/activitymodel\">\n" +
+            "  <sender account-id=\"test-account at dspc.net\" name=\"Joe Tester\">\n" +
+            "    <e-mail>test-account at bluprints.com</e-mail>\n" +
+            "    <phone>0793041414141</phone>\n" +
+            "    <crypt-signature/>\n" +
+            "  </sender>\n" +
+            "  <recipient account-id=\"hvendelbo at bluprints.com\" name=\"Henrik Vendelbo\"/>\n" +
+            "</TransmissionData>";
+        unmarshalMarshalUnmarshal(TransmissionData.class, input1);
+        final String input2 =
+            "<TransmissionData mail-id=\"mail456.test-account at dspc.net\" xmlns=\"http://commons.dspc.net/activitymodel\">\n" +
+            "  <sender account-id=\"test-account at dspc.net\" name=\"Joe Tester\">\n" +
+            "    <e-mail>test-account at bluprints.com</e-mail>\n" +
+            "    <phone>0793041414141</phone>\n" +
+            "  </sender>\n" +
+            "  <recipient account-id=\"hvendelbo at bluprints.com\" name=\"Henrik Vendelbo\"/>\n" +
+            "</TransmissionData>";
+        unmarshalMarshalUnmarshal(TransmissionData.class, input2);
+        final String input3 =
+            "<TransmissionData mail-id=\"mail456.test-account at dspc.net\" xmlns=\"http://commons.dspc.net/activitymodel\">\n" +
+            "  <sender account-id=\"test-account at dspc.net\" name=\"Joe Tester\">\n" +
+            "    <phone>0793041414141</phone>\n" +
+            "  </sender>\n" +
+            "  <recipient account-id=\"hvendelbo at bluprints.com\" name=\"Henrik Vendelbo\"/>\n" +
+            "</TransmissionData>";
+        unmarshalMarshalUnmarshal(TransmissionData.class, input3);
+    }
+
+    /** Test for <a href="http://issues.apache.org/jira/browse/JAXME-12">JAXME-12</a>
+     */
+    public void testJaxMe12() throws Exception {
+        final String[] inputs = new String[]{
+            "<Body1 text-template=\"y\" html-template=\"x\" xmlns=\"http://commons.dspc.net/activitymodel2\"/>",
+            "<Body1 text-template=\"y\" xmlns=\"http://commons.dspc.net/activitymodel2\"/>",
+            "<Body1 html-template=\"x\" xmlns=\"http://commons.dspc.net/activitymodel2\"/>",
+            "<Body1 xmlns=\"http://commons.dspc.net/activitymodel2\"/>",
+            "<Body2 xmlns=\"http://commons.dspc.net/activitymodel2\"/>"
+        };
+        for (int i = 0;  i < inputs.length;  i++) {
+        	unmarshalMarshalUnmarshal(Body1.class, inputs[i]);
+        }
+        Body1 body1 = new ObjectFactory().createBody1();
+        body1.setValue("ok");
+        Body2 body2 = new ObjectFactory().createBody2();
+        body2.setValue("ok");
+    }
+
+    /** Test for <a href="http://issues.apache.org/jira/browse/JAXME-38">JAXME-38</a>
+     */
+    public void testJaxMe38() throws Exception {
+    	RowImpl emptyRow = new RowImpl();
+        final String xml = "<ex:row xmlns:ex=\"" + getNamespaceURI(emptyRow) + "\">\n" +
+        "  <ex:cell id=\"1\">a</ex:cell>\n" +
+        "</ex:row>";
+        unmarshalMarshalUnmarshal(Row.class, xml);
+    }
+
+    /** Test for <a href="http://issues.apache.org/jira/browse/JAXME-39">JAXME-39</a>
+     */
+    public void testJaxMe39() throws Exception {
+    	IngredientImpl ingredientImpl = new IngredientImpl();
+        assertTrue(!ingredientImpl.isSetIngredientId());
+        ingredientImpl.setIngredientId(new Integer(0));
+        assertTrue(ingredientImpl.isSetIngredientId());
+    }
+
+    /** Test for <a href="http://issues.apache.org/jira/browse/JAXME-45">JAXME-45</a>
+     */
+    public void testJaxMe45() throws Exception {
+    	Outer outer = new org.apache.ws.jaxme.test.misc.xsimport.a.ObjectFactory().createOuter();
+        outer.setInner1("ok");
+        outer.setInner2(0);
+        JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.xsimport.a");
+        StringWriter sw = new StringWriter();
+        context.createMarshaller().marshal(outer, sw);
+        assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
+                     "<a:outer xmlns:a=\"http://ws.apache.org/jaxme/test/misc/xsimport/a\">\n" +
+                     "  <b:inner1 xmlns:b=\"http://ws.apache.org/jaxme/test/misc/xsimport/b\">ok</b:inner1>\n" +
+                     "  <b:inner2 xmlns:b=\"http://ws.apache.org/jaxme/test/misc/xsimport/b\">0</b:inner2>\n" +
+                     "</a:outer>", sw.toString());
+    }
+
+	/** Test for <a href="http://issues.apache.org/jira/browse/JAXME-51">JAXME-51</a>.
+	 */
+	public void testJAXME51() throws Exception {
+		final String xsSchema =
+			"<?xml version='1.0' encoding='utf-8'?>\n"
+			+ "<xs:schema\n"
+			+ "    xmlns:xs='http://www.w3.org/2001/XMLSchema'\n"
+			+ "    elementFormDefault='qualified'\n"
+			+ "    xmlns='http://ws.apache.org/jaxme/test/jira/jaxme51'\n"
+			+ "    xmlns:jaxb='http://java.sun.com/xml/ns/jaxb'\n"
+			+ "    targetNamespace='http://ws.apache.org/jaxme/test/jira/jaxme51'"
+			+ "    jaxb:version='1.0'>\n"
+			+ "  <xs:annotation><xs:appinfo>\n"
+			+ "    <jaxb:globalBindings underscoreBinding='asCharInWord'/>"
+			+ "  </xs:appinfo></xs:annotation>\n"
+			+ "  <xs:element name='bug'>\n"
+			+ "    <xs:complexType>\n"
+			+ "      <xs:all>\n"
+			+ "        <xs:element name='element1' type='xs:string'/>\n"
+			+ "        <xs:element name='element_1' type='xs:string'/>\n"
+			+ "      </xs:all>\n"
+			+ "    </xs:complexType>\n"
+			+ "  </xs:element>\n"
+			+ "</xs:schema>\n";
+		Generator g = new GeneratorImpl();
+		SchemaReader sr = new JAXBSchemaReader();
+		g.setSchemaReader(sr);
+		sr.setGenerator(g);
+		SchemaSG schema = g.getSchemaReader().parse(new InputSource(new StringReader(xsSchema)));
+		assertEquals("Element1", JavaNamer.convert("element1", schema));
+		assertEquals("Element_1", JavaNamer.convert("element_1", schema));
+	}
+
+	/** Test for <a href="http://issues.apache.org/jira/browse/JAXME-62">JAXME-62</a>.
+	 */
+	public void testJAXME62() throws Exception {
+		for (int i = 0;  i < 6;  i++) {
+			runFacetTest(i, "a", i < 5);
+		}
+		for (int i = 0;  i < 6;  i++) {
+			runFacetTest(i, "b", i > 3);
+		}
+		for (int i = 0;  i < 6;  i++) {
+			runFacetTest(i, "c", i == 4);
+		}
+	}
+
+	private static class EventDetector implements ValidationEventHandler {
+		private boolean gotEvent = false;
+		public boolean handleEvent(ValidationEvent pEvent) {
+			gotEvent = true;
+			return true;
+		}
+		boolean isSuccess() { return !gotEvent; }
+	};
+
+	private void runFacetTest(int i, String pAttrName, boolean pSuccess) throws JAXBException {
+		JAXBContext ctx = super.getJAXBContext(Jira62.class);
+		String xml =
+			"<ex:jira62"
+			+ "  xmlns:ex='http://ws.apache.org/jaxme/test/misc/types'"
+			+ "  " + pAttrName + "='";
+		for (int j = 0;  j < i;  j++) {
+			xml += (char) ('0' + j);
+		}
+		xml += "'/>";
+		InputSource isource = new InputSource(new StringReader(xml));
+		isource.setSystemId("testJAXME62-a-" + i + ".xsd");
+		EventDetector ed = new EventDetector();
+		Unmarshaller u = ctx.createUnmarshaller();
+		u.setEventHandler(ed);
+		u.unmarshal(isource);
+		assertEquals(pSuccess, ed.isSuccess());
+	}
+
+	/** Test for <a href="http://issues.apache.org/jira/browse/JAXME-63">JAXME-63</a>.
+	 */
+	public void testJAXME63() throws Exception {
+		final String xml =
+			"<xs:schema\n"
+			+ "    xmlns:xs='http://www.w3.org/2001/XMLSchema'\n"
+			+ "    elementFormDefault='qualified'>\n"
+			+ "  <xs:group name='params'>\n"
+			+ "    <xs:choice>\n"
+			+ "      <xs:element name='string' type='xs:string'/>\n"
+			+ "      <xs:element name='int' type='xs:int'/>\n"
+			+ "      <xs:element name='boolean' type='xs:boolean'/>\n"
+			+ "    </xs:choice>\n"
+			+ "  </xs:group>\n"
+			+ "  <xs:element name='call'>\n"
+			+ "    <xs:complexType>\n"
+			+ "      <xs:group ref='params' maxOccurs='unbounded'/>\n"
+			+ "    </xs:complexType>\n"
+			+ "  </xs:element>\n"
+			+ "</xs:schema>";
+		Generator g = new GeneratorImpl();
+		g.setProperty("jaxme.package.name", "org.apache.ws.jaxme.test.jira.jaxme63");
+		SchemaReader sr = new JAXBSchemaReader();
+		g.setSchemaReader(sr);
+		sr.setGenerator(g);
+		SchemaSG schema = g.getSchemaReader().parse(new InputSource(new StringReader(xml)));
+		try {
+			schema.generate();
+			fail("Expected exception");
+		} catch (SAXException e) {
+			assertTrue(e.getMessage().indexOf("Model groups with maxOccurs > 1 are not yet supported.") != -1);
+		}
+	}
+
+	/** Test for <a href="http://issues.apache.org/jira/browse/JAXME-65">JAXME-65</a>.
+	 */
+	public void testJAXME65() throws Exception {
+		final String xml1 =
+			"<jaxme65 xmlns='http://ws.apache.org/jaxme/test/jira/jaxme65'>some text<problem>here it is</problem>more text</jaxme65>";
+		Jaxme65 text1 = (Jaxme65) getJAXBContext(Jaxme65.class).createUnmarshaller().unmarshal(new InputSource(new StringReader(xml1)));
+		List list1 = text1.getContent();
+		assertEquals(3, list1.size());
+		assertEquals("some text", list1.get(0));
+		Object o = list1.get(1);
+		assertTrue(o instanceof Jaxme65Type.Problem);
+		Jaxme65Type.Problem problem = (Jaxme65Type.Problem) o;
+		assertEquals("here it is", problem.getValue());
+		assertEquals("more text", list1.get(2));
+		final String xml2 =
+			"<jaxme65 xmlns='http://ws.apache.org/jaxme/test/jira/jaxme65'>some text</jaxme65>";
+		Jaxme65 text2 = (Jaxme65) getJAXBContext(Jaxme65.class).createUnmarshaller().unmarshal(new InputSource(new StringReader(xml2)));
+		List list2 = text2.getContent();
+		assertEquals(1, list2.size());
+		assertEquals("some text", list2.get(0));
+	}
+
+	/** Test for <a href="http://issues.apache.org/jira/browse/JAXME-72">JAXME-72</a>.
+	 */
+	public void testJAXME72() throws JAXBException {
+		// create test structure
+		org.apache.ws.jaxme.test.jira72.ObjectFactory oFact = new org.apache.ws.jaxme.test.jira72.ObjectFactory();
+		Jaxme72 jaxme72  = oFact.createJaxme72();
+		QName qName = new QName("http://this.namespace/must/be/declared", "jaxme72");
+		jaxme72.setTest(qName);
+		// try to marshal it...Jira issue 72 address the problem that this will fail.
+		JAXBContext ctx = JAXBContext.newInstance("org.apache.ws.jaxme.test.jira72");
+		StringWriter sw = new StringWriter();
+		ctx.createMarshaller().marshal(jaxme72, sw);
+		// if we get this far issue 72 shoulb be fixed. just to be sure - unmarshal and compare QNames.
+		Jaxme72 jaxme72Clone = (Jaxme72) ctx.createUnmarshaller().unmarshal(new InputSource(new StringReader(sw.toString())));
+		assertEquals(jaxme72.getTest(),jaxme72Clone.getTest());
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/MarshallerTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/MarshallerTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/MarshallerTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,703 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.DateFormat;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.UnmarshalException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.ws.jaxme.XMLConstants;
+import org.apache.ws.jaxme.XMLWriter;
+import org.apache.ws.jaxme.impl.DatatypeConverterImpl;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.impl.JMControllerImpl;
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.apache.ws.jaxme.test.misc.address.Address;
+import org.apache.ws.jaxme.test.misc.address.AddressType;
+import org.apache.ws.jaxme.test.misc.types.AllElement;
+import org.apache.ws.jaxme.test.misc.types.AllSimpleTypes;
+import org.apache.ws.jaxme.test.misc.types.AllTypesElement;
+import org.apache.ws.jaxme.test.misc.types.Author;
+import org.apache.ws.jaxme.test.misc.types.Html;
+import org.apache.ws.jaxme.test.misc.types.ObjectFactory;
+import org.apache.ws.jaxme.test.misc.types.impl.AllElementImpl;
+import org.apache.ws.jaxme.test.misc.types.impl.AllSimpleTypesImpl;
+import org.apache.ws.jaxme.test.misc.types.impl.AllTypesElementImpl;
+import org.apache.ws.jaxme.util.Duration;
+import org.apache.ws.jaxme.xs.util.XsDateFormat;
+import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
+import org.apache.ws.jaxme.xs.util.XsTimeFormat;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: MarshallerTest.java 279090 2005-09-06 22:26:11 +0200 (Di, 06 Sep 2005) jochen $
+ */
+public class MarshallerTest extends BaseTestCase {
+	private JAXBContextImpl factory;
+
+  /** <p>Creates a new instance of MarshallerTest.</p>
+   */
+  public MarshallerTest(String arg) { super(arg); }
+
+  public void setUp() throws JAXBException {
+    factory = (JAXBContextImpl) JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.types");
+  }
+
+  protected JAXBContextImpl getFactory() {
+    return factory;
+  }
+
+  protected Calendar getDateTime() {
+    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+    cal.set(Calendar.DAY_OF_MONTH, 22);
+    cal.set(Calendar.MONTH, 11-1);
+    cal.set(Calendar.YEAR, 2002);
+    cal.set(Calendar.HOUR_OF_DAY, 16);
+    cal.set(Calendar.MINUTE, 43);
+    cal.set(Calendar.SECOND, 37);
+    cal.set(Calendar.MILLISECOND, 0);
+    return cal;
+  }
+
+  protected Calendar getTime() {
+    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+    cal.set(Calendar.HOUR_OF_DAY, 16);
+    cal.set(Calendar.MINUTE, 43);
+    cal.set(Calendar.SECOND, 37);
+    cal.set(Calendar.MILLISECOND, 0);
+    cal.set(Calendar.YEAR, 0);
+    cal.set(Calendar.MONTH, 0);
+    cal.set(Calendar.DAY_OF_MONTH, 0);
+    return cal;
+  }
+
+  protected Calendar getDate() {
+    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+    cal.set(Calendar.DAY_OF_MONTH, 22);
+    cal.set(Calendar.MONTH, 11-1);
+    cal.set(Calendar.YEAR, 2002);
+    cal.set(Calendar.HOUR_OF_DAY, 0);
+    cal.set(Calendar.MINUTE, 0);
+    cal.set(Calendar.SECOND, 0);
+    cal.set(Calendar.MILLISECOND, 0);
+    return cal;
+  }
+
+  protected Duration getDuration() {
+    Duration d = new Duration(false, 1, 2, 3, 4, 5, 6, 7);
+    return d;
+  }
+
+  protected byte[] getHexBytes() {
+    return new byte[]{1, 17, 35, 78, 115, -99, -69, -1};
+  }
+
+  protected BigDecimal newBigDecimal() {
+      return new BigDecimal("6.023e23");
+  }
+  
+  protected AllSimpleTypes getAllSimpleTypesElement() {
+    AllSimpleTypes element = new AllSimpleTypesImpl();
+    element.setStringElem("This is a string with german Umlauts: \u00e4\u00f6\u00fc\u00df\u00c4\u00d6\u00dc");
+    element.setDoubleElem(23979782937923.2398798);
+    element.setFloatElem(-34768.3486787f);
+    element.setIntElem(-2139879);
+    element.setLongElem(1290380128309182303l);
+    element.setShortElem((short) 23878);
+    element.setDateElem(getDate());
+    element.setDateTimeElem(getDateTime());
+    element.setTimeElem(getTime());
+    element.setDurationElem(getDuration());
+    element.setHexBinaryElem(getHexBytes());
+    element.setBase64BinaryElem(getHexBytes());
+    element.setNmTokenElem("a-name-token"); 
+    List nmTokens = element.getNmTokensElem();
+    nmTokens.add("a-name-token");
+    nmTokens.add("another:name-token");
+    element.setDecimalElem(newBigDecimal());
+    element.setIntegerElem(new BigDecimal("-6023e20").toBigInteger());
+    element.setNonNegativeIntegerElem(new BigInteger("101"));
+    element.setPositiveIntegerElem(new BigDecimal("+6023e20").toBigInteger());
+    element.setNonPositiveIntegerElem(new BigInteger("-21714"));
+    element.setNegativeIntegerElem(new BigInteger("-21714"));
+    element.setQNameElem(new QName("http://ws.apache.org/jaxme/test/misc/types", "ias"));
+    element.setBooleanElem(true);
+    return element;
+  }
+
+  protected AllTypesElement getAllTypesElement() throws JAXBException {
+    AllTypesElement element = (AllTypesElement) getFactory().getManager(AllTypesElement.class).getElementJ();
+    element.setAllSimpleTypesElement(getAllSimpleTypesElement());
+    List list = element.getListTypeElement();
+    list.add(new BigInteger("7"));
+    list.add(new BigInteger("-3"));
+    list.add(new BigInteger("0"));
+    element.setUnionTypeElement(getDateTime());
+    return element;
+  }
+
+  protected String getAllSimpleTypesElementString() {
+    AllTypesElementImpl elem = new AllTypesElementImpl();
+    String uri = elem.getQName().getNamespaceURI();
+    return
+      "<ex:AllSimpleTypesElement xmlns:ex=\"" + uri + "\">" +
+      "<ex:StringElem>This is a string with german Umlauts: &#228;&#246;&#252;&#223;&#196;&#214;&#220;</ex:StringElem>" +
+      "<ex:IntElem>-2139879</ex:IntElem>" +
+      "<ex:LongElem>1290380128309182303</ex:LongElem>" +
+      "<ex:ShortElem>23878</ex:ShortElem>" +
+      "<ex:DoubleElem>2.397978293792324E13</ex:DoubleElem>" +
+      "<ex:FloatElem>-34768.348</ex:FloatElem>" +
+      "<ex:DateTimeElem>2002-11-22T16:43:37Z</ex:DateTimeElem>" +
+      "<ex:DateElem>2002-11-22Z</ex:DateElem>" +
+      "<ex:TimeElem>16:43:37Z</ex:TimeElem>" +
+      "<ex:DurationElem>P1Y2M3DT4H5M6.7S</ex:DurationElem>" +
+      "<ex:HexBinaryElem>0111234E739DBBFF</ex:HexBinaryElem>" +
+      "<ex:Base64BinaryElem>AREjTnOdu/8=</ex:Base64BinaryElem>" +
+      "<ex:NmTokenElem>a-name-token</ex:NmTokenElem>" +
+      "<ex:NmTokensElem>a-name-token another:name-token</ex:NmTokensElem>" +
+      "<ex:DecimalElem>" + new DatatypeConverterImpl().printDecimal(newBigDecimal()) + "</ex:DecimalElem>" +
+      "<ex:IntegerElem>-602300000000000000000000</ex:IntegerElem>" +
+      "<ex:NonNegativeIntegerElem>101</ex:NonNegativeIntegerElem>" +
+      "<ex:PositiveIntegerElem>602300000000000000000000</ex:PositiveIntegerElem>" +
+      "<ex:NonPositiveIntegerElem>-21714</ex:NonPositiveIntegerElem>" +
+      "<ex:NegativeIntegerElem>-21714</ex:NegativeIntegerElem>" +
+      "<ex:QNameElem>ex:ias</ex:QNameElem>" +
+      "<ex:BooleanElem>true</ex:BooleanElem>" +
+      "</ex:AllSimpleTypesElement>";
+  }
+
+  private String getAllTypesElementString(boolean pSchemaDeclaration, boolean pFormatted) {
+    AllTypesElementImpl elem = new AllTypesElementImpl();
+    String uri = elem.getQName().getNamespaceURI();
+    String xsi = pSchemaDeclaration ? " xmlns:xsi=\""
+    	+ XMLConstants.XML_SCHEMA_URI + "\" xsi:"
+        + XMLConstants.XML_SCHEMA_NS_ATTR + "=\"foo.xsd\"" : "";
+    String lf = pFormatted ? "\n" : "";
+    String sep = pFormatted ? "  " : "";
+    String sep2 = sep + sep;
+    return
+      "<ex:AllTypesElement xmlns:ex=\"" + uri + "\"" + xsi + ">" + lf +
+      sep + "<ex:AllSimpleTypesElement>" + lf +
+      sep2 + "<ex:StringElem>This is a string with german Umlauts: &#228;&#246;&#252;&#223;&#196;&#214;&#220;</ex:StringElem>" + lf +
+	  sep2 + "<ex:IntElem>-2139879</ex:IntElem>" + lf +
+      sep2 + "<ex:LongElem>1290380128309182303</ex:LongElem>" + lf +
+      sep2 + "<ex:ShortElem>23878</ex:ShortElem>" + lf +
+      sep2 + "<ex:DoubleElem>2.397978293792324E13</ex:DoubleElem>" + lf +
+      sep2 + "<ex:FloatElem>-34768.348</ex:FloatElem>" + lf +
+      sep2 + "<ex:DateTimeElem>2002-11-22T16:43:37Z</ex:DateTimeElem>" + lf +
+      sep2 + "<ex:DateElem>2002-11-22Z</ex:DateElem>" + lf +
+      sep2 + "<ex:TimeElem>16:43:37Z</ex:TimeElem>" + lf +
+      sep2 + "<ex:DurationElem>P1Y2M3DT4H5M6.7S</ex:DurationElem>" + lf +
+      sep2 + "<ex:HexBinaryElem>0111234E739DBBFF</ex:HexBinaryElem>" + lf +
+      sep2 + "<ex:Base64BinaryElem>AREjTnOdu/8=</ex:Base64BinaryElem>" + lf +
+      sep2 + "<ex:NmTokenElem>a-name-token</ex:NmTokenElem>" + lf +
+      sep2 + "<ex:NmTokensElem>a-name-token another:name-token</ex:NmTokensElem>" + lf +
+      sep2 + "<ex:DecimalElem>" + new DatatypeConverterImpl().printDecimal(newBigDecimal()) + "</ex:DecimalElem>" + lf +
+      sep2 + "<ex:IntegerElem>-602300000000000000000000</ex:IntegerElem>" + lf +
+      sep2 + "<ex:NonNegativeIntegerElem>101</ex:NonNegativeIntegerElem>" + lf +
+      sep2 + "<ex:PositiveIntegerElem>602300000000000000000000</ex:PositiveIntegerElem>" + lf +
+      sep2 + "<ex:NonPositiveIntegerElem>-21714</ex:NonPositiveIntegerElem>" + lf +
+      sep2 + "<ex:NegativeIntegerElem>-21714</ex:NegativeIntegerElem>" + lf +
+      sep2 + "<ex:QNameElem>ex:ias</ex:QNameElem>" + lf +
+      sep2 + "<ex:BooleanElem>true</ex:BooleanElem>" + lf +
+      sep + "</ex:AllSimpleTypesElement>" + lf +
+      sep + "<ex:ListTypeElement>7 -3 0</ex:ListTypeElement>" + lf +
+      sep + "<ex:UnionTypeElement>2002-11-22T16:43:37Z</ex:UnionTypeElement>" + lf +
+      "</ex:AllTypesElement>";
+  }
+
+  protected XMLReader getXMLReader() throws ParserConfigurationException, SAXException {
+    // Verify whether we can create a SAX Parser; it's better to detect this here
+    // than within JAXB
+    SAXParserFactory spf = SAXParserFactory.newInstance();
+    spf.setNamespaceAware(true);
+    spf.setValidating(false);
+    SAXParser sp = spf.newSAXParser();
+    return sp.getXMLReader();
+  }
+
+  protected void verifyAllSimpleTypesElement(AllSimpleTypes pElement) {
+    assertEquals("This is a string with german Umlauts: \u00e4\u00f6\u00fc\u00df\u00c4\u00d6\u00dc",
+                       pElement.getStringElem());
+    assertEquals(new Double("2.397978293792324E13").doubleValue(),
+                 pElement.getDoubleElem(), 0);
+    assertEquals(new Float(-34768.348).floatValue(), pElement.getFloatElem(), 0);
+    assertEquals(new Integer(-2139879).intValue(), pElement.getIntElem());
+    assertEquals(new Long(1290380128309182303L).longValue(), pElement.getLongElem());
+    assertEquals(new Short((short) 23878).shortValue(), pElement.getShortElem());
+    assertEquals(getDateTime(), pElement.getDateTimeElem());
+    assertEquals(getDate(), pElement.getDateElem());
+    assertEquals(getTime(), pElement.getTimeElem());
+    assertEquals(getDuration(), pElement.getDurationElem());
+    assertEquals(getHexBytes(), pElement.getHexBinaryElem());
+    assertEquals(getHexBytes(), pElement.getBase64BinaryElem());
+    assertEquals(new BigInteger("101"), pElement.getNonNegativeIntegerElem());
+    assertTrue(pElement.isBooleanElem());
+  }
+
+  protected void verifyAllTypesElement(AllTypesElement pElement) {
+    verifyAllSimpleTypesElement(pElement.getAllSimpleTypesElement());
+    List list = pElement.getListTypeElement();
+    assertEquals(3, list.size());
+    assertEquals(new BigInteger("7"), list.get(0));
+    assertEquals(new BigInteger("-3"), list.get(1));
+    assertEquals(new BigInteger("0"), list.get(2));
+    Object object = pElement.getUnionTypeElement();
+    String dateTime1 = DateFormat.getDateTimeInstance().format(getDateTime().getTime());
+    String dateTime2 = DateFormat.getDateTimeInstance().format(((Calendar) object).getTime());
+    assertEquals(dateTime1, dateTime2);
+  }
+
+    /** <p>Tests unmarshalling of a simple element.</p>
+     */
+  	public void testUnmarshalSimpleElements() throws Exception {
+		String s = getAllTypesElementString(false, false);
+	    StringReader sr = new StringReader(s);
+		AllTypesElement e = (AllTypesElement) getFactory().createUnmarshaller().unmarshal(new InputSource(sr));
+		verifyAllSimpleTypesElement(e.getAllSimpleTypesElement());
+	}
+
+  /** <p>Tests, whether complex elements can be marshalled.</p>
+   */
+  public void testUnmarshalComplexElements() throws Exception {
+    testUnmarshalComplexElements(false);
+    testUnmarshalComplexElements(true);
+  }
+
+  private void testUnmarshalComplexElements(boolean pSchemaLocation)
+      throws Exception {
+    JAXBContext myFactory = getFactory();
+    Unmarshaller unmarshaller = myFactory.createUnmarshaller();
+    String s = getAllTypesElementString(pSchemaLocation, true);
+    StringReader sr = new StringReader(s);
+    AllTypesElement result = (AllTypesElement) unmarshaller.unmarshal(new InputSource(sr));
+    verifyAllTypesElement(result);
+    result = (AllTypesElement) myFactory.createUnmarshaller().unmarshal(new StreamSource(new StringReader(s)));
+    verifyAllTypesElement(result);
+  }
+
+  /** <p>Tests marshalling of a simple element.</p>
+   */
+  public void testMarshalSimpleElements() throws Exception {
+	  JMMarshallerImpl m = (JMMarshallerImpl) getFactory().createMarshaller();
+	  StringWriter sw = new StringWriter();
+	  AllTypesElement element = getAllTypesElement();
+	  m.setXmlDeclaration(false);
+	  m.setEncoding("US-ASCII");
+	  m.marshal(element, sw);
+	  String expected = getAllTypesElementString(false, true);
+	  assertEquals(expected, sw.toString());
+  }
+
+  /** <p>Tests marshalling of a complex element.</p>
+   */
+  public void testMarshalComplexElements() throws Exception {
+    JAXBContext myFactory = getFactory();
+    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
+    marshaller.setXmlDeclaration(false);
+    StringWriter sw = new StringWriter();
+    Class c = marshaller.getXMLWriterClass();
+    XMLWriter w = (XMLWriter) c.newInstance();
+    w.init(marshaller);
+    String rawInput = getAllTypesElementString(false, true);
+    StringBuffer input = new StringBuffer();
+    for (int i = 0;  i < rawInput.length();  i++) {
+      char ch = rawInput.charAt(i);
+      boolean done = false;
+      if (ch == '&') {
+        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
+          int j = 2;
+          StringBuffer digits = new StringBuffer();
+          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
+            digits.append(rawInput.charAt(i+j));
+            ++j;
+          }
+          if (digits.length() > 0  &&
+              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
+            char chr = (char) Integer.parseInt(digits.toString());
+            if (w.canEncode(chr)) {
+              done = true;
+              i += j;
+              input.append(chr);
+            }
+          }
+        }
+      }
+      if (!done) {
+        input.append(ch);
+      }
+    }
+    marshaller.marshal(getAllTypesElement(), sw);
+    assertEquals(input.toString(), sw.toString());
+  }
+
+  protected String getMarshalledAuthor() throws JAXBException {
+      Author author = new ObjectFactory().createAuthor();
+      author.setRating(2);
+      author.setValue("This is a test.");
+      StringWriter sw = new StringWriter();
+      Marshaller m = getFactory().createMarshaller();
+      m.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+      m.marshal(author, sw);
+      return sw.toString();
+  }
+
+  /** <p>Tests, whether elements with simple content can be marshalled.</p>
+   */
+  public void testMarshalSimpleContent() throws Exception {
+      String expect = "<ex:Author rating=\"2\" xmlns:ex=\"http://ws.apache.org/jaxme/test/misc/types\">This is a test.</ex:Author>";
+      String got = getMarshalledAuthor();
+      assertEquals(expect, got);
+  }
+
+  private void verifyUnmarshalledAuthor(Author pAuthor) {
+    assertEquals(2, pAuthor.getRating());
+    assertEquals("This is a test.", pAuthor.getValue());
+  }
+
+  /** <p>Tests, whether elements with simple content can be unmarshalled.</p>
+   */
+  public void testUnmarshalSimpleContent() throws Exception {
+  	  String s = getMarshalledAuthor();
+      Author author = (Author) getFactory().createUnmarshaller().unmarshal(new InputSource(new StringReader(s)));
+      verifyUnmarshalledAuthor(author);
+      author = (Author) getFactory().createUnmarshaller().unmarshal(new StreamSource(new StringReader(s)));
+      verifyUnmarshalledAuthor(author);
+  }
+
+  /**
+   * Tests that toString returns an appropriate xsd:duration value
+   */
+  public void testExplicitToString() {
+      String dur1 = "P0Y0M0DT0H2M60S";
+      Duration duration1 = Duration.valueOf(dur1);
+      String actualReturn = duration1.toString();
+      assertEquals("return value not as expected", dur1, actualReturn);
+  }
+
+  /**
+   * Tests that toString returns an appropriate xsd:duration value
+   */
+  public void testImplicitToString() {
+      String dur2 = "PT2M60S";
+      Duration duration2 = Duration.valueOf(dur2);
+      String actualReturn = duration2.toString();
+      String expect = "P0Y0M0DT0H2M60S";
+      assertEquals("return value not as expected ", expect, actualReturn);
+  }
+  
+  /**
+   * Test that getMillis returns the total time of duration in
+   milliseconds
+   */
+  public void testMillis() {
+      String dur2 = "PT2M60S";
+      Duration duration2 = Duration.valueOf(dur2);
+      assertEquals(2, duration2.getMinutes());
+      assertEquals(60, duration2.getSeconds());
+  }
+
+  protected String getAllElementString(boolean pRandom, Format pDateTimeFormat, Format pDateFormat, Format pTimeFormat) {
+    AllElementImpl elem = new AllElementImpl();
+    String uri = elem.getQName().getNamespaceURI();
+    String[] elements = new String[]{
+      "<ex:StringElem>This is a string with german Umlauts: &#228;&#246;&#252;&#223;&#196;&#214;&#220;</ex:StringElem>",
+      "<ex:IntElem>-2139879</ex:IntElem>",
+      "<ex:LongElem>1290380128309182303</ex:LongElem>",
+      "<ex:ShortElem>23878</ex:ShortElem>",
+      "<ex:DoubleElem>2.397978293792324E13</ex:DoubleElem>",
+      "<ex:FloatElem>-34768.348</ex:FloatElem>",
+      "<ex:DateTimeElem>" + pDateTimeFormat.format(getDateTime()) + "</ex:DateTimeElem>",
+      "<ex:DateElem>" + pDateFormat.format(getDate()) + "</ex:DateElem>",
+      "<ex:TimeElem>" + pTimeFormat.format(getTime()) + "</ex:TimeElem>",
+      "<ex:DurationElem>P1Y2M3DT4H5M6.7S</ex:DurationElem>",
+      "<ex:HexBinaryElem>0111234E739DBBFF</ex:HexBinaryElem>",
+      "<ex:Base64BinaryElem>AREjTnOdu/8=</ex:Base64BinaryElem>",
+      "<ex:NmTokenElem>a-name-token</ex:NmTokenElem>",
+      "<ex:NmTokensElem>a-name-token another:name-token</ex:NmTokensElem>",
+      "<ex:DecimalElem>" + new DatatypeConverterImpl().printDecimal(newBigDecimal()) + "</ex:DecimalElem>",
+      "<ex:IntegerElem>-602300000000000000000000</ex:IntegerElem>",
+      "<ex:NonNegativeIntegerElem>101</ex:NonNegativeIntegerElem>",
+      "<ex:PositiveIntegerElem>602300000000000000000000</ex:PositiveIntegerElem>",
+      "<ex:NonPositiveIntegerElem>-21714</ex:NonPositiveIntegerElem>",
+      "<ex:NegativeIntegerElem>-21714</ex:NegativeIntegerElem>",
+      "<ex:QNameElem>ex:ias</ex:QNameElem>",
+      "<ex:BooleanElem>true</ex:BooleanElem>"
+    };
+
+    if (pRandom) {
+    	List list = new ArrayList(Arrays.asList(elements));
+        for (int i = 0;  i < elements.length;  i++) {
+            int num = (int) (Math.random() * list.size());
+            String element = (String) list.remove(num);
+        	elements[i] = element;
+        }
+    }
+
+    StringBuffer result = new StringBuffer();
+    result.append("<ex:AllElement xmlns:ex=\"" + uri + "\">");
+    for (int i = 0;  i < elements.length;  i++) {
+    	result.append(elements[i]);
+    }
+    result.append("</ex:AllElement>");
+    return result.toString();
+  }
+
+  /** <p>Tests marshalling and unmarshalling of an element with "xs:all"
+   * contents.</p>
+   */
+  public void testAllElement() throws Exception {
+	  final Format defaultDateTimeFormat = new XsDateTimeFormat();
+	  final Format defaultDateFormat = new XsDateFormat();
+	  final Format defaultTimeFormat = new XsTimeFormat();
+	  testAllElement(defaultDateTimeFormat, defaultDateFormat, defaultTimeFormat);
+
+	  final Format otherDateTimeFormat = new Format(){
+		private static final long serialVersionUID = -6173879133371739286L;
+		private final DateFormat df = new SimpleDateFormat("yyyy.MMM.dd 'at' HH:mm:ss.SSS z");
+		public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
+			return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
+		}
+		public Object parseObject(String pSource, ParsePosition pPos) {
+			Calendar cal = Calendar.getInstance();
+			cal.setTime((Date) df.parseObject(pSource, pPos));
+			return cal;
+		}
+	  };
+	  final Format otherDateFormat = new Format(){
+		  private final DateFormat df = new SimpleDateFormat("yyyy.MMM.dd z");
+		  public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
+			  return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
+		  }
+		  public Object parseObject(String pSource, ParsePosition pPos) {
+			  Calendar cal = Calendar.getInstance();
+			  cal.setTime((Date) df.parseObject(pSource, pPos));
+			  return cal;
+		  }
+	  };
+	  final Format otherTimeFormat = new Format(){
+		  private static final long serialVersionUID = -6173879133371739286L;
+		  private final DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS z");
+		  public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
+			  return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
+		  }
+		  public Object parseObject(String pSource, ParsePosition pPos) {
+			  Calendar cal = Calendar.getInstance();
+			  cal.setTime((Date) df.parseObject(pSource, pPos));
+			  return cal;
+		  }
+	  };
+	  testAllElement(otherDateTimeFormat, otherDateFormat, otherTimeFormat);
+  }
+
+  private void testAllElement(final Format pDateTimeFormat, final Format pDateFormat, final Format pTimeFormat) throws JAXBException, PropertyException {
+	  String s = getAllElementString(true, pDateTimeFormat, pDateFormat, pTimeFormat);
+	  JAXBContext context = getFactory();
+	  Unmarshaller unmarshaller = context.createUnmarshaller();
+	  unmarshaller.setProperty(JMControllerImpl.JAXME_FORMAT_DATETIME, pDateTimeFormat);
+	  unmarshaller.setProperty(JMControllerImpl.JAXME_FORMAT_DATE, pDateFormat);
+	  unmarshaller.setProperty(JMControllerImpl.JAXME_FORMAT_TIME, pTimeFormat);
+	  AllElement e = (AllElement) unmarshaller.unmarshal(new InputSource(new StringReader(s)));
+	  StringWriter sw = new StringWriter();
+	  Marshaller marshaller = context.createMarshaller();
+	  marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+	  marshaller.setProperty(Marshaller.JAXB_ENCODING, "ASCII");
+	  marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+	  marshaller.setProperty(JMControllerImpl.JAXME_FORMAT_DATETIME, pDateTimeFormat);
+	  marshaller.setProperty(JMControllerImpl.JAXME_FORMAT_DATE, pDateFormat);
+	  marshaller.setProperty(JMControllerImpl.JAXME_FORMAT_TIME, pTimeFormat);
+	  marshaller.marshal(e, sw);
+	  String got = sw.toString();
+	  String expect = getAllElementString(false, pDateTimeFormat, pDateFormat, pTimeFormat);
+	  assertEquals(expect, got);
+}
+
+  private RootElementHandler getRootElementInfo(String pElement) throws ParserConfigurationException, IOException, SAXException {
+    RootElementHandler reh = new RootElementHandler();
+    XMLReader xr = getXMLReader();
+    try {
+      xr.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+    } catch (SAXNotSupportedException e) {
+    } catch (SAXNotRecognizedException e) {
+    }
+    try {
+      xr.setFeature("http://xml.org/sax/features/xmlns-uris", true);
+    } catch (SAXNotSupportedException e) {
+    } catch (SAXNotRecognizedException e) {
+    }
+    xr.setContentHandler(reh);
+    xr.parse(new InputSource(new StringReader(pElement)));
+    return reh;
+  }
+
+  private class RootElementHandler extends DefaultHandler {
+    Attributes rootElementAttributes;
+    String rootElementURI, rootElementLocalName, rootElementQName;
+    private boolean isRootElement = true;
+    public void startElement(String pNamespaceURI, String pLocalName, String pQName,
+    		                 Attributes pAttr) {
+      if (isRootElement) {
+      	isRootElement = false;
+      	rootElementAttributes = pAttr;
+      	rootElementURI = pNamespaceURI;
+      	rootElementLocalName = pLocalName;
+      	rootElementQName = pQName;
+      }
+    }
+  }
+
+  private String getContents(String pElement) {
+    int offset1 = pElement.indexOf('>');
+    int offset2 = pElement.lastIndexOf('<');
+    assertTrue(offset2 > offset1);
+    return pElement.substring(offset1+1, offset2);
+  }
+
+  protected void assertEquals(Attributes pAttr1, Attributes pAttr2) {
+    assertEquals(pAttr1.getLength(), pAttr2.getLength());
+    for (int i = 0;  i < pAttr1.getLength();  i++) {
+       String uri = pAttr1.getURI(i);
+        String localName = pAttr1.getLocalName(i);
+        String value = pAttr1.getValue(i);
+        assertNotNull(value);
+        assertEquals(value, pAttr2.getValue(uri, localName));
+    }
+  }
+
+  /** <p>Tests the {@link Marshaller} property
+   * {@link Marshaller#JAXB_SCHEMA_LOCATION}.</p>
+   */
+  public void testSchemaLocation() throws Exception {
+    String s = getAllTypesElementString(true, false);
+    JAXBContext context = getFactory();
+    AllTypesElement e = (AllTypesElement) context.createUnmarshaller().unmarshal(new InputSource(new StringReader(s)));
+    StringWriter sw = new StringWriter();
+    Marshaller marshaller = context.createMarshaller();
+    marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "foo.xsd");
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+    marshaller.setProperty(Marshaller.JAXB_ENCODING, "ASCII");
+    marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+    marshaller.marshal(e, sw);
+    String got = sw.toString();
+    String s1 = "xsi:" + XMLConstants.XML_SCHEMA_NS_ATTR + "='foo.xsd'";
+    String s2 = "xsi:" + XMLConstants.XML_SCHEMA_NS_ATTR + "=\"foo.xsd\"";
+    int offset1 = s.indexOf(s1);
+    int offset2 = s.indexOf(s2);
+    int offset3 = s.indexOf('>');
+    assertTrue((offset1 > 0  &&  offset1 < offset3)
+               ||  (offset2 > 0  &&  offset2 < offset3));
+ 
+    // When validating the result, we are unsure about the
+    // order of the attributes in the outermost element.
+    RootElementHandler reh1 = getRootElementInfo(s);
+    RootElementHandler reh2 = getRootElementInfo(got);
+    assertEquals(reh1.rootElementURI, reh2.rootElementURI);
+    assertEquals(reh1.rootElementLocalName, reh2.rootElementLocalName);
+    assertEquals(reh1.rootElementAttributes, reh2.rootElementAttributes);
+    assertEquals(getContents(s), getContents(got));
+  }
+
+
+	/** Tests unmarshalling of an invalid string into a JaxMe object.
+	 */
+	public void testValidator() throws Exception {
+		String invalidAddress = // Note the missing "Last"
+			"<Address xmlns=\"http://ws.apache.org/jaxme/test/misc/address\">\n" +
+			"  <Name>\n" +
+			"    <First>Jane</First>\n" +
+			"  </Name>\n" +
+			"</Address>";
+		InputSource isource = new InputSource(new StringReader(invalidAddress));
+		isource.setSystemId("testValidator.xml");
+		JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
+		try {
+			context.createUnmarshaller().unmarshal(isource);
+			fail("No error reported.");
+		} catch (UnmarshalException e) {
+			// Ok
+		} catch (Throwable t) {
+			fail("Unexpected throwable " + t);
+		}
+
+		org.apache.ws.jaxme.test.misc.address.ObjectFactory of = new org.apache.ws.jaxme.test.misc.address.ObjectFactory();
+		Address address = of.createAddress();
+		address.setName(of.createAddressTypeNameType());
+		AddressType.NameType name = address.getName();
+		name.setFirst("Jane");
+		try {
+			assertFalse(context.createValidator().validate(address));
+		} catch (Throwable t) {
+			t.printStackTrace();
+			fail("Unexpected throwable " + t);
+		}
+	}
+
+	/** Tests marshalling and unmarshalling of a mixed content element.
+	 */
+	public void testMixedContent() throws Exception {
+		final String html =
+			"<ex:html xmlns:ex=\"http://ws.apache.org/jaxme/test/misc/types\">\n" +
+			"  xyz<ex:dummy>012</ex:dummy>\n" +
+			"  <ex:head><ex:title>foo bar</ex:title></ex:head>\n" +
+			"  <ex:body><ex:p/></ex:body>\n" +
+			"</ex:html>";
+		InputSource isource = new InputSource(new StringReader(html));
+		isource.setSystemId("mixedContent.xml");
+		JAXBContext ctx = getJAXBContext(Html.class);
+		Html htmlElem = (Html) ctx.createUnmarshaller().unmarshal(isource);
+		StringWriter sw = new StringWriter();
+		Marshaller m = ctx.createMarshaller();
+		m.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+		m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+		m.marshal(htmlElem, sw);
+		String got = sw.toString();
+		assertEquals(html, got);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/NestedGroupTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/NestedGroupTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/NestedGroupTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+import org.apache.ws.jaxme.ValidationEvents;
+import org.apache.ws.jaxme.impl.ValidationEventImpl;
+import org.apache.ws.jaxme.test.misc.group.impl.PersonsImpl;
+import org.apache.ws.jaxme.test.misc.types.FsDirectory;
+import org.apache.ws.jaxme.test.misc.types.FsDirectoryType;
+import org.apache.ws.jaxme.test.misc.types.FsFile;
+import org.apache.ws.jaxme.test.misc.types.FsNode;
+import org.apache.ws.jaxme.test.nestedgroups.MailTemplate;
+import org.apache.ws.jaxme.test.nestedgroups.MailTemplateMixed;
+import org.apache.ws.jaxme.test.nestedgroups.impl.MailTemplateImpl;
+import org.xml.sax.InputSource;
+
+
+/**
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class NestedGroupTest extends BaseTestCase {
+	/** Creates a new instance with the given name.
+	 */
+	public NestedGroupTest(String pName) {
+        super(pName);
+    }
+
+    private String getPersons() throws Exception {
+        return
+        "<Persons xmlns=\"" + new PersonsImpl().getQName().getNamespaceURI() + "\">\n"
+        + "  <Person Alias=\"Ias\">\n"
+        + "    <FirstName>Changshin</FirstName>\n"
+        + "    <LastName>Lee</LastName>\n"
+        + "    <Age>30</Age>\n"
+        + "  </Person>\n"
+        + "</Persons>";
+    }
+    
+	/** Tests unmarshalling and marshalling of the
+	 * document returned by {@link #getPersons()}.
+	 */
+	public void testNestedGroup() throws Exception {
+		//unmarshalMarshalUnmarshal(Persons.class, getPersons());
+    }
+
+    private String getMailTemplate1(boolean pMixed) {
+		final String a, b, c, d, name;
+		if (pMixed) {
+			name = "Mixed";
+			a = "abc";
+			b = "bcd";
+			c = "cde";
+			d = "def";
+		} else {
+			name = a = b = c = d = "";
+		}
+		return
+        "<ng:MailTemplate" + name + " name=\"foo\" language=\"bar\""
+        + " xmlns:ng=\"" + new MailTemplateImpl().getQName().getNamespaceURI() + "\">\n"
+        + "  " + a + "<ng:subject>A test subject</ng:subject>" + b + "\n"
+        + "  " + c + "<ng:body>A test body</ng:body>" + d + "\n"
+        + "</ng:MailTemplate" + name + ">";
+    }
+
+    private String getMailTemplate2(boolean pMixed) {
+		final String a, b, c, d, name;
+		if (pMixed) {
+			name = "Mixed";
+			a = "abc";
+			b = "bcd";
+			c = "cde";
+			d = "def";
+		} else {
+			name = a = b = c = d = "";
+		}
+        return
+        "<ng:MailTemplate" + name + " name=\"foo\" language=\"bar\""
+        + " xmlns:ng=\"" + new MailTemplateImpl().getQName().getNamespaceURI() + "\">\n"
+        + "  " + a + "<ng:subject>A test subject</ng:subject>" + d + "\n"
+        + "  " + b + "<ng:prepend>A prefix</ng:prepend>\n"
+        + "  " + c + "<ng:append>A suffix</ng:append>\n"
+        + "</ng:MailTemplate" + name + ">";
+    }
+
+    private String getMailTemplate3(boolean pMixed) {
+		final String a, b, c, d, name;
+		if (pMixed) {
+			name = "Mixed";
+			a = "abc";
+			b = "bcd";
+			c = "cde";
+			d = "def";
+		} else {
+			name = a = b = c = d = "";
+		}
+        return
+        "<ng:MailTemplate" + name + " name=\"foo\" language=\"bar\""
+        + " xmlns:ng=\"" + new MailTemplateImpl().getQName().getNamespaceURI() + "\">\n"
+        + "  " + a + "<ng:subject>A test subject</ng:subject>" + d + "\n"
+        + "  " + b + "<ng:prepend>A prefix</ng:prepend>\n"
+        + "  " + c + "<ng:append>A suffix</ng:append>\n"
+        + "  <ng:body>A test body</ng:body>\n"
+        + "</ng:MailTemplate" + name + ">";
+    }
+
+    /** Tests unmarshalling and marshalling of an instance of
+     * {@link MailTemplate}.
+     */
+    public void testMailTemplate() throws Exception {
+        unmarshalMarshalUnmarshal(MailTemplate.class, getMailTemplate1(false));
+        unmarshalMarshalUnmarshal(MailTemplate.class, getMailTemplate2(false));
+    }
+
+	private class MyEventHandler implements ValidationEventHandler {
+		private boolean ok;
+		public boolean handleEvent(ValidationEvent pEvent) {
+			if (pEvent instanceof ValidationEventImpl) {
+				ValidationEventImpl ev = (ValidationEventImpl) pEvent;
+				if (ValidationEvents.EVENT_CHOICE_GROUP_REUSE.equals(ev.getErrorCode())) {
+					ok = true;
+				}
+			}
+			return false;
+		}
+	}
+
+	/** Tests proper handling of the choice group.
+	 */
+	public void testMailTemplateError() throws Exception {
+        JAXBContext context = JAXBContext.newInstance(getPackageName(MailTemplate.class));
+        Unmarshaller unmarshaller = context.createUnmarshaller();
+		MyEventHandler h = new MyEventHandler();
+		unmarshaller.setEventHandler(h);
+		try {
+	        unmarshaller.unmarshal(new InputSource(new StringReader(getMailTemplate3(false))));
+		} catch (Throwable t) {
+		}
+		assertTrue(h.ok);
+	}
+
+    /** Tests unmarshalling and marshalling of an instance of
+     * {@link MailTemplateMixed}.
+     */
+    public void testMailTemplateMixed() throws Exception {
+        unmarshalMarshalUnmarshal(MailTemplateMixed.class, getMailTemplate1(true), false);
+        unmarshalMarshalUnmarshal(MailTemplateMixed.class, getMailTemplate2(true), false);
+    }
+
+	/** Tests proper handling of the choice group.
+	 */
+	public void testMailTemplateMixedError() throws Exception {
+        JAXBContext context = JAXBContext.newInstance(getPackageName(MailTemplateMixed.class));
+        Unmarshaller unmarshaller = context.createUnmarshaller();
+		MyEventHandler h = new MyEventHandler();
+		unmarshaller.setEventHandler(h);
+		try {
+	        unmarshaller.unmarshal(new InputSource(new StringReader(getMailTemplate3(true))));
+		} catch (Throwable t) {
+		}
+		assertTrue(h.ok);
+	}
+
+	/** Tests proper inheritance of xs:extension.
+	 */
+	public void testInheritance() throws Exception {
+		assertTrue(FsNode.class.isAssignableFrom(FsFile.class));
+		assertTrue(FsNode.class.isAssignableFrom(FsDirectory.class));
+		assertTrue(FsNode.class.isAssignableFrom(FsDirectoryType.class));
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/ParserTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/ParserTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/ParserTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1114 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Calendar;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Facet;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ListTypeSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SimpleContentSG;
+import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.UnionTypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSGFactory;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.SGFactoryImpl;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.jaxb.JAXBAttribute;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser;
+import org.apache.ws.jaxme.xs.types.XSID;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implements some basic tests for the Schema generator.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: ParserTest.java 232139 2005-07-13 19:58:16Z jochen $
+ */
+public class ParserTest extends BaseTestCase {
+  public ParserTest(String arg) { super(arg); }
+
+  protected SchemaSG parse(String pSchema, String pSystemId) throws Exception {
+    JAXBSchemaReader r = getSchemaReader();
+    InputSource isource = new InputSource(new StringReader(pSchema));
+    isource.setSystemId(pSystemId);
+    return r.parse(isource);
+  }
+
+  protected JAXBSchemaReader getSchemaReader() {
+      Generator generator = new GeneratorImpl();
+      JAXBSchemaReader r = new JAXBSchemaReader();
+      generator.setSchemaReader(r);
+      r.setGenerator(generator);
+      return r;
+  }
+
+  public void testSimpleTypes() throws Exception {
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:simpleType name='a'>\n" +
+      "    <xs:restriction base='xs:string'>\n" +
+      "      <xs:minLength value='3'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:simpleType name='b'>\n" +
+      "    <xs:list itemType='xs:int'/>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:simpleType name='c'>\n" +
+      "    <xs:union memberTypes='a b'/>\n" +
+      "  </xs:simpleType>\n" +
+      "</xs:schema>\n";
+
+    SchemaSG schemaSG = parse(schema, "testSimpleTypes.xsd");
+
+    TypeSG[] st = schemaSG.getTypes();
+    assertEquals(3, st.length);
+
+    TypeSG st1 = st[0];
+    assertTrue(!st1.isComplex());
+    SimpleTypeSG sst1 = st1.getSimpleTypeSG();
+    assertTrue(sst1.isAtomic());
+    assertTrue(!sst1.isList());
+    assertTrue(!sst1.isUnion());
+    assertEquals(sst1.getRuntimeType(), JavaQNameImpl.getInstance(String.class));
+
+    TypeSG st2 = st[1];
+    assertTrue(!st2.isComplex());
+    SimpleTypeSG sst2 = st2.getSimpleTypeSG();
+    assertTrue(!sst2.isAtomic());
+    assertTrue(sst2.isList());
+    assertTrue(!sst2.isUnion());
+    ListTypeSG lt = sst2.getListType();
+    assertNotNull(lt.getItemType());
+    TypeSG sst = lt.getItemType();
+    assertTrue(!sst.isComplex());
+    SimpleTypeSG it = sst.getSimpleTypeSG();
+    assertEquals(JavaQNameImpl.INT, it.getRuntimeType());
+
+    TypeSG st3 = st[2];
+    assertEquals(false, st3.isComplex());
+    SimpleTypeSG sst3 = st3.getSimpleTypeSG();
+    assertEquals(false, sst3.isAtomic());
+    assertEquals(false, sst3.isList());
+    assertEquals(true, sst3.isUnion());
+    UnionTypeSG ut = sst3.getUnionType();
+    TypeSG[] uTypes = ut.getMemberTypes();
+    assertEquals(2, uTypes.length);
+  }
+
+  public void testAttributes() throws Exception {
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation><xs:appinfo>\n" +
+      "    <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "      <jaxb:package name='parsertest.testattributes'/>\n" +
+      "    </jaxb:schemaBindings>\n" +
+      "  </xs:appinfo></xs:annotation>\n" +
+      "  <xs:attribute name='a' type='xs:string'/>\n" +
+      "\n" +
+      "  <xs:attribute name='b'>\n" +
+      "    <xs:simpleType>\n" +
+      "      <xs:restriction base='xs:int'/>\n" +
+      "    </xs:simpleType>\n" +
+      "  </xs:attribute>\n" +
+      "\n" +
+      "  <xs:complexType name='attributesOwner'>\n" +
+      "    <xs:attribute ref='a'/>\n" +
+      "    <xs:attribute ref='b'/>\n" +
+      "    <xs:attribute name='c' type='xs:int'/>\n" +
+      "  </xs:complexType>\n" +
+      "</xs:schema>\n";
+
+    SchemaSG jschema = parse(schema, "testAttributes.xsd");
+
+    TypeSG[] types = jschema.getTypes();
+    assertEquals(1, types.length);
+    assertTrue(types[0].isComplex());
+
+    AttributeSG[] attr = types[0].getComplexTypeSG().getAttributes();
+    assertEquals(3, attr.length);
+
+    AttributeSG attr1 = attr[0];
+    assertTrue(!attr1.getTypeSG().isComplex());
+    SimpleTypeSG sst1 = attr1.getTypeSG().getSimpleTypeSG();
+    assertTrue(sst1.isAtomic());
+    assertEquals(JavaQNameImpl.getInstance(String.class), sst1.getRuntimeType());
+
+    AttributeSG attr2 = attr[1];
+    assertTrue(!attr2.getTypeSG().isComplex());
+    SimpleTypeSG sst2 = attr2.getTypeSG().getSimpleTypeSG();
+    assertTrue(sst2.isAtomic());
+    assertEquals(JavaQNameImpl.INT, sst2.getRuntimeType());
+
+    AttributeSG attr3 = attr[2];
+    assertTrue(!attr3.getTypeSG().isComplex());
+    SimpleTypeSG sst3 = attr3.getTypeSG().getSimpleTypeSG();
+    assertTrue(sst3.isAtomic());
+    assertEquals(JavaQNameImpl.INT, sst3.getRuntimeType());
+  }
+
+  public void testAttributeGroups() throws Exception {
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation><xs:appinfo>\n" +
+      "    <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "      <jaxb:package name='parsertest.testattributegroups'/>\n" +
+      "    </jaxb:schemaBindings>\n" +
+      "  </xs:appinfo></xs:annotation>\n" +
+      "  <xs:attribute name='a' type='xs:string'/>\n" +
+      "  <xs:attribute name='b' type='xs:int'/>\n" +
+      "\n" +
+      "  <xs:attributeGroup name='c'>\n" +
+      "    <xs:attribute name='d' type='xs:dateTime'/>\n" +
+      "    <xs:attribute name='e' type='xs:float'/>\n" +
+      "    <xs:attribute ref='a'/>\n" +
+      "  </xs:attributeGroup>\n" +
+      "\n" +
+      "  <xs:attributeGroup name='f'>\n" +
+      "    <xs:attribute name='g' type='xs:double'/>\n" +
+      "    <xs:attributeGroup ref='c'/>\n" +
+      "    <xs:attribute ref='b'/>\n" +
+      "  </xs:attributeGroup>\n" +
+      "\n" +
+      "  <xs:element name='ea'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:attributeGroup ref='c'/>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "\n" +
+      "  <xs:element name='eb'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:attributeGroup ref='f'/>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "</xs:schema>\n";
+
+    SchemaSG jschema = parse(schema, "testAttributeGroups.xsd");
+
+    ObjectSG[] elements = jschema.getElements();
+    assertNotNull(elements);
+    assertEquals(2, elements.length);
+
+    ObjectSG ea = elements[0];
+    assertTrue(ea.getTypeSG().isComplex());
+    ComplexTypeSG eact = ea.getTypeSG().getComplexTypeSG();
+    AttributeSG[] eactAttr = eact.getAttributes();
+    assertEquals(3, eactAttr.length);
+    assertEquals(new XsQName((String) null, "d"), eactAttr[0].getName());
+    assertEquals(eactAttr[0].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(Calendar.class));
+    assertEquals(new XsQName((String) null, "e"), eactAttr[1].getName());
+    assertEquals(eactAttr[1].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(float.class));
+    assertEquals(new XsQName((String) null, "a"), eactAttr[2].getName());
+    assertEquals(eactAttr[2].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(String.class));
+
+    ObjectSG eb = elements[1];
+    assertTrue(eb.getTypeSG().isComplex());
+    ComplexTypeSG ebct = eb.getTypeSG().getComplexTypeSG();
+    AttributeSG[] ebctAttr = ebct.getAttributes();
+    assertEquals(5, ebctAttr.length);
+    assertEquals(new XsQName((String) null, "g"), ebctAttr[0].getName());
+    assertEquals(ebctAttr[0].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(double.class));
+    assertEquals(new XsQName((String) null, "d"), ebctAttr[1].getName());
+    assertEquals(ebctAttr[1].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(Calendar.class));
+    assertEquals(ebctAttr[2].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(float.class));
+    assertEquals(ebctAttr[3].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(String.class));
+    assertEquals(ebctAttr[4].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(int.class));
+  }
+
+  public void testElements() throws Exception {
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation><xs:appinfo>\n" +
+      "    <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "      <jaxb:package name='parsertest.testelements'/>\n" +
+      "    </jaxb:schemaBindings>\n" +
+      "  </xs:appinfo></xs:annotation>\n" +
+      "  <xs:element name='a' type='xs:string'/>\n" +
+      "\n" +
+      "  <xs:element name='b'>\n" +
+      "    <xs:simpleType>\n" +
+      "      <xs:restriction base='xs:float'/>\n" +
+      "    </xs:simpleType>\n" +
+      "  </xs:element>\n" +
+      "\n" +
+      "  <xs:element name='c'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:annotation>\n" +
+      "        <xs:documentation>\n" +
+      "          The type of 'c'.\n" +
+      "        </xs:documentation>\n" +
+      "      </xs:annotation>\n" +
+      "      <xs:sequence>\n" +
+      "        <xs:element ref='a'/>\n" +
+      "        <xs:element name='d' type='xs:double'>\n" +
+      "          <xs:annotation>\n" +
+      "            <xs:documentation>\n" +
+      "              The element 'd'.\n" +
+      "            </xs:documentation>\n" +
+      "          </xs:annotation>\n" +
+      "        </xs:element>\n" +
+      "      </xs:sequence>\n" +
+      "      <xs:attribute name='e' type='xs:int'>\n" +
+      "        <xs:annotation>\n" +
+      "          <xs:documentation>\n" +
+      "            The attribute 'e'.\n" +
+      "          </xs:documentation>\n" +
+      "        </xs:annotation>\n" +
+      "      </xs:attribute>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "\n" +
+      "  <xs:element name='f'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:simpleContent>\n" +
+      "        <xs:extension base='xs:int'>\n" +
+      "          <xs:attribute name='g' type='xs:boolean'/>\n" +
+      "        </xs:extension>\n" +
+      "      </xs:simpleContent>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "</xs:schema>\n";
+
+    System.err.println("testElements: ->");
+    SchemaSG jschema = parse(schema, "testElements.xsd");
+
+    ObjectSG[] elements = jschema.getElements();
+    assertEquals(4, elements.length);
+
+    ObjectSG e1 = elements[0];
+    assertEquals(new XsQName((String) null, "a"), e1.getName());
+    TypeSG t1 = e1.getTypeSG();
+    assertTrue(!t1.isComplex());
+    assertTrue(t1.getSimpleTypeSG().isAtomic());
+    assertEquals(t1.getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(String.class));
+
+    ObjectSG e2 = elements[1];
+    assertEquals(new XsQName((String) null, "b"), e2.getName());
+    TypeSG t2 = e2.getTypeSG();
+    assertTrue(!t2.isComplex());
+    SimpleTypeSG st2 = t2.getSimpleTypeSG();
+    assertTrue(st2.isAtomic());
+    assertEquals(JavaQNameImpl.getInstance(float.class), st2.getRuntimeType());
+
+    ObjectSG e3 = elements[2];
+    assertEquals(new XsQName((String) null, "c"), e3.getName());
+    TypeSG t3 = e3.getTypeSG();
+    assertTrue(t3.isComplex());
+    ComplexTypeSG ct3 = t3.getComplexTypeSG();
+    assertTrue(!ct3.hasSimpleContent());
+    ComplexContentSG cct3 = ct3.getComplexContentSG();
+    ParticleSG[] childs = cct3.getRootParticle().getGroupSG().getParticles();
+    assertEquals(2, childs.length);
+    assertTrue(childs[0].isElement());
+    ObjectSG child1 = childs[0].getObjectSG();
+    assertEquals(new XsQName((String) null, "a"), child1.getName());
+    assertTrue(childs[1].isElement());
+    ObjectSG child2 = childs[1].getObjectSG();
+    assertEquals(new XsQName((String) null, "d"), child2.getName());
+    assertTrue(!child2.getTypeSG().isComplex());
+    SimpleTypeSG st4 = child2.getTypeSG().getSimpleTypeSG();
+    assertEquals(JavaQNameImpl.getInstance(double.class), st4.getRuntimeType());
+    AttributeSG[] attributes = ct3.getAttributes();
+    assertEquals(1, attributes.length);
+    assertEquals(new XsQName((String) null, "e"), attributes[0].getName());
+    assertTrue(!attributes[0].getTypeSG().isComplex());
+
+    ObjectSG e4 = elements[3];
+    assertTrue(e4.getTypeSG().isComplex());
+    ComplexTypeSG ct4 = e4.getTypeSG().getComplexTypeSG();
+    assertTrue(ct4.hasSimpleContent());
+    SimpleContentSG sct4 = ct4.getSimpleContentSG();
+    assertTrue(!sct4.getContentTypeSG().isComplex());
+    assertEquals(JavaQNameImpl.getInstance(int.class), sct4.getContentTypeSG().getRuntimeType());
+    assertEquals(1, ct4.getAttributes().length);
+    assertEquals(new XsQName((String) null, "g"), ct4.getAttributes()[0].getName());
+    assertEquals(JavaQNameImpl.getInstance(boolean.class), ct4.getAttributes()[0].getTypeSG().getRuntimeType());
+  }
+
+  public void testFacets() throws Exception {
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation><xs:appinfo>\n" +
+      "    <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "      <jaxb:package name='parsertest.testfacets'/>\n" +
+      "    </jaxb:schemaBindings>\n" +
+      "  </xs:appinfo></xs:annotation>\n" +
+      "  <xs:simpleType name='USState'>\n" +
+      "    <xs:restriction base='xs:string'>\n" +
+      "      <xs:enumeration value='AK'/>\n" +
+      "      <xs:enumeration value='AL'/>\n" +
+      "      <xs:enumeration value='AR'/>\n" +
+      "      <!-- and so on ... -->\n" +   
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "  <xs:element name='a' type='USState'/>\n" +
+      "</xs:schema>\n";
+    
+    SchemaSG jschema = parse(schema, "testFacets.xsd");
+
+    ObjectSG[] elements = jschema.getElements();
+    assertEquals(1, elements.length);
+    ObjectSG se1 = elements[0];
+    assertEquals(new XsQName((String) null, "a"), se1.getName());
+    assertTrue(!se1.getTypeSG().isComplex());
+    SimpleTypeSG sst1 = se1.getTypeSG().getSimpleTypeSG();
+    assertEquals(JavaQNameImpl.getInstance(String.class), sst1.getRuntimeType());
+    Facet facet = sst1.getFacet(Facet.ENUMERATION);
+    assertNotNull(facet);
+    String[] values = facet.getValues();
+    assertNotNull(values);
+    assertEquals(3, values.length);
+    assertEquals("AK", values[0]);
+    assertEquals("AL", values[1]);
+    assertEquals("AR", values[2]);
+  }
+
+  public void testGlobalBindingsDefaults() throws Exception {
+    // Parse a schema without globalBindings; it should have the default
+    // settings.
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>\n";
+    
+    SchemaSG jschema = parse(schema, "testGlobalBindingsDefaults.xsd");
+
+    String collectionType = jschema.getCollectionType();
+    assertEquals(ArrayList.class.getName(), collectionType);
+    JAXBJavaType[] javaTypes = jschema.getJAXBJavaTypes();
+    assertNotNull(javaTypes);
+    assertEquals(0, javaTypes.length);
+    XsQName[] typesafeEnumBase = jschema.getTypesafeEnumBase();
+    assertNotNull(typesafeEnumBase);
+    assertEquals(1, typesafeEnumBase.length);
+    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "NCName"), typesafeEnumBase[0]);
+    boolean isBindingStyleModelGroup = jschema.isBindingStyleModelGroup();
+    assertTrue(!isBindingStyleModelGroup);
+    boolean choiceContentProperty = jschema.isChoiceContentProperty();
+    assertTrue(!choiceContentProperty);
+    boolean enableFailFastCheck = jschema.isFailFastCheckEnabled();
+    assertTrue(!enableFailFastCheck);
+    boolean isJavaNamingConventionsEnabled = jschema.isJavaNamingConventionsEnabled();
+    assertTrue(isJavaNamingConventionsEnabled);
+    boolean isFixedAttributeConstantProperty = jschema.isFixedAttributeConstantProperty();
+    assertTrue(!isFixedAttributeConstantProperty);
+    boolean generatingIsSetMethod = jschema.isGeneratingIsSetMethod();
+    assertTrue(!generatingIsSetMethod);
+    boolean underscoreWordSeparator = jschema.isUnderscoreWordSeparator();
+    assertTrue(underscoreWordSeparator);
+  }
+
+
+  public void testGlobalBindings() throws Exception {
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation>\n" +
+      "    <xs:appinfo>\n" +
+      "      <jaxb:globalBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'\n" +
+      "          collectionType='indexed'\n" +
+      "          typesafeEnumBase='xs:String xs:NCName'\n" +
+      "          bindingStyle='modelGroupBinding'\n" +
+      "          choiceContentProperty='true'\n" +
+      "          enableFailFastCheck='1'\n" +
+      "          enableJavaNamingConventions='false'\n" +
+      "          fixedAttributeAsConstantProperty='true'\n" +
+      "          generateIsSetMethod='1'\n" +
+      "          underscoreBinding='asCharInWord'/>\n" +
+      "    </xs:appinfo\n>" +
+      "  </xs:annotation>\n" +
+      "</xs:schema>";
+    
+    SchemaSG jschema = parse(schema, "testGlobalBindingsDefaults.xsd");
+
+    String collectionType = jschema.getCollectionType();
+    assertEquals("indexed", collectionType);
+    XsQName[] typesafeEnumBase = jschema.getTypesafeEnumBase();
+    assertNotNull(typesafeEnumBase);
+    assertEquals(2, typesafeEnumBase.length);
+    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "String"), typesafeEnumBase[0]);
+    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "NCName"), typesafeEnumBase[1]);
+
+    boolean isBindingStyleModelGroup = jschema.isBindingStyleModelGroup();
+    assertTrue(isBindingStyleModelGroup);
+
+    boolean isChoiceContentProperty = jschema.isChoiceContentProperty();
+    assertTrue(isChoiceContentProperty);
+
+    boolean enableFailFastCheck = jschema.isFailFastCheckEnabled();
+    assertTrue(enableFailFastCheck);
+
+    boolean isJavaNamingConventionsEnabled = jschema.isJavaNamingConventionsEnabled();
+    assertTrue(!isJavaNamingConventionsEnabled);
+
+    boolean fixedAttributeConstantProperty = jschema.isFixedAttributeConstantProperty();
+    assertTrue(fixedAttributeConstantProperty);
+
+    boolean generatingIsSetMethod = jschema.isGeneratingIsSetMethod();
+    assertTrue(generatingIsSetMethod);
+
+    boolean isUnderscoreWordSeparator = jschema.isUnderscoreWordSeparator();
+    assertTrue(!isUnderscoreWordSeparator);
+
+    JAXBJavaType[] javaTypes = jschema.getJAXBJavaTypes();
+    assertNotNull(javaTypes);
+    assertEquals(0, javaTypes.length);
+  }
+
+/*
+  public void testSchemaBindingsDefaults() throws Exception {
+    // Parse a schema without schemaBindings; it should have the default
+    // settings.
+    final String mName = "testSchemaBindingsDefaults";
+    log.entering(mName);
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>\n";
+    
+    JAXBSchemaReader r = new JAXBSchemaReader();
+    InputSource isource = new InputSource(new StringReader(schema));
+    isource.setSystemId("testSchemaBindingsDefaults.xsd");
+    JAXBSchema jschema = (JAXBSchema) r.parse(isource);
+    SchemaBindings schemaBindings = jschema.getSchemaBindings();
+    List nameXmlTransforms = schemaBindings.getNameXmlTransform();
+    assertNotNull(nameXmlTransforms);
+    assertEquals(0, nameXmlTransforms.size());
+    assertNull(schemaBindings.getPackage());
+  }
+
+  public void testSchemaBindings() throws Exception {
+    final String mName = "testSchemaBindings";
+    final String myPackageName = "org.apache.ws.jaxme.somepackage";
+
+    log.entering(mName);
+    final String schema =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation>\n" +
+      "    <xs:appinfo>\n" +
+      "      <jaxb:schemaBindings xmlns:jaxb='" + JAXBSchemaReader.JAXB_SCHEMA_URI + "'>\n" +
+      "        <jaxb:package name='" + myPackageName + "'>\n" +
+      "          <jaxb:javadoc>Test documentation</jaxb:javadoc>\n" +
+      "        </jaxb:package>\n" +
+      "        <jaxb:nameXmlTransform>\n" +
+      "          <jaxb:typeName prefix='b' suffix='a'/>\n" +
+      "        </jaxb:nameXmlTransform>\n" +
+      "      </jaxb:schemaBindings>\n" +
+      "    </xs:appinfo>\n" +
+      "  </xs:annotation>\n" +
+      "  <xs:complexType name='a'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element name='x' type='xs:int'/>\n" +
+      "    </xs:sequence>\n" +
+      "    <xs:attribute name='y' type='xs:string'/>\n" +
+      "  </xs:complexType>\n" +
+      "  <xs:element name='b' type='a'/>\n" +
+      "</xs:schema>";
+    
+    JAXBSchemaReader r = new JAXBSchemaReader();
+    InputSource isource = new InputSource(new StringReader(schema));
+    isource.setSystemId("testSchemaBindings.xsd");
+    JAXBSchema jschema = (JAXBSchema) r.parse(isource);
+    SchemaBindings schemaBindings = jschema.getSchemaBindings();
+
+    SchemaBindings.Package schemaPackage = schemaBindings.getPackage();
+    assertNotNull(schemaPackage);
+    assertEquals(myPackageName, schemaPackage.getName());
+    Javadoc javadoc = schemaPackage.getJavadoc();
+    assertNotNull(javadoc);
+    assertEquals("Test documentation", javadoc.getText());
+
+    List nameXmlTransforms = schemaBindings.getNameXmlTransform();
+    assertNotNull(nameXmlTransforms);
+    assertEquals(1, nameXmlTransforms.size());
+    SchemaBindings.NameXmlTransform nameXmlTransform =
+      (SchemaBindings.NameXmlTransform) nameXmlTransform.get(0);
+    assertNotNull(nameXmlTransform);
+    SchemaBindings.NameTransformation transformation =
+      (SchemaBindings.NameTransformation) nameXmlTransform.getTypeName();
+    assertEquals("a", transformation.getSuffix());
+    assertEquals("b", transformation.getPrefix());
+
+    JAXBSchemaWriter writer = new JAXBSchemaWriter();
+    SGFactory factory = writer.getSGFactory();
+
+    SchemaType[] types = jschema.getSchemaTypes();
+    assertNotNull(types);
+    assertEquals(1, types.length);
+    SchemaType st = types[0];
+    TypeSG typeSG = factory.getTypeSG(st);
+    JavaQName qName = typeSG.getClassName(st, SchemaClass.CLASS_TYPE_XML_INTERFACE);
+    assertEquals(myPackageName, qName.getPackageName());
+  }
+*/
+
+  public void testPurchaseOrder() throws Exception {
+    /*
+     A modified version of the first example from XML Schema Part 0:
+     http:www.w3.org/TR/xmlschema-0/#po.xml 
+     Modifications:
+     1) Removed forward references by re-ordering the document 
+     2) Changed some types to remove types not currently supported
+     xsd:NMTOKEN         -> xsd:string 
+     xsd:positiveInteger -> xsd:integer
+    */
+
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " \n" +
+      " <xsd:annotation> \n" +
+      "  <xsd:documentation xml:lang='en'> \n" +
+      "   Purchase order schema for Example.com. \n" +
+      "   Copyright 2000 Example.com. All rights reserved. \n" +
+      "  </xsd:documentation> \n" +
+      "  <xsd:appinfo>\n" +
+      "   <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "    <jaxb:package name='parsertest.testpurchaseorder'/>\n" +
+      "   </jaxb:schemaBindings>\n" +
+      "  </xsd:appinfo>\n" +
+      " </xsd:annotation> \n" +
+      " \n" +
+      " <xsd:element name='comment' type='xsd:string'/> \n" +
+      " \n" +
+      " <xsd:simpleType name='SKU'> \n" +
+      "  <xsd:restriction base='xsd:string'> \n" +
+      "   <xsd:pattern value='\\d{3}-[A-Z]{2}'/> \n" +
+      "  </xsd:restriction> \n" +
+      " </xsd:simpleType> \n" +
+      " \n" +
+      " <xsd:complexType name='USAddress'> \n" +
+      "  <xsd:sequence> \n" +
+      "   <xsd:element name='name'   type='xsd:string'/> \n" +
+      "   <xsd:element name='street' type='xsd:string'/> \n" +
+      "   <xsd:element name='city'   type='xsd:string'/> \n" +
+      "   <xsd:element name='state'  type='xsd:string'/> \n" +
+      "   <xsd:element name='zip'    type='xsd:integer'/> \n" +
+      "  </xsd:sequence> \n" +
+      "  <xsd:attribute name='country' type='xsd:string' fixed='US'/> \n" +
+      " </xsd:complexType> \n" +
+      " \n" +
+      " <xsd:complexType name='Items'> \n" +
+      "  <xsd:sequence> \n" +
+      "   <xsd:element name='item' minOccurs='0' maxOccurs='unbounded'> \n" +
+      "    <xsd:complexType> \n" +
+      "     <xsd:sequence> \n" +
+      "      <xsd:element name='productName' type='xsd:string'/> \n" +
+      "      <xsd:element name='quantity'> \n" +
+      "       <xsd:simpleType> \n" +
+      "        <xsd:restriction base='xsd:positiveInteger'> \n" +
+      "         <xsd:maxExclusive value='100'/> \n" +
+      "        </xsd:restriction> \n" +
+      "       </xsd:simpleType> \n" +
+      "      </xsd:element> \n" +
+      "      <xsd:element name='USPrice'  type='xsd:decimal'/> \n" +
+      "      <xsd:element ref='comment'   minOccurs='0'/> \n" +
+      "      <xsd:element name='shipDate' type='xsd:date' minOccurs='0'/> \n" +
+      "     </xsd:sequence> \n" +
+      "     <xsd:attribute name='partNum' type='SKU' use='required'/> \n" +
+      "    </xsd:complexType> \n" +
+      "   </xsd:element> \n" +
+      "  </xsd:sequence> \n" +
+      " </xsd:complexType> \n" +
+      " \n" +
+      " <xsd:complexType name='PurchaseOrderType'> \n" +
+      "  <xsd:sequence> \n" +
+      "   <xsd:element name='shipTo' type='USAddress'/> \n" +
+      "   <xsd:element name='billTo' type='USAddress'/> \n" +
+      "   <xsd:element ref='comment' minOccurs='0'/> \n" +
+      "   <xsd:element name='items'  type='Items'/> \n" +
+      "  </xsd:sequence> \n" +
+      "  <xsd:attribute name='orderDate' type='xsd:date'/> \n" +
+      " </xsd:complexType> \n" +
+      " \n" +
+      " <xsd:element name='purchaseOrder' type='PurchaseOrderType'/> \n" +
+      " \n" +
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testPurchaseOrder.xsd");
+
+    TypeSG[] schemaTypes = jschema.getTypes();
+    assertNotNull(schemaTypes);
+    assertEquals(4, schemaTypes.length);
+
+    // SKU
+    TypeSG sku = schemaTypes[0];
+    assertEquals(new XsQName((String) null, "SKU"), sku.getName());
+    assertTrue(sku.isGlobalType());
+    assertTrue(!sku.isComplex());
+    assertTrue(sku.isRestriction());
+    assertEquals(new XsQName(XSParser.XML_SCHEMA_URI, "string"), sku.getRestrictedType().getName());
+
+    // USAddress
+    // <xsd:complexType name='USAddress'> 
+    // <xsd:sequence>
+    TypeSG usAddress = schemaTypes[1];
+    assertEquals(new XsQName((String) null, "USAddress"), usAddress.getName());
+    assertTrue(usAddress.isGlobalType());
+    assertTrue(usAddress.isComplex());
+    assertTrue(usAddress.getComplexTypeSG().getComplexContentSG().getRootParticle().getGroupSG().isSequence());
+    // USAddress.country
+    //  <xsd:attribute name='country' type='xsd:string' fixed='US'/>
+    // ToDo: test attribute fixed='US'
+    AttributeSG [] usAddressAttributes = usAddress.getComplexTypeSG().getAttributes();
+    assertEquals(1, usAddressAttributes.length);
+    AttributeSG country = usAddressAttributes[0];
+    assertEquals(new XsQName((String) null, "country"), country.getName());
+    assertEquals(JavaQNameImpl.getInstance(String.class), country.getTypeSG().getRuntimeType());
+    // USAddress children
+    String [] nameShouldBe = {"name", "street", "city",  "state", "zip"};
+    ParticleSG [] usAddressChildren = usAddress.getComplexTypeSG().getComplexContentSG().getRootParticle().getGroupSG().getParticles();
+    assertEquals(5, usAddressChildren.length);
+    for (int i = 0; i < usAddressChildren.length; i++) {
+      ParticleSG child = usAddressChildren[i];
+      assertTrue(child.isElement());
+      assertEquals(new XsQName((String) null, nameShouldBe[i]), child.getObjectSG().getName());
+      assertTrue(!child.getObjectSG().getTypeSG().isComplex());
+      Class childRuntimeClass = "zip".equals(nameShouldBe[i]) ? BigInteger.class : String.class;
+      assertEquals(JavaQNameImpl.getInstance(childRuntimeClass), child.getObjectSG().getTypeSG().getRuntimeType());
+    }
+
+    // Items
+    TypeSG items = schemaTypes[2];
+    assertEquals(new XsQName((String) null, "Items"), items.getName());
+    assertTrue(items.isGlobalType());
+    assertTrue(items.isComplex());
+    ComplexTypeSG itemsComplex = items.getComplexTypeSG();
+    assertTrue(!itemsComplex.hasSimpleContent());
+    ComplexContentSG itemsComplexContent = itemsComplex.getComplexContentSG();
+    GroupSG group = itemsComplexContent.getRootParticle().getGroupSG();
+    assertTrue(group.isSequence());
+    // Items.item
+    ParticleSG[] itemsChildren = group.getParticles();
+    assertEquals(1, itemsChildren.length);
+    ParticleSG item = itemsChildren[0];
+    assertTrue(item.isElement());
+    assertEquals(new XsQName((String) null, "item"), item.getObjectSG().getName());
+    assertEquals(0, item.getMinOccurs());
+    assertEquals(-1, item.getMaxOccurs());
+    TypeSG itemST = item.getObjectSG().getTypeSG();
+    assertTrue(itemST.isComplex());
+    assertTrue(!itemST.getComplexTypeSG().hasSimpleContent());
+    assertTrue(itemST.getComplexTypeSG().getComplexContentSG().getRootParticle().getGroupSG().isSequence());
+    // Items.item.partNum
+    // <xsd:attribute name='partNum' type='SKU' use='required'/>
+    AttributeSG[] itemAttributes = itemST.getComplexTypeSG().getAttributes();
+    assertEquals(1, itemAttributes.length);
+    AttributeSG partNum = itemAttributes[0];
+    assertEquals(new XsQName((String) null, "partNum"), partNum.getName());
+    assertTrue(partNum.isRequired());
+    // Items.item.USPrice
+    // <xsd:element name='USPrice'  type='xsd:decimal'/> 
+    ParticleSG[] itemChildren = itemST.getComplexTypeSG().getComplexContentSG().getRootParticle().getGroupSG().getParticles();
+    assertEquals(5, itemChildren.length);
+    ParticleSG usPrice = itemChildren[2];
+    assertTrue(usPrice.isElement());
+    assertEquals(new XsQName((String) null,"USPrice"), usPrice.getObjectSG().getName());
+    TypeSG usPriceSST = usPrice.getObjectSG().getTypeSG();
+    assertTrue(!usPrice.getObjectSG().getTypeSG().isComplex());
+    assertTrue(usPriceSST.getSimpleTypeSG().isAtomic());
+    assertEquals(java.math.BigDecimal.class.getName(), usPriceSST.getRuntimeType().toString());   
+    // Items.item.comment
+    // <xsd:element ref='comment'   minOccurs='0'/> 
+    ParticleSG comment = itemChildren[3];
+    assertTrue(comment.isElement());
+    assertEquals(new XsQName((String) null, "comment"), comment.getObjectSG().getName());
+    assertEquals(0, comment.getMinOccurs());
+    TypeSG commentSST = comment.getObjectSG().getTypeSG();
+    assertTrue(!commentSST.isComplex());
+    assertTrue(commentSST.getSimpleTypeSG().isAtomic());
+    assertEquals(JavaQNameImpl.getInstance(String.class), commentSST.getRuntimeType());   
+    // Items.item.productName
+    // <xsd:element name='productName' type='xsd:string'/>
+    ParticleSG productName = itemChildren[0];
+    assertTrue(productName.isElement());
+    assertEquals(new XsQName((String) null, "productName"), productName.getObjectSG().getName());
+    TypeSG productNameSST = productName.getObjectSG().getTypeSG();
+    assertTrue(!productNameSST.isComplex());
+    assertTrue(productNameSST.getSimpleTypeSG().isAtomic());
+    assertEquals(JavaQNameImpl.getInstance(String.class), productNameSST.getRuntimeType());   
+    // Items.item.quantity
+    ParticleSG quantity = itemChildren[1];
+    assertTrue(quantity.isElement());
+    assertEquals(new XsQName((String) null, "quantity"), quantity.getObjectSG().getName());
+    TypeSG quantitySST = quantity.getObjectSG().getTypeSG();
+    assertTrue(!quantitySST.isComplex());
+    assertTrue(quantitySST.getSimpleTypeSG().isAtomic());
+    assertEquals(JavaQNameImpl.getInstance(java.math.BigInteger.class), quantitySST.getRuntimeType());    
+    // Items.item.shipDate
+    // <xsd:element name='shipDate' type='xsd:date' minOccurs='0'/> 
+    ParticleSG shipDate = itemChildren[4];
+    assertTrue(shipDate.isElement());
+    assertEquals(new XsQName((String) null, "shipDate"), shipDate.getObjectSG().getName());
+    TypeSG shipDateSST = shipDate.getObjectSG().getTypeSG();
+    assertTrue(!shipDateSST.isComplex());
+    assertEquals(0, shipDate.getMinOccurs());
+    assertTrue(shipDateSST.getSimpleTypeSG().isAtomic());
+    assertEquals(Calendar.class.getName(), shipDateSST.getRuntimeType().toString());    
+
+    // PurchaseOrderType
+    TypeSG purchaseOrderType = schemaTypes[3];
+    assertEquals(new XsQName((String) null, "PurchaseOrderType"), purchaseOrderType.getName());
+    assertTrue(purchaseOrderType.isGlobalType());
+    assertTrue(purchaseOrderType.isComplex());
+    assertTrue(purchaseOrderType.getComplexTypeSG().getComplexContentSG().getRootParticle().getGroupSG().isSequence());
+    // PurchaseOrderType.orderDate
+    // <xsd:attribute name='orderDate' type='xsd:date'/>
+    AttributeSG [] potAttributes = purchaseOrderType.getComplexTypeSG().getAttributes();
+    assertEquals(1, potAttributes.length);
+    AttributeSG orderDate = potAttributes[0];
+    assertEquals(new XsQName((String) null, "orderDate"), orderDate.getName());
+    assertEquals(JavaQNameImpl.getInstance(Calendar.class), 
+                 orderDate.getTypeSG().getSimpleTypeSG().getRuntimeType());
+    ParticleSG [] potChildren = purchaseOrderType.getComplexTypeSG().getComplexContentSG().getRootParticle().getGroupSG().getParticles();
+    assertEquals(4, potChildren.length);
+    // PurchaseOrderType.shipTo
+    // <xsd:element name='shipTo' type='USAddress'/> 
+    ParticleSG shipTo = potChildren[0];
+    assertTrue(shipTo.isElement());
+    assertEquals(new XsQName((String) null, "shipTo"), shipTo.getObjectSG().getName());
+    TypeSG shipToST = shipTo.getObjectSG().getTypeSG();
+    assertTrue(shipToST.isComplex());
+    assertEquals(new XsQName((String) null, "USAddress"), shipToST.getName());
+    assertTrue(shipToST.isComplex());
+    // PurchaseOrderType.billTo
+    // <xsd:element name='billTo' type='USAddress'/> 
+    ParticleSG billTo = potChildren[1];
+    assertTrue(billTo.isElement());
+    assertEquals(new XsQName((String) null, "billTo"), billTo.getObjectSG().getName());
+    TypeSG billToST = billTo.getObjectSG().getTypeSG();
+    assertTrue(billToST.isComplex());
+    assertEquals(new XsQName((String) null, "USAddress"), billToST.getName());
+    assertTrue(billToST.isComplex());
+    // PurchaseOrderType.comment
+    // <xsd:element ref='comment' minOccurs='0'/> 
+    ParticleSG potComment = potChildren[2];
+    assertTrue(potComment.isElement());
+    assertEquals(new XsQName((String) null, "comment"), comment.getObjectSG().getName());
+    assertEquals(0, comment.getMinOccurs());
+    TypeSG potCommentST = potComment.getObjectSG().getTypeSG();
+    assertTrue(!potCommentST.isComplex());
+    assertEquals(JavaQNameImpl.getInstance(String.class), potCommentST.getRuntimeType()); 
+    // PurchaseOrderType.items
+    // <xsd:element name='items'  type='Items'/> 
+    ParticleSG potItems = potChildren[3];
+    assertTrue(potItems.isElement());
+    assertEquals(new XsQName((String) null, "items"), potItems.getObjectSG().getName());
+    assertTrue(potItems.getObjectSG().getTypeSG().isComplex());
+
+    // purchaseOrder
+    // <xsd:element name='purchaseOrder' type='PurchaseOrderType'/>
+    ObjectSG[] elements = jschema.getElements();
+    assertNotNull(elements);
+    assertEquals(2, elements.length);
+    ObjectSG purchaseOrder = elements[1];
+    assertEquals(new XsQName((String) null, "purchaseOrder"), purchaseOrder.getName());
+    assertTrue(purchaseOrder.getTypeSG().isComplex());
+    assertTrue(purchaseOrder.getTypeSG().isGlobalType());
+    assertEquals(new XsQName((String) null, "PurchaseOrderType"), purchaseOrder.getTypeSG().getName());
+  }
+
+  /** A test case to trigger a previous parser bug.  */
+  public void testRestrictionMaxExclusive() throws Exception {
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xsd:annotation><xsd:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testrestrictionmaxexclusive'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xsd:appinfo></xsd:annotation>\n" +
+      " <xsd:element name='quantity'> \n" +
+      "  <xsd:simpleType> \n" +
+      "   <xsd:restriction base='xsd:decimal'> \n" +
+      "    <xsd:maxExclusive value='100'/> \n" +
+      "   </xsd:restriction> \n" +
+      "  </xsd:simpleType> \n" +
+      " </xsd:element> \n" +
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testRestrictionMaxExclusive.xsd");
+    ObjectSG[] elements = jschema.getElements();
+    assertEquals(1, elements.length);
+    ObjectSG quantity = elements[0];
+    String maxExclusive = quantity.getTypeSG().getSimpleTypeSG().getAtomicType().getMaxExclusive();
+    assertNotNull(maxExclusive);
+    assertEquals("100", maxExclusive);
+  }
+
+  /** Test some basic functionality of the builtin datatype nonPositiveInteger. */
+  public void testNonPositiveInteger() throws Exception {
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xsd:annotation><xsd:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testnonpositiveinteger'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xsd:appinfo></xsd:annotation>\n" +
+      " <xsd:element name='non-positive-integer' type='xsd:nonPositiveInteger'/> \n" + 
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testNonPositiveInteger.xsd");
+
+    // simple, atomic, with restriction and maxExclusive and maxInclusive
+    TypeSG npi = jschema.getElements()[0].getTypeSG();
+    assertTrue(!npi.isComplex());
+    SimpleTypeSG npis = npi.getSimpleTypeSG();
+    assertTrue(npis.isAtomic());
+    assertTrue(!npis.isList());
+    assertTrue(!npis.isUnion());
+    assertEquals(new Long(0), npis.getAtomicType().getFractionDigits());
+    assertEquals("0", npis.getAtomicType().getMaxInclusive());
+    assertEquals("1", npis.getAtomicType().getMaxExclusive());
+  }
+
+  /** Test some basic functionality of the builtin datatype negativeInteger. */
+  public void testNegativeInteger() throws Exception {
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xsd:annotation><xsd:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testnegativeinteger'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xsd:appinfo></xsd:annotation>\n" +
+      " <xsd:element name='negative-integer' type='xsd:negativeInteger'/> \n" + 
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testNegativeInteger.xsd");
+
+    // simple, atomic, with restrictions on maxInclusive and MaxExclusive
+    TypeSG ni = jschema.getElements()[0].getTypeSG();
+    assertTrue(!ni.isComplex());
+    SimpleTypeSG nis = ni.getSimpleTypeSG();
+    assertTrue(nis.isAtomic());
+    assertTrue(!nis.isList());
+    assertTrue(!nis.isUnion());
+    assertEquals(new Long(0), nis.getAtomicType().getFractionDigits());
+    assertEquals("-1", nis.getAtomicType().getMaxInclusive());
+    assertEquals("0", nis.getAtomicType().getMaxExclusive());
+  }
+
+  public void testNonNegativeIntegerType() throws Exception {
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xsd:annotation><xsd:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testnonnegativeinteger'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xsd:appinfo></xsd:annotation>\n" +
+      " <xsd:element name='non-negative-integer' type='xsd:nonNegativeInteger'/> \n" + 
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testNonNegativeIntegerType.xsd");
+
+    // simple, atomic, with restriction on minInclusive and minExclusive
+    TypeSG nni = jschema.getElements()[0].getTypeSG();
+    assertTrue(!nni.isComplex());
+    SimpleTypeSG nnis = nni.getSimpleTypeSG();
+    assertTrue(nnis.isAtomic());
+    assertTrue(!nnis.isList());
+    assertTrue(!nnis.isUnion());
+    assertEquals(new Long(0), nnis.getAtomicType().getFractionDigits());
+    assertEquals("-1", nnis.getAtomicType().getMinExclusive());
+    assertEquals("0", nnis.getAtomicType().getMinInclusive());
+  }
+
+  public void testPositiveIntegerType() throws Exception {
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xsd:annotation><xsd:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testpositiveinteger'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xsd:appinfo></xsd:annotation>\n" +
+      " <xsd:element name='positive-integer' type='xsd:positiveInteger'/> \n" + 
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testPositiveIntegerType.xsd");
+
+    // simple, atomic, with restriction on minInclusive and minExclusive
+    TypeSG pi = jschema.getElements()[0].getTypeSG();
+    assertTrue(!pi.isComplex());
+    SimpleTypeSG pis = pi.getSimpleTypeSG();
+    assertTrue(pis.isAtomic());
+    assertTrue(!pis.isList());
+    assertTrue(!pis.isUnion());
+    assertEquals(new Long(0), pis.getAtomicType().getFractionDigits());
+    assertEquals("0", pis.getAtomicType().getMinExclusive());
+    assertEquals("1", pis.getAtomicType().getMinInclusive());
+  }
+
+  /** Test some basic functionality of the builtin datatype integer. */
+  public void testIntegerType() throws Exception {
+    final String schema = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xsd:annotation><xsd:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testintegertype'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xsd:appinfo></xsd:annotation>\n" +
+      " <xsd:element name='integer' type='xsd:integer'/> \n" + 
+      "</xsd:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testIntegerType.xsd");
+
+    // simple, atomic, with restriction on fractionDigits
+    ObjectSG[] elements = jschema.getElements();
+    TypeSG i = elements[0].getTypeSG();
+    assertTrue(!i.isComplex());
+    SimpleTypeSG is = i.getSimpleTypeSG();
+    assertTrue(is.isAtomic());
+    assertTrue(!is.isList());
+    assertTrue(!is.isUnion());
+    assertEquals(JavaQNameImpl.getInstance(BigInteger.class), is.getRuntimeType());
+    assertEquals(new Long(0), is.getAtomicType().getFractionDigits());
+  }
+
+  /** Test built-in type NMTOKENS. */
+  public void testNmTokensType() throws Exception {
+    final String schema = 
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> \n" +
+      " <xs:annotation><xs:appinfo>\n" +
+      "  <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "   <jaxb:package name='parsertest.testnmtokenstype'/>\n" +
+      "  </jaxb:schemaBindings>\n" +
+      " </xs:appinfo></xs:annotation>\n" +
+      " <xs:element name='some-nmtokens' type='xs:NMTOKENS'/> \n" + 
+      "</xs:schema> \n";
+
+    SchemaSG jschema = parse(schema, "testNmTokensType.xsd");
+
+    // list of one or more nmtoken's
+    ObjectSG[] elements = jschema.getElements();
+    assertEquals(1, elements.length);
+    TypeSG nmts = elements[0].getTypeSG();
+    assertTrue(!nmts.isComplex());
+    SimpleTypeSG nmtss = nmts.getSimpleTypeSG();
+    assertTrue(!nmtss.isAtomic());
+    assertTrue(nmtss.isList());
+    assertTrue(!nmtss.isUnion());
+    ListTypeSG nmtsl = nmtss.getListType();
+    assertEquals(new Long(1), nmtsl.getMinLength());
+  }  
+
+    /** Test for <a href="http://issues.apache.org/jira/browse/JAXME-46">JAXME-46</a>
+     */
+    public void testJira46() throws Exception {
+    	final String uri = "http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/";
+    	final String schemaSpec =
+    		"<xs:schema targetNamespace='" + uri + "'\n" +
+    		"    xmlns:eGov_IT='" + uri + "'\n" +
+    		"    xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+    		"  <xs:element name='Riferimento'>\n" +
+    		"    <xs:complexType>\n" +
+    		"      <xs:sequence/>\n" +
+    		"      <xs:attribute ref='eGov_IT:id' use='required'/>\n" +
+    		"    </xs:complexType>\n" +
+    		"  </xs:element>\n" +
+    		"  <xs:attribute name='id' type='xs:ID'/>\n" +
+    		"</xs:schema>\n";
+    	
+    	InputSource isource = new InputSource(new StringReader(schemaSpec));
+    	isource.setSystemId("jira46.xsd");
+    	JAXBSchemaReader r = getSchemaReader();
+    	XSParser parser = r.getSGFactory().newXSParser();
+    	parser.setValidating(false);
+    	XSSchema schema = parser.parse(isource);
+    	XSAttribute[] attrs = schema.getAttributes();
+    	assertEquals(1, attrs.length);
+    	XSAttribute idAttr = attrs[0];
+    	assertTrue(idAttr instanceof JAXBAttribute);
+    	assertEquals(new XsQName(uri, "id"), idAttr.getName());
+    	assertEquals(XSID.getInstance(), idAttr.getType());
+    	assertTrue(idAttr.isOptional());
+    	XSElement[] elements = schema.getElements();
+    	assertEquals(1, elements.length);
+    	XSElement rifElem = elements[0];
+    	assertFalse(rifElem.getType().isSimple());
+    	XSComplexType ct = rifElem.getType().getComplexType();
+    	XSAttributable[] rifAttrs = ct.getAttributes();
+    	assertEquals(1, rifAttrs.length);
+    	XSAttribute idRef = (XSAttribute) rifAttrs[0];
+    	assertTrue(idRef instanceof JAXBAttribute);
+    	assertFalse(idRef.equals(idAttr));
+    	assertEquals(new XsQName(uri, "id"), idAttr.getName());
+    	assertEquals(XSID.getInstance(), idAttr.getType());
+    	assertFalse(idRef.isOptional());
+    }
+
+    /** Test, whether a choice group with multiplicity > 1 is
+     * rejected.
+     */
+    public void testMultipleGroupRejected() throws Exception {
+    	final String schemaSpec =
+    		"<xs:schema\n" +
+    		"    xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+    		"    elementFormDefault='qualified'\n" +
+    		"    xmlns:jaxb='http://java.sun.com/xml/ns/jaxb'\n" +
+    		"    jaxb:version='1.0'>\n" +
+            "  <xs:annotation><xs:appinfo>\n" +
+            "    <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+            "      <jaxb:package name='parsertest.testmultiplegroupsrejected'/>\n" +
+            "    </jaxb:schemaBindings>\n" +
+            "  </xs:appinfo></xs:annotation>\n" +
+            "  <xs:element name='DIAGJOBS'>\n" +
+    		"    <xs:complexType>\n" +
+    		"      <xs:choice maxOccurs='unbounded'>\n" +
+    		"        <xs:element name='DIAGJOB' type='xs:string'/>\n" +
+    		"        <xs:sequence>\n" +
+    		"          <xs:element name='DJREF' type='xs:long'/>\n" +
+    		"          <xs:element name='DESCRIPTIONS' type='xs:string' minOccurs='0'/>\n" +
+    		"        </xs:sequence>\n" +
+    		"      </xs:choice>\n" +
+    		"    </xs:complexType>\n" +
+    		"  </xs:element>\n" +
+    		"</xs:schema>\n";
+      	SchemaSG schema = parse(schemaSpec, "testMultipleGroupRejected.xsd");
+      	try {
+      		schema.generate();
+      		fail("Expected an exception");
+      	} catch (SAXException e) {
+      		assertTrue(e.getMessage().indexOf("Model groups with maxOccurs > 1 are not yet supported.") != -1);
+      	}
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrintParseTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrintParseTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrintParseTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.apache.ws.jaxme.tests.printparse.Test;
+import org.apache.ws.jaxme.tests.printparse.impl.TestImpl;
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+
+/** Test case for the
+ * <code>printMethod</code> and <code>parseMethod</code>
+ * attributes in <code>jaxb:javaType</code>.
+ */
+public class PrintParseTest extends TestCase {
+	private String getNamespace() {
+		TestImpl test = new TestImpl();
+        return test.getQName().getNamespaceURI();
+    }
+
+    private String getPackageName() {
+		String testClassName = Test.class.getName();
+        int offset = testClassName.lastIndexOf('.');
+        return testClassName.substring(0, offset);
+    }
+
+    private JAXBContext getJAXBContext() throws JAXBException {
+    	return JAXBContext.newInstance(getPackageName());
+    }
+
+    /** Tests the use of <code>jaxb:javaType/@print</code>.
+     */
+    public void testPrint() throws Exception {
+    	boolean[] bools = new boolean[]{false, true};
+        int[] ints = new int[]{0,1};
+        for (int i = 0;  i < bools.length;  i++) {
+            Test test = new TestImpl();
+            test.setBool(bools[i]);
+            StringWriter sw = new StringWriter();
+            Marshaller m = getJAXBContext().createMarshaller();
+            m.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+            m.marshal(test, sw);
+            String expect =
+              "<Test xmlns=\"" + getNamespace() + "\"><Bool>" + ints[i] +
+              "</Bool></Test>";
+            String got = sw.toString();
+            assertEquals(expect, got);
+        }
+    }
+
+    /** Tests the use of <code>jaxb:javaType/@parse</code>.
+     */
+    public void testParse() throws Exception {
+        boolean[] bools = new boolean[]{false, true};
+        int[] ints = new int[]{0,1};
+        for (int i = 0;  i < bools.length;  i++) {
+            String input =
+                "<Test xmlns=\"" + getNamespace() + "\"><Bool>" + ints[i] +
+                "</Bool></Test>";
+            Unmarshaller u = getJAXBContext().createUnmarshaller();
+            Test test = (Test) u.unmarshal(new InputSource(new StringReader(input)));
+            assertEquals(bools[i], test.isBool());
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrinterCreatorTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrinterCreatorTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/PrinterCreatorTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.apache.ws.jaxme.examples.misc.address.AddressCreator;
+import org.apache.ws.jaxme.examples.misc.address.AddressPrinter;
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.apache.ws.jaxme.test.misc.address.Address;
+import org.xml.sax.InputSource;
+
+
+/** Basic test for marshalling and unmarshalling an
+ * Address document.
+ */
+public class PrinterCreatorTest extends BaseTestCase {
+	/** Creates a new instance with the given name.
+	 */
+	public PrinterCreatorTest(String pName) {
+		super(pName);
+	}
+	
+	private String getAddress() throws Exception {
+		StringWriter sw = new StringWriter();
+		AddressCreator.writeAddress(sw);
+		sw.close();
+		return "<Address xmlns=\"http://ws.apache.org/jaxme/test/misc/address\">\n" +
+		"  <Name>\n" +
+		"    <First>Jane</First>\n" +
+		"    <Last>Doe</Last>\n" +
+		"  </Name>\n" +
+		"  <Postal>\n" +
+		"    <Street>34 Main Street</Street>\n" +
+		"    <ZIP>02215</ZIP>\n" +
+		"    <City>Boston</City>\n" +
+		"    <State>MA</State>\n" +
+		"  </Postal>\n" +
+		"  <PhoneDetails>\n" +
+		"    <Phone type=\"Work\">\n" +
+		"      <PhoneNumber>555.6789</PhoneNumber>\n" +
+		"    </Phone>\n" +
+		"    <Phone type=\"Fax\">\n" +
+		"      <PhoneNumber>555.1212</PhoneNumber>\n" +
+		"    </Phone>\n" +
+		"  </PhoneDetails>\n" +
+		"  <EmailDetails>\n" +
+		"    <Email type=\"Private\">\n" +
+		"      <EmailAddress>jdoe at yourcompany.com</EmailAddress>\n" +
+		"    </Email>\n" +
+		"    <Email type=\"Office\">\n" +
+		"      <EmailAddress>josephdoe at mycompany.com</EmailAddress>\n" +
+		"    </Email>\n" +
+		"    <Email type=\"Office\">\n" +
+		"      <EmailAddress>joseph.doe at mycompany.com</EmailAddress>\n" +
+		"    </Email>\n" +
+		"  </EmailDetails>\n" +
+		"</Address>";
+	}
+	
+	/** Tests marshalling a JaxMe object.
+	 */
+	public void testCreate() throws Exception {
+		StringWriter sw = new StringWriter();
+		AddressCreator.writeAddress(sw);
+		sw.close();
+		String expect = "<Address xmlns=\"http://ws.apache.org/jaxme/test/misc/address\">\n" +
+		"  <Name>\n" +
+		"    <First>Jane</First>\n" +
+		"    <Last>Doe</Last>\n" +
+		"  </Name>\n" +
+		"  <Postal>\n" +
+		"    <Street>34 Main Street</Street>\n" +
+		"    <ZIP>02215</ZIP>\n" +
+		"    <City>Boston</City>\n" +
+		"    <State>MA</State>\n" +
+		"  </Postal>\n" +
+		"  <PhoneDetails>\n" +
+		"    <Phone type=\"Work\">\n" +
+		"      <PhoneNumber>555.6789</PhoneNumber>\n" +
+		"    </Phone>\n" +
+		"    <Phone type=\"Fax\">\n" +
+		"      <PhoneNumber>555.1212</PhoneNumber>\n" +
+		"    </Phone>\n" +
+		"  </PhoneDetails>\n" +
+		"  <EmailDetails>\n" +
+		"    <Email type=\"Private\">\n" +
+		"      <EmailAddress>jdoe at yourcompany.com</EmailAddress>\n" +
+		"    </Email>\n" +
+		"    <Email type=\"Office\">\n" +
+		"      <EmailAddress>josephdoe at mycompany.com</EmailAddress>\n" +
+		"    </Email>\n" +
+		"    <Email type=\"Office\">\n" +
+		"      <EmailAddress>joseph.doe at mycompany.com</EmailAddress>\n" +
+		"    </Email>\n" +
+		"  </EmailDetails>\n" +
+		"</Address>";
+		String got = sw.toString();
+		assertEquals(expect, got);
+	}
+	
+	/** Tests unmarshalling a string into t JaxMe object.
+	 */
+	public void testPrint() throws Exception {
+		String address = getAddress();
+		InputSource isource = new InputSource(new StringReader(address));
+		isource.setSystemId("testPrint.xml");
+		Address addr = AddressPrinter.getAddress(isource);
+		JAXBContext context = JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.address");
+		StringWriter sw = new StringWriter();
+		Marshaller m = context.createMarshaller();
+		m.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+		m.marshal(addr, sw);
+		sw.close();
+		String got = sw.toString();
+		assertEquals(address, got);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/RecursionTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/RecursionTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/RecursionTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,96 @@
+package org.apache.ws.jaxme.junit;
+
+import org.apache.ws.jaxme.test.recursion.Attribute;
+import org.apache.ws.jaxme.test.recursion.DirectEmployee;
+import org.apache.ws.jaxme.test.recursion.IndirectEmployee;
+import org.apache.ws.jaxme.test.recursion.PotEmployee;
+
+
+/**
+ * Tests for unmarshalling from a string, them marshalling to another
+ * string and unmarshalling back to another object for comparison.
+ * Three different recursive schemas are used:
+ * <ol>
+ *   <li>Direct recursion: A node is recurring directly under itself.</li>
+ *   <li>Indirect recursion: A node is recurring as a child of another
+ *     node within itself.</li>
+ *   <li>Potential direct/indirect recursion: A node is directly
+ *     recurring/indirectly recurring under as one of the choices under
+ *     itself.</li>
+ * </ol>
+ */
+public class RecursionTest extends BaseTestCase {
+    /** Creates a new instance with the given name.
+     */
+    public RecursionTest(String pName) { super(pName); }
+
+    /** Tests indirect recursion: The recursing element is a child
+     * elements child.
+     */
+    public void testIndirectRecursion() throws Exception {
+	    final String xml =
+	        "<rec:IndirectEmployee name=\"Bill\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" +
+	        "  <rec:Manager>\n" +
+	        "    <rec:Employees name=\"Bud\" id=\"2\">\n" +
+	        "      <rec:Manager>\n" +
+	        "        <rec:Employees name=\"Buck\" id=\"3\">\n" +
+	        "          <rec:Manager/>\n" +
+	        "        </rec:Employees>\n" +
+	        "      </rec:Manager>\n" +
+	        "    </rec:Employees>\n" +
+	        "  </rec:Manager>\n" +
+	        "</rec:IndirectEmployee>";
+
+		unmarshalMarshalUnmarshal(IndirectEmployee.class, xml);
+	}
+
+    /** Tests direct recursion: The recursing element is an
+     * immediate child.
+     */
+    public void testDirectRecursion() throws Exception {
+	    final String xml =
+	        "<rec:DirectEmployee name=\"John\" id=\"4\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" +
+	        "  <rec:Employees name=\"Jack\" id=\"5\">\n" +
+	        "    <rec:Employees name=\"Jim\" id=\"6\">\n" +
+	        "      <rec:Employees name=\"James\" id=\"7\"/>\n" +
+	        "    </rec:Employees>\n" +
+	        "  </rec:Employees>\n" +
+	        "</rec:DirectEmployee>";
+		unmarshalMarshalUnmarshal(DirectEmployee.class, xml);
+	}
+
+    /** Tests potential recursion: The recursing element may
+     * be a direct or an indirect child.
+     */
+    public void testPotentialRecursion() throws Exception {
+	    final String xml1 =
+	        "<rec:PotEmployee name=\"John\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" +
+	        "  <rec:Employees name=\"Francis\" id=\"3\"/>\n" +
+	        "</rec:PotEmployee>";
+		unmarshalMarshalUnmarshal(PotEmployee.class, xml1);
+		final String xml2 =
+	        "<rec:PotEmployee name=\"John\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" +
+	        "  <rec:Manager>\n" +
+		    "    <rec:Employees name=\"Francis\" id=\"3\"/>\n" +
+		    "  </rec:Manager>\n" +
+		    "</rec:PotEmployee>";
+		unmarshalMarshalUnmarshal(PotEmployee.class, xml2);
+	}
+
+    /** Tests recursion using element references.
+     */
+    public void testElementRecursion() throws Exception {
+    	final String xml =
+            "<rec:Attribute name=\"Sam\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" +
+            "  <rec:AttributeList>\n" +
+            "    <rec:Attribute name=\"Sonny\" id=\"2\">\n" +
+            "      <rec:AttributeList/>\n" +
+            "    </rec:Attribute>\n" +
+            "    <rec:Attribute name=\"Severine\" id=\"3\">\n" +
+            "      <rec:AttributeList/>\n" +
+            "    </rec:Attribute>\n" +
+            "  </rec:AttributeList>\n" +
+            "</rec:Attribute>";
+        unmarshalMarshalUnmarshal(Attribute.class, xml);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/WildcardTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/WildcardTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/junit/WildcardTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.WildcardAttribute;
+import org.apache.ws.jaxme.impl.JMMarshallerImpl;
+import org.apache.ws.jaxme.impl.OrderedAttributeXMLWriter;
+import org.apache.ws.jaxme.test.misc.wildcards.AnyAttribute;
+import org.apache.ws.jaxme.test.misc.wildcards.ListAttribute;
+import org.apache.ws.jaxme.test.misc.wildcards.ObjectFactory;
+import org.apache.ws.jaxme.test.misc.wildcards.OtherAttribute;
+import org.xml.sax.InputSource;
+
+
+/** <p>Test case for wildcard attributes and elements.</p>
+ */
+public class WildcardTest extends BaseTestCase {
+    public WildcardTest(String pName) {
+        super(pName);
+    }
+
+    protected JAXBContext getJAXBContext() throws JAXBException {
+        return JAXBContext.newInstance("org.apache.ws.jaxme.test.misc.wildcards");
+    }
+
+    protected String asString(Element pElement) throws JAXBException {
+        Marshaller marshaller = getJAXBContext().createMarshaller();
+        marshaller.setProperty(JMMarshallerImpl.JAXME_XML_DECLARATION, Boolean.FALSE);
+        marshaller.setProperty(JMMarshallerImpl.JAXME_XML_WRITER, OrderedAttributeXMLWriter.class);
+        StringWriter sw = new StringWriter();
+        marshaller.marshal(pElement, sw);
+        return sw.toString();
+    }
+
+    protected String getMarshalledAnyAttribute() throws JAXBException {
+        ObjectFactory objectFactory = new ObjectFactory();
+        AnyAttribute anyAttribute = objectFactory.createAnyAttribute();
+        anyAttribute.setAnyAttribute(new QName("foo", "bar"), "value 1");
+        anyAttribute.setAnyAttribute(new QName("baz"), "value 2");
+        return asString(anyAttribute);
+    }
+
+    protected String getMarshalledListAttribute() throws JAXBException {
+        ObjectFactory objectFactory = new ObjectFactory();
+        ListAttribute listAttribute = objectFactory.createListAttribute();
+        listAttribute.setAnyAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards/2", "foo"), "value 1");
+        listAttribute.setAnyAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards", "bar"), "value 2");
+        return asString(listAttribute);
+    }
+
+    protected String getMarshalledOtherAttribute() throws JAXBException {
+        ObjectFactory objectFactory = new ObjectFactory();
+        OtherAttribute otherAttribute = objectFactory.createOtherAttribute();
+        otherAttribute.setAnyAttribute(new QName("foo", "bar"), "value 1");
+        otherAttribute.setAnyAttribute(new QName("baz"), "value 2");
+        return asString(otherAttribute);
+    }
+
+    protected Element getUnmarshalledElement(String pMarshalledElement) throws JAXBException {
+        Unmarshaller unmarshaller = getJAXBContext().createUnmarshaller();
+        return (Element) unmarshaller.unmarshal(new InputSource(new StringReader(pMarshalledElement)));
+    }
+
+    public void testMarshalAnyAttribute() throws Exception {
+        String expect = "<ex:AnyAttribute p:bar=\"value 1\" baz=\"value 2\" xmlns:ex=\"http://ws.apache.org/jaxme/test/misc/wildcards\" xmlns:p=\"foo\"/>";
+        String got = getMarshalledAnyAttribute();
+        assertEquals(expect, got);
+    }
+
+    protected void assertEquals(WildcardAttribute[] pExpect, WildcardAttribute[] pGot) {
+        assertEquals(pExpect.length, pGot.length);
+        Map mapGot = new HashMap();
+        for (int i = 0;  i < pGot.length;  i++) {
+            mapGot.put(pGot[i].getName(), pGot[i].getValue());
+        }
+        if (mapGot.size() < pGot.length) {
+            fail("Expected " + pGot.length + " elements in result Map, got " + mapGot.size());
+        }
+        for (int i = 0;  i < pExpect.length;  i++) {
+            WildcardAttribute wa = pExpect[i];
+            String value = (String) mapGot.get(wa.getName());
+            if (value == null) {
+                fail("Expected name " + wa.getName() + " in result Map.");
+            } else {
+                assertEquals(wa.getValue(), value);
+            }
+        }
+    }
+
+    public void testUnmarshalAnyAttribute() throws Exception {
+        AnyAttribute anyAttribute = (AnyAttribute) getUnmarshalledElement(getMarshalledAnyAttribute());
+        WildcardAttribute[] attrs = anyAttribute.getAnyAttributeArray();
+        assertEquals(new WildcardAttribute[]{
+			new WildcardAttribute(new QName("foo", "bar"), "value 1"),
+			new WildcardAttribute(new QName("baz"), "value 2"),
+		}, attrs);
+    }
+
+    public void testMarshalListAttribute() throws Exception {
+        String expect = "<ex:ListAttribute p:foo=\"value 1\" ex:bar=\"value 2\" xmlns:ex=\"http://ws.apache.org/jaxme/test/misc/wildcards\" xmlns:p=\"http://ws.apache.org/jaxme/test/misc/wildcards/2\"/>";
+        String got = getMarshalledListAttribute();
+        assertEquals(expect, got);
+    }
+
+    public void testUnmarshalListAttribute() throws Exception {
+        ListAttribute listAttribute = (ListAttribute) getUnmarshalledElement(getMarshalledListAttribute());
+        WildcardAttribute[] attrs = listAttribute.getAnyAttributeArray();
+        assertEquals(new WildcardAttribute[]{
+			new WildcardAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards/2", "foo"), "value 1"),
+			new WildcardAttribute(new QName("http://ws.apache.org/jaxme/test/misc/wildcards", "bar"), "value 2")
+		}, attrs);
+    }
+
+    public void testMarshalOtherAttribute() throws Exception {
+        String expect = "<ex:OtherAttribute p:bar=\"value 1\" baz=\"value 2\" xmlns:ex=\"http://ws.apache.org/jaxme/test/misc/wildcards\" xmlns:p=\"foo\"/>";
+        String got = getMarshalledOtherAttribute();
+        assertEquals(expect, got);
+    }
+
+    public void testUnmarshalOtherAttribute() throws Exception {
+        OtherAttribute otherAttribute = (OtherAttribute) getUnmarshalledElement(getMarshalledOtherAttribute());
+        WildcardAttribute[] attrs = otherAttribute.getAnyAttributeArray();
+        assertEquals(new WildcardAttribute[]{
+			new WildcardAttribute(new QName("foo", "bar"), "value 1"),
+			new WildcardAttribute(new QName("baz"), "value 2")
+        }, attrs);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Base package for the <a href='http://ws.apache.org/jaxme'>JaxMe Java-XML binder</a>.
+    </p>
+        <p>
+This package contains the base interfaces and classes for the <code>JaxMe</code>
+runtime engine. The sources generated by <code>JaxMe</code> from schema rely on
+implementations of these interfaces (contained in the <a href='impl/package-summary.html'>
+impl</a> subpackage) to function.
+    </p>    
+        <p>
+This package is also the root of the <code>JaxMe</code> package
+structure. Within this package structure are the following important components:
+    </p>
+        <ul>
+            <li>
+<a href='js/package-summary.html'>org.apache.ws.jaxme.js</a> 
+the JaxMe Java Source generation framework
+        </li>
+            <li>
+org.apache.ws.jaxme.pm
+the JaxMe database persistence framework
+        </li>
+            <li>
+<a href='xs/package-summary.html'>org.apache.ws.jaxme.xs</a> 
+the JaxMe generic schema parser
+        </li>
+            <li>
+<a href='sqls/package-summary.html'>org.apache.ws.jaxme.sql</a> 
+the JaxMe generic framework for SQL generators, a specialization of
+the Jave Source framework
+        </li>      
+            <li>
+<a href='generator/package-summary.html'>org.apache.ws.jaxme.generator</a> 
+the JaxMe specific generators used to generate source from schema, 
+a specialization of the Jave Source framework
+        </li>
+            <li>
+<a href='logging/package-summary.html'>org.apache.ws.jaxme.logging</a> 
+the JaxMe logging framework
+        </li>         
+    </ul>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Base64Binary.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Base64Binary.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Base64Binary.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+import java.io.IOException;
+
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
+
+
+/** A utility class for working with base64 encoding.
+ */
+public class Base64Binary {
+	/** Creates a clone of the byte array <code>pValue</code>.
+	 */
+	public static byte[] getClone(byte[] pValue) {
+		byte[] result = new byte[pValue.length];
+		System.arraycopy(pValue, 0, result, 0, pValue.length);
+		return result;
+	}
+
+	/** Converts the string <code>pValue</code> into a
+	 * base64 encoded byte array.
+	 */
+	public static byte[] decode(String pValue) throws IOException {
+		return (new BASE64Decoder()).decodeBuffer(pValue);
+	}
+
+	/** Converts the base64 encoded byte array <code>pValue</code>
+	 * into a string.
+	 */
+	public static String encode(byte[] pValue) {
+		return (new BASE64Encoder()).encode(pValue);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/ClassLoader.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/ClassLoader.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/ClassLoader.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+
+/** <p>Helper class for working with class loaders.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: ClassLoader.java 231893 2004-07-27 11:19:25Z jochen $
+ */
+public class ClassLoader {
+  /** <p>Loads a class with the given name. First attempts to use
+   * the context class loader, then its own class loader.</p>
+   *
+   * @param pName The fully qualified name of the class being loaded.
+   * @throws ClassNotFoundException Loading the class failed.
+   * @return The class with the name <code>pName</code>.
+   */
+  public static Class getClass(String pName) throws ClassNotFoundException {
+    // First try: The default ClassLoader
+    try {
+      return Class.forName(pName);
+    } catch (ClassNotFoundException e) {
+      // Second try: The threads context ClassLoader
+      try {
+        java.lang.ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+          throw new ClassNotFoundException(pName);   
+        }
+        return cl.loadClass(pName);
+      } catch (ClassNotFoundException f) {
+        throw e;
+      }
+    }
+  }
+
+  /** <p>Loads a class with the given name using <code>getClass(String)</code>.
+   * If an instance of the returned class cannot be assigned to the
+   * class or interface <code>pAssignableTo</code>, throws an
+   * IllegalArgumentException.</p>
+   *
+   * @throws ClassNotFoundException The class with the name <code>pName</code>
+   *   could not be loaded.
+   * @throws IllegalArgumentException Instances of the class with the name
+   *   <code>pName</code> are not assignable to the interface or class
+   *   <code>pAssignableTo</code>.
+   */
+  public static Class getClass(String pName, Class pAssignableTo)
+      throws ClassNotFoundException {
+    Class result = getClass(pName);
+    if (pAssignableTo != null  &&  !pAssignableTo.isAssignableFrom(result)) {
+      throw new IllegalArgumentException("The class " + result.getName() +
+                                          " is not implementing or extending " +
+                                          pAssignableTo.getName());
+    }
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Configurator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Configurator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Configurator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,563 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/** <p>The Configurator is an idea borrowed by the Ant project.
+ * It is a SAX2 handler that reads a config file which is
+ * represented by a hierarchy of Java beans. For example:</p>
+ * <pre>
+ *   &lt;outerBean foo="true" bar="Quite right"&gt;
+ *     &lt;innerBean whatever="57"&gt;
+ *     &lt;/innerBean
+ *   &lt;/outerBean&gt;
+ * </pre>
+ * The example would create an object outerBean and call its
+ * methods <code>setFoo(boolean)</code> and
+ * <code>setBar(String)</code> to process the attributes.
+ * It would also create a bean innerBean by calling the
+ * outerBeans method <code>createInnerBean()</code>.
+ * Finally the innerBean is configured by calling
+ * <code>setWhatever(int)</code>.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: Configurator.java 232067 2005-03-10 10:14:08Z jochen $
+ */
+public class Configurator implements ContentHandler, NamespaceResolver {
+  private static final Class[] zeroClasses = new Class[0];
+  private static final Object[] zeroObjects = new Object[0];
+  private static final Class[] oneClassString = new Class[]{String.class};
+  private static final Class[] oneClassAttributes = new Class[]{Attributes.class};
+
+  private String[] namespaces;
+  private List beans = new ArrayList();
+  private List names = new ArrayList();
+  private Object currentBean;
+  private String currentName;
+  private Locator locator;
+  private Object beanFactory;
+  private Object rootObject;
+  private Object resultBean;
+  private int ignoreLevel = 0;
+  private NamespaceSupport nss = new NamespaceSupport();
+  boolean nssNeedsContext;
+
+  /** <p>Sets the namespace handled by the configurator. Defaults
+   * to no namespace. Shortcut for
+   * <code>setNamespace(new String[]{pNamespace})</code>.</p>
+   *
+   * @param pNamespace The namespace being set
+   */
+  public void setNamespace(String pNamespace) {
+    setNamespaces(new String[]{pNamespace});
+  }
+
+  /** <p>Sets the namespaces handled by the configurator. Defaults
+   * to no namespace.</p>
+   *
+   * @param pNamespaces The namespaces being set
+   */
+  public void setNamespaces(String[] pNamespaces) {
+    namespaces = pNamespaces;
+  }
+
+  /** <p>Returns the namespaces handled by the configurator. Defaults
+   * to no namespace.</p>
+   */
+  public String[] getNamespaces() {
+    return namespaces;
+  }
+
+  /** <p>Sets the Locator being used in error messages.</p>
+   */
+  public void setDocumentLocator(Locator pLocator) {
+    locator = pLocator;
+  }
+
+  /** <p>Returns the Locator being used in error messages.</p>
+   */
+  public Locator getDocumentLocator() {
+    return locator;
+  }
+
+  /** <p>Sets the bean factory, creating the outermost element.
+   * The bean factory must have a matching <code>createElementName()</code>
+   * method, with <samp>ElementName</samp> being the element name
+   * of the document element.</p>
+   */
+  public void setBeanFactory(Object pFactory) {
+    beanFactory = pFactory;
+  }
+
+  /** <p>Returns the bean factory, creating the outermost element.
+   * The bean factory must have a matching <code>createElementName()</code>
+   * method, with <samp>ElementName</samp> being the element name
+   * of the document element.</p>
+   */
+  public Object getBeanFactory() {
+    return beanFactory == null ? this : beanFactory;
+  }
+
+  /** <p>An alternative to using the bean factory. This object
+   * is used as the root object, regardless of its name.</p>
+   */
+  public void setRootObject(Object pRootObject) {
+    rootObject = pRootObject;
+  }
+
+  /** <p>An alternative to using the bean factory. This object
+   * is used as the root object, regardless of its name.</p>
+   */
+  public Object getRootObject() {
+    return rootObject;
+  }
+
+  public void startDocument() throws SAXException {
+    currentBean = null;
+    currentName = null;
+    beans.clear();
+    names.clear();
+    ignoreLevel = 0;
+    nss.reset();
+    nssNeedsContext = true;
+  }
+  public void endDocument() throws SAXException {}
+
+  public void startPrefixMapping(String pPrefix, String pURI)
+      throws SAXException {
+    nss.declarePrefix(pPrefix, pURI);
+  }
+
+  public void endPrefixMapping(String pPrefix)
+      throws SAXException {
+    nss.undeclarePrefix(pPrefix);
+  }
+
+  /** <p>Returns whether a namespace is matching the configured
+   * namespace.</p>
+   */
+  protected boolean isNamespaceMatching(String pNamespace) {
+    if (pNamespace == null) {
+      pNamespace = "";
+    }
+    String[] myNamespaces = getNamespaces();
+    if (myNamespaces == null  ||  myNamespaces.length == 0) {
+      return pNamespace.length() == 0;
+    } else {
+      for (int i = 0;  i < myNamespaces.length;  i++) {
+        String s = myNamespaces[i];
+        if (s == null) {
+          s = "";
+        }
+        if (s.equals(pNamespace)) {
+          return true;
+        }
+      }
+      return false;
+    }
+  }
+
+  /** <p>Given a prefix and a name, creates a method name matching
+   * the prefix and the name.</p>
+   */
+  protected String getMethodNameFor(String pPrefix, String pName) {
+    StringBuffer result = new StringBuffer(pPrefix);
+    for (int i = 0;  i < pName.length();  i++) {
+      char c = pName.charAt(i);
+      if (i == 0) {
+        if (Character.isJavaIdentifierStart(c)) {
+          result.append(Character.toUpperCase(c));
+        } else {
+          result.append('_');
+        }
+      } else {
+        if (Character.isJavaIdentifierPart(c)) {
+          result.append(c);
+        } else {
+          result.append('_');
+        }
+      }
+    }
+    return result.toString();
+  }
+
+  /** <p>Creates a new bean, matching the element name <code>pLocalName</code>.
+   * If this is the outermost bean, calls the bean factorys
+   * <code>createBeanName()</code> method, otherwise calls the current beans
+   * <code>createBeanName()</code> method, with <samp>beanName</samp>
+   * being the value of the <code>pLocalName</code> parameter.</p>
+   */
+  public void startElement(String pNamespaceURI, String pQName,
+                            String pLocalName, Attributes pAttr) throws SAXException {
+    if (ignoreLevel > 0) {
+      ++ignoreLevel;
+      return;
+    }
+    
+    if (!isNamespaceMatching(pNamespaceURI)) {
+      if (currentBean == null) {
+        String[] myNamespaces = getNamespaces();
+        if (myNamespaces == null  ||  myNamespaces.length == 0) {
+          throw new SAXParseException("The document element must have the default namespace.",
+                                       getDocumentLocator());
+        } else {
+          StringBuffer sb = new StringBuffer("The document element must have either of the namespaces: ");
+          for (int i = 0;  i < myNamespaces.length;  i++) {
+            if (i > 0) sb.append(",");
+            String s = myNamespaces[i];
+            if (s == null) {
+              s = "";
+            } 
+            sb.append('"').append(s).append('"');
+          }
+          throw new SAXParseException(sb.toString(), getDocumentLocator());
+        }
+      }
+
+      ++ignoreLevel;
+      return; // Namespace not matching, ignore this element
+    }
+
+    Object o;
+    if (currentBean == null  &&  rootObject != null) {
+      o = rootObject;
+    } else {
+      o = null;
+      Object factory = (currentBean == null) ? beanFactory : currentBean;
+      String methodName = getMethodNameFor("create", pLocalName);
+      try {
+        o = invokeMethod(methodName, factory, oneClassAttributes,
+                         new Object[]{pAttr});
+      } catch (SAXParseException e) {
+        if (e.getException() != null  &&
+            e.getException() instanceof NoSuchMethodException) {
+          try {
+            o = invokeMethod(methodName, factory, zeroClasses, zeroObjects);
+            e = null;
+          } catch (SAXParseException f) {
+            if (f.getException() != null  &&
+                f.getException() instanceof NoSuchMethodException) {
+              if (currentBean == null) {
+                throw new SAXParseException("Invalid document element: " + pQName,
+                                             getDocumentLocator());
+              } else {
+                throw new SAXParseException("Invalid child element name: " + pQName,
+                                             getDocumentLocator());
+              }
+            }
+            throw f;
+          }
+        }
+        if (e != null) {
+           throw e;
+        }
+      }
+      if (o == null) {
+        throw new SAXParseException("Method " + methodName + " of class " +
+                                     factory.getClass().getName() +
+                                     " did not return an object.",
+                                     getDocumentLocator());
+      }
+    }
+
+    if (currentBean == null) {
+      resultBean = o;
+    } else {
+      beans.add(currentBean);
+      names.add(currentName);
+    }
+    currentBean = o;
+    currentName = pQName;
+
+    if (pAttr != null) {
+      for (int i = 0;  i < pAttr.getLength();  i++) {
+        String uri = pAttr.getURI(i);
+        if (uri == null  ||  uri.length() == 0  ||  isNamespaceMatching(uri)) {
+          String value = pAttr.getValue(i);
+          String qName = pAttr.getQName(i);
+          String setMethodName = getMethodNameFor("set", pAttr.getLocalName(i));
+          Method[] methods = currentBean.getClass().getMethods();
+          for (int j = 0;  j < methods.length;  j++) {
+            Method method = methods[j];
+            if (!setMethodName.equals(method.getName())) {
+              continue;
+            }
+            Class[] argClasses = method.getParameterTypes();
+            if (argClasses.length != 1) {
+              continue;
+            }
+            Object[] args = null;
+            if (argClasses[0] == String.class) {
+              args = new Object[]{value};
+            } else if (argClasses[0] == Integer.class  ||
+                        argClasses[0] == Integer.TYPE) {
+              try {
+                args = new Object[]{new Integer(value)};
+              } catch (Exception e) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " contains an invalid Integer value: " +
+                                             value, getDocumentLocator());
+              }
+            } else if (argClasses[0] == Long.class  ||
+                        argClasses[0] == Long.TYPE) {
+              try {
+                args = new Object[]{new Long(value)};
+              } catch (Exception e) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " contains an invalid Long value: " +
+                                             value, getDocumentLocator());
+              }
+            } else if (argClasses[0] == Short.class  ||
+                        argClasses[0] == Short.TYPE) {
+              try {
+                args = new Object[]{new Short(value)};
+              } catch (Exception e) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " contains an invalid Short value: " +
+                                             value, getDocumentLocator());
+              }
+            } else if (argClasses[0] == Byte.class  ||
+                        argClasses[0] == Byte.TYPE) {
+              try {
+                args = new Object[]{new Byte(value)};
+              } catch (Exception e) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " contains an invalid Byte value: " +
+                                             value, getDocumentLocator());
+              }
+            } else if (argClasses[0] == Boolean.class  ||
+                        argClasses[0] == Boolean.TYPE) {
+              try {
+                args = new Object[]{Boolean.valueOf(value)};
+              } catch (Exception e) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " contains an invalid Boolean value: " +
+                                             value, getDocumentLocator());
+              }
+            } else if (argClasses[0] == Character.class  ||
+                        argClasses[0] == Character.TYPE) {
+              if (value.length() != 1) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " contains an invalid Character value: " +
+                                             value, getDocumentLocator());
+              }
+              args = new Object[]{new Character(value.charAt(0))};
+            } else if (argClasses[0] == Class.class) {
+              Class c;
+              try {
+                c = ClassLoader.getClass(value);
+              } catch (Exception e) {
+                throw new SAXParseException("Failed to load class " + value,
+                                             getDocumentLocator(), e);
+              }
+              args = new Object[]{c};
+            } else if (argClasses[0] == QName.class) {
+              try {
+                QName name = QName.valueOf(value);
+                args = new Object[]{name};
+              } catch (Exception e) {
+                throw new SAXParseException("Failed to parse QName " + value,
+                                             getDocumentLocator());
+              }
+            } else {
+              // Try a constructor class(String)
+              try {
+                Constructor con = argClasses[0].getConstructor(oneClassString);
+                args = new Object[]{con.newInstance(new Object[]{value})};
+              } catch (InvocationTargetException e) {
+                Throwable t = e.getTargetException();
+                throw new SAXParseException("Failed to invoke constructor of class " +
+                                             argClasses[0].getClass().getName(),
+                                             getDocumentLocator(),
+                                             (t instanceof Exception) ? ((Exception) t) : e);
+              } catch (NoSuchMethodException e) {
+                throw new SAXParseException("Attribute " + qName +
+                                             " has an invalid type: " +
+                                             argClasses[0].getClass().getName(),
+                                             getDocumentLocator());
+              } catch (IllegalAccessException e) {
+                throw new SAXParseException("Illegal access to constructor of class " +
+                                             argClasses[0].getClass().getName(),
+                                             getDocumentLocator(), e);
+              } catch (InstantiationException e) {
+                throw new SAXParseException("Failed to instantiate class " +
+                                             argClasses[0].getClass().getName(),
+                                             getDocumentLocator(), e);
+              }
+            }
+
+            try {
+              method.invoke(currentBean, args);
+            } catch (IllegalAccessException e) {
+              throw new SAXParseException("Illegal access to method " + setMethodName +
+                                             " of class " + currentBean.getClass().getName(),
+                                             getDocumentLocator(), e);
+            } catch (InvocationTargetException e) {
+              Throwable t = e.getTargetException();
+              throw new SAXParseException("Failed to invoke method " + setMethodName +
+                                           " of class " + currentBean.getClass().getName(),
+                                           getDocumentLocator(),
+                                           (t instanceof Exception) ? ((Exception) t) : e);
+            }
+          }
+        }
+      }
+    }
+  }
+
+  protected Object invokeMethod(String pMethodName, Object pBean,
+                                 Class[] pSignature, Object[] pArgs)
+     throws SAXException {
+    try {
+      Method m = pBean.getClass().getMethod(pMethodName, pSignature);
+      return m.invoke(pBean, pArgs);
+    } catch (IllegalAccessException e) {
+      throw new SAXParseException("Illegal access to method " + pMethodName +
+                                   " of class " + pBean.getClass().getName(),
+                                   getDocumentLocator(), e);
+    } catch (NoSuchMethodException e) {
+      throw new SAXParseException("No such method in class " +
+                                   pBean.getClass().getName() + ": " + pMethodName,
+                                   getDocumentLocator(), e);
+    } catch (InvocationTargetException e) {
+      Throwable t = e.getTargetException();
+      throw new SAXParseException("Failed to invoke method " + pMethodName +
+                                   " of class " + pBean.getClass().getName(),
+                                   getDocumentLocator(),
+                                   (t instanceof Exception) ? ((Exception) t) : e);
+    }
+  }
+
+  /** <p>Terminates parsing the current bean by calling its
+   * <code>finish()</code> method, if any.</p>
+   */
+  public void endElement(String namespaceURI, String qName, String localName)
+      throws SAXException {
+    if (ignoreLevel > 0) {
+      --ignoreLevel;
+      return;
+    }
+
+    Object previousBean = currentBean;
+    if (beans.size() > 0) {
+      currentBean = beans.remove(beans.size()-1);
+      currentName = names.remove(names.size()-1).toString();
+    } else {
+      currentBean = null;
+      currentName = null;
+    }
+    try {
+      invokeMethod("finish", previousBean, zeroClasses, zeroObjects);
+    } catch (SAXParseException e) {
+      if (e.getException() == null  ||
+          !(e.getException() instanceof NoSuchMethodException)) {
+        throw e;
+      }
+    }
+  }
+
+  /** <p>Handles atomic child elements by invoking their method
+   * <code>addText(String pText)</code>. Note that it may happen,
+   * that this method is invoked multiple times, if the parser
+   * splits a piece of text into multiple SAX events.</p>
+   */
+  public void characters(char[] ch, int start, int length)
+      throws SAXException {
+    if (ignoreLevel > 0) {
+      return;
+    }
+
+    String s = new String(ch, start, length);
+    try {
+      invokeMethod("addText", currentBean, oneClassString, new String[]{s});
+    } catch (SAXParseException e) {
+      if (e.getException() != null  &&
+          (e.getException() instanceof NoSuchMethodException)) {
+        boolean allWhitespace = true;
+        for (int i = 0;  i < length;  i++) {
+          if (!Character.isWhitespace(ch[start+i])) {
+            allWhitespace = false;
+            break;
+          }
+        }
+        if (allWhitespace) {
+          // Ignore this
+        } else {
+          throw new SAXParseException("Element " + currentName +
+                                       " doesn't support embedded text.",
+                                       getDocumentLocator());
+        }
+      } else {
+        throw e;
+      }
+    }      
+  }
+
+  public void ignorableWhitespace(char[] ch, int start, int length)
+    throws SAXException {
+  }
+
+  public void processingInstruction(String target, String data)
+    throws SAXException {
+  }
+
+  public void skippedEntity(String name) throws SAXException {
+  }
+
+  /** Returns the parsed result bean.
+   */
+  public Object getResult() { return resultBean; }
+
+  public boolean processName(String pName, String[] parts) {
+    int offset = pName.indexOf(':');
+    if (offset == -1) {
+      String uri = nss.getNamespaceURI("");
+      if (uri == null) {
+        parts[0] = "";
+      } else {
+        parts[0] = uri;
+      }
+      parts[1] = pName;
+      parts[2] = pName;
+      return true;
+    } else {
+      String uri = nss.getNamespaceURI(pName.substring(0, offset));
+      if (uri == null) {
+        return false;
+      } else {
+        parts[0] = uri;
+        parts[1] = pName.substring(offset+1);
+        parts[2] = pName;
+        return true;
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMBuilder.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMBuilder.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMBuilder.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/** <p>Converts a stream of SAX events into a DOM node.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: DOMBuilder.java 231826 2004-04-18 19:15:30Z jochen $
+ */
+public class DOMBuilder implements ContentHandler {
+    private Document document;
+    private Node target;
+    private Node currentNode;
+    private Locator locator;
+    private boolean prefixMappingIsAttribute;
+    private List prefixes;
+    
+    /** <p>Sets whether the event {@link #startPrefixMapping}
+     * shall create an <code>xmlns</code> attribute. Defaults
+     * to false.</p>
+     */
+    public boolean isPrefixMappingIsAttribute() {
+        return prefixMappingIsAttribute;
+    }
+    
+    /** <p>Returns whether the event {@link #startPrefixMapping}
+     * shall create an <code>xmlns</code> attribute. Defaults
+     * to false.</p>
+     */
+    public void setPrefixMappingIsAttribute(boolean pPrefixMappingIsAttribute) {
+        prefixMappingIsAttribute = pPrefixMappingIsAttribute;
+    }
+    
+    /** <p>Sets the document being used as object factory.</p>
+     */
+    public void setDocument(Document pDocument) {
+        document = pDocument;
+    }
+    
+    /** <p>Returns the document being used as object factory.</p>
+     */
+    public Document getDocument() {
+        return document;
+    }
+    
+    /** <p>Sets the Locator.</p>
+     */
+    public void setDocumentLocator(Locator pLocator) {
+        locator = pLocator;
+    }
+    
+    /** <p>Returns the Locator.</p>
+     */
+    public Locator getDocumentLocator() {
+        return locator;
+    }
+    
+    /** <p>Sets the target node. The document is built as a fragment
+     * in the target node.</p>
+     */
+    public void setTarget(Node pNode) {
+        target = pNode;
+        currentNode = pNode;
+        if (getDocument() == null) {
+            setDocument(pNode.getNodeType() == Node.DOCUMENT_NODE ?
+                    (Document) pNode : pNode.getOwnerDocument());
+        }
+    }
+    
+    /** <p>Returns the target node. The document is built as a fragment
+     * in the target node.</p>
+     */
+    public Node getTarget() {
+        return target;
+    }
+    
+    /**
+     * @see org.xml.sax.ContentHandler#startDocument()
+     */
+    public void startDocument() throws SAXException {
+    }
+    
+    /**
+     * @see org.xml.sax.ContentHandler#endDocument()
+     */
+    public void endDocument() throws SAXException {
+    }
+    
+    public void startPrefixMapping(String prefix, String uri)
+    		throws SAXException {
+        if (isPrefixMappingIsAttribute()) {
+            if (prefixes == null) {
+                prefixes = new ArrayList();
+            }
+            prefixes.add(prefix);
+            prefixes.add(uri);
+        }
+    }
+    
+    public void endPrefixMapping(String prefix) throws SAXException {
+    }
+    
+    public void startElement(String pNamespaceURI, String pLocalName,
+            				 String pQName, Attributes pAttr) throws SAXException {
+        Document doc = getDocument();
+        Element element;
+        if (pNamespaceURI == null  ||  pNamespaceURI.length() == 0) {
+            element = doc.createElement(pQName);
+        } else {
+            element = doc.createElementNS(pNamespaceURI, pQName);
+        }
+        if (pAttr != null) {
+            for (int i = 0;  i < pAttr.getLength();  i++) {
+                String uri = pAttr.getURI(i);
+                String qName = pAttr.getQName(i);
+                String value = pAttr.getValue(i);
+                if (uri == null  ||  uri.length() == 0) {
+                    element.setAttribute(qName, value);
+                } else {
+                    element.setAttributeNS(uri, qName, value);
+                }
+            }
+        }
+        if (prefixes != null) {
+            for (int i = 0;  i < prefixes.size();  i += 2) {
+                String prefix = (String) prefixes.get(i);
+                String uri = (String) prefixes.get(i+1);
+                if (prefix == null  ||  "".equals(prefix)) {
+                    element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
+                                           XMLConstants.XMLNS_ATTRIBUTE, uri);
+                } else {
+                    element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
+                                           XMLConstants.XMLNS_ATTRIBUTE + ':' + prefix, uri);
+                }
+            }
+            prefixes.clear();
+        }
+        currentNode.appendChild(element);
+        currentNode = element;
+    }
+    
+    public void endElement(String namespaceURI, String localName, String qName)
+    		throws SAXException {
+        currentNode = currentNode.getParentNode();
+    }
+    
+    public void characters(char[] ch, int start, int length)
+    		throws SAXException {
+        Node node = currentNode.getLastChild();
+        String s = new String(ch, start, length);
+        if (node != null  &&  node.getNodeType() == Node.TEXT_NODE) {
+            ((Text) node).appendData(s);
+        } else {
+            Text text = getDocument().createTextNode(s);
+            currentNode.appendChild(text);
+        }
+    }
+    
+    public void ignorableWhitespace(char[] ch, int start, int length)
+    		throws SAXException {
+        characters(ch, start, length);
+    }
+    
+    public void processingInstruction(String pTarget, String pData)
+    		throws SAXException {
+        ProcessingInstruction pi = getDocument().createProcessingInstruction(pTarget, pData);
+        currentNode.appendChild(pi);
+    }
+    
+    public void skippedEntity(String pName) throws SAXException {
+        EntityReference entity = getDocument().createEntityReference(pName);
+        currentNode.appendChild(entity);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMSerializer.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMSerializer.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/DOMSerializer.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+import javax.xml.XMLConstants;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.AttributesImpl;
+
+/** <p>Serializes a DOM node into a stream of SAX events.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: DOMSerializer.java 232067 2005-03-10 10:14:08Z jochen $
+ */
+public class DOMSerializer {
+  private boolean namespaceDeclarationAttribute;
+  private boolean parentsNamespaceDeclarationDisabled;
+
+  /** <p>Sets whether XML declarations are being serialized as
+   * attributes or as SAX events (default).</p>
+   */
+  public void setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute) {
+    namespaceDeclarationAttribute = pXmlDeclarationAttribute;
+  }
+
+  /** <p>Returns whether XML declarations are being serialized as
+   * attributes or as SAX events (default).</p>
+   */
+  public boolean isNamespaceDeclarationAttribute() {
+    return namespaceDeclarationAttribute;
+  }
+
+  /** <p>Returns whether XML declarations present in the parent nodes
+   * are being serialized (default) or not. This option takes effect
+   * only if the namespace declarations are sent as events. In other
+   * words, if the <code>namespaceDeclarationAttribute</code>
+   * properts is false.</p>
+   */
+  public void setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled) {
+    parentsNamespaceDeclarationDisabled = pParentsXmlDeclarationDisabled;
+  }
+
+  /** <p>Sets whether XML declarations present in the parent nodes
+   * are being serialized (default) or not. This option takes effect
+   * only if the namespace declarations are sent as events. In other
+   * words, if the <code>namespaceDeclarationAttribute</code>
+   * properts is false.</p>
+   */
+  public boolean isParentsNamespaceDeclarationDisabled() {
+    return parentsNamespaceDeclarationDisabled;
+  }
+
+  protected void doSerializeChilds(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    for (Node child = pNode.getFirstChild();  child != null;
+          child = child.getNextSibling()) {
+      doSerialize(child, pHandler);
+    }
+  }
+
+  protected void parentsStartPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    if (pNode != null) {
+      parentsStartPrefixMappingEvents(pNode.getParentNode(), pHandler);
+      if (pNode.getNodeType() == Node.ELEMENT_NODE) {
+        startPrefixMappingEvents(pNode, pHandler);
+      }
+    }
+  }
+
+  protected void parentsEndPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    if (pNode != null) {
+      if (pNode.getNodeType() == Node.ELEMENT_NODE) {
+        endPrefixMappingEvents(pNode, pHandler);
+      }
+      parentsEndPrefixMappingEvents(pNode.getParentNode(), pHandler);
+    }
+  }
+
+  protected void startPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    NamedNodeMap nnm = pNode.getAttributes();
+    if (nnm != null) {
+      for (int i = 0;  i < nnm.getLength();  i++) {
+        Node attr = nnm.item(i);
+        if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+          String prefix;
+          if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) {
+            prefix = attr.getLocalName();
+          } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getNodeName())) {
+            prefix = "";
+          } else {
+            throw new IllegalStateException("Unable to parse namespace declaration: " + attr.getNodeName());
+          }
+          String uri = attr.getNodeValue();
+          if (uri == null) {
+            uri = "";
+          }
+          pHandler.startPrefixMapping(prefix, uri);
+        }
+      }
+    }
+  }
+
+  protected void endPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    NamedNodeMap nnm = pNode.getAttributes();
+    if (nnm != null) {
+      for (int i = nnm.getLength()-1;  i >= 0;  i--) {
+        Node attr = nnm.item(i);
+        if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+          String prefix = attr.getLocalName();
+          pHandler.endPrefixMapping(prefix);
+        }
+      }
+    }
+  }
+
+  /** Converts the given node <code>pNode</code> into a
+   * stream of SAX events, which are fired into the
+   * content handler <code>pHandler</code>.
+   */
+  public void serialize(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    if (!isNamespaceDeclarationAttribute()  &&
+        !isParentsNamespaceDeclarationDisabled()) {
+      parentsStartPrefixMappingEvents(pNode.getParentNode(), pHandler);
+    }
+    doSerialize(pNode, pHandler);
+    if (!isNamespaceDeclarationAttribute()  &&
+        !isParentsNamespaceDeclarationDisabled()) {
+      parentsEndPrefixMappingEvents(pNode.getParentNode(), pHandler);
+    }
+  }
+
+  protected void doSerialize(Node pNode, ContentHandler pHandler)
+      throws SAXException {
+    switch (pNode.getNodeType()) {
+      case Node.DOCUMENT_NODE:
+        pHandler.startDocument();
+        doSerializeChilds(pNode, pHandler);
+        pHandler.endDocument();
+        break;
+      case Node.DOCUMENT_FRAGMENT_NODE:
+        doSerializeChilds(pNode, pHandler);
+        break;
+      case Node.ELEMENT_NODE:
+        AttributesImpl attr = new AttributesImpl();
+        boolean isNamespaceDeclarationAttribute = isNamespaceDeclarationAttribute();
+        if (!isNamespaceDeclarationAttribute) {
+          startPrefixMappingEvents(pNode, pHandler);
+        }
+        NamedNodeMap nnm = pNode.getAttributes();
+        if (nnm != null) {
+          for (int i = 0;  i < nnm.getLength();  i++) {
+            Node a = nnm.item(i);
+            if (isNamespaceDeclarationAttribute  ||
+                !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(a.getNamespaceURI())) {
+              String aUri = a.getNamespaceURI();
+              String aLocalName = a.getLocalName();
+              String aNodeName = a.getNodeName();
+              if (aLocalName == null) {
+                  if (aUri == null  ||  aUri.length() == 0) {
+                      aLocalName = aNodeName;
+                  } else {
+                      throw new IllegalStateException("aLocalName is null");
+                  }
+              }
+              attr.addAttribute(aUri == null ? "" : aUri, aNodeName,
+                                aLocalName, "CDATA", a.getNodeValue());
+            }
+          }
+        }
+        String nUri = pNode.getNamespaceURI();
+        if (nUri == null) {
+            nUri = "";
+        }
+        pHandler.startElement(nUri, pNode.getLocalName(),
+                              pNode.getNodeName(), attr);
+        doSerializeChilds(pNode, pHandler);
+        pHandler.endElement(nUri, pNode.getLocalName(),
+                            pNode.getNodeName());
+        if (!isNamespaceDeclarationAttribute) {
+          endPrefixMappingEvents(pNode, pHandler);
+        }
+        break;
+      case Node.TEXT_NODE:
+      case Node.CDATA_SECTION_NODE:
+        {
+          String s = pNode.getNodeValue();
+          pHandler.characters(s.toCharArray(), 0, s.length());
+        }
+        break;
+      case Node.PROCESSING_INSTRUCTION_NODE:
+        pHandler.processingInstruction(pNode.getNodeName(), pNode.getNodeValue());
+        break;
+      case Node.ENTITY_REFERENCE_NODE:
+        pHandler.skippedEntity(pNode.getNodeName());
+        break;
+      case Node.COMMENT_NODE:
+        if (pHandler instanceof LexicalHandler) {
+          String s = pNode.getNodeValue();
+          ((LexicalHandler) pHandler).comment(s.toCharArray(), 0, s.length());
+        }
+        break;
+      default:
+        throw new IllegalStateException("Unknown node type: " + pNode.getNodeType());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Duration.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Duration.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/Duration.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,311 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+import java.io.Serializable;
+
+
+/** <p>Implementation of xs:duration.</p>
+ */
+public class Duration implements Serializable, Comparable {
+	private static final long serialVersionUID = 3257001055736117303L;
+	private final boolean isNegative;
+    private final int years, months, days, hours, minutes, seconds;
+    private final long millis;
+
+	/** Creates a new instance with the given values.
+	 */
+	public Duration(boolean pNegative, int pYears, int pMonths, int pDays, int pHours, int pMinutes, int pSeconds, long pMillis) {
+        isNegative = pNegative;
+        years = pYears;
+        months = pMonths;
+        days = pDays;
+        hours = pHours;
+        minutes = pMinutes;
+        seconds = pSeconds;
+        millis = pMillis;
+    }
+  
+    /** <p>Returns the number of years.</p>
+     */
+    public int getYears() {
+        return years;
+    }
+
+    /** <p>Returns the number of months.</p>
+     */
+    public int getMonths() {
+        return months;
+    }
+
+    /** <p>Returns the number of days.</p>
+     */
+    public int getDays() {
+        return days;
+    }
+
+    /** <p>Returns the number of hours.</p>
+     */
+    public int getHours() {
+        return hours;
+    }
+
+    /** <p>Returns the number of minutes.</p>
+     */
+    public int getMinutes() {
+        return minutes;
+    }
+
+    /** <p>Returns the number of seconds.</p>
+     */
+    public int getSeconds() {
+        return seconds;
+    }
+
+    /** <p>Returns the number of milliseconds.</p>
+     */
+    public long getMillis() {
+        return millis;
+    }
+
+    /** <p>Returns a string representation of this Duration.</p>
+     */
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        sb.append('P');
+        sb.append(getYears());
+        sb.append('Y');
+        sb.append(getMonths());
+        sb.append('M');
+        sb.append(getDays());
+        sb.append("DT");
+        sb.append(getHours());
+        sb.append('H');
+        sb.append(getMinutes());
+        sb.append('M');
+        sb.append(getSeconds());
+        long m = getMillis();
+        if (m != 0) {
+            sb.append('.');
+            sb.append(m);
+        }
+        sb.append('S');
+        return sb.toString();
+    }
+
+    /** <p>Converts the given String representation into an instance of
+     * Duration.</p>
+     * @throws IllegalArgumentException The String could not be parsed.
+     */
+    public static Duration valueOf(String pValue) {
+        if (pValue == null) {
+            throw new NullPointerException("The duration value must not be null.");
+        }
+        int len = pValue.length();
+        int offset = 0;
+        boolean isNegative;
+        if (len > 0) {
+            char c = pValue.charAt(0);
+            if (c == '-') {
+                isNegative = true;
+                ++offset;
+            } else if (c == '+') {
+                isNegative = false;
+                ++offset;
+            } else {
+                isNegative = false;
+            }
+        } else {
+            throw new IllegalArgumentException("Invalid duration: Empty string");
+        }
+        
+        if (len == 0  ||  pValue.charAt(offset) != 'P') {
+            throw new IllegalArgumentException("Invalid duration: " + pValue + " (must start with P, +P, or -P)");
+        } else {
+            ++offset;
+        }
+        
+        int years = -1, months = -1, daysOfMonth = -1, hours = -1, minutes = -1, seconds = -1;
+        long millis = -1;
+        int preDecimalPoint = -1;
+        boolean separatorSeen = false;
+        StringBuffer digits = new StringBuffer();
+        while (offset < len) {
+            char c = pValue.charAt(offset);
+            if (Character.isDigit(c)) {
+                digits.append(c);
+            } else if (c == 'T') {
+                if (separatorSeen) {
+                    throw new IllegalArgumentException("Invalid duration: " + pValue
+                            + " (date/time separator 'T' used twice)");
+                } else {
+                    separatorSeen = true;
+                }
+            } else {
+                long l;
+                if (digits.length() == 0) {
+                    l = 0;
+                } else {
+                    try {
+                        l = Long.parseLong(digits.toString());
+                    } catch (NumberFormatException e) {
+                        throw new IllegalArgumentException("Invalid duration: "  + pValue
+                                + " (max long value exceeded by " + digits + ")");
+                    }
+                    digits.setLength(0);
+                }
+                if (preDecimalPoint >= 0) {
+                    if (c == 'S') {
+                        if (!separatorSeen) {
+                            throw new IllegalArgumentException("Invalid duration: " + pValue
+                                    + "(seconds specified before date/time separator 'T' seen)");
+                        }
+                        if (seconds != -1) {
+                            throw new IllegalArgumentException("Invalid duration: " + pValue
+                                    + " (seconds specified twice)");
+                        }
+                        seconds = preDecimalPoint;
+                        millis = l;
+                        preDecimalPoint = -1;
+                    } else {
+                        throw new IllegalArgumentException("Invalid duration: " + pValue
+                                + " (decimal point not allowed here: "
+                                + preDecimalPoint + "." + digits + c + ")");
+                    }
+                } else if (l > Integer.MAX_VALUE) {
+                    throw new IllegalArgumentException("Invalid duration: " + pValue
+                            + " (max integer value exceeded by " + digits + ")");
+                } else {
+                    int i = (int) l;
+                    if (c == '.') {
+                        preDecimalPoint = i;
+                    } else if (separatorSeen) {
+                        if (c == 'Y'  ||  c == 'D') {
+                            throw new IllegalArgumentException("Invalid duration: " + pValue
+                                    + " (years or days of month specified after date/time separator 'T' seen)");
+                        } else if (c == 'S') {
+                            if (seconds != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (seconds specified twice)");
+                            }
+                            seconds = i;
+                            millis = 0;
+                        } else if (c == 'M') {
+                            if (minutes != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (minutes specified twice)");
+                            } else if (seconds != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (minutes specified after seconds)");
+                            }
+                            minutes = i;
+                        } else if (c == 'H') {
+                            if (hours != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (hours specified twice)");
+                           } else if (minutes != -1) {
+                               throw new IllegalArgumentException("Invalid duration: " + pValue
+                                       + " (hours specified after minutes)");
+                           } else if (seconds != -1) {
+                               throw new IllegalArgumentException("Invalid duration: " + pValue
+                                       + " (seconds specified after minutes)");
+                           }
+                           hours = i;
+                        }
+                    } else {
+                        if (c == 'H'  ||  c == 'S') {
+                            throw new IllegalArgumentException("Invalid duration: " + pValue
+                                    + " (hours or seconds specified before date/time separator 'T' seen)");
+                        } else if (c == 'Y') {
+                            if (years != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (years specified twice)");
+                            } else if (months != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (years specified after months)");
+                            } else if (daysOfMonth != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (years specified after days of month)");
+                            }
+                            years = i;
+                        } else if (c == 'M') {
+                            if (months != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (months specified twice)");
+                            } else if (daysOfMonth != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                        + " (days of month specified after months)");
+                            }
+                            months = i;
+                        } else if (c == 'D') {
+                            if (daysOfMonth != -1) {
+                                throw new IllegalArgumentException("Invalid duration: " + pValue
+                                                                   + " (days of month specified twice)");
+                            }
+                            daysOfMonth = i;
+                        }
+                    }
+                }
+            }
+            ++offset;
+        }
+        return new Duration(isNegative,
+                			years == -1 ? 0 : years,
+							months == -1 ? 0 : months,
+							daysOfMonth == -1 ? 0 :daysOfMonth,
+							hours == -1 ? 0 : hours,
+							minutes == -1 ? 0 : minutes,
+							seconds == -1 ? 0 : seconds,
+							millis == -1 ? 0 : millis);
+    }
+
+    public boolean equals(Object o) {
+        if (o == null  ||  !(o instanceof Duration)) {
+            return false;
+        }
+        return compareTo((Duration) o) == 0;
+    }
+
+    public int compareTo(Object o) {
+        return compareTo((Duration) o);
+    }
+
+	/** Actual implementation of {@link #compareTo(Object)}.
+	 */
+	public int compareTo(Duration d) {
+        if (isNegative != d.isNegative) {
+            return isNegative ? -1 : 1;
+        }
+        if (years != d.years) { return years - d.years; }
+        if (months != d.months) { return months - d.months; }
+        if (days != d.days) { return days - d.days; }
+        if (hours != d.hours) { return hours - d.hours; }
+        if (minutes != d.minutes) { return minutes - d.minutes; }
+        if (seconds != d.seconds) { return seconds - d.seconds; }
+        if (millis > d.millis) {
+            return 1;
+        } else if (millis < d.millis) {
+            return -1;
+        } else {
+            return 0;
+        }
+    }
+
+    public int hashCode() {
+        return isNegative ? 1 : 0 + years + months + days + hours + minutes + seconds + (int) millis;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/HexBinary.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/HexBinary.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/HexBinary.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+/** <p>Utility class for xs:hexbinary.</p>
+ */
+public class HexBinary {
+	/** Creates a clone of the given byte array.
+	 */
+	public static byte[] getClone(byte[] pHexBinary) {
+		byte[] result = new byte[pHexBinary.length];
+		System.arraycopy(pHexBinary, 0, result, 0, pHexBinary.length);
+		return result;
+	}
+
+	/** Converts the string <code>pValue</code> into an
+	 * array of hex bytes.
+	 */
+	public static byte[] decode(String pValue) {
+		if ((pValue.length() % 2) != 0) {
+			throw new IllegalArgumentException("A HexBinary string must have even length.");
+		}
+		byte[] result = new byte[pValue.length() / 2];
+		int j = 0;
+		for (int i = 0;  i < pValue.length();  ) {
+			byte b;
+			char c = pValue.charAt(i++);
+			char d = pValue.charAt(i++);
+			if (c >= '0'  &&  c <= '9') {
+				b = (byte) ((c - '0') << 4);
+			} else if (c >= 'A'  &&  c <= 'F') {
+				b = (byte) ((c - 'A' + 10) << 4);
+			} else if (c >= 'a'  &&  c <= 'f') {
+				b = (byte) ((c - 'a' + 10) << 4);
+			} else {
+				throw new IllegalArgumentException("Invalid hex digit: " + c);
+			}
+			if (d >= '0'  &&  d <= '9') {
+				b += (byte) (d - '0');
+			} else if (d >= 'A'  &&  d <= 'F') {
+				b += (byte) (d - 'A' + 10);
+			} else if (d >= 'a'  &&  d <= 'f') {
+				b += (byte) (d - 'a' + 10);
+			} else {
+				throw new IllegalArgumentException("Invalid hex digit: " + d);
+			}
+			result[j++] = b;
+		}
+		return result;
+	}
+
+	/** Converts the byte array <code>pHexBinary</code> into
+	 * a string.
+	 */
+	public static String encode(byte[] pHexBinary) {
+		StringBuffer result = new StringBuffer();
+		for (int i = 0;  i < pHexBinary.length;  i++) {
+			byte b = pHexBinary[i];
+			byte c = (byte) ((b & 0xf0) >> 4);
+			if (c <= 9) {
+				result.append((char) ('0' + c));
+			} else {
+				result.append((char) ('A' + c - 10));
+			}
+			c = (byte) (b & 0x0f);
+			if (c <= 9) {
+				result.append((char) ('0' + c));
+			} else {
+				result.append((char) ('A' + c - 10));
+			}
+		}
+		return result.toString();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceResolver.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceResolver.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceResolver.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+/** <p>An abstract object which is able to split an XML name
+ * into its namespace URI and local part.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: NamespaceResolver.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface NamespaceResolver {
+  /** <p>Splits the XML name <code>pName</code> into its
+   * namespace URI, qualified name and local name, which
+   * are stored into the array parts:
+   * <ul>
+   *   <li><code>parts[0]</code>: namespace URI; empty if no namespace is used</li>
+   *   <li><code>parts[1]</code>: local name, with the prefix removed</li>
+   *   <li><code>parts[2]</code>: qualified name (same as pName)</li>
+   * </ul>
+   *
+   * @return True, if the namespace prefix of <code>pName</code>
+   *   was successfully resolved. False otherwise.
+   */
+  public boolean processName(String pName, String[] parts);
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceSupport.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceSupport.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceSupport.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+
+
+/** <p>Similar to org.xml.sax.NamespaceSupport, but
+ * for marshalling and not for parsing XML.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: NamespaceSupport.java 232067 2005-03-10 10:14:08Z jochen $
+ */
+public class NamespaceSupport implements NamespaceContext {
+    List prefixList;
+    String cachedURI, cachedPrefix;
+    
+    /** <p>Creates a new instance of NamespaceSupport.</p> */
+    public NamespaceSupport() {
+    }
+    
+    /** <p>Resets the NamespaceSupport's state for reuse.</p>
+     */
+    public void reset() {
+        cachedURI = cachedPrefix = null;
+        if (prefixList != null) {
+            prefixList.clear();
+        }
+    }
+    
+    /** <p>Declares a new prefix.</p>
+     */
+    public void declarePrefix(String pPrefix, String pURI) {
+        if (pURI == null) { pURI = ""; }
+        if (cachedURI == null) {
+            cachedURI = pURI;
+            cachedPrefix = pPrefix;
+        } else {
+            if (prefixList == null) { prefixList = new ArrayList(); }
+            prefixList.add(cachedPrefix);
+            prefixList.add(cachedURI);
+            cachedPrefix = pPrefix;
+            cachedURI = pURI;
+        }
+    }
+
+    /** <p>Removes a prefix declaration. Assumes that the prefix is the
+     * current prefix. If not, throws a IllegalStateException.</p>
+     */
+    public void undeclarePrefix(String pPrefix) {
+        if (pPrefix.equals(cachedPrefix)) {
+            if (prefixList != null  &&  prefixList.size() > 0) {
+                cachedURI = prefixList.remove(prefixList.size()-1).toString();
+                cachedPrefix = prefixList.remove(prefixList.size()-1).toString();
+            } else {
+                cachedPrefix = cachedURI = null;
+            }
+        } else {
+            for (int i = prefixList.size()-2;  i >= 0;  i -= 2) {
+                if (pPrefix.equals(prefixList.get(i))) {
+                    prefixList.remove(i);
+                    prefixList.remove(i);
+                    return;
+                }
+            }
+            throw new IllegalStateException("Undeclared prefix: " + pPrefix);
+        }
+    }
+    
+    /** <p>Given a prefix, returns the URI to which the prefix is
+     * currently mapped or null, if there is no such mapping.</p>
+     * <p><em>Note</em>: This methods behaviour is precisely
+     * defined by {@link NamespaceContext#getNamespaceURI(java.lang.String)}.</p>
+     *
+     * @param pPrefix The prefix in question
+     */
+    public String getNamespaceURI(String pPrefix) {
+        if (pPrefix == null) {
+            throw new IllegalArgumentException("Namespace prefix must not be null");
+        }
+        if (cachedURI != null) {
+            if (cachedPrefix.equals(pPrefix)) { return cachedURI; }
+            if (prefixList != null) {
+                for (int i = prefixList.size();  i > 0;  i -= 2) {
+                    if (pPrefix.equals(prefixList.get(i-2))) {
+                        return (String) prefixList.get(i-1);
+                    }
+                }
+            }
+        }
+        if (XMLConstants.XML_NS_PREFIX.equals(pPrefix)) {
+            return XMLConstants.XML_NS_URI;
+        } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(pPrefix)) {
+            return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+        }
+        return null;
+    }
+    
+    /** <p>Returns a prefix currently mapped to the given URI or
+     * null, if there is no such mapping. This method may be used
+     * to find a possible prefix for an elements namespace URI. For
+     * attributes you should use {@link #getAttributePrefix(String)}.</p>
+     * <p><em>Note</em>: This methods behaviour is precisely
+     * defined by {@link NamespaceContext#getPrefix(java.lang.String)}.</p>
+     *
+     * @param pURI The namespace URI in question
+     * @throws IllegalArgumentException The namespace URI is null.
+     */
+    public String getPrefix(String pURI) {
+        if (pURI == null) {
+            throw new IllegalArgumentException("Namespace URI must not be null");
+        }
+        if (cachedURI != null) {
+            if (cachedURI.equals(pURI)) { return cachedPrefix; }
+            if (prefixList != null) {
+                for (int i = prefixList.size();  i > 0;  i -= 2) {
+                    if (pURI.equals(prefixList.get(i-1))) {
+                        return (String) prefixList.get(i-2);
+                    }
+                }
+            }
+        }
+        if (XMLConstants.XML_NS_URI.equals(pURI)) {
+            return XMLConstants.XML_NS_PREFIX;
+        } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(pURI)) {
+            return XMLConstants.XMLNS_ATTRIBUTE;
+        }
+        return null;
+    }
+    
+    /** <p>Returns a non-empty prefix currently mapped to the given
+     * URL or null, if there is no such mapping. This method may be
+     * used to find a possible prefix for an attributes namespace
+     * URI. For elements you should use {@link #getPrefix(String)}.</p>
+     *
+     * @param pURI Thhe namespace URI in question
+     * @throws IllegalArgumentException The namespace URI is null.
+     */
+    public String getAttributePrefix(String pURI) {
+        if (pURI == null) {
+            throw new IllegalArgumentException("Namespace URI must not be null");
+        }
+        if (pURI.length() == 0) {
+            return "";
+        }
+        if (cachedURI != null) {
+            if (cachedURI.equals(pURI)  &&  cachedPrefix.length() > 0) {
+                return cachedPrefix;
+            }
+            if (prefixList != null) {
+                for (int i = prefixList.size();  i > 0;  i -= 2) {
+                    if (pURI.equals(prefixList.get(i-1))) {
+                        String prefix = (String) prefixList.get(i-2);
+                        if (prefix.length() > 0) {
+                            return prefix;
+                        }
+                    }
+                }
+            }
+        }    
+        if (XMLConstants.XML_NS_URI.equals(pURI)) {
+            return XMLConstants.XML_NS_PREFIX;
+        } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(pURI)) {
+            return XMLConstants.XMLNS_ATTRIBUTE;
+        }
+        return null;
+    }
+    
+    
+    
+    /** <p>Returns a collection to all prefixes bound to the given
+     * namespace URI.
+     * <p><em>Note</em>: This methods behaviour is precisely
+     * defined by {@link NamespaceContext#getPrefixes(java.lang.String)}.</p>
+     *
+     * @param pURI The namespace prefix in question
+     */
+    public Iterator getPrefixes(String pURI) {
+        if (pURI == null) {
+            throw new IllegalArgumentException("Namespace URI must not be null");
+        }
+        List list = new ArrayList();
+        if (cachedURI != null) {
+            if (cachedURI.equals(pURI)) { list.add(cachedPrefix); }
+            if (prefixList != null) {
+                for (int i = prefixList.size();  i > 0;  i -= 2) {
+                    if (pURI.equals(prefixList.get(i-1))) {
+                        list.add(prefixList.get(i-2));
+                    }
+                }
+            }
+        }
+        if (pURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
+            list.add(XMLConstants.XMLNS_ATTRIBUTE);
+        } else if (pURI.equals(XMLConstants.XML_NS_URI)) {
+            list.add(XMLConstants.XML_NS_PREFIX);
+        }
+        return list.iterator();
+    }
+    
+    /** <p>Returns whether a given prefix is currently declared.</p>
+     */
+    public boolean isPrefixDeclared(String pPrefix) {
+        if (cachedURI != null) {
+            if (cachedPrefix != null  &&  cachedPrefix.equals(pPrefix)) { return true; }
+            if (prefixList != null) {
+                for (int i = prefixList.size();  i > 0;  i -= 2) {
+                    if (prefixList.get(i-2).equals(pPrefix)) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return "xml".equals(pPrefix);
+    }
+
+	/** Returns the current number of assigned prefixes.
+	 * Note, that a prefix may be assigned in several nested
+	 * elements, in which case every assignment is counted.<br>
+	 * This method is typically called before invoking the
+	 * method
+	 * {@link org.xml.sax.ContentHandler#startElement(String, String, String, org.xml.sax.Attributes)}.
+	 * The return value is used as a saveable state. After
+	 * invoking 
+	 * {@link org.xml.sax.ContentHandler#endElement(String, String, String)},
+	 * the state is restored by calling {@link #checkContext(int)}.
+	 */
+    public int getContext() {
+        return (prefixList == null ? 0 : prefixList.size()) +
+        	(cachedURI == null ? 0 : 2);
+    }
+
+	/** This method is used to restore the namespace state
+	 * after an element is created. It takes as input a state,
+	 * as returned by {@link #getContext()}.<br>
+	 * For any prefix, which was since saving the state,
+	 * the prefix is returned and deleted from the internal
+	 * list. In other words, a typical use looks like this:
+	 * <pre>
+	 *   NamespaceSupport nss;
+	 *   ContentHandler h;
+	 *   int context = nss.getContext();
+	 *   h.startElement("foo", "bar", "f:bar", new AttributesImpl());
+	 *   ...
+	 *   h.endElement("foo", "bar", "f:bar");
+	 *   for (;;) {
+	 *     String prefix = nss.checkContext(context);
+	 *     if (prefix == null) {
+	 *       break;
+	 *     }
+	 *     h.endPrefixMapping(prefix);
+	 *   }
+	 * </pre>
+	 */
+	public String checkContext(int i) {
+        if (getContext() == i) {
+            return null;
+        }
+        String result = cachedPrefix;
+        if (prefixList != null  &&  prefixList.size() > 0) {
+            cachedURI = prefixList.remove(prefixList.size()-1).toString();
+            cachedPrefix = prefixList.remove(prefixList.size()-1).toString();
+        } else {
+            cachedURI = null;
+            cachedPrefix = null;
+        }
+        return result;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceUser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceUser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/NamespaceUser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.util;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: NamespaceUser.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface NamespaceUser {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/jaxme/org/apache/ws/jaxme/util/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.util Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Utility classes used by JaxMe core.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/AbstractJavaMethod.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/AbstractJavaMethod.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/AbstractJavaMethod.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ 
+ */
+package org.apache.ws.jaxme.js;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.js.JavaSource.Protection;
+
+
+/** Base class of methods, constructors, and the like.
+ */
+public abstract class AbstractJavaMethod extends ConditionalIndentationJavaSourceObject {
+	private List exceptions = new ArrayList();
+	private List params = new ArrayList();
+	
+	protected AbstractJavaMethod(String pName, JavaQName pType,
+			Protection pProtection) {
+		super(pName, pType, pProtection);
+	}
+	
+	/** <p>Returns whether the method is throwing the given exception.
+	 * Note that this method doesn't care for inheritance. For example,
+	 * if the method declares to be throwing an {@link java.net.MalformedURLException},
+	 * then the value <code>isThrowing(java.io.IOException.class)</code>
+	 * is still false.</p>
+	 */
+	public boolean isThrowing(JavaQName e) {
+		if (e == null) {
+			throw new NullPointerException("The exception argument must not be null.");
+		}
+		for (Iterator iter = exceptions.iterator();  iter.hasNext();  ) {
+			if (e.equals(iter.next())) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/** <p>Returns whether the method is throwing the given exception.
+	 * Note that this method doesn't care for inheritance. For example,
+	 * if the method declares to be throwing an {@link java.net.MalformedURLException},
+	 * then the value <code>isThrowing(java.io.IOException.class)</code>
+	 * is still false.</p>
+	 */
+	public boolean isThrowing(Class e) {
+		if (e == null) {
+			throw new NullPointerException("The exception argument must not be null.");
+		}
+		return isThrowing(JavaQNameImpl.getInstance(e));
+	}
+	
+	/** <p>Adds an exception to this methods list of exceptions.</p>
+	 *
+	 * @see #getExceptions
+	 */
+	public void addThrows(JavaQName e) {
+		if (e == null) {
+			throw new NullPointerException("The exception argument must not be null.");
+		}
+		if (!exceptions.contains(e)) {
+			exceptions.add(e);
+		}
+	}
+	
+	/** <p>Adds an exception to this methods list of exceptions.</p>
+	 *
+	 * @see #getExceptions
+	 */
+	public void addThrows(Class e) {
+		if (e == null) {
+			throw new NullPointerException("The exception argument must not be null.");
+		}
+		exceptions.add(JavaQNameImpl.getInstance(e));
+	}
+	
+	/** <p>Adds a parameter that this method takes.</p>
+	 *
+	 * @see #getParams
+	 * @return An object to use for referencing the parameter inside the method.
+	 */
+	public Parameter addParam(Class p, String v) {
+		return addParam(JavaQNameImpl.getInstance(p), v);
+	}
+	
+	/** <p>Adds a parameter that this method takes.</p>
+	 *
+	 * @see #getParams
+	 * @return An object to use for referencing the parameter inside the method.
+	 */
+	public Parameter addParam(JavaQName pType, String pName) {
+		if (pType == null) {
+			throw new NullPointerException("Type argument must not be null");
+		}
+		if (pName == null) {
+			throw new NullPointerException("Parameter name argument must not be null");
+		}
+		for (Iterator iter = params.iterator(); iter.hasNext();) {
+			Parameter param = (Parameter) iter.next();
+			if (param.getName().equals(pName)) {
+				throw new IllegalArgumentException("Parameter name '" + pName + "' is already used for a parameter of type " + param.getType());
+			}
+		}
+		Parameter p = new Parameter(pType, pName);
+		params.add(p);
+		return p;
+	}
+	
+	/** <p>Adds a parameter that this method takes.</p>
+	 *
+	 * @see #getParams
+	 * @return An object to use for referencing the parameter inside the method.
+	 */
+	public Parameter addParam(Parameter pParam) {
+		return addParam(pParam.getType(), pParam.getName());
+	}
+	
+	/** <p>Clears the list of parameters.</p>
+	 */
+	public void clearParams() {
+		params.clear();
+	}
+	
+	/** <p>Returns the list of exceptions thrown by this method.</p>
+	 *
+	 * @see #addThrows(JavaQName)
+	 */
+	public JavaQName[] getExceptions() {
+		return (JavaQName[]) exceptions.toArray(new JavaQName[exceptions.size()]);
+	}
+	
+	
+	/** <p>Returns the list of parameters that this method takes. Any element
+	 * in the list is an instance of {@link Parameter}.</p>
+	 *
+	 * @return the list of parameters
+	 * @see #addParam(JavaQName, String)
+	 */
+	public Parameter[] getParams() {
+		return (Parameter[]) params.toArray(new Parameter[params.size()]);
+	}
+	
+	/** <p>Returns a list of the parameter names that this method takes. Any element
+	 * in the list is an instance of {@link java.lang.String}.</p>
+	 *
+	 * @return the list of parameter names
+	 * @see #addParam(JavaQName, String)
+	 */
+	public String[] getParamNames() {
+		String[] res = new String[params.size()];
+		for (int i = 0;  i < params.size();  i++) {
+			res[i++] = ((Parameter) params.get(i)).getName();        
+		}
+		return res;
+	}
+	
+	/** <p>Returns an array of the parameter types that this method takes. This array can be used for JavaSource.getMethod() or JavaSource.getConstructor().</p>
+	 *
+	 * @return the list of parameter types
+	 * @see #addParam(JavaQName, String)
+	 */
+	public JavaQName[] getParamTypes() {
+		JavaQName[] res = new JavaQName[params.size()];
+		for (int i = 0;  i < params.size();  i++) {
+			res[i++] = ((Parameter) params.get(i)).getType();        
+		}
+		return res;
+	}
+	
+	/** <p>Removes an exception from this methods list of exceptions, if it is declared to be thrown.</p>
+	 * @param exc the exception to be removed 
+	 */
+	public void removeThrows(JavaQName exc) {
+		exceptions.remove(exc);
+	}
+	
+	/** <p>Removes an exception from this methods list of exceptions, if it is declared to be thrown.</p>
+	 * @param exc the exception to be removed 
+	 */
+	public void removeThrows(Class exc) {
+		removeThrows(JavaQNameImpl.getInstance(exc));
+	}
+
+	/** <p>Clears the list of thrown exceptions.</p>
+	 */
+	public void clearThrows() {
+		exceptions.clear();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationEngine.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationEngine.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationEngine.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1214 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ConditionalIndentationEngine extends IndentationEngine {
+  /** <p>Shortcut for
+   * <code>addLine("if (", pTokens, ") {"); indent();</code>.</p>
+   */
+  public void addIf(Object[] pTokens);
+  /** <p>Shortcut for <code>addIf(new Object[]{pLine})</code>.</p>
+   */
+  public void addIf(Object pLine);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2);
+  /** <p>Shortcut for
+   * <code>addIf(new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4})</code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5})</code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6}) </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8}) </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9}) </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10})
+   * </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9,
+                    Object pToken10);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11})  </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9,
+                    Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12})        </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9,
+                    Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13})  </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9,
+                    Object pToken10, Object pToken11, Object pToken12,
+                    Object pToken13);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken14})  </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9,
+                    Object pToken10, Object pToken11, Object pToken12,
+                    Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken15})  </code>.</p>
+   */
+  public void addIf(Object pToken1, Object pToken2, Object pToken3,
+                    Object pToken4, Object pToken5, Object pToken6,
+                    Object pToken7, Object pToken8, Object pToken9,
+                    Object pToken10, Object pToken11, Object pToken12,
+                    Object pToken13, Object pToken14, Object pToken15);
+
+  /** <p>Shortcut for <code>unindent(); addLine("} else if (", pTokens, ") {");
+   * indent();</code>.</p>
+   */
+  public void addElseIf(Object[] pTokens);
+  /** <p>Shortcut for <code>addIf(new Object[]{pLine})</code>.</p>
+   */
+  public void addElseIf(Object pLine);
+  /** <p>Shortcut for
+   * <code>addElseIf(new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2);
+  /** <p>Shortcut for
+   * <code>addElseIf(new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4})</code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5})</code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6}) </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8}) </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9}) </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10})
+   * </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11})  </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12})        </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13})  </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12,
+                        Object pToken13);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken14})  </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12,
+                        Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addElseIf(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken15})  </code>.</p>
+   */
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12,
+                        Object pToken13, Object pToken14, Object pToken15);
+
+  /** <p>Shortcut for <code>pFirst ? addIf(pTokens) :
+   * addElseIf(pTokens)</code>.</p>
+   */
+  public void addIf(boolean pFirst, Object[] pTokens);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3,
+   * pToken4})</code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5})</code>.</p>
+   */
+    public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                      Object pToken3, Object pToken4, Object pToken5);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6}) </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6);
+  /** <p>Shortcut for <code>addIf(pFirst, new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7);
+  /** <p>Shortcut for <code>addIf(pFirst, new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5, pToken6, pToken7, pToken8}) </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addIf(pFirst, new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9})
+   * </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10})
+   * </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9, Object pToken10);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11})  </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9, Object pToken10, Object pToken11);
+  /** <p>Shortcut for
+   * <code>addIf(pFirst, new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12})        </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9, Object pToken10, Object pToken11,
+                    Object pToken12);
+  /** <p>Shortcut for <code>addIf(pFirst, new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13})  </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9, Object pToken10, Object pToken11,
+                    Object pToken12, Object pToken13);
+  /** <p>Shortcut for <code>addIf(pFirst, new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken14})  </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9, Object pToken10, Object pToken11,
+                    Object pToken12, Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addIf(pFirst, new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken15})  </code>.</p>
+   */
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2,
+                    Object pToken3, Object pToken4, Object pToken5,
+                    Object pToken6, Object pToken7, Object pToken8,
+                    Object pToken9, Object pToken10, Object pToken11,
+                    Object pToken12, Object pToken13, Object pToken14,
+                    Object pToken15);
+
+  /** <p>Shortcut for <code>unindent(); addLine("} else {"); indent();</code>.
+   */
+  public void addElse();
+  /** <p>Shortcut for <code>unindent(); addLine("}");</code>.
+   */
+  public void addEndIf();
+
+  /** <p>Shortcut for <code>addLine(new Object[]{"throw new",
+   * pExceptionClass, "(", pArgs, ");"});</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass, Object[] pArgs);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass, new Object[]{pToken1})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3,
+                                                              Object pToken4);
+ /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+  * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5})</code>.</p>
+  */
+ public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2, Object pToken3,
+                                                             Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3,
+                                                              Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3,
+                                                              Object pToken4, Object pToken5, Object pToken6,
+                                                              Object pToken7);
+ /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+  * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+  * pToken8})</code>.</p>
+  */
+ public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2, Object pToken3,
+                                                             Object pToken4, Object pToken5, Object pToken6,
+                                                             Object pToken7, Object pToken8);
+ /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+  * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+  * pToken8, pToken9})</code>.</p>
+  */
+ public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2, Object pToken3,
+                                                             Object pToken4, Object pToken5, Object pToken6,
+                                                             Object pToken7, Object pToken8, Object pToken9);
+ /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+  * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+  * pToken8, pToken9, pToken10}) </code>.</p>
+  */
+ public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2, Object pToken3,
+                                                             Object pToken4, Object pToken5, Object pToken6,
+                                                             Object pToken7, Object pToken8, Object pToken9,
+                                                             Object pToken10);
+ /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+  * new Object[]{pToken1, pToken2, pToken3,
+  * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+  * pToken11})</code>.</p>
+  */
+ public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2, Object pToken3,
+                                                             Object pToken4, Object pToken5, Object pToken6,
+                                                             Object pToken7, Object pToken8, Object pToken9,
+                                                             Object pToken10, Object pToken11);
+ /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+  * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+  * pToken8, pToken9, pToken10, pToken11, pToken12})</code>.</p>
+  */
+ public void addThrowNew(JavaQName pExceptionClass,
+                          Object pToken1, Object pToken2, Object pToken3,
+                                                             Object pToken4, Object pToken5, Object pToken6,
+                                                             Object pToken7, Object pToken8, Object pToken9,
+                                                             Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12, pToken13})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3,
+                                                              Object pToken4, Object pToken5, Object pToken6,
+                                                              Object pToken7, Object pToken8, Object pToken9,
+                                                              Object pToken10, Object pToken11, Object pToken12,
+                                                              Object pToken13);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken14})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3,
+                                                              Object pToken4, Object pToken5, Object pToken6,
+                                                              Object pToken7, Object pToken8, Object pToken9,
+                                                              Object pToken10, Object pToken11, Object pToken12,
+                                                              Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken15})</code>.</p>
+   */
+  public void addThrowNew(JavaQName pExceptionClass,
+                           Object pToken1, Object pToken2, Object pToken3,
+                                Object pToken4, Object pToken5, Object pToken6,
+                                                         Object pToken7, Object pToken8, Object pToken9,
+                                                         Object pToken10, Object pToken11, Object pToken12,
+                                                         Object pToken13, Object pToken14, Object pToken15);
+  /** <p>Shortcut for <code>addThrowNew(JavaQNameImpl.getInstance(pExceptionClass),
+   * pArgs)</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass, Object[] pArgs);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass, new Object[]{pToken1})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass, Object pToken1);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10}) </code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9,
+                                                                   Object pToken10);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9,
+                                                                   Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9,
+                                                                   Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12, pToken13})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9,
+                                                                   Object pToken10, Object pToken11, Object pToken12,
+                                                                   Object pToken13);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken14})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9,
+                                                                   Object pToken10, Object pToken11, Object pToken12,
+                                                                   Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addThrowNew(pExceptionClass,
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7,
+   * pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken15})</code>.</p>
+   */
+  public void addThrowNew(Class pExceptionClass,
+                                                                   Object pToken1, Object pToken2, Object pToken3,
+                                                                   Object pToken4, Object pToken5, Object pToken6,
+                                                                   Object pToken7, Object pToken8, Object pToken9,
+                                                                   Object pToken10, Object pToken11, Object pToken12,
+                                                                   Object pToken13, Object pToken14, Object pToken15);
+
+  /** <p>Shortcut for <code>addLine(new Object[]{"try {"}); indent();</code>.</p>
+   */
+  public void addTry();
+  /** <p>Shortcut for <code>addLine(unindent(); new Object[]{"} catch (",
+   * pExceptionClass, " ", pVar, ") {"); indent();</code></p>
+   * @return An object being used to reference the catched exception.
+   */
+  public DirectAccessible addCatch(JavaQName pExceptionClass, Object pVar);
+  /** <p>Shortcut for <code>addCatch(JavaQNameImpl.getInstance(pExceptionClass), pVar)</code>.</p>
+   * @return An object being used to reference the catched exception.
+   */
+  public DirectAccessible addCatch(Class pExceptionClass, Object pVar);
+  /** <p>Shortcut for <code>addCatch(pExceptionClass, "e");</code></p>
+   * @return An object being used to reference the catched exception.
+   */
+  public DirectAccessible addCatch(JavaQName pExceptionClass);
+  /** <p>Shortcut for <code>addCatch(pExceptionClass, "e");</code></p>
+   * @return An object being used to reference the catched exception.
+   */
+  public DirectAccessible addCatch(Class pExceptionClass);
+  /** <p>Shortcut for <code>unindent(); addLine("} finally {"); indent();</code>.</p>
+   */
+  public void addFinally();
+  /** <p>Shortcut for <code>unindent(); addLine("}");</code>.</p>
+   */
+  public void addEndTry();
+
+  /** <p>Shortcut for <code>addLine("for (", pArgs, ") {"); indent();</code>.</p>
+   */
+  public void addFor(Object[] pArgs);
+
+  /** <p>Shortcut for <code>addFor(new Object[]{pVarClass, " ", pVar, " = 0;  ",
+   *                                            pVar, " &lt; ", pArray, ".length;  ",
+   *                                            pVar, "++"})</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForArray(JavaQName pVarClass, Object pVar, Object pArray);
+  /** <p>Shortcut for <code>addForArray(JavaQNameImpl.getInstance(pVarClass),
+   *                                    pVar, pArray)</code>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForArray(Class pVarClass, Object pVar, Object pArray);
+  /** <p>Shortcut for <code>addForArray(pVar, pArray);</code>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForArray(Object pVar, Object pArray);
+  /** <p>Shortcut for <code>addForArray(pVarClass, getLocalVariableName(),
+   *                                     pArray)</code></p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForArray(JavaQName pVarClass, Object pArray);
+  /** <p>Shortcut for <code>addForArray(pVarClass, getLocalVariableName(),
+   *                                     pArray)</code></p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForArray(Class pVarClass, Object pArray);
+  /** <p>Shortcut for <code>addForArray(int.class, pArray);</code>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForArray(Object pArray);
+
+  /** <p>Shortcut for <code>addFor(new Object[]{pVarClass, " ", pVar, " = 0;  ",
+   *                                            pVar, " &lt; ", pList, ".size();  ",
+   *                                            pVar, "++"})</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForList(JavaQName pVarClass, Object pVar, Object pList);
+  /** <p>Shortcut for <code>addForList(JavaQNameImpl.getInstance(pVarClass),
+   *                                   pVar, pList)</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForList(Class pVarClass, Object pVar, Object pList);
+  /** <p>Shortcut for <code>addFor(int.class, pVar, pList)</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForList(Object pVar, Object pList);
+  /** <p>Shortcut for <code>addForList(pVarClass, getLocalVariableName(), pList)</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForList(JavaQName pVarClass, Object pList);
+  /** <p>Shortcut for <code>addForList(JavaQNameImpl.getInstance(pVarClass),
+   *                                   pList)</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForList(Class pVarClass, Object pList);
+  /** <p>Shortcut for <code>addForList(int.class, pVar, pList)</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForList(Object pList);
+
+  /** <p>Shortcut for <code>addFor(new Object[]{pVarClass, " ", pVar, " = ",
+   *                                            pIterator, ";  ",
+   *                                            pVar, ".hasNext();  ) {"});</code>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForIterator(JavaQName pVarClass, Object pVar, Object pIterator);
+  /** <p>Shortcut for <code>addFor(new Object[]{pVarClass, " ", pVar, " = ",
+   *                                            pIterator, ";  ",
+   *                                            pVar, ".hasNext();  ) {"});</code>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForIterator(Class pVarClass, Object pVar, Object pIterator);
+  /** <p>Shortcut for <code>addFor(JavaQNameImpl.getInstance(java.util.Iterator.class),
+   *                               pVar, pIterator);</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForIterator(Object pVar, Object pIterator);
+  /** <p>Shortcut for
+   * <code>addForIterator(pVarClass, getLocalVariableName(), pIterator)</code>.</p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForIterator(JavaQName pVarClass, Object pIterator);
+  /** <p>Shortcut for
+   * <code>addForIterator(pVarClass, getLocalVariableName(), pIterator)</code>.</p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForIterator(Class pVarClass, Object pIterator);
+  /** <p>Shortcut for <code>addForIterator(Iterator.class, pIterator)</code>.</p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForIterator(Object pIterator);
+
+  /** <p>Shortcut for <code>addForIterator(pVarClass, pVar,
+   *                                       new Object[]{"(", pVar, ").iterator()"},);
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForCollection(JavaQName pVarClass, Object pVar, Object pCollection);
+  /** <p>Shortcut for <code>addForCollection(JavaQNameImpl.getInstance(pVarClass),
+   *                                         pVar, pCollection)</code></p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForCollection(Class pVarClass, Object pVar, Object pCollection);
+  /** <p>Shortcut for <code>addForCollection(java.util.Iterator.class,
+   *                                         pVar, pCollection);</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForCollection(Object pVar, Object pCollection);
+  /** <p>Shortcut for <code>addForCollection(pVarClass, getLocalVariableName(),
+   *                                         pCollection)</code></p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForCollection(JavaQName pVarClass, Object pCollection);
+  /** <p>Shortcut for <code>addForCollection(pVarClass, getLocalVariableName(),
+   *                                         pCollection)</code></p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForCollection(Class pVarClass, Object pCollection);
+  /** <p>Shortcut for <code>addForCollection(java.util.Iterator.class,
+   *                                         pCollection);</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForCollection(Object pCollection);
+
+  /** <p>Shortcut for <code>addFor(new Object[]{pVarClass, " ", pVar, " = ",
+   *                                            pEnumeration, ";  ",
+   *                                            pVar, ".hasMoreElements();  ) {"});</code>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForEnumeration(JavaQName pVarClass, Object pVar, Object pEnumeration);
+  /** <p>Shortcut for <code>addFor(new Object[]{pVarClass, " ", pVar, " = ",
+   *                                            pEnumeration, ";  ",
+   *                                            pVar, ".hasMoreElements();  ) {"});</code>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForEnumeration(Class pVarClass, Object pVar, Object pEnumeration);
+  /** <p>Shortcut for <code>addFor(JavaQNameImpl.getInstance(java.util.Enumeration.class),
+   *                               pVar, pEnumeration);</code>.</p>
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForEnumeration(Object pVar, Object pEnumeration);
+  /** <p>Shortcut for
+   * <code>addForEnumeration(pVarClass, getLocalVariableName(), pEnumeration)</code>.</p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForEnumeration(JavaQName pVarClass, Object pEnumeration);
+  /** <p>Shortcut for
+   * <code>addForEnumeration(pVarClass, getLocalVariableName(), pEnumeration)</code>.</p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForEnumeration(Class pVarClass, Object pEnumeration);
+  /** <p>Shortcut for <code>addForEnumeration(Enumeration.class, pIterator)</code>.</p>
+   *
+   * @return An object being used to reference the variable
+   *    <code>pVar</code> in the method.
+   */
+  public DirectAccessible addForEnumeration(Object pEnumeration);
+
+  /** <p>Shortcut for <code>unindent(); addLine("}");</code>.</p>
+   */
+  public void addEndFor();
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1})</code>.</p>
+   */
+  public void addFor(Object pToken1);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3,
+   *                                            pToken4})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7,
+   *                                            pToken8})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8, 
+   *                                            pToken9})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8,
+   *                                            pToken9, pToken10})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8,
+   *                                            pToken9, pToken10, pToken11})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8,
+   *                                            pToken9, pToken10, pToken11,
+   *                                            pToken12})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8,
+   *                                            pToken9, pToken10, pToken11, pToken12,
+   *                                            pToken13})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8,
+   *                                            pToken9, pToken10, pToken11, pToken12,
+   *                                            pToken13, pToken14})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addFor(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   *                                            pToken5, pToken6, pToken7, pToken8,
+   *                                            pToken9, pToken10, pToken11, pToken12,
+   *                                            pToken13, pToken14, pToken15})</code>.</p>
+   */
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14, Object Token15);
+
+  /** <p>Shortcut for <code>addLine("while (", pExpr, ") {"); indent();</code>.</p>
+   */
+  public void addWhile(Object[] pExpr);
+  /** <p>Shortcut for <code>addWhile(new Object[]{"(", pIterator, ").hasNext()"});</code>
+   */
+  public void addWhileIterator(Object pIterator);
+  /** <p>Shortcut for <code>unindent(); addLine("}");</code>.</p>
+   */
+  public void addEndWhile();
+  /** <p>Shortcut for <code>addWhile(new Object[]{pToken1})</code>.</p>
+   */
+  public void addWhile(Object pToken1);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4);
+  /** <p>Shortcut for <code>addWhile(new Object[]{pToken1, pToken2,
+   * pToken3, pToken4, pToken5})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8, pToken9})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8, pToken9, pToken10})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11})
+   * </code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addWhile(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11,
+   * pToken12})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+   * pToken13})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+   * pToken13, pToken14})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13, Object pToken14);
+  /** <p>Shortcut for
+   * <code>addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4,
+   * pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11,
+   * pToken12, pToken13, pToken14, pToken15})</code>.</p>
+   */
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13, Object pToken14, Object Token15);
+  /** <p>Shortcut for <code>addLine("switch (", pTokens, ") {"); indent();
+   * indent();</code>.</p>
+   */
+  public void addSwitch(Object[] pTokens);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pLine})</code>.</p>
+   */
+  public void addSwitch(Object pLine);
+  /** <p>Shortcut for
+   * <code>addSwitch(new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2);
+  /** <p>Shortcut for
+   * <code>addSwitch(new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4})</code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5})</code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6}) </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8}) </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9}) </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10}) </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                         Object pToken4, Object pToken5, Object pToken6,
+                         Object pToken7, Object pToken8, Object pToken9,
+                         Object pToken10);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11})  </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12})  </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13})  </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12,
+                        Object pToken13);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken14})  </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12,
+                        Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addSwitch(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken15})  </code>.</p>
+   */
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+                        Object pToken4, Object pToken5, Object pToken6,
+                        Object pToken7, Object pToken8, Object pToken9,
+                        Object pToken10, Object pToken11, Object pToken12,
+                        Object pToken13, Object pToken14, Object pToken15);
+
+  /** <p>Shortcut for <code>unindent(); addLine("case ", pTokens, ":");
+   * indent();</code>.</p>
+   */
+  public void addCase(Object[] pTokens);
+  /** <p>Shortcut for <code>addCase(new Object[]{pLine})</code>.</p>
+   */
+  public void addCase(Object pLine);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2);
+  /** <p>Shortcut for
+   * <code>addCase(new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4})</code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5})</code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6}) </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7}) </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8}) </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9}) </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10})
+   * </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8, Object pToken9,
+                      Object pToken10);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11})  </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8, Object pToken9,
+                      Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12})  </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8, Object pToken9,
+                      Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13})  </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken14})  </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8, Object pToken9,
+                      Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addCase(new Object[]{pToken1, pToken2, pToken3,
+   * pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10,
+   * pToken11, pToken12, pToken13, pToken15})  </code>.</p>
+   */
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+                      Object pToken4, Object pToken5, Object pToken6,
+                      Object pToken7, Object pToken8, Object pToken9,
+                      Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14, Object pToken15);
+
+  /** <p>Shortcut for
+   * <code>unindent(); addLine("default:"); indent();</code>.</p>
+   */
+  public void addDefault();
+  /** <p>Shortcut for <code>addLine("break;");</code>.</p>
+   */
+  public void addBreak();
+
+  /** <p>Shortcut for <code>unindent(); unindent(); addLine("}");</code>.</p>
+   */
+  public void addEndSwitch();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationJavaSourceObject.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationJavaSourceObject.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/ConditionalIndentationJavaSourceObject.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1138 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class ConditionalIndentationJavaSourceObject extends JavaSourceObject
+    implements ConditionalIndentationEngine {
+  private class LocalJavaFieldDeclaration {
+    LJFImpl field;
+    private LocalJavaFieldDeclaration(LJFImpl pField) {
+      field = pField;
+    }
+  }
+
+  public class LoopVariable implements DirectAccessible, IndentedObject {
+     private Object value;
+	 private JavaQName type;
+     public LoopVariable(Object pValue, JavaQName pType) {
+        value = pValue;
+		type = pType;
+     }
+	 public JavaQName getType() { return type; }
+     public boolean isNullable() { return false; }
+     public void setNullable(boolean pNullable) {
+       if (pNullable) {
+         throw new IllegalStateException("Loop variables cannot be nullable.");
+       }
+     }
+     public Object getValue() {
+        return value;
+     }
+     public void write(IndentationEngine pEngine, IndentationTarget pTarget)
+         throws IOException {
+       pEngine.write(pTarget, getValue());
+     }
+  }
+
+  public class LJFImpl extends JavaField implements LocalJavaField {
+    LJFImpl(JavaQName pType, String pName) {
+       super(pName, pType, null);
+    }
+    public void write(IndentationEngine pEngine, IndentationTarget pTarget)
+        throws IOException {
+      pEngine.write(pTarget, getName());
+    }
+  }
+
+  private int localVariableCounter = 0;
+
+  protected ConditionalIndentationJavaSourceObject
+      (String pName, JavaQName pType, JavaSource.Protection pProtection) {
+    super(pName, pType, pProtection);
+  }
+
+  public void addIf(Object[] pTokens) {
+  	 addLine("if (", pTokens, ") {");
+  	 indent();
+  }
+  public void addIf(Object pToken1) {
+	 addIf(new Object[]{pToken1});
+  }
+  public void addIf(Object pToken1, Object pToken2) {
+	 addIf(new Object[]{pToken1, pToken2});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                     Object pToken5) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9, Object pToken10) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9, Object pToken10, Object pToken11) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12, Object pToken13) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							  pToken13});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12, Object pToken13, Object pToken14) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							  pToken13, pToken14});
+  }
+  public void addIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12, Object pToken13, Object pToken14,
+							Object pToken15) {
+	 addIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							  pToken13, pToken14, pToken15});
+  }
+
+  public void addElseIf(Object[] pTokens) {
+  	 unindent();
+  	 addLine("} else if (", pTokens, ") {");
+  	 indent();
+  }
+  public void addElseIf(Object pToken1) {
+	 addElseIf(new Object[]{pToken1});
+  }
+  public void addElseIf(Object pToken1, Object pToken2) {
+	 addElseIf(new Object[]{pToken1, pToken2});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9, Object pToken10) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9, Object pToken10, Object pToken11) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9, Object pToken10, Object pToken11,
+							    Object pToken12) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9, Object pToken10, Object pToken11,
+							    Object pToken12, Object pToken13) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							      pToken13});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9, Object pToken10, Object pToken11,
+							    Object pToken12, Object pToken13, Object pToken14) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							      pToken13, pToken14});
+  }
+  public void addElseIf(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+							    Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+							    Object pToken9, Object pToken10, Object pToken11,
+							    Object pToken12, Object pToken13, Object pToken14,
+							    Object pToken15) {
+	 addElseIf(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							      pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							      pToken13, pToken14, pToken15});
+  }
+
+  public void addIf(boolean pFirst, Object[] pTokens) {
+  	 if (pFirst) {
+  	 	addIf(pTokens);
+  	 } else {
+  	 	addElseIf(pTokens);
+  	 }
+  }
+  public void addIf(boolean pFirst, Object pToken1) {
+	 addIf(pFirst, new Object[]{pToken1});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							          pToken7});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							          pToken7, pToken8});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+	 	                         pToken7, pToken8, pToken9});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9, Object pToken10) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+	 	                         pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9, Object pToken10, Object pToken11) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							          pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+	 	                         pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12, Object pToken13) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							          pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							          pToken13});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12, Object pToken13, Object pToken14) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+	 	                         pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+	 	                         pToken13, pToken14});
+  }
+  public void addIf(boolean pFirst, Object pToken1, Object pToken2, Object pToken3,
+                     Object pToken4, Object pToken5, Object pToken6, Object pToken7,
+                     Object pToken8, Object pToken9, Object pToken10, Object pToken11,
+							Object pToken12, Object pToken13, Object pToken14,	Object pToken15) {
+	 addIf(pFirst, new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                               pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							          pToken13, pToken14, pToken15});
+  }
+
+  public void addElse() {
+	 unindent();
+	 addLine("} else {");
+	 indent();
+  }
+
+  public void addEndIf() {
+	 unindent();
+	 addLine("}");
+  }
+
+  public void addThrowNew(JavaQName pExceptionClass, Object[] pArgs) {
+    addLine("throw new ", pExceptionClass, "(", pArgs, ");");
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1, pToken2});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8,
+							Object pToken9) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8, Object pToken9, Object pToken10) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+                           Object pToken11) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+                           Object pToken11, Object pToken12) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+                           Object pToken11, Object pToken12, Object pToken13) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							        pToken13});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+                           Object pToken11, Object pToken12, Object pToken13,
+                           Object pToken14) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							        pToken13, pToken14});
+  }
+  public void addThrowNew(JavaQName pExceptionClass, Object pToken1, Object pToken2,
+                           Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+                           Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+                           Object pToken11, Object pToken12, Object pToken13,
+                           Object pToken14, Object pToken15) {
+	 addThrowNew(pExceptionClass,
+	             new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+							        pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+							        pToken13, pToken14, pToken15});
+  }
+
+  public void addThrowNew(Class pExceptionClass, Object[] pArgs) {
+  	 addThrowNew(JavaQNameImpl.getInstance(pExceptionClass), pArgs);
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1, pToken2});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4) {
+	 addThrowNew(pExceptionClass, new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8,
+							Object pToken9) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8, Object pToken9, Object pToken10) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+									Object pToken11) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+									Object pToken11, Object pToken12) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+									Object pToken11, Object pToken12, Object pToken13) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+									  pToken13});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+									Object pToken11, Object pToken12, Object pToken13,
+									Object pToken14) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+									  pToken13, pToken14});
+  }
+  public void addThrowNew(Class pExceptionClass, Object pToken1, Object pToken2,
+									Object pToken3, Object pToken4, Object pToken5, Object pToken6,
+									Object pToken7, Object pToken8, Object pToken9, Object pToken10,
+									Object pToken11, Object pToken12, Object pToken13,
+									Object pToken14, Object pToken15) {
+	 addThrowNew(pExceptionClass,
+					 new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+									  pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+									  pToken13, pToken14, pToken15});
+  }
+
+  public void addTry() {
+    addLine("try {");
+    indent();
+  }
+  public DirectAccessible addCatch(JavaQName pExceptionClass, Object pVar) {
+    unindent();
+    addLine("} catch (", pExceptionClass, " ", pVar, ") {");
+    indent();
+    return new LoopVariable(pVar, pExceptionClass);
+  }
+  public DirectAccessible addCatch(Class pExceptionClass, Object pVar) {
+    return addCatch(JavaQNameImpl.getInstance(pExceptionClass), pVar); 
+  }
+  public DirectAccessible addCatch(JavaQName pExceptionClass) {
+    return addCatch(pExceptionClass, getLocalVariableName());
+  }
+  public DirectAccessible addCatch(Class pExceptionClass) {
+    return addCatch(pExceptionClass, getLocalVariableName());
+  }
+  public void addFinally() {
+    unindent();
+    addLine("} finally {");
+    indent();
+  }
+  public void addEndTry() {
+    unindent();
+    addLine("}");
+  }
+
+
+  public void addFor(Object[] pArgs) {
+    addLine("for (", pArgs, ") {");
+    indent();
+  }
+
+
+  public DirectAccessible addForArray(JavaQName pVarClass, Object pVar, Object pArray) {
+    addFor(new Object[]{pVarClass, " ", pVar, " = 0;  ",
+                        pVar, " < (", pArray, ").length;  ",
+                        pVar, "++"});
+    return new LoopVariable(pVar, pVarClass);
+  }
+  public DirectAccessible addForArray(Class pVarClass, Object pVar, Object pArray) {
+    return addForArray(JavaQNameImpl.getInstance(pVarClass), pVar, pArray);
+  }
+  public DirectAccessible addForArray(Object pVar, Object pArray) {
+    return addForArray(int.class, pVar, pArray);
+  }
+  public DirectAccessible addForArray(JavaQName pVarClass, Object pArray) {
+    return addForArray(pVarClass, getLocalVariableName(), pArray);
+  }
+  public DirectAccessible addForArray(Class pVarClass, Object pArray) {
+    return addForArray(pVarClass, getLocalVariableName(), pArray);
+  }
+  public DirectAccessible addForArray(Object pArray) {
+    return addForArray(int.class, pArray);
+  }
+
+  public DirectAccessible addForList(JavaQName pVarClass, Object pVar, Object pList) {
+    addFor(new Object[]{pVarClass, " ", pVar, " = 0;  ", pVar, " < (", pList,
+                         ").size();  ", pVar, "++"});
+    return new LoopVariable(pVar, pVarClass);
+  }
+  public DirectAccessible addForList(Class pVarClass, Object pVar, Object pList) {
+    return addForList(JavaQNameImpl.getInstance(pVarClass), pVar, pList);
+  }
+  public DirectAccessible addForList(Object pVar, Object pList) {
+    return addForList(int.class, pVar, pList);
+  }
+  public DirectAccessible addForList(JavaQName pVarClass, Object pList) {
+    return addForList(pVarClass, getLocalVariableName(), pList);
+  }
+  public DirectAccessible addForList(Class pVarClass, Object pList) {
+     return addForList(pVarClass, getLocalVariableName(), pList);
+  }
+  public DirectAccessible addForList(Object pList) {
+    return addForList(int.class, pList);
+  }
+
+
+  public DirectAccessible addForIterator(JavaQName pVarClass, Object pVar, Object pIterator) {
+    addFor(new Object[]{pVarClass, " ", pVar, " = ", pIterator, ";  ", pVar,
+                        ".hasNext();  "});
+    return new LoopVariable(pVar, pVarClass);
+  }
+  public DirectAccessible addForIterator(Class pVarClass, Object pVar, Object pIterator) {
+    return addForIterator(JavaQNameImpl.getInstance(pVarClass), pVar, pIterator);
+  }
+  public DirectAccessible addForIterator(Object pVar, Object pIterator) {
+    return addForIterator(Iterator.class, pVar, pIterator);
+  }
+  public DirectAccessible addForIterator(JavaQName pVarClass, Object pIterator) {
+    return addForIterator(pVarClass, getLocalVariableName(), pIterator);
+  }
+  public DirectAccessible addForIterator(Class pVarClass, Object pIterator) {
+    return addForIterator(pVarClass, getLocalVariableName(), pIterator);
+  }
+  public DirectAccessible addForIterator(Object pIterator) {
+    return addForIterator(Iterator.class, pIterator);
+  }
+
+  public DirectAccessible addForEnumeration(JavaQName pVarClass, Object pVar, Object pEnumeration) {
+    addFor(new Object[]{pVarClass, " ", pVar, " = ", pEnumeration, ";  ", pVar,
+                        ".hasMoreElements();  "});
+    return new LoopVariable(pVar, pVarClass);
+  }
+  public DirectAccessible addForEnumeration(Class pVarClass, Object pVar, Object pEnumeration) {
+    return addForEnumeration(JavaQNameImpl.getInstance(pVarClass), pVar, pEnumeration);
+  }
+  public DirectAccessible addForEnumeration(Object pVar, Object pEnumeration) {
+    return addForEnumeration(Enumeration.class, pVar, pEnumeration);
+  }
+  public DirectAccessible addForEnumeration(JavaQName pVarClass, Object pEnumeration) {
+    return addForEnumeration(pVarClass, getLocalVariableName(), pEnumeration);
+  }
+  public DirectAccessible addForEnumeration(Class pVarClass, Object pEnumeration) {
+    return addForEnumeration(pVarClass, getLocalVariableName(), pEnumeration);
+  }
+  public DirectAccessible addForEnumeration(Object pEnumeration) {
+    return addForEnumeration(Enumeration.class, pEnumeration);
+  }
+
+  public DirectAccessible addForCollection(JavaQName pVarClass, Object pVar, Object pCollection) {
+    return addForIterator(pVarClass, pVar, new Object[]{"(", pCollection, ").iterator()"});
+  }
+  public DirectAccessible addForCollection(Class pVarClass, Object pVar, Object pCollection) {
+    return addForCollection(JavaQNameImpl.getInstance(pVarClass), pVar, pCollection);
+  }
+  public DirectAccessible addForCollection(Object pVar, Object pCollection) {
+    return addForCollection(Iterator.class, pVar, pCollection);
+  }
+  public DirectAccessible addForCollection(JavaQName pVarClass, Object pCollection) {
+    return addForCollection(pVarClass, getLocalVariableName(), pCollection);
+  }
+  public DirectAccessible addForCollection(Class pVarClass, Object pCollection) {
+    return addForCollection(pVarClass, getLocalVariableName(), pCollection);
+  }
+  public DirectAccessible addForCollection(Object pCollection) {
+    return addForCollection(Iterator.class, pCollection);
+  }
+
+  public void addEndFor() {
+    unindent();
+    addLine("}");
+  }
+  public void addFor(Object pToken1) {
+    addFor(new Object[]{pToken1});
+  }
+  public void addFor(Object pToken1, Object pToken2) {
+    addFor(new Object[]{pToken1, pToken2});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3) {
+    addFor(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+                         pToken13});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+                         pToken13, pToken14});
+  }
+  public void addFor(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14, Object pToken15) {
+    addFor(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                         pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+                         pToken13, pToken14, pToken15});
+  }
+
+  /** <p>Shortcut for <code>addLine("while (", pExpr, ") {"); indent();</code>.</p>
+   */
+  public void addWhile(Object[] pExpr) {
+     addLine("while (", pExpr, ") {");
+     indent();
+  }
+  /** <p>Shortcut for <code>addWhile(new Object[]{"(", pIterator, ").hasNext()"});</code>
+   */
+  public void addWhileIterator(Object pIterator) {
+     addWhile(new Object[]{"(", pIterator, ").hasNext()"});
+  }
+  /** <p>Shortcut for <code>unindent(); addLine("}");</code>.</p>
+   */
+  public void addEndWhile() {
+     unindent();
+     addLine("}");
+  }
+  public void addWhile(Object pToken1) {
+    addWhile(new Object[]{pToken1});
+  }
+  public void addWhile(Object pToken1, Object pToken2) {
+    addWhile(new Object[]{pToken1, pToken2});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9, pToken10, pToken11, pToken12});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+                         pToken13});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+                          pToken13, pToken14});
+  }
+  public void addWhile(Object pToken1, Object pToken2, Object pToken3, Object pToken4,
+                      Object pToken5, Object pToken6, Object pToken7, Object pToken8,
+                      Object pToken9, Object pToken10, Object pToken11, Object pToken12,
+                      Object pToken13, Object pToken14, Object pToken15) {
+    addWhile(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+                          pToken7, pToken8, pToken9, pToken10, pToken11, pToken12,
+                         pToken13, pToken14, pToken15});
+  }
+
+  public void addSwitch(Object[] pTokens) {
+    addLine("switch (", pTokens, ") {");
+    indent();
+    indent();
+  }
+  public void addSwitch(Object pToken1) {
+    addSwitch(new Object[]{pToken1});
+  }
+  public void addSwitch(Object pToken1, Object pToken2) {
+    addSwitch(new Object[]{pToken1, pToken2});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9,
+			Object pToken10) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9,
+			Object pToken10, Object pToken11) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9, pToken10,
+			   pToken11});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9,
+			Object pToken10, Object pToken11, Object pToken12) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9, pToken10,
+			   pToken11, pToken12});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9,
+			Object pToken10, Object pToken11, Object pToken12,
+			Object pToken13) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9, pToken10,
+			   pToken11, pToken12, pToken13});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9,
+			Object pToken10, Object pToken11, Object pToken12,
+			Object pToken13, Object pToken14) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9, pToken10,
+			   pToken11, pToken12, pToken13, pToken14});
+  }
+  public void addSwitch(Object pToken1, Object pToken2, Object pToken3,
+			Object pToken4, Object pToken5, Object pToken6,
+			Object pToken7, Object pToken8, Object pToken9,
+			Object pToken10, Object pToken11, Object pToken12,
+			Object pToken13, Object pToken14, Object pToken15) {
+    addSwitch(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+			   pToken6, pToken7, pToken8, pToken9, pToken10,
+			   pToken11, pToken12, pToken13, pToken14, pToken15});
+  }
+
+  public void addCase(Object[] pTokens) {
+    unindent();
+    addLine("case ", pTokens, ":");
+    indent();
+  }
+  public void addCase(Object pToken1) {
+    addCase(new Object[]{pToken1});
+  }
+  public void addCase(Object pToken1, Object pToken2) {
+    addCase(new Object[]{pToken1, pToken2});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3) {
+    addCase(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9,
+		      Object pToken10) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9,
+		      Object pToken10, Object pToken11) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9, pToken10, pToken11});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9,
+		      Object pToken10, Object pToken11, Object pToken12) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9, pToken10, pToken11,
+			 pToken12});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9,
+		      Object pToken10, Object pToken11, Object pToken12,
+		      Object pToken13) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9, pToken10, pToken11,
+			 pToken12, pToken13});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9,
+		      Object pToken10, Object pToken11, Object pToken12,
+		      Object pToken13, Object pToken14) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9, pToken10, pToken11,
+			 pToken12, pToken13, pToken14});
+  }
+  public void addCase(Object pToken1, Object pToken2, Object pToken3,
+		      Object pToken4, Object pToken5, Object pToken6,
+		      Object pToken7, Object pToken8, Object pToken9,
+		      Object pToken10, Object pToken11, Object pToken12,
+		      Object pToken13, Object pToken14, Object pToken15) {
+    addCase(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6,
+			 pToken7, pToken8, pToken9, pToken10, pToken11,
+			 pToken12, pToken13, pToken14, pToken15});
+  }
+
+  public void addDefault() {
+    unindent();
+    addLine("default:");
+    indent();
+  }
+
+  public void addBreak() {
+    addLine("break;");
+  }
+
+  public void addEndSwitch() {
+    unindent();
+    unindent();
+    addLine("}");
+  }
+  public String getLocalVariableName() {
+    return "_" + ++localVariableCounter;
+  }
+
+  protected abstract void writeHeader(IndentationTarget pTarget)
+    throws IOException;
+
+  public void write(IndentationTarget pTarget) throws IOException {
+    JavaComment jc = getComment();
+    if (jc != null) {
+      jc.write(pTarget);
+      pTarget.indent(0);
+    }
+    writeHeader(pTarget);
+    if (!pTarget.isInterface()  &&  !isAbstract()) {
+      super.write(new IncreasingTarget(pTarget));
+      pTarget.indent(0);
+      pTarget.write("}");
+      pTarget.write();
+    }
+  }
+
+  public void write(IndentationTarget pTarget, Object pObject)
+        throws IOException {
+    if (pObject instanceof LocalJavaFieldDeclaration) {
+      LJFImpl f = ((LocalJavaFieldDeclaration) pObject).field;
+      f.writeNoEol(pTarget);
+    } else {
+      super.write(pTarget, pObject);
+    }
+  }
+
+  /** <p>Creates a new {@link LocalJavaField} with the given class and name,
+   * which is not final.</p>
+   */
+  public LocalJavaField newJavaField(Class pType, String pName) {
+     return newJavaField(JavaQNameImpl.getInstance(pType), pName);
+  }
+
+  /** <p>Creates a new {@link LocalJavaField} with the given class and
+   * name.</p>
+   */
+  public LocalJavaField newJavaField(JavaQName pType, String pName) {
+    LJFImpl result = new LJFImpl(pType, pName);
+    addLine(new LocalJavaFieldDeclaration(result));
+    return result;
+  }
+
+  /** <p>Creates a new {@link LocalJavaField} with the given class, which is
+   * not final. The field name will be generated using
+   * {@link #getLocalVariableName()}.</p>
+   */
+  public LocalJavaField newJavaField(JavaQName pType) {
+    return newJavaField(pType, getLocalVariableName());
+  }
+
+  /** <p>Creates a new {@link LocalJavaField} with the given class, which is
+   * not final. The field name will be generated using
+   * {@link #getLocalVariableName()}.</p>
+   */
+  public LocalJavaField newJavaField(Class pType) {
+    return newJavaField(pType, getLocalVariableName());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/DirectAccessible.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/DirectAccessible.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/DirectAccessible.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+/** <p>This interface is an abstract base for fields and similar
+ * objects. It doesn't define many methods, it mainly indicates, that
+ * the implementations value is directly and fast accessible in
+ * the generated code. The use is best demonstrated by an example.
+ * Suggest the following piece of code:</p>
+ * <pre>
+ *     Object value;
+ *     return new Object[]{"((", value, ") * (", value, "))"};
+ * </pre>
+ * <p>The example is well suited for the case, where <code>value</code>
+ * is a variable name like "i". It is not suited, if "value" contains
+ * an expensive method call like "sin(x)". It is even wrong in the
+ * case "i++".</p>
+ * <p>By using the interface <code>DirectAccessible</code>, you can
+ * change the implementation of <code>getSquare()</code> to look
+ * like this:
+ * <pre>
+ *     Object value;
+ *     JavaQName type;
+ *     if (!(value instanceof DirectAccessible)) {
+ *       LocalJavaField v = pMethod.newJavaField(type);
+ *       v.addLine(value);
+ *       v.setFinal(true);
+ *       value = v;
+ *     }
+ *     return new Object[]{"((", value, ") * (", value, "))"};
+ * </pre>
+ * <p>This results in code, which is far more readable and better
+ * optimized.</p>
+ *
+ * @author <a href="mailto:jwi at softwareag.com">Jochen Wiedmann</a>
+ */
+public interface DirectAccessible extends TypedValue {
+   /** <p>Returns whether the value is possibly null.</p>
+    */
+   public boolean isNullable();
+   /** <p>Sets whether the value is possibly null.</p>
+    */
+   public void setNullable(boolean pNullable);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IncreasingTarget.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IncreasingTarget.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IncreasingTarget.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+
+/** <p>A filtering indentation target, which pipes all output
+ * to the actual target, except that it increases the indentation
+ * level by 1.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: IncreasingTarget.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class IncreasingTarget implements IndentationTarget {
+  private IndentationTarget actualTarget;
+  private Boolean isInterface;
+  public IncreasingTarget(IndentationTarget pActualTarget) {
+    actualTarget = pActualTarget;
+  }
+  public boolean isInterface() {
+  	 return (isInterface == null) ? actualTarget.isInterface() : isInterface.booleanValue();
+  }
+  public void setInterface(Boolean pInterface) {
+  	 isInterface = pInterface;
+  }
+  public void indent(int i) throws IOException {
+    actualTarget.indent(i+1);
+  }
+  public String asString(JavaQName pQName) {
+    return actualTarget.asString(pQName);
+  }
+  public void write(String pValue) throws IOException {
+    actualTarget.write(pValue);
+  }
+  public void write() throws IOException {
+    actualTarget.write();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngine.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngine.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngine.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: IndentationEngine.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface IndentationEngine {
+  public static final Object NOTHING = "";
+
+  /** <p>Increases the current level of indentation.</p>
+   */
+  public void indent();
+  /** <p>Decreases the current level of indentation.</p>
+   */
+  public void unindent();
+
+  /** <p>Adds the IndentationEngine's contents to the given
+   * {@link IndentationTarget}.</p>
+   */
+  public void write(IndentationTarget pTarget) throws IOException;
+
+  /** <p>Adds the given objects contents to the given
+   * {@link IndentationTarget}.</p>
+   */
+  public void write(IndentationTarget pTarget, Object pObject) throws IOException;
+
+  /** <p>Clears the IndentationEngine's contents.</p>
+   */
+  public void clear();
+  /** <p>Sets the current level of indentation.</p>
+   */
+  public void setLevel(int pLevel);
+  /** <p>Returns the current level of indentation.</p>
+   */
+  public int getLevel();
+
+  /** <p>Adds the given tokens as a complete line, using the
+   * given level of indentation.</p>
+   */
+  public void addLine(int pLevel, Object[] pTokens);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(), pTokens)</code>.</p>
+   */
+  public void addLine(Object[] pTokens);
+  /** <p>Adds an empty line, shortcut for
+   * <code>addLine(getIndentationLevel, new Object[0])</<code>.</p>
+   */
+  public void addLine();
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pLine})</code>.</p>
+   */
+  public void addLine(Object pLine);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2})</code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3})</code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4})</code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5})</code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6}) </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7}) </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8}) </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9}) </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9, pToken10}) </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9, pToken10,
+   *              pToken11})  </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9, pToken10,
+   *              pToken11, pToken12})  </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9, pToken10,
+   *              pToken11, pToken12, pToken13})  </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9, pToken10,
+   *              pToken11, pToken12, pToken13, pToken14})  </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13, Object pToken14);
+  /** <p>Shortcut for <code>addLine(getIndentationLevel(),
+   * new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+   *              pToken6, pToken7, pToken8, pToken9, pToken10,
+   *              pToken11, pToken12, pToken13, pToken15})  </code>.</p>
+   */
+  public void addLine(Object pToken1, Object pToken2, Object pToken3,
+                       Object pToken4, Object pToken5, Object pToken6,
+                       Object pToken7, Object pToken8, Object pToken9,
+                       Object pToken10, Object pToken11, Object pToken12,
+                       Object pToken13, Object pToken14, Object pToken15);
+
+  /** <p>Moves the cursor to the top of the method.</p>
+   */
+  public void moveToTop();
+
+  /** <p>Moves the cursor to the bottom of the method.</p>
+   */
+  public void moveToBottom();
+
+  /** <p>Sets a placeholder with the given name.</p>
+   * @param pName The placeholders name
+   * @param pAutoRemove Whether the placeholder must be removed by invoking {@link PlaceHolder#remove()} (false)
+   * or not (true).
+   */
+  public PlaceHolder newPlaceHolder(String pName, boolean pAutoRemove);
+
+  /** <p>Searches for the placeholder with the given name. The cursor
+   * will be set to the line after the placeholder, if it is found.
+   * In that case subsequent invocations of {@link IndentationEngine#addLine()}
+   * will add code to the lines following the placeholder. Otherwise
+   * the cursor is unchanged.</p>
+   * @param pName The placeholders name
+   * @return The placeholder or null, if it wasn't found.
+   */
+  public PlaceHolder getPlaceHolder(String pName);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngineImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngineImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationEngineImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,337 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: IndentationEngineImpl.java 232093 2005-04-21 11:25:23Z mac $
+ */
+public abstract class IndentationEngineImpl implements IndentationEngine {
+  private int level = 0;
+  final private List lines = new ArrayList();
+  private int cursor = -1;
+
+  private class IndentedLine {
+    int indLevel;
+    Object[] tokens;
+  }
+
+  private class PlaceHolderImpl implements PlaceHolder {
+    private final boolean autoRemovable;
+    private final String name;
+    private final int plLevel;
+    private Map properties;
+    public PlaceHolderImpl(String pName, boolean pAutoRemovable) {
+      name = pName;
+      autoRemovable = pAutoRemovable;
+      plLevel = IndentationEngineImpl.this.getLevel();
+    }
+    public String getName() { return name; }
+    public boolean isAutoRemovable() { return autoRemovable; }
+    public void remove() { removePlaceHolder(this); }
+    public void setProperty(String pKey, Object pValue) {
+      if (properties == null) {
+        properties = new HashMap();
+      }
+      properties.put(pKey, pValue);
+    }
+    public Object getProperty(String pKey) { return properties == null ? null : properties.get(pKey); }
+    public int getLevel() { return plLevel; }
+  }
+
+  protected IndentationEngineImpl() {}
+
+  public boolean isEmpty() { return lines.size() == 0; }
+  public void clear() { lines.clear(); }
+  public void indent() { ++level; }
+  public void unindent() { --level; }
+  public void setLevel(int pLevel) { level = pLevel; }
+  public int getLevel() { return level; }
+
+  public void addLine(int pLevel, Object[] pTokens) {
+    IndentedLine l = new IndentedLine();
+    l.indLevel = pLevel;
+    l.tokens = pTokens;
+    if (cursor == -1) {
+       lines.add(l);
+    } else {
+       lines.add(cursor++, l);
+    }
+  }
+
+  public void moveToTop() {
+    cursor = 0;
+  }
+
+  public void moveToBottom() {
+    cursor = -1;
+  }
+
+  public PlaceHolder newPlaceHolder(String pName, boolean pAutoRemovable) {
+    PlaceHolder result = new PlaceHolderImpl(pName, pAutoRemovable);
+    addLine(result);
+    return result;
+  }
+
+  public PlaceHolder getPlaceHolder(String pName) {
+    for (int i = 0;  i < lines.size();  i++) {
+      IndentedLine l = (IndentedLine) lines.get(i);
+      Object [] tokens = l.tokens;
+      if (tokens.length > 0  &&  tokens[0] instanceof PlaceHolder) {
+        PlaceHolder placeHolder = (PlaceHolder) tokens[0];
+        if (pName.equals(placeHolder.getName())) {
+          cursor = i+1;
+          level = placeHolder.getLevel();
+          return placeHolder;
+        }
+      }
+    }
+    return null;
+  }
+
+  protected void removePlaceHolder(PlaceHolder pPlaceHolder) {
+    String name = pPlaceHolder.getName();
+    for (int i = 0;  i < lines.size();  i++) {
+      IndentedLine l = (IndentedLine) lines.get(i);
+      Object [] tokens = l.tokens;
+      if (tokens.length > 0  &&  tokens[0] instanceof PlaceHolder) {
+        PlaceHolder placeHolder = (PlaceHolder) tokens[0];
+        if (name.equals(placeHolder.getName())) {
+          lines.remove(i);
+          if (cursor > i) { --cursor; }
+          return;
+        }
+      }
+    }
+    throw new IllegalStateException("The placeholder " + pPlaceHolder.getName() +
+                                     " was not found and cannot be removed.");
+  }
+
+  protected void checkNulls(Object pTokens) {
+    if (pTokens == null) {
+      throw new NullPointerException("Null token detected.");
+    }
+    if (pTokens.getClass().isArray()) {
+		if (!pTokens.getClass().getComponentType().isPrimitive()) {
+			Object[] tokens = (Object[]) pTokens;
+			for (int i = 0;  i < tokens.length;  i++) {
+				checkNulls(tokens[i]);
+			}
+		}
+    } else if (pTokens instanceof Collection) {
+      for (Iterator iter = ((Collection) pTokens).iterator();  iter.hasNext();  ) {
+        checkNulls(iter.next());
+      }
+    } else if (pTokens instanceof JavaSource) {
+      if (!(this instanceof JavaSource)) {
+        throw new IllegalStateException("An instance of JavaSource cannot be added to an instance of " +
+                                        getClass().getName());
+      }
+      if (!(pTokens instanceof JavaInnerClass)) {
+        throw new IllegalStateException("Only inner classes can be added, outer classes are standalone objects.");
+      }
+      JavaInnerClass jic = (JavaInnerClass) pTokens;
+      JavaSource js = (JavaSource) this;
+      if (!jic.getOuterClass().equals(js)) {
+         throw new IllegalStateException("The inner class " + jic.getQName() +
+                                         " cannot be added to a different outer class " +
+                                         js.getQName());
+      }
+    }
+  }
+
+  public void addLine(Object[] pTokens) {
+    checkNulls(pTokens);
+    addLine(getLevel(), pTokens);
+  }
+
+  public void addLine() {
+    addLine(new Object[0]);
+  }
+  public void addLine(Object pLine) {
+    addLine(new Object[]{pLine});
+  }
+  public void addLine(Object pToken1, Object pToken2) {
+    addLine(new Object[]{pToken1, pToken2});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3) {
+    addLine(new Object[]{pToken1, pToken2, pToken3});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9, Object pToken10) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9, pToken10});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9, Object pToken10, Object pToken11) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9, pToken10,
+                         pToken11});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9, Object pToken10, Object pToken11,
+                       Object pToken12) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9, pToken10,
+                         pToken11, pToken12});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9, Object pToken10, Object pToken11,
+                       Object pToken12, Object pToken13) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9, pToken10,
+                         pToken11, pToken12, pToken13});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9, Object pToken10, Object pToken11,
+                       Object pToken12, Object pToken13, Object pToken14) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9, pToken10,
+                         pToken11, pToken12, pToken13, pToken14});
+  }
+  public void addLine(Object pToken1, Object pToken2,
+                       Object pToken3, Object pToken4, Object pToken5,
+                       Object pToken6, Object pToken7, Object pToken8,
+                       Object pToken9, Object pToken10, Object pToken11,
+                       Object pToken12, Object pToken13, Object pToken14,
+                       Object pToken15) {
+    addLine(new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5,
+                         pToken6, pToken7, pToken8, pToken9, pToken10,
+                         pToken11, pToken12, pToken13, pToken14, pToken15});
+  }
+
+  public String[] getLines(int pLevel) {
+    String[] result = new String[lines.size()];
+    return result;
+  }
+
+  protected Iterator getLines() {
+    return lines.iterator();
+  }
+
+  public void write(IndentationTarget pTarget, Object pObject)
+      throws IOException {
+    if (pObject.getClass().isArray()) {
+      // We are *not* casting to Object[], because the array
+	  // might be primitive.
+      int arrayLength = Array.getLength(pObject);
+	  for (int i = 0;  i < arrayLength;  i++) {
+		write(pTarget, Array.get(pObject, i));
+	  }
+	} else if (pObject instanceof JavaSourceObject) {
+		  pTarget.write(((JavaSourceObject) pObject).getName());
+    } else if (pObject instanceof List) {
+    	for (Iterator iter = ((List) pObject).iterator();  iter.hasNext();  ) {
+    		write(pTarget, iter.next());
+    	}
+    } else if (pObject instanceof Class) {
+      JavaQName name = JavaQNameImpl.getInstance((Class) pObject); 
+      write(pTarget, pTarget.asString(name));
+    } else if (pObject instanceof JavaQName) {
+      write(pTarget, pTarget.asString((JavaQName) pObject));
+    } else if (pObject instanceof IndentedObject) {
+      ((IndentedObject) pObject).write(this, pTarget);
+    } else {
+      pTarget.write(pObject.toString());
+    }
+  }
+
+  public void write(IndentationTarget pTarget) throws IOException {
+    for (Iterator iter = getLines();  iter.hasNext();  ) {
+      IndentedLine l = (IndentedLine) iter.next();
+      Object[] tokens = l.tokens;
+      if (tokens.length == 1  &&  tokens[0] instanceof PlaceHolder) {
+        PlaceHolder placeHolder = (PlaceHolder) tokens[0];
+        if (!placeHolder.isAutoRemovable()) {
+          throw new IllegalStateException("The PlaceHolder " + placeHolder.getName() + " has not been removed.");
+        }
+      } else {
+        pTarget.indent(l.indLevel);
+        for (int i = 0;  i < tokens.length;  i++) {
+          write(pTarget, tokens[i]);
+        }
+        pTarget.write();
+      }
+    }
+  }
+
+  public String asString() {
+  	 StringWriter sw = new StringWriter();
+  	 IndentationTarget target = new WriterTarget(sw);
+  	 try {
+		write(target);
+  	 } catch (IOException e) {
+  	 	throw new IllegalStateException(e.getMessage());
+  	 }
+  	 return sw.toString();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationTarget.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationTarget.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentationTarget.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+/** <p>Interface that an IndentationEngine's target must
+ * fulfill.</p>
+ */
+public interface IndentationTarget {
+  /** <p>Returns whether the IndentationEngine is creating a Java
+   * interface. Creating an interface means, for example, that
+   * method bodies are being suppressed.</p>
+   */
+  public boolean isInterface();
+  /** <p>Indents the current line by adding blanks for the given
+   * indentation level. This method must be called before any
+   * of the <code>write(String)</code> or <code>write()</code>
+   * methods or following the line terminating <code>write()</code>
+   * method.</p>
+   */
+  public void indent(int i) throws IOException;
+  /** <p>Converts a class name into a string. The string may then be
+   * written to the target using <code>write()</code>.</p>
+   */
+  public String asString(JavaQName pQName);
+  /** <p>Writes a string to the target.</p>
+   */
+  public void write(String pValue) throws IOException;
+  /** <p>Terminates a line in the target.</p>
+   */
+  public void write() throws IOException;
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentedObject.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentedObject.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/IndentedObject.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+/** <p>Interface of an object which is able to write itself
+ * into a given {@link org.apache.ws.jaxme.js.IndentationTarget}.</p>
+ * using methods of the given {@link org.apache.ws.jaxme.js.IndentationEngine}.</p>
+ *
+ * @author <a href="mailto:jwi at softwareag.com">Jochen Wiedmann</a>
+ */
+public interface IndentedObject {
+   public void write(IndentationEngine pEngine, IndentationTarget pTarget)
+       throws IOException;
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaClassInitializer.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaClassInitializer.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaClassInitializer.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+
+/** <p>Implements a Java class constructor.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaClassInitializer extends ConditionalIndentationJavaSourceObject {
+  /** Creates a new instance of JavaClassInitializer */
+  JavaClassInitializer() {
+    super(null, null, null);
+  }
+
+  protected void writeHeader(IndentationTarget pTarget) throws IOException {
+    if (!pTarget.isInterface()) {
+      pTarget.indent(0);
+      pTarget.write("static {");
+      pTarget.write();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaComment.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaComment.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaComment.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+/** <p>A class representing a Java comment.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaComment {
+  boolean forJavaDoc;
+
+  /** <p>Creates a new JavaComment which ought to be included into JavaDoc.
+   * Use JavaComment(false) for comments which should be excluded.</p>
+   */
+  JavaComment() { forJavaDoc = true; }
+
+  /** <p>Creates a new JavaComment.</p>
+   *
+   * @param javaDoc True, if this comment should appear in JavaDoc, false otherwise
+   */
+  JavaComment(boolean javaDoc) { forJavaDoc = javaDoc; }
+
+  private List authors;
+  /** <p>Returns the JavaDoc author field or null, if there is no
+   * author field.</p>
+   *
+   * @see #addAuthor
+   */
+  public List getAuthors() { return authors; }
+  /** <p>Sets the JavaDoc author field. Use null to disable the author field.</p>
+   *
+   * @see #getAuthors
+   */
+  public void addAuthor(String author) {
+  	 if (authors == null) {
+  	 	authors = new ArrayList();
+  	 }
+    authors.add(author);
+  }
+
+  private String version;
+  /** <p>Returns the JavaDoc version field or null, if there is no
+   * version field.</p>
+   *
+   * @see #setVersion
+   */
+  public String getVersion() { return version; }
+  /** <p>Sets the JavaDoc version field. Use null to disable the version field.</p>
+   *
+   * @see #getVersion
+   */
+  public void setVersion(String pVersion) {
+    version = (pVersion != null  &&  pVersion.length() > 0) ? pVersion : null;
+  }
+
+  private String returns;
+  /** <p>Returns the JavaDoc return field or null, if there is no
+   * return field.</p>
+   *
+   * @see #setReturn
+   */
+  public String getReturn() { return returns; }
+  /** <p>Sets the JavaDoc return field. Use null to disable the return field.</p>
+   *
+   * @see #getReturn
+   */
+  public void setReturn(String pReturns) {
+    returns = (pReturns != null  &&  pReturns.length() > 0) ? pReturns : null;
+  }
+
+  private List see = new ArrayList();
+  /** <p>Returns an array list of Strings which should be used for "see" fields.</p>
+   *
+   * @see #addSee
+   */
+  public List getSee() { return see; }
+  /** <p>Adds an element to the list of Strings which should be used for
+   * "see" fields.</p>
+   *
+   * @see #getSee
+   */
+  public void addSee(String pSee) { see.add(pSee); }
+
+  private ArrayList lines = new ArrayList();
+  /** <p>Returns an array of lines being the comments content.</p>
+   *
+   * @see #addLine
+   */
+  public ArrayList getLines() { return lines; }
+  /** <p>Adds a line to the comments content.</p>
+   *
+   * @see #getLines
+   */
+  public void addLine(String s) {
+    if (s == null) s = "";
+    boolean done = false;
+    for (java.util.StringTokenizer st = new java.util.StringTokenizer(s, "\n");
+         st.hasMoreTokens();  ) {
+      String t = st.nextToken();
+      if (t.length() > 0  &&  t.charAt(t.length()-1) == '\r') {
+        t = t.substring(0, t.charAt(t.length()-1));
+      }
+      lines.add(t);
+      done = true;
+    }
+    if (!done) lines.add("");
+  }
+
+  private List params = new ArrayList();
+  /** <p>Returns an array of values for the JavaDoc param field.</p>
+   *
+   * @see #addParam
+   */
+  public List getParams() { return params; }
+  /** <p>Adds a JavaDoc "param" field.</p>
+   *
+   * @see #getParams
+   */
+  public void addParam(String s) { params.add(s); }
+
+  private List throwsList = new ArrayList();
+  /** <p>Returns an array of values for the JavaDoc throw field.</p>
+   *
+   * @see #addThrows
+   */
+  public List getThrows() { return throwsList; }
+  /** <p>Adds a JavaDoc "throw" field.</p>
+   *
+   * @see #getThrows
+   */
+  public void addThrows(String s) { throwsList.add(s); }
+
+  /** <p>Returns a string representation of this comment.</p>
+   */
+  public void write(IndentationTarget pTarget) throws IOException {
+    String sep = "/*" + (forJavaDoc ? "* " : " ");
+    String othersep = " * ";
+    if (lines.size() > 0) {
+      for (int i = 0;  i < lines.size();  i++) {
+        if (i > 0) pTarget.indent(0);
+        pTarget.write(sep);
+        pTarget.write(lines.get(i).toString());
+        pTarget.write();
+        sep = othersep;
+      }
+    } else {
+      pTarget.write(sep);
+      pTarget.write();
+      sep = othersep;
+    }
+    pTarget.indent(0);
+    pTarget.write(sep);
+    pTarget.write();
+
+    for (int i = 0;  i < params.size();  i++) {
+      pTarget.indent(0);
+      pTarget.write(sep);
+      pTarget.write("@param ");
+      pTarget.write(params.get(i).toString());
+      pTarget.write();
+    }
+    if (returns != null) {
+      pTarget.indent(0);
+      pTarget.write(sep);
+      pTarget.write("@return ");
+      pTarget.write(returns);
+      pTarget.write();
+    }
+    for (int i = 0;  i < throwsList.size();  i++) {
+      pTarget.indent(0);
+      pTarget.write(sep);
+      pTarget.write("@throws ");
+      pTarget.write(throwsList.get(i).toString());
+      pTarget.write();
+    }
+    for (int i = 0;  i < see.size();  i++) {
+      pTarget.indent(0);
+      pTarget.write(sep);
+      pTarget.write("@see ");
+      pTarget.write(see.get(i).toString());
+      pTarget.write();
+    }
+    List myAuthors = getAuthors();
+    if (myAuthors != null) {
+  		for (Iterator iter = myAuthors.iterator();  iter.hasNext();  ) {
+        pTarget.indent(0);
+        pTarget.write(sep);
+        pTarget.write("@author ");
+		    pTarget.write((String) iter.next());
+        pTarget.write();
+      }
+    }
+    if (version != null) {
+      pTarget.indent(0);
+      pTarget.write(sep);
+      pTarget.write("@version ");
+      pTarget.write(version);
+      pTarget.write();
+    }
+    pTarget.indent(0);
+    pTarget.write(" */");
+    pTarget.write();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaConstructor.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaConstructor.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaConstructor.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+
+/** <p>An implementation of a Java constructor.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaConstructor extends AbstractJavaMethod {
+  /** Creates a new JavaConstructor with the given protection */
+  JavaConstructor(String pName, JavaSource.Protection pProtection) {
+    super(pName, null, pProtection);
+  }
+
+  public String getName() {
+  	 String name = super.getName();
+  	 int offset = name.lastIndexOf('$');
+  	 if (offset > -1) {
+  	 	return name.substring(offset+1);
+  	 } else {
+  	 	return name;
+  	 }
+  }
+
+  protected void writeHeader(IndentationTarget pTarget) throws IOException {
+    if (pTarget.isInterface()) {
+      return;
+    }
+    pTarget.indent(0);
+    JavaSource.Protection protection = getProtection();
+    if (protection != null  &&  !protection.equals(JavaSource.DEFAULT_PROTECTION)) {
+      pTarget.write(getProtection().toString());
+      pTarget.write(" ");
+    }
+    pTarget.write(getName());
+    pTarget.write("(");
+    Parameter[] params = getParams();
+    for (int i = 0;  i < params.length;  i++) {
+      if (i > 0) {
+        pTarget.write(", ");
+      }
+      Parameter p = params[i];
+      pTarget.write(pTarget.asString(p.getType()));
+      pTarget.write(" ");
+      pTarget.write(p.getName());
+    }
+    pTarget.write(")");
+    JavaQName[] exceptions = getExceptions();
+    for (int i = 0;  i < exceptions.length; i++) {
+        if (i > 0) {
+          pTarget.write(", ");
+        } else {
+          pTarget.write(" throws ");
+        }
+      pTarget.write(pTarget.asString(exceptions[i]));
+    }
+    pTarget.write(" {");
+    pTarget.write();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaField.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaField.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaField.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+
+/** <p>Implements a field that a java class or interface may have.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaField extends JavaSourceObject implements DirectAccessible {
+  private class MyTarget implements IndentationTarget {
+    private StringBuffer sb = new StringBuffer();
+    private IndentationTarget actualTarget;
+    private MyTarget(IndentationTarget pActualTarget) {
+      actualTarget = pActualTarget;
+    }
+    public boolean isInterface() {
+      return actualTarget.isInterface();
+    }
+    public String asString(JavaQName pQName) {
+      return actualTarget.asString(pQName);
+    }
+    public void write(String pValue) {
+      sb.append(pValue);
+    }
+    public void write() {
+      sb.append("\n");
+    }
+    public void indent(int i) {
+    }
+    public String getResult() { return sb.toString(); }
+  }
+
+  private boolean isTransient;
+  private boolean isNullable = true;
+
+  /** <p>Creates a new JavaField with the given name, type and
+   * protection.</p>
+   */
+  JavaField(String pName, JavaQName pType, JavaSource.Protection pProtection) {
+    super(pName, pType, pProtection);
+  }
+
+  /** <p>Sets whether the field is transient. By default it isn't.</p>
+   */
+  public void setTransient(boolean pTransient) {
+  	 isTransient = pTransient;
+  }
+
+  /** <p>Returns whether the field is transient. By default it isn't.</p>
+	*/
+  public boolean isTransient() {
+	 return isTransient;
+  }
+
+
+  /** <p>Returns a string representation of this field.</p>
+   */
+  public void write(IndentationTarget pTarget) throws IOException {
+    pTarget.indent(0);
+    writeNoEol(pTarget);
+    pTarget.write();
+  }
+
+  protected void writeNoEol(IndentationTarget pTarget) throws IOException {
+    if (pTarget.isInterface()) {
+      return;
+    }
+    JavaComment jcon = getComment();
+    if (jcon != null) {
+      jcon.write(pTarget);
+      pTarget.indent(0);
+    }
+    JavaSource.Protection protection = getProtection();
+    if (protection != null  &&  !protection.equals(JavaSource.DEFAULT_PROTECTION)) {
+      pTarget.write(protection.toString());
+      pTarget.write(" ");
+    }
+    if (isFinal()) {
+      pTarget.write("final ");
+    }
+    if (isStatic()) {
+      pTarget.write("static ");
+    }
+    if (isTransient()) {
+    	pTarget.write("transient ");
+    }
+    pTarget.write(pTarget.asString(getType()));
+    pTarget.write(" ");
+    pTarget.write(getName());
+    if (isEmpty()) {
+      pTarget.write(";");
+    } else {
+      pTarget.write(" = ");
+      MyTarget mt = new MyTarget(pTarget);
+      super.write(mt);
+      String result = mt.getResult();
+      if (result.endsWith("\r\n")) {
+        result = result.substring(0, result.length()-2);
+      } else if (result.endsWith("\n")) {
+        result = result.substring(0, result.length()-1);
+      }
+      pTarget.write(result);
+      if (!result.endsWith(";")) {
+        pTarget.write(";");
+      }
+    }
+  }
+
+  public void setValue(Object pValue) {
+    clear();
+    addLine(pValue);
+  }
+
+  public boolean isNullable() { return isNullable; }
+  public void setNullable(boolean pNullable) { isNullable = pNullable; }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaInnerClass.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaInnerClass.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaInnerClass.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+
+/** <p>Implements an inner class.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaInnerClass extends JavaSource {
+  /** <p>Creates a new JavaInnerClass with the given protection.</p>
+   *
+   * @param pPackage The package name; null or empty string indicates
+   *   the root package
+   * @param pName The class or interface name
+   * @param pProtection null, "public", "protected" or "private"
+   */
+  JavaInnerClass(JavaSource pOuterClass, JavaQName pName, Protection pProtection) {
+    super(pOuterClass.getFactory(), pName, pProtection);
+    outerClass = pOuterClass;
+  }
+
+  JavaSource outerClass;
+  /** <p>Returns the outer JavaSource instance.</p>
+   */
+  public JavaSource getOuterClass() {
+    return outerClass;
+  }
+
+  /** <p>Throws an exception, as inner classes don't have import
+   * statements.</p>
+   */
+  public void addImport(String s) {
+    throw new IllegalArgumentException("Inner classes must not use the import statement");
+  }
+
+  /** <p>Returns whether this inner class is static.</p>
+   */
+  public boolean getStatic() {
+    return super.getStatic();
+  }
+
+  /** <p>Sets whether this inner class is static.</p>
+   */
+  public void setStatic(boolean pStatic) {
+    super.setStatic(pStatic);
+  }
+
+  /** <p>Returns, whether this is an inner class.</p>
+	*/
+  public boolean isInnerClass() {
+	  return true;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaMethod.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaMethod.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaMethod.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+
+/** <p>Implements a Java method.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaMethod extends AbstractJavaMethod {
+  private boolean isSynchronized;
+
+  /** <p>Creates a new JavaMethod with the given name, return
+   * type and protection.</p>
+   */
+  JavaMethod(String pName, JavaQName pType, JavaSource.Protection pProtection) {
+    super(pName, pType, pProtection);
+  }
+
+  /** <p>Sets whether this method is synchronized.</p>
+   */
+  public void setSynchronized(boolean pSynchronized) {
+    isSynchronized = pSynchronized;
+  }
+
+  /** <p>Returns whether this method is synchronized.</p>
+	*/
+  public boolean isSynchronized() {
+    return isSynchronized;
+  }
+
+  /** <p>Adds a header line.</p>
+   */
+  protected void writeHeader(IndentationTarget pTarget) throws IOException {
+    pTarget.indent(0);
+    JavaSource.Protection protection = getProtection();
+    if (protection != null  &&  !protection.equals(JavaSource.DEFAULT_PROTECTION)) {
+      pTarget.write(getProtection().toString());
+      pTarget.write(" ");
+    }
+    if (isStatic()) {
+      pTarget.write("static ");
+    }
+    if (isFinal()) {
+      pTarget.write("final ");
+    }
+    if (isAbstract()) {
+      pTarget.write("abstract ");
+    }
+    if (isSynchronized()  &&  !pTarget.isInterface()) {
+    	pTarget.write("synchronized ");
+    }
+	 pTarget.write(pTarget.asString(getType()));
+    pTarget.write(" ");
+    pTarget.write(getName());
+    pTarget.write("(");
+    Parameter[] params = getParams();
+    for (int i = 0;  i < params.length;  i++) {
+      if (i > 0) {
+        pTarget.write(", ");
+      }
+      Parameter p = params[i];
+      pTarget.write(pTarget.asString(p.getType()) );
+      pTarget.write(" ");
+      pTarget.write(p.getName());
+    }
+    pTarget.write(")");
+    JavaQName[] exceptions = getExceptions();
+    for (int i = 0;  i < exceptions.length; i++) {
+        if (i > 0) {
+          pTarget.write(", ");
+        } else {
+          pTarget.write(" throws ");
+        }
+      pTarget.write(pTarget.asString(exceptions[i]));
+    }
+    if (pTarget.isInterface()  ||  isAbstract()) {
+      pTarget.write(";");
+    } else {
+      pTarget.write(" {");
+    }
+    pTarget.write();
+  }
+
+  /** <p>Returns the abbreviated method signature: The method name, followed
+   * by the parameter types. This is typically used in logging statements.</p>
+   */
+  public String getLoggingSignature() {
+    StringBuffer result = new StringBuffer(getName());
+    Parameter[] params = getParams();
+    if (params.length > 0) {
+      result.append('(');
+      for (int i = 0; i < params.length; i++) {
+        if (i > 0) { result.append(','); }
+        result.append(params[i].getType().getClassName());
+      }
+      result.append(')');
+    }
+    return result.toString();
+  }
+
+  /** <p>Returns whether the JavaMethod is void.</p>
+   */
+  public boolean isVoid() {
+    return getType().equals(JavaQNameImpl.VOID);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.Serializable;
+
+
+/** <p>A qualified class name, including package name. Instances
+ * of JavaQName are obtained by invoking private methods of the
+ * class JavaQNameImpl.</p>
+ */
+public interface JavaQName extends Comparable, Serializable {
+	/** <p>Returns the JavaQName's package name. The empty string
+	 * represents the default package.</p>
+	 */
+	public String getPackageName();
+	
+	/** <p>Returns the JavaQName's class name. This is the composition of
+	 * {@link #getOuterClassName()} and {@link #getInnerClassName}.</p>
+	 */
+	public String getClassName();
+	
+	/** <p>If the class is an inner class: Returns the name of the enclosing
+	 * class. Otherwise returns null.</p>
+	 */
+	public String getOuterClassName();
+	
+	/** <p>If the class is an inner class: Returns the name of the inner
+	 * class. Otherwise returns {@link #getClassName()}.</p>
+	 */
+	public String getInnerClassName();
+	
+	/** <p>Returns whether the class described by the JavaQName is
+	 * actually an array class. If so, you may use the
+	 * <code>getInstanceClass()</code> method to determine the
+	 * JavaQName of the array elements.</p>
+	 */
+	public boolean isArray();
+	
+	/** <p>If the method <code>isArray()</code> returns true,
+	 * you may use this method to obtain the instance class.</p>
+	 * 
+	 * @throws IllegalStateException This JavaQName is no array,
+	 *   and <code>isArray()</code> returns false.
+	 */
+	public JavaQName getInstanceClass();
+	
+	/** <p>Returns whether this is a primitive class. Primitive classes
+	 * are {@link JavaQNameImpl#VOID}, {@link JavaQNameImpl#BOOLEAN},
+	 * {@link JavaQNameImpl#BYTE}, {@link JavaQNameImpl#SHORT},
+	 * {@link JavaQNameImpl#INT}, {@link JavaQNameImpl#LONG},
+	 * {@link JavaQNameImpl#FLOAT}, {@link JavaQNameImpl#DOUBLE}, and
+	 * {@link JavaQNameImpl#CHAR}.</p>
+	 */
+	public boolean isPrimitive();
+	
+	/** <p>Returns whether this class may be imported. For instance,
+	 * this is not the case for primitive classes.</p>
+	 */
+	public boolean isImportable();
+	
+	/** <p>Returns whether this class is an inner class.</p>
+	 */
+	public boolean isInnerClass();
+	
+	/** If the class is primitive: Returns the corresponding
+	 * object type.
+	 */
+	public JavaQName getObjectType();
+
+	/** If the class is primitive: Returns the name of the
+	 * corresponding object classes method for converting
+	 * the object into a primitive value.
+	 */
+	public String getPrimitiveConversionMethod();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQNameImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQNameImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaQNameImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+
+/** <p>Accessor class for JavaQName.</p>
+ * 
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JavaQNameImpl.java 232162 2005-07-28 19:47:58Z jochen $
+ */
+public class JavaQNameImpl {
+  private static final Map names = new HashMap();
+  private abstract static class DefaultImpl implements JavaQName {
+    public int compareTo(Object pOther) {
+      JavaQName other = (JavaQName) pOther;
+      if (isArray()) {
+        if (!other.isArray()) {
+          return -1;
+        } else {
+          return getInstanceClass().compareTo(other.getInstanceClass());
+        }
+      } else {
+        if (other.isArray()) {
+          return 1;
+        }
+      }
+      int result = getPackageName().compareTo(other.getPackageName());
+      if (result != 0) {
+        return result;
+      }
+      result = getClassName().compareTo(other.getClassName());
+      if (result != 0) {
+        return result;
+      }
+      return 0;
+    }
+    public int hashCode() {
+      return getPackageName().hashCode() + getClassName().hashCode();
+    }
+    public boolean equals(Object pOther) {
+      if (pOther == null  ||  !(pOther instanceof JavaQName)) { return false; }
+      return compareTo(pOther) == 0;
+    }
+  }
+
+
+  private static class StandardImpl extends DefaultImpl {
+    private String packageName, className;
+    public StandardImpl(String pPackageName, String pClassName) {
+      checkPackageName(pPackageName);
+      packageName = pPackageName;
+      className = pClassName;
+    }
+    protected void checkPackageName(String pPackageName) {
+      for (StringTokenizer st = new StringTokenizer(pPackageName, ".");
+           st.hasMoreTokens();  ) {
+        String tok = st.nextToken();
+        if (tok.length() == 0) {
+          throw new IllegalArgumentException("Invalid package name: " + pPackageName);
+        }
+        for (int i = 0;  i < tok.length(); i++) {
+          char c = tok.charAt(i);
+          if ((i == 0  &&  !Character.isJavaIdentifierStart(c))  ||
+              (i > 0  &&  !Character.isJavaIdentifierPart(c))) {
+            throw new IllegalArgumentException("Invalid package name: " + pPackageName);
+          }
+        }
+      }
+    }
+    public String getPackageName() { return packageName; }
+    public String getClassName() { return className; }
+    public boolean isArray() { return false; }
+    public JavaQName getInstanceClass() {
+      throw new IllegalStateException("The class " + this + "is not an array class.");
+    }
+    public boolean isImportable() { return true; }
+    public boolean isPrimitive() { return false; }
+    public String toString() {
+      String c = getClassName();
+      String p = getPackageName();
+      return p.length() > 0 ? (p + "." + c) : c;
+    }
+    public String getOuterClassName() {
+      int offset = className.lastIndexOf('$');
+      if (offset == -1) {
+        return null;
+      } else {
+        return className.substring(0, offset);
+      }
+    }
+    public String getInnerClassName() {
+      int offset = className.lastIndexOf('$');
+      if (offset == -1) {
+        return className;
+      } else {
+        return className.substring(offset+1);
+      }
+    }
+    public boolean isInnerClass() { return className.indexOf('$') > 0; }
+	public JavaQName getObjectType() { return null; }
+	public String getPrimitiveConversionMethod() { return null; }
+  }
+
+  private static class PrimitiveImpl extends StandardImpl {
+	private final JavaQName objectType;
+	private final String primitiveConversionMethod;
+	public PrimitiveImpl(String pClassName, JavaQName pObjectType, String pConversionMethod) {
+      super("", pClassName);
+	  objectType = pObjectType;
+	  primitiveConversionMethod = pConversionMethod;
+    }
+    public boolean isImportable() { return false; }
+    public boolean isPrimitive() { return true; }
+    public void checkPackageName() {}
+    public String toString() { return getClassName(); }
+	public JavaQName getObjectType() { return objectType; }
+	public String getPrimitiveConversionMethod() { return primitiveConversionMethod; }
+  }
+
+  private static class ArrayImpl extends DefaultImpl {
+    private JavaQName qName;
+    public ArrayImpl(JavaQName pQName) {
+      qName = pQName;
+    }
+    public String getPackageName() { return qName.getPackageName(); }
+    public String getClassName() { return qName.getClassName(); }
+    public boolean isArray() { return true; }
+    public boolean isImportable() { return false; }
+    public boolean isPrimitive() { return false; }
+    public JavaQName getInstanceClass() { return qName; }
+    public String toString() { return qName.toString() + "[]"; }
+    public String getOuterClassName() { return null; }
+    public String getInnerClassName() { return qName.getClassName(); }
+    public boolean isInnerClass() { return false; }
+	public JavaQName getObjectType() { return null; }
+	public String getPrimitiveConversionMethod() { return null; }
+  }
+
+  /** <p>For use in return types or method parameters: The
+   * void type.</p>
+   */
+  public static final JavaQName VOID = new PrimitiveImpl(void.class.getName(), null, null);
+  /** <p>For use in return types or method parameters: The
+   * boolean type.</p>
+   */
+  public static final JavaQName BOOLEAN = new PrimitiveImpl(boolean.class.getName(), JavaQNameImpl.getInstance(Boolean.class), "booleanValue()");
+  /** <p>For use in return types or method parameters: The
+   * byte type.</p>
+   */
+  public static final JavaQName BYTE = new PrimitiveImpl(byte.class.getName(), JavaQNameImpl.getInstance(Byte.class), "byteValue");
+  /** <p>For use in return types or method parameters: The
+   * short type.</p>
+   */
+  public static final JavaQName SHORT = new PrimitiveImpl(short.class.getName(), JavaQNameImpl.getInstance(Short.class), "shortValue");
+  /** <p>For use in return types or method parameters: The
+   * int type.</p>
+   */
+  public static final JavaQName INT = new PrimitiveImpl(int.class.getName(), JavaQNameImpl.getInstance(Integer.class), "intValue");
+  /** <p>For use in return types or method parameters: The
+   * long type.</p>
+   */
+  public static final JavaQName LONG = new PrimitiveImpl(long.class.getName(), JavaQNameImpl.getInstance(Long.class), "longValue");
+  /** <p>For use in return types or method parameters: The
+   * float type.</p>
+   */
+  public static final JavaQName FLOAT = new PrimitiveImpl(float.class.getName(), JavaQNameImpl.getInstance(Float.class), "floatValue");
+  /** <p>For use in return types or method parameters: The
+   * double type.</p>
+   */
+  public static final JavaQName DOUBLE = new PrimitiveImpl(double.class.getName(), JavaQNameImpl.getInstance(Double.class), "doubleValue");
+  /** <p>For use in return types or method parameters: The
+   * char type.</p>
+   */
+  public static final JavaQName CHAR = new PrimitiveImpl(char.class.getName(), JavaQNameImpl.getInstance(Character.class), "charValue");
+
+  private static final JavaQName[] primitives = new JavaQName[]{
+    VOID, BOOLEAN, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, CHAR
+  };
+  private static final Class[] primitiveClasses = new Class[]{
+    void.class, boolean.class, byte.class, short.class, int.class,
+    long.class, float.class, double.class, char.class
+  };
+
+  public static JavaQName getInstance(Class pClass) {
+    if (pClass.isArray()) {
+    	return getArray(getInstance(pClass.getComponentType()));
+    }
+    if (pClass.isPrimitive()) {
+      for (int i = 0;  i < primitives.length;  i++) {
+        if (primitiveClasses[i].equals(pClass)) {
+          return primitives[i];
+        }
+      }
+      throw new IllegalArgumentException("Unknown primitive type: " + pClass.getClass().getName());
+    }
+    if (void.class.equals(pClass)) {
+      return VOID;
+    }
+
+    String name = pClass.getName();
+    int offset = name.lastIndexOf('.');
+    if (offset == -1) {
+      return getInstance(null, name);
+    } else {
+      return getInstance(name.substring(0, offset),
+                          name.substring(offset+1));
+    }
+  }
+
+  public static JavaQName getInstance(String pPackageName, String pClassName) {
+    if (pClassName == null  ||  pClassName.length() == 0) {
+      throw new NullPointerException("The class name must not be null or empty.");
+    }
+    String name;
+    if (pPackageName == null  ||  pPackageName.length() == 0) {
+      for (int i = 0;  i < primitives.length;  i++) {
+        if (primitiveClasses[i].getName().equals(pClassName)) {
+          return primitives[i];
+        }
+      }
+      name = pClassName;
+      pPackageName = "";
+    } else {
+      name = pPackageName + "." + pClassName;
+    }
+    JavaQName result;
+    synchronized (names) {
+      result = (JavaQName) names.get(name);
+      if (result == null) {
+        if (pClassName.endsWith("[]")) {
+          String instanceClassName = pClassName.substring(0, pClassName.length()-2);
+          JavaQName instanceClass = getInstance(pPackageName, instanceClassName);
+          result = new ArrayImpl(instanceClass);
+        } else {
+          result = new StandardImpl(pPackageName, pClassName);
+        }
+        names.put(name, result);
+      }
+    }
+    return result;
+  }
+
+  /** <p>Returns an instance with the given class name.</p>
+   * @param pClassName The class name
+   */
+  public static JavaQName getInstance(String pClassName) {
+	  int offset = pClassName.lastIndexOf('.');
+	  if (offset == -1) {
+		  return getInstance(null, pClassName);
+	  } else {
+		  return getInstance(pClassName.substring(0, offset), pClassName.substring(offset+1));
+	  }
+  }
+
+  /** Returns an instance of {@link JavaQName}, which represents
+   * an array. The array elements are instances of <code>pQName</code>.
+   */
+  public static JavaQName getArray(JavaQName pQName) {
+    String name = pQName.toString() + "[]";
+    JavaQName result;
+    synchronized (names) {
+      result = (JavaQName) names.get(name);
+      if (result == null) {
+        result = new ArrayImpl(pQName);
+        names.put(name, result);
+      }
+    }
+    return result;
+  }
+
+  /** <p>Returns the fully qualified name of an inner class of
+   * <code>pQName</code> with the name <code>pInnerClassName</code>.</p>
+   */
+  public static JavaQName getInnerInstance(JavaQName pQName, String pInnerClassName) {
+  	 return getInstance(pQName.getPackageName(), pQName.getClassName() + "$" + pInnerClassName);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSource.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSource.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSource.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1336 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+
+
+/** A class representing a Java source file.
+ */
+public class JavaSource extends IndentationEngineImpl {
+	/** Specifies the type of a java class (interface, or class).
+	 */
+    public static class Type implements Serializable {
+		private static final long serialVersionUID = -9130708752353639211L;
+		private String name;
+    	Type(String pName) {
+    		name = pName;
+    	}
+    	public String toString() { return name; }
+    	/** Converts the given string into a java class type.
+    	 */
+        public static Type valueOf(String pType) {
+    		if ("class".equals(pType)) {
+    			return CLASS;
+    		} else if ("interface".equals(pType)) {
+    			return INTERFACE;
+    		} else {
+    			throw new IllegalArgumentException("Type must be either 'class' or 'interface'.");
+    		}
+    	}
+    }
+
+    /** Specifies a java objects protection (default, public,
+     * protected, or private).
+     */
+    public static class Protection implements Serializable {
+		private static final long serialVersionUID = 1184782160268911467L;
+		private String name;
+    	Protection(String pName) {
+    		name = pName;
+    	}
+    	public String toString() { return name; }
+    	/** Converts the given string into a protection type.
+    	 */
+        public static Protection valueOf(String pProtection) {
+    		if ("public".equals(pProtection)) {
+    			return PUBLIC;
+    		} else if ("protected".equals(pProtection)) {
+    			return PROTECTED;
+    		} else if ("private".equals(pProtection)) {
+    			return PRIVATE;
+    		} else if (pProtection == null  ||  "".equals(pProtection)) {
+    			return DEFAULT_PROTECTION;
+    		} else {
+    			throw new IllegalArgumentException("Protection must be either 'public', 'protected', 'private', null or '' (default protection).");
+    		}
+    	}
+    	/** Returns an instance of Protection by using the methods
+    	 * {@link Modifier#isPublic(int)}, {@link Modifier#isProtected(int)} and
+    	 * {@link Modifier#isPrivate(int)} on the argument <code>pModifiers</code>.
+    	 * If neither returns true, assumes {@link JavaSource#DEFAULT_PROTECTION}.
+    	 */
+    	public static Protection valueOf(int pModifiers) {
+    		if (Modifier.isPublic(pModifiers)) {
+    			return PUBLIC;
+    		} else if (Modifier.isProtected(pModifiers)) {
+    			return PROTECTED;
+    		} else if (Modifier.isPrivate(pModifiers)) {
+    			return PRIVATE;
+    		} else {
+    			return DEFAULT_PROTECTION;
+    		}
+    	}
+    }
+
+    /** Type of a JavaSource class.
+     * @see #INTERFACE
+     * @see #getType
+     * @see #setType
+     */
+    public static final Type CLASS = new Type("class");
+    
+    /** Type of a JavaSource interface.
+     * @see #CLASS
+     * @see #getType
+     * @see #setType
+     */
+    public static final Type INTERFACE = new Type("interface");
+    
+    /** Protection of a class, field or method: public
+     */
+    public static final Protection PUBLIC = new Protection("public");
+    
+    /** Protection of a class, field or method: protected
+     */
+    public static final Protection PROTECTED = new Protection("protected");
+    
+    /** Protection of a class, field or method: private
+     */
+    public static final Protection PRIVATE = new Protection("private");
+    
+    /** Default protection of a class, field or method
+     */
+    public static final Protection DEFAULT_PROTECTION = new Protection("");
+    
+    /** Creates a new instance of JavaSource with the given protection.
+     * @param pFactory The {@link JavaSourceFactory factory} creating this
+     *   instance of JavaSource.
+     * @param pName The class or interface name
+     * @param pProtection null, "public", "protected" or "private"
+     */
+    JavaSource(JavaSourceFactory pFactory, JavaQName pName, Protection pProtection) {
+    	factory = pFactory;
+    	setQName(pName);
+    	setProtection(pProtection);
+    }
+    
+    List myObjects = new ArrayList();
+    
+    /** Returns the static class initializers.
+     */
+    public JavaClassInitializer[] getClassInitializers() {
+    	List result = new ArrayList(myObjects);
+    	for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
+    		ConditionalIndentationJavaSourceObject object =
+    			(ConditionalIndentationJavaSourceObject) iter.next();
+    		if (object instanceof JavaClassInitializer) {
+    			result.add(object);
+    		}
+    	}
+    	return (JavaClassInitializer[]) result.toArray(new JavaClassInitializer[result.size()]);
+    }
+    
+    private JavaSourceFactory factory;
+
+    /** Returns the {@link JavaSourceFactory} that created this instance of
+     * JavaSource.
+     */
+    public JavaSourceFactory getFactory() {
+    	return factory;
+    }
+    
+    private JavaQName myQName;
+    /** Returns the JavaSource's JavaQName.
+     */
+    public JavaQName getQName() {
+    	return myQName;
+    }
+    /** Sets the JavaSource's JavaQName.
+     */
+    public void setQName(JavaQName pQName) {
+    	myQName = pQName;
+    }
+    /** Returns the class or interface name.
+     * @see #setQName
+     */
+    public String getClassName() { return myQName.getClassName(); }
+    /** Returns the package name. The empty String represents the
+     * root package.
+     */
+    public String getPackageName() { return myQName.getPackageName(); }
+    
+    private Protection myProtection;
+    /** Returns the protection.
+     * @see #setProtection
+     */
+    public Protection getProtection() { return myProtection; }
+    /** Sets the protection; use null for default protection.
+     * @see #getProtection
+     */
+    public void setProtection(Protection protection) {
+    	myProtection = (protection == null) ? DEFAULT_PROTECTION : protection;
+    }
+    
+    private Type type = CLASS;
+    /** Returns the JavaSource type.
+     * @return "class" or "interface"
+     * @see #setType
+     */
+    public Type getType() { return type; }
+    /** Sets the JavaSource type.
+     * @param pType "class" or "interface"
+     * @see #getType
+     */
+    public void setType(Type pType) {
+    	this.type = (pType == null) ? CLASS : pType;
+    }
+    
+    private JavaComment comment;
+    /** Returns the comment describing this class or interface.
+     * @see #newComment
+     */
+    public JavaComment getComment() { return comment; }
+    /** Creates a new Javadoc comment describing this class or interface.
+     * @see #getComment
+     */
+    public JavaComment newComment() {
+    	if (comment == null) {
+    		comment = new JavaComment();
+    		return comment;
+    	} else {
+    		throw new IllegalStateException("A Javadoc comment has already been created for this object.");
+    	}
+    }
+    
+    private List extendedClasses;
+    /** Clears the list of extended classes or interfaces.
+     */
+    public void clearExtends() {
+    	extendedClasses = null;
+    }
+    /** Returns the class or interface extended by this class or interface.
+     * @see #addExtends(JavaQName)
+     */
+    public JavaQName[] getExtends() {
+    	if (extendedClasses == null) {
+    		return new JavaQName[0];
+    	} else {
+    		return (JavaQName[]) extendedClasses.toArray(new JavaQName[extendedClasses.size()]);
+    	}
+    }
+    /** Sets the class or interface extended by this class or interface.
+     * Null or the empty string disable the "extends" clause.
+     * @see #getExtends
+     */
+    public void addExtends(JavaQName pExtends) {
+    	if (extendedClasses == null) {
+    		extendedClasses = new ArrayList();
+    	} else if ("class".equals(getType())) {
+    		throw new IllegalStateException("Only interfaces may extend multiple classes.");
+    	}
+    	extendedClasses.add(pExtends);
+    }
+    /** Sets the class or interface extended by this class or interface.
+     * Null or the empty string disable the "extends" clause.
+     * @see #getExtends
+     */
+    public void addExtends(Class pExtends) {
+    	addExtends(JavaQNameImpl.getInstance(pExtends));
+    }
+    
+    /** Returns whether the class is extending the given super class or interface.
+     */
+    public boolean isExtending(JavaQName pClass) {
+    	for (Iterator iter = extendedClasses.iterator();  iter.hasNext();  ) {
+    		if (iter.next().equals(pClass)) {
+    			return true;
+    		}
+    	}
+    	return false;
+    }
+    
+    /** Returns whether the class is extending the given super class or interface.
+     */
+    public boolean isExtending(Class pClass) {
+    	return isExtending(JavaQNameImpl.getInstance(pClass));
+    }
+    
+    private ArrayList imports = new ArrayList();
+    /** Returns the list of packages and classes being imported.
+     * @see #addImport(JavaQName)
+     */
+    public JavaQName[] getImports() {
+    	return (JavaQName[]) imports.toArray(new JavaQName[imports.size()]);
+    }
+    
+    /** Adds a package or class to the list of packages and classes being imported.
+     * @see #getImports()
+     */
+    public void addImport(JavaQName s) {
+    	if (s.isArray()) {
+    		throw new IllegalArgumentException("Arrays cannot be imported");
+    	}
+    	imports.add(s);
+    }
+    
+    /** Adds a package or class to the list of packages and classes being imported.
+     * @see #addImport(JavaQName)
+     */
+    public void addImport(Class s) { imports.add(JavaQNameImpl.getInstance(s)); }
+    
+    /** Clears the list of imports.
+     */
+    public void clearImports() { imports.clear(); }
+    
+    private ArrayList myImplements = new ArrayList();
+    /** Returns the list of interfaces being implented by this class or
+     * interface.
+     * @see #addImplements(JavaQName)
+     */
+    public JavaQName[] getImplements() {
+    	return (JavaQName[]) myImplements.toArray(new JavaQName[myImplements.size()]);
+    }
+    
+    /** Adds an interface to the list of interfaces being implemented by
+     * this class or interface.
+     * @see #getImplements()
+     */
+    public void addImplements(JavaQName s) { myImplements.add(s); }
+    
+    /** Adds an interface to the list of interfaces being implemented by
+     * this class or interface.
+     * @see #getImplements()
+     */
+    public void addImplements(Class s) { myImplements.add(JavaQNameImpl.getInstance(s)); }
+    
+    /** Clears the list of implemented interfaces.
+     */
+    public void clearImplements() { myImplements.clear(); }
+    
+    /** Returns whether the class is implementing the given interface.
+     */
+    public boolean isImplementing(JavaQName pClass) {
+    	for (Iterator iter = myImplements.iterator();  iter.hasNext();  ) {
+    		if (iter.next().equals(pClass)) {
+    			return true;
+    		}
+    	}
+    	return false;
+    }
+    
+    /** Returns whether the class is implementing the given interface.
+     */
+    public boolean isImplementing(Class pClass) {
+    	return isImplementing(JavaQNameImpl.getInstance(pClass));
+    }
+    
+    private ArrayList myFields = new ArrayList();
+    /** Returns the field with the given name or null, if no such field exists.
+     */
+    public JavaField getField(String pName) {
+    	if (pName == null) {
+    		throw new NullPointerException("A field name must not be null.");
+    	}
+    	JavaField[] fields = getFields();
+    	for (int i = 0;  i < fields.length;  i++) {
+    		if (pName.equals(fields[i].getName())) {
+    			return fields[i];
+    		}
+    	}
+    	return null;
+    }
+    /** Returns the list of fields that this class has.
+     * @see #newJavaField(String, JavaQName, Protection)
+     */
+    public JavaField[] getFields() {
+    	return (JavaField[]) myFields.toArray(new JavaField[myFields.size()]);
+    }
+    /** Adds a field to this classes list of fields.
+     * @see #getFields
+     */
+    void addField(JavaField f) {
+    	String s = f.getName();
+    	for (int i = 0;  i < myFields.size();  i++) {
+    		if (s.equals(((JavaField) myFields.get(i)).getName())) {
+    			throw new IllegalStateException("The class " + getQName() + " already has a field " + s + ".");
+    		}
+    	}
+    	myFields.add(f);
+    }
+    
+    /** Returns the list of constructors that this class has.
+     * @see #newJavaConstructor(JavaConstructor, boolean)
+     */
+    public JavaConstructor[] getConstructors() {
+    	List result = new ArrayList();
+    	for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
+    		ConditionalIndentationJavaSourceObject object =
+    			(ConditionalIndentationJavaSourceObject) iter.next();
+    		if (object instanceof JavaConstructor) {
+    			result.add(object);
+    		}
+    	}
+    	return (JavaConstructor[]) result.toArray(new JavaConstructor[result.size()]);
+    }
+    /** Adds a constructor to this classes list of constructors.
+     * @see #getConstructors()
+     */
+    void addConstructor(JavaConstructor c) { myObjects.add(c); }
+    /** Returns an iterator the the classes constructors. This
+     * iterator allows to remove constructors.
+     */
+    public Iterator getConstructorIterator() {
+    	return new MyObjectIterator(JavaConstructor.class);
+    }
+    
+    /** Returns the list of methods that this class has.
+     * @see #newJavaMethod(String, JavaQName, Protection)
+     */
+    public JavaMethod[] getMethods() {
+    	List result = new ArrayList();
+    	for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
+    		ConditionalIndentationJavaSourceObject object = (ConditionalIndentationJavaSourceObject) iter.next();
+    		if (object instanceof JavaMethod) {
+    			result.add(object);
+    		}
+    	}
+    	return (JavaMethod[]) result.toArray(new JavaMethod[result.size()]);
+    }
+
+    private boolean isMatching(Parameter[] parameters, JavaQName[] pParams) {
+		if (parameters.length == pParams.length) {
+			for (int i = 0;  i < parameters.length;  i++) {
+				if (!parameters[i].getType().equals(pParams[i])) {
+					return false;
+				}
+			}
+			return true;
+		} else {
+			return false;
+		}
+    }
+
+    /** Returns the method with the given signature or null, if there
+     * is no such method.
+     */
+    public JavaMethod getMethod(String pMethodName, JavaQName[] pParams) {
+    	for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
+    		ConditionalIndentationJavaSourceObject object = (ConditionalIndentationJavaSourceObject) iter.next();
+    		if (object instanceof JavaMethod) {
+    			JavaMethod jm = (JavaMethod) object;
+    			if (jm.getName().equals(pMethodName)) {
+    				if (isMatching(jm.getParams(), pParams)) {
+    					return jm;
+    				}
+    			}
+    		}
+    	}
+    	return null;
+    }
+
+    /** Returns the constructor with the given signature or null, if there
+     * is no such constructor.
+     */
+    public JavaConstructor getConstructor(JavaQName[] pParams) {
+        for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
+            ConditionalIndentationJavaSourceObject object = 
+            	(ConditionalIndentationJavaSourceObject) iter.next();
+            if (object instanceof JavaConstructor) {
+                JavaConstructor jc = (JavaConstructor) object;
+                if (isMatching(jc.getParams(), pParams)) {
+                	return jc;
+                }
+            }
+        }
+        return null;
+    }
+
+    private class MyObjectIterator implements Iterator {
+    	private final Class instanceClass;
+    	MyObjectIterator(Class pInstanceClass) {
+    		instanceClass = pInstanceClass;
+    	}
+    	
+    	private Object result = null;
+    	private boolean mayRemove;
+    	private Iterator inner = myObjects.iterator();
+    	public void remove() {
+    		if (!mayRemove) {
+    			throw new IllegalStateException("remove() is only allowed immediately after next()");
+    		}
+    		inner.remove();
+    		mayRemove = false;
+    	}
+    	public boolean hasNext() {
+    		mayRemove = false;
+    		if (result != null) {
+    			return true;
+    		}
+    		while (inner.hasNext()) {
+    			Object o = inner.next();
+    			if (instanceClass.isAssignableFrom(o.getClass())) {
+    				result = o;
+    				return true;
+    			}
+    		}
+    		result = null;
+    		return false;
+    	}
+    	public Object next() {
+    		if (!hasNext()) {
+    			throw new NoSuchElementException();
+    		}
+    		Object myResult = result;
+    		result = null;
+    		mayRemove = true;
+    		return myResult;
+    	}
+    }
+    
+    /** Returns an iterator to the classes methods. This iterator
+     * allows to remove certain methods.
+     */
+    public Iterator getMethodIterator() {
+    	return new MyObjectIterator(JavaMethod.class);
+    }
+    
+    
+    /** Adds a method to this classes list of methods.
+     * @see #getMethods()
+     */
+    void addMethod(JavaMethod m) { myObjects.add(m); }
+    
+    
+    public void write(IndentationTarget pTarget) throws IOException {
+    	if (!isInnerClass()) {
+    		String packageName = getPackageName();
+    		if (packageName.length() > 0) {
+    			pTarget.indent(0);
+    			pTarget.write("package ");
+    			pTarget.write(packageName);
+    			pTarget.write(";");
+    			pTarget.write();
+    			pTarget.indent(0);
+    			pTarget.write();
+    		}
+    	}
+    	
+    	JavaQName[] myExtendedClasses = getExtends();
+    	JavaQName[] implementedInterfaces = getImplements();
+    	JavaInnerClass[] myInnerClasses = getInnerClasses();
+    	JavaField[] fields = getFields();
+    	getConstructors();
+    	getMethods();
+    	
+    	JavaQName[] myImports = getImports();
+    	Arrays.sort(myImports);
+    	if (myImports.length > 0) {
+    		for (int i = 0;  i < myImports.length;  i++) {
+    			pTarget.indent(0);
+    			pTarget.write("import ");
+    			pTarget.write(myImports[i].toString());
+    			pTarget.write(";");
+    			pTarget.write();
+    		}
+    		pTarget.indent(0);
+    		pTarget.write();
+    		pTarget.indent(0);
+    		pTarget.write();
+    	}
+    	if (comment != null) {
+    		comment.write(pTarget);
+    		pTarget.indent(0);
+    		pTarget.write();
+    	}
+    	
+    	pTarget.indent(0);
+    	if (myProtection != null  &&  !myProtection.equals(DEFAULT_PROTECTION)) {
+    		pTarget.write(myProtection.toString());
+    		pTarget.write(" ");
+    	}
+    	if (isStatic) {
+    		pTarget.write("static ");
+    	}
+    	if (isAbstract()) {
+    		pTarget.write("abstract ");
+    	}
+    	pTarget.write(getType().toString());
+    	pTarget.write(" ");
+    	String s = getClassName();
+    	int offset = s.lastIndexOf('.');
+    	if (offset > -1) {
+    		s = s.substring(offset+1);
+    	}
+    	offset = s.lastIndexOf('$');
+    	if (offset > -1) {
+    		s = s.substring(offset+1);
+    	}
+    	pTarget.write(s);
+    	pTarget.write(" ");
+    	for (int i = 0;  i < myExtendedClasses.length;  i++) {
+    		if (i > 0) {
+    			pTarget.write(", ");
+    		} else {
+    			pTarget.write("extends ");
+    		}
+    		pTarget.write(pTarget.asString(myExtendedClasses[i]));
+    		pTarget.write(" ");
+    	}
+    	if (implementedInterfaces.length > 0) {
+    		for (int i = 0;  i < implementedInterfaces.length;  i++) {
+    			if (i == 0) {
+    				pTarget.write("implements ");
+    			} else {
+    				pTarget.write(", ");
+    			}
+    			pTarget.write(pTarget.asString(implementedInterfaces[i]));
+    			pTarget.write(" ");
+    		}
+    	}
+    	pTarget.write("{");
+    	pTarget.write();
+    	
+    	IncreasingTarget increasingTarget = new IncreasingTarget(pTarget);
+    	for (int i = 0;  i < myInnerClasses.length;  i++) {
+    		increasingTarget.setInterface(myInnerClasses[i].isInterface() ?
+    				Boolean.TRUE : Boolean.FALSE);
+    		myInnerClasses[i].write(increasingTarget);
+    		increasingTarget.setInterface(null);
+    		pTarget.indent(0);
+    		pTarget.write();
+    	}
+    	
+    	if (fields != null  &&  fields.length > 0) {
+    		for (int i = 0;  i < fields.length;  i++) {
+    			fields[i].write(increasingTarget);
+    			pTarget.indent(0);
+    			pTarget.write();
+    		}
+    		pTarget.indent(0);
+    		pTarget.write();
+    	}
+    	
+    	for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
+    		ConditionalIndentationJavaSourceObject object =
+    			(ConditionalIndentationJavaSourceObject) iter.next();
+    		object.write(increasingTarget);
+    		pTarget.indent(0);
+    		pTarget.write();
+    	}
+    	
+    	String[] myRawJavaSources = getRawJavaSources();
+    	
+    	for (int i = 0;  i < myRawJavaSources.length;  i++) {
+    		for (StringTokenizer st = new StringTokenizer(myRawJavaSources[i], "\r\n");
+    		st.hasMoreTokens();  ) {
+    			pTarget.indent(0);
+    			String tok = st.nextToken();
+    			if (tok.length() > 0) {
+    				pTarget.write(tok);
+    			}
+    			pTarget.write();
+    		}
+    		pTarget.indent(0);
+    		pTarget.write();
+    	}
+    	pTarget.indent(0);
+    	pTarget.write("}");
+    	pTarget.write();
+    }
+    
+    /** Returns a quoted string constant suitable for embedding
+     * into Java source, but without quotes.
+     */
+    public static String getQuotedNoQuotes(String s) {
+    	StringBuffer sb = new StringBuffer();
+    	for (int i = 0;  i < s.length();  i++) {
+    		char c = s.charAt(i);
+    		if (c == '\n') {
+    			sb.append("\\n");
+    		} else if (c == '\\') {
+    			sb.append("\\\\");
+    		} else if (c == '\t') {
+    			sb.append("\\t");
+    		} else if (c == '\r') {
+    			sb.append("\\r");
+    		} else if (c == '\f') {
+    			sb.append("\\f");
+    		} else if (c == '\"') {
+    			sb.append("\\\"");
+    		} else {
+    			sb.append(c);
+    		}
+    	}
+    	return sb.toString();
+    }
+    
+    /** Returns a quoted string constant suitable for embedding
+     * into Java source.
+     */
+    public static String getQuoted(String s) {
+    	return "\"" + getQuotedNoQuotes(s) + "\"";
+    }
+    
+    private java.util.List innerClasses;
+    /** Adds an inner class.
+     */
+    public void addInnerClass(JavaInnerClass pClass) {
+    	if (innerClasses == null) {
+    		innerClasses = new java.util.ArrayList();
+    	}
+    	innerClasses.add(pClass);
+    }
+    /** Clears the list of inner classes.
+     */
+    public void clearInnerClasses() {
+    	innerClasses = null;
+    }
+    /** Returns the array of inner classes.
+     */
+    public JavaInnerClass[] getInnerClasses() {
+    	if (innerClasses == null) {
+    		return new JavaInnerClass[0];
+    	}
+    	return (JavaInnerClass[])
+		innerClasses.toArray(new JavaInnerClass[innerClasses.size()]);
+    }
+	/** Returns the inner class named <code>pName</code>, or
+	 * null, if no such class exists.
+	 */
+	public JavaInnerClass getInnerClass(String pName) {
+		if (innerClasses == null) {
+			return null;
+		}
+		for (int i = 0;  i < innerClasses.size();  i++) {
+			JavaInnerClass jic = (JavaInnerClass) innerClasses.get(i);
+			if (jic.getQName().getInnerClassName().equals(pName)) {
+				return jic;
+			}
+		}
+		return null;
+	}
+    
+    private boolean isStatic;
+    /** Returns whether this JavaSource is static (for inner classes).
+     */
+    protected boolean getStatic() {
+    	return isStatic;
+    }
+    
+    /** Sets whether this JavaSource is static (for inner classes).
+     */
+    public void setStatic(boolean pStatic) {
+    	isStatic = pStatic;
+    }
+    
+    private java.util.List rawJavaSources;
+    /** Adds a piece of raw Java source to the class.
+     */
+    public void addRawJavaSource(String pSource) {
+    	if (pSource != null  &&  pSource.length() > 0) {
+    		if (rawJavaSources == null) {
+    			rawJavaSources = new java.util.ArrayList();
+    		}
+    		rawJavaSources.add(pSource);
+    	}
+    }
+    
+    /** Clears the list of raw Java sources.
+     */
+    public void clearRawJavaSources() {
+    	rawJavaSources = null;
+    }
+    
+    /** Returns an array with the pieces of raw Java sources.
+     */
+    public String[] getRawJavaSources() {
+    	if (rawJavaSources == null) {
+    		return new String[0];
+    	}
+    	return (String[]) rawJavaSources.toArray(new String[rawJavaSources.size()]);
+    }
+    
+    private boolean bAbstract;
+    /** Returns whether class is abstract.
+     */
+    public boolean isAbstract() {
+    	return bAbstract;
+    }
+    /** Sets whether this class is abstract.
+     */
+    public void setAbstract(boolean isAbstract) {
+    	this.bAbstract = isAbstract;
+    }
+    
+    /** Returns whether this is an interface or not.
+     */
+    public boolean isInterface() {
+    	return INTERFACE.equals(getType());
+    }
+    
+    /** Returns whether the given JavaQName is a local class.
+     * In other words, whether the package name can be omitted
+     * when referencing the class.
+     */
+    public String asString(JavaQName pQName, boolean pAddIfPossible) {
+    	return _asString(pQName, pAddIfPossible).replace('$', '.');
+    }
+    
+    private String _asString(JavaQName pQName, boolean pAddIfPossible) {
+    	if (isForcingFullyQualifiedName()) {
+    		return pQName.toString();
+    	}
+    	if (pQName.isArray()) {
+    		return asString(pQName.getInstanceClass(), pAddIfPossible) + "[]";
+    	}
+    	if (!pQName.isImportable()) {
+    		return pQName.toString();
+    	}
+    	if ("".equals(pQName.getPackageName())) {
+    		return pQName.getClassName();
+    	}
+    	
+    	JavaQName outerQName = pQName;
+    	int offset = outerQName.getClassName().indexOf('$');
+    	if (offset >= 0) {
+    		String className = outerQName.getClassName().substring(0, offset);
+    		outerQName = JavaQNameImpl.getInstance(outerQName.getPackageName(), className);
+    	}
+    	
+    	offset = outerQName.getClassName().indexOf('.');
+    	if (offset >= 0) {
+    		String className = pQName.getClassName().substring(0, offset);
+    		outerQName = JavaQNameImpl.getInstance(outerQName.getPackageName(), className);
+    	}
+    	
+    	if (getQName().equals(outerQName)) {
+    		return pQName.getClassName();
+    	} else if (getQName().getClassName().equals(outerQName.getClassName())) {
+    		return pQName.toString();
+    	}
+    	
+    	boolean done = false;
+    	boolean imported = false;
+    	
+    	for (Iterator iter = imports.iterator();  !done  &&  iter.hasNext();  ) {
+    		JavaQName jqName = (JavaQName) iter.next();
+    		if (jqName.equals(outerQName)) {
+    			done = true;
+    			imported = true;
+    		} else if (outerQName.getClassName().equals(jqName.getClassName())) {
+    			done = true;
+    			imported = false;
+    		}
+    	}
+    	
+    	if (!done) {
+    		String packageName = pQName.getPackageName();
+    		if (packageName.equals(getPackageName())  ||
+    				packageName.equals("java.lang")) {
+    			imported = true;
+    			done = true;
+    		}
+    		if (!done) {
+    			if (pAddIfPossible) {
+    				addImport(outerQName);
+    				done = true;
+    				imported = true;
+    			} else {
+    				done = true;
+    				imported = false;
+    			}
+    		}
+    	}
+    	
+    	if (imported) {
+    		return pQName.getClassName();
+    	} else {
+    		return pQName.toString();
+    	}
+    }
+    
+    private boolean forcingFullyQualifiedName = false;
+    /** Returns, whether class references are always using the
+     * fully qualified class name.
+     */
+    public boolean isForcingFullyQualifiedName() {
+    	return forcingFullyQualifiedName;
+    }
+    /** Sets, whether class references are always using the
+     * fully qualified class name.
+     */
+    public void setForcingFullyQualifiedName(boolean pForcingFullyQualifiedName) {
+    	forcingFullyQualifiedName = pForcingFullyQualifiedName;
+    }
+
+    private boolean hasDynamicImports = true;
+    /** Returns, whether the class is automatically adding imports.
+     */
+    public boolean hasDynamicImports() {
+    	return hasDynamicImports;
+    }
+    /** Sets, whether the class is automatically adding imports.
+     */
+    public void setDynamicImports(boolean pDynamicImports) {
+    	hasDynamicImports = pDynamicImports;
+    }
+    
+    /** Writes the JavaSource contents into the given Writer.
+     */
+    public void write(Writer pTarget) throws IOException {
+    	if (hasDynamicImports()) {
+    		IndentationTarget devNullTarget = new IndentationTarget(){
+    			public boolean isInterface() { return JavaSource.this.isInterface(); }
+    			public String asString(JavaQName pQName) {
+    				return JavaSource.this.asString(pQName, true);
+    			}
+    			public void write(String pValue) {}
+    			public void write() {}
+    			public void indent(int i) {}
+    		};
+    		write(devNullTarget);
+    	}
+    	WriterTarget wt = new WriterTarget(){
+    		public boolean isInterface() { return JavaSource.this.isInterface(); }
+    		public String asString(JavaQName pQName) {
+    			return JavaSource.this.asString(pQName, false);
+    		}
+    	};
+    	wt.setTarget(pTarget);
+    	write(wt);
+    }
+    
+    /** Returns a string representation of this JavaSource file.
+     */
+    public String toString() {
+    	StringWriter sw = new StringWriter();
+    	try {
+    		write(sw);
+    		return sw.toString();
+    	} catch (IOException e) {
+    		throw new IllegalStateException("Unexcpected IOException while writing into a StringWriter: " + e.getMessage());
+    	}
+    }
+    
+    /** Creates a new instance of JavaClassInitializer.
+     */
+    public JavaClassInitializer newJavaClassInitializer() {
+    	JavaClassInitializer result = new JavaClassInitializer();
+    	result.setJavaSource(this);
+    	myObjects.add(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaConstructor with default protection.
+     */
+    public JavaConstructor newJavaConstructor() {
+    	return newJavaConstructor(DEFAULT_PROTECTION);
+    }
+    
+    /** Creates a new JavaConstructor with the given protection.
+     */
+    public JavaConstructor newJavaConstructor(JavaSource.Protection pProtection) {
+    	JavaConstructor result = new JavaConstructor(getClassName(), pProtection);
+    	result.setJavaSource(this);
+    	this.addConstructor(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaConstructor with the given protection.
+     * Equivalent to <code>newJavaConstructor(Protection.valueOf(pProtection))</code>.
+     */
+    public JavaConstructor newJavaConstructor(String pProtection) {
+    	return newJavaConstructor(Protection.valueOf(pProtection));
+    }
+    
+    /** Creates a new JavaConstructor with the same parameters,
+     * protection and exceptions than the given. Equivalent to
+     * <code>newJavaConstructor(pConstructor, false)</code>.
+     */
+    public JavaConstructor newJavaConstructor(JavaConstructor pConstructor) {
+    	return newJavaConstructor(pConstructor, false);
+    }
+    
+    /** Creates a new JavaConstructor with the same signature
+     * than the given constructors. Equivalent to
+     * <code>newJavaConstructor(pConstructor, false)</code>.
+     * If the <code>pSuper</code> argument is true, adds an
+     * invocation of the super classes constructor with the
+     * same arguments.
+     */
+    public JavaConstructor newJavaConstructor(JavaConstructor pConstructor, boolean pSuper) {
+    	JavaConstructor result = newJavaConstructor(pConstructor.getProtection());
+    	List superParams = pSuper ? new ArrayList() : null;
+    	Parameter[] params = pConstructor.getParams();
+    	for (int i = 0;  i < params.length;  i++) {
+    		DirectAccessible p = result.addParam(params[i]);
+    		if (pSuper) {
+    			if (!superParams.isEmpty()) {
+    				superParams.add(", ");
+    			}
+    			superParams.add(p);
+    		}
+    	}
+    	JavaQName[] exceptions = pConstructor.getExceptions();
+    	for (int i = 0;  i < exceptions.length;  i++) {
+    		result.addThrows(exceptions[i]);
+    	}
+    	if (pSuper) {
+    		result.addLine("super(", superParams, ");");
+    	}
+    	return result;
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and default protection.
+     */
+    public JavaMethod newJavaMethod(String pName, String pType) {
+    	return newJavaMethod(pName, JavaQNameImpl.getInstance(pType), (Protection) null);
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and protection.
+     */
+    public JavaMethod newJavaMethod(String pName, String pType, Protection pProtection) {
+    	return newJavaMethod(pName, JavaQNameImpl.getInstance(pType), pProtection);
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and protection.
+     */
+    public JavaMethod newJavaMethod(String pName, String pType, String pProtection) {
+    	return newJavaMethod(pName, JavaQNameImpl.getInstance(pType),
+    			Protection.valueOf(pProtection));
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and default protection.
+     */
+    public JavaMethod newJavaMethod(String pName, JavaQName pType) {
+    	return newJavaMethod(pName, pType, DEFAULT_PROTECTION);
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and protection.
+     */
+    public JavaMethod newJavaMethod(String pName, JavaQName pType, Protection pProtection) {
+    	JavaMethod result = new JavaMethod(pName, pType, pProtection);
+    	result.setJavaSource(this);
+    	addMethod(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and protection.
+     */
+    public JavaMethod newJavaMethod(String pName, JavaQName pType, String pProtection) {
+    	JavaMethod result = new JavaMethod(pName, pType, Protection.valueOf(pProtection));
+    	result.setJavaSource(this);
+    	addMethod(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and default protection.
+     */
+    public JavaMethod newJavaMethod(String pName, Class pType) {
+    	return newJavaMethod(pName, JavaQNameImpl.getInstance(pType), DEFAULT_PROTECTION);
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and protection.
+     */
+    public JavaMethod newJavaMethod(String pName, Class pType, Protection pProtection) {
+    	return newJavaMethod(pName, JavaQNameImpl.getInstance(pType), pProtection);
+    }
+    
+    /** Creates a new JavaMethod with the given name, return
+     * type and protection.
+     */
+    public JavaMethod newJavaMethod(String pName, Class pType, String pProtection) {
+    	return newJavaMethod(pName, JavaQNameImpl.getInstance(pType),
+    			Protection.valueOf(pProtection));
+    }
+
+    /** Creates a new JavaField with the given fields signature.
+     */
+    public JavaField newJavaField(Field pField) {
+    	final int modifiers = pField.getModifiers();
+    	final JavaField result = newJavaField(pField.getName(), pField.getType(), Protection.valueOf(modifiers));
+    	result.setFinal(Modifier.isFinal(modifiers));
+    	result.setStatic(Modifier.isStatic(modifiers));
+    	result.setTransient(Modifier.isTransient(modifiers));
+    	return result;
+    }
+
+    /** Creates a new JavaConstructor with the signature of the
+     * given constructor.
+     */
+    public JavaConstructor newJavaConstructor(Constructor pConstructor) {
+    	final int modifiers = pConstructor.getModifiers();
+    	JavaConstructor result = newJavaConstructor(Protection.valueOf(modifiers));
+    	addParameters(result, pConstructor.getParameterTypes());
+    	addExceptions(result, pConstructor.getExceptionTypes());
+    	return result;
+    }
+    
+    /** Creates a new JavaMethod with the signature of the given method
+     * <code>pMethod</code>.
+     * More precise:
+     * <ol>
+     *   <li>The name of the created method is <code>pMethod.getName()</code>.</li>
+     *   <li>The return type is set to <code>pMethod.getReturnType()</code>.</li>
+     *   <li>The protection is set to that of <code>pMethod</code>.
+     *   <li>For any class in <code>pMethod.getParameterTypes()</code>, calls
+     *     {@link JavaMethod#addParam(Class,String)} with the parameter names "p0", "p1", ...</li>
+     *   <li>For any exception in <code>pMethod.getExceptionTypes()</code>, calls
+     *     {@link JavaMethod#addThrows(Class)}.</li>
+     * </ol>
+     */
+    public JavaMethod newJavaMethod(Method pMethod) {
+    	final int modifiers = pMethod.getModifiers();
+    	JavaMethod result = newJavaMethod(pMethod.getName(),
+    			JavaQNameImpl.getInstance(pMethod.getReturnType()),
+				JavaSource.Protection.valueOf(modifiers));
+    	result.setAbstract(Modifier.isAbstract(modifiers));
+    	result.setFinal(Modifier.isFinal(modifiers));
+    	result.setStatic(Modifier.isStatic(modifiers));
+    	result.setSynchronized(Modifier.isSynchronized(modifiers));
+    	addParameters(result, pMethod.getParameterTypes());
+    	addExceptions(result, pMethod.getExceptionTypes());
+    	return result;
+    }
+
+    private void addExceptions(AbstractJavaMethod pMethod, Class[] pExceptions) {
+		if (pExceptions != null) {
+    		for (int i = 0;  i < pExceptions.length;  i++) {
+    			pMethod.addThrows(pExceptions[i]);
+    		}
+    	}
+	}
+
+    private void addParameters(AbstractJavaMethod pMethod, Class[] pParameters) {
+		if (pParameters != null) {
+    		for (int i = 0;  i < pParameters.length;  i++) {
+    			String parameterName = "p" + i;
+    			pMethod.addParam(pParameters[i], parameterName);
+    		}
+    	}
+	}
+    
+    /** Creates a new JavaMethod with the given methods name and signature.
+     * This is useful, for example, if you have an interface and derive an
+     * implementation. The following values are not cloned:
+     * {@link JavaMethod#isAbstract()}, {@link JavaMethod#isStatic()},
+     * {@link JavaMethod#isFinal()}, and {@link JavaMethod#isSynchronized()}.
+     */
+    public JavaMethod newJavaMethod(JavaMethod pMethod) {
+    	JavaMethod jm = newJavaMethod(pMethod.getName(), pMethod.getType(), pMethod.getProtection());
+    	Parameter[] params = pMethod.getParams();
+    	for (int i = 0;  i < params.length;  i++) {
+    		jm.addParam(params[i].getType(), params[i].getName());
+    	}
+    	JavaQName[] exceptions = pMethod.getExceptions();
+    	for (int i = 0;  i < exceptions.length;  i++) {
+    		jm.addThrows(exceptions[i]);
+    	}
+    	return jm;
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * protection.
+     */
+    public JavaField newJavaField(String pName, JavaQName pType, Protection pProtection) {
+    	JavaField result = new JavaField(pName, pType, pProtection);
+    	result.setJavaSource(this);
+    	addField(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * protection.
+     */
+    public JavaField newJavaField(String pName, JavaQName pType, String pProtection) {
+    	JavaField result = new JavaField(pName, pType, Protection.valueOf(pProtection));
+    	result.setJavaSource(this);
+    	addField(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * default protection.
+     */
+    public JavaField newJavaField(String pName, JavaQName pType) {
+    	return newJavaField(pName, pType, DEFAULT_PROTECTION);
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * protection.
+     */
+    public JavaField newJavaField(String pName, String pType, Protection pProtection) {
+    	return newJavaField(pName, JavaQNameImpl.getInstance(pType), pProtection);
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * protection.
+     */
+    public JavaField newJavaField(String pName, String pType, String pProtection) {
+    	return newJavaField(pName, JavaQNameImpl.getInstance(pType),
+    			Protection.valueOf(pProtection));
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * default protection.
+     */
+    public JavaField newJavaField(String pName, String pType) {
+    	return newJavaField(pName, JavaQNameImpl.getInstance(pType), (Protection) null);
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * protection.
+     */
+    public JavaField newJavaField(String pName, Class pType, JavaSource.Protection pProtection) {
+    	return newJavaField(pName, JavaQNameImpl.getInstance(pType), pProtection);
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * protection. Equivalent to <code>newJavaField(pName, pType,
+     * Protection.valueOf(pProtecttion)</code>.
+     */
+    public JavaField newJavaField(String pName, Class pType, String pProtection) {
+    	return newJavaField(pName, JavaQNameImpl.getInstance(pType),
+    			Protection.valueOf(pProtection));
+    }
+    
+    /** Creates a new JavaField with the given name, type and
+     * default protection.
+     */
+    public JavaField newJavaField(String pName, Class pType) {
+    	return newJavaField(pName, JavaQNameImpl.getInstance(pType));
+    }
+    
+    /** Creates a new JavaInnerClass with the given name and
+     * default protection.
+     */
+    public JavaInnerClass newJavaInnerClass(String pName) {
+    	return newJavaInnerClass(pName, DEFAULT_PROTECTION);
+    }
+    
+    /** Creates a new JavaInnerClass with the given name and
+     * protection.
+     */
+    public JavaInnerClass newJavaInnerClass(String pName, Protection pProtection) {
+    	JavaQName innerClassName = JavaQNameImpl.getInnerInstance(getQName(), pName);
+    	JavaInnerClass result = new JavaInnerClass(this, innerClassName, pProtection);
+    	addInnerClass(result);
+    	return result;
+    }
+    
+    /** Creates a new JavaInnerClass with the given name and
+     * protection.
+     */
+    public JavaInnerClass newJavaInnerClass(String pName, String pProtection) {
+    	return newJavaInnerClass(pName, Protection.valueOf(pProtection));
+    }
+    
+    /** Returns, whether this is an inner class.
+     */
+    public boolean isInnerClass() {
+    	return false;
+    }
+    /** Creates a new Java property with the given type and name.
+     * Shortcut for
+     * <pre>
+     * String upperCaseName = Character.toUpperCase(pName.charAt(0)) +
+     *     pName.substring(1);
+     * if (JavaQNameImpl.VOID.equals(pType)) {
+     *   newBeanProperty(pType, pName, "is" + upperCaseName, "set" + upperCaseName);
+     * } else {
+     *   newBeanProperty(pType, pName, "get" + upperCaseName, "set" + upperCaseName);
+     * }
+     * </pre>
+     */
+    public void newBeanProperty(JavaQName pType, String pName) {
+    	String upperCaseName = Character.toUpperCase(pName.charAt(0)) + pName.substring(1);
+    	if (JavaQNameImpl.BOOLEAN.equals(pType)) {
+    		newBeanProperty(pType, pName, "is" + upperCaseName, "set" + upperCaseName);
+    	} else {
+    		newBeanProperty(pType, pName, "get" + upperCaseName, "set" + upperCaseName);
+    	}
+    }
+    
+    /** Shortcut for <code>newBeanProperty(JavaQNameImpl.getInstance(pClass), pName)</code>.
+     * @see #newBeanProperty(JavaQName, String)
+     */
+    public void newBeanProperty(Class pClass, String pName) {
+    	newBeanProperty(JavaQNameImpl.getInstance(pClass), pName);
+    }
+    
+    /** Shortcut for
+     * <pre>
+     * newJavaField(pFieldName, pType, JavaSource.PRIVATE);
+     * JavaMethod getMethod = newJavaMethod(pGetMethodName, pType, JavaSource.PUBLIC);
+     * getMethod.addLine("return this.", pFieldName, ";");
+     * JavaMethod setMethod = newJavaMethod(pSetMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
+     * setMethod.addParam(pType, pFieldName);
+     * setMethod.addLine("this.", pFieldName, " = ", pFieldName, ";");
+     * </pre>
+     * @param pType The property type
+     * @param pFieldName The name of the generated field. The generated field has private
+     * access.
+     * @param pGetMethodName The name of the generated get method or null, if no such
+     * method is being created.
+     * @param pSetMethodName The name of the generated set method or null, if no such
+     * method is being created.
+     */
+    public void newBeanProperty(JavaQName pType, String pFieldName,
+    		String pGetMethodName, String pSetMethodName) {
+    	newJavaField(pFieldName, pType, JavaSource.PRIVATE);
+    	if (pGetMethodName != null) {
+    		JavaMethod getMethod = newJavaMethod(pGetMethodName, pType, JavaSource.PUBLIC);
+    		getMethod.addLine("return this.", pFieldName, ";");
+    	}
+    	if (pSetMethodName != null) {
+    		JavaMethod setMethod = newJavaMethod(pSetMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
+    		setMethod.addParam(pType, pFieldName);
+    		setMethod.addLine("this.", pFieldName, " = ", pFieldName, ";");
+    	}
+    }
+    
+    /** Shortcut for <code>newBeanProperty(JavaQNameImpl.getInstance(pClass),
+     * pFieldName, pGetMethodName, pSetMethodName)</code>.
+     * @see #newBeanProperty(JavaQName, String, String, String)
+     */
+    public void newBeanProperty(Class pClass, String pFieldName,
+    		String pGetMethodName, String pSetMethodName) {
+    	newBeanProperty(JavaQNameImpl.getInstance(pClass), pFieldName, pGetMethodName,
+    			pSetMethodName);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,408 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.js.apps.JavaSourceResolver;
+import org.apache.ws.jaxme.js.impl.TextFileImpl;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+
+/** <p>Factory for generating JavaSource objects.</p>
+ * <p>
+ * The factory properties:
+ * </p>
+ * <ul>
+ *  <li>{@link #setOverwriteForced}</li>
+ *  <li>{@link #setSettingReadOnly}</li>
+ * </ul>
+ * <p>
+ * are used for finely grained controlled over the generated 
+ * source files. Methods are provided to access abstract descriptions
+ * of the files to be created:
+ * </p>
+ * <ul>
+ *   <li>{@link #getTextFiles} and {@link #getTextFile}</li>
+ *   <li>{@link #getJavaSources} and {@link #getJavaSource}</li>
+ * </ul>
+ * <p>
+ * Concrete files (source and otherwise) are created by calling 
+ * the following construction methods:
+ * </p>
+ * <ul>
+ *   <li>{@link #newJavaSource(JavaQName)}, {@link #newJavaSource(JavaQName, String)}
+ *  and {@link #newJavaSource(JavaQName, JavaSource.Protection)}</li>
+ *   <li>{@link #newTextFile}</li>
+ * </ul>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JavaSourceFactory.java 358952 2005-12-24 22:48:25 +0100 (Sa, 24 Dez 2005) jochen $
+ */
+public class JavaSourceFactory implements JavaSourceResolver {
+	private Logger logger = LoggerAccess.getLogger(JavaSourceFactory.class);
+	private boolean overwriteForced;
+	private boolean settingReadOnly;
+	private Map sources = new HashMap();
+	private List files = new ArrayList();
+
+	/** <p>Sets the {@link Logger} to use.</p>
+	 */
+	public void setLogger(Logger pLogger) {
+		logger = pLogger;
+  	}
+
+	/** <p>Returns the {@link Logger}.</p>
+	 */
+	public Logger getLogger() {
+		return logger;
+	}
+	
+	/** <p>Sets whether the generated files are created in read-only mode.</p>
+	 */
+	public void setSettingReadOnly(boolean pSettingReadOnly) {
+		settingReadOnly = pSettingReadOnly;
+	}
+	
+	/** <p>Returns whether the generated files are created in read-only mode.</p>
+	 */
+	public boolean isSettingReadOnly() {
+		return settingReadOnly;
+	}
+	
+	/** <p>By default the JavaSourceFactory will only overwrite existing
+	 * files only, if they have different content. If the overwriteForced property is
+	 * set to true, existing files will always be overwritten.</p>
+	 * @see #isOverwriteForced()
+	 */
+	public void setOverwriteForced(boolean pOverwriteForced) {
+		overwriteForced = pOverwriteForced;
+	}
+	
+	/** <p>By default the JavaSourceFactory will only overwrite existing
+	 * files, if they have different content. If the overwriteForced property is
+	 * set to true, existing files will always be overwritten.</p>
+	 * @see #setOverwriteForced(boolean)
+	 */
+	public boolean isOverwriteForced() {
+		return overwriteForced;
+	}
+	
+	/** <p>Creates a new instance of JavaSource with the given
+	 * name and default protection.</p>
+	 */
+	public JavaSource newJavaSource(JavaQName pName) {
+		return newJavaSource(pName, JavaSource.DEFAULT_PROTECTION);
+	}
+	
+	/** <p>Creates a new instance of JavaSource with the given
+	 * name and protection.</p>
+	 */
+	public JavaSource newJavaSource(JavaQName pName, JavaSource.Protection pProtection) {
+		if (sources.containsKey(pName)) {
+			throw new IllegalStateException("The class " + pName + " has already been created.");
+		}
+		JavaSource result = new JavaSource(this, pName, pProtection);
+		sources.put(pName, result);
+		return result;
+	}
+	
+	/** <p>Creates a new instance of JavaSource with the given
+	 * name and protection. Shortcut for
+	 * <code>newJavaSource(pName, JavaSource.Protection.valueOf(pProtection))</code>.</p>
+	 */
+	public JavaSource newJavaSource(JavaQName pName, String pProtection) {
+		return newJavaSource(pName, JavaSource.Protection.valueOf(pProtection));
+	}
+	
+	/** <p>Returns an iterator to the generated classes.</p>
+	 */
+	public Iterator getJavaSources() {
+		return sources.values().iterator();
+	}
+	
+	/** <p>Returns an iterator to the generated text files.</p>
+	 */
+	public Iterator getTextFiles() {
+		return files.iterator();
+	}
+	
+	/** <p>Returns the generated class with the given name or null, if
+	 * no such class has been generated.</p>
+	 */
+	public JavaSource getJavaSource(JavaQName pName) {
+		return (JavaSource) sources.get(pName);
+	}
+	
+	/** <p>Returns the text file with the given name or null, if no such
+	 * text file has been generated.</p>
+	 */
+	public TextFile getTextFile(String pPackageName, String pFileName) {
+		for (Iterator iter = files.iterator();  iter.hasNext();  ) {
+			TextFile textFile = (TextFile) iter.next();
+			if (textFile.getPackageName().equals(pPackageName)  &&  textFile.getFileName().equals(pFileName)) {
+				return textFile;
+			}
+		}
+		return null;
+	}
+	
+	/** <p>Given a package name and a base directory, returns the package
+	 * directory.</p>
+	 *
+	 * @param pBaseDir The base directory, where to create sources;
+	 *    may be null (current directory).
+	 * @return Package directory; null is a valid value and indicates
+	 *    the current directory.
+	 */
+	public File getPackageDirectory(File pBaseDir, String pPackageName) {
+		if (pPackageName != null) {
+			for (StringTokenizer st = new StringTokenizer(pPackageName, ".");
+			st.hasMoreTokens();  ) {
+				String dir = st.nextToken();
+				pBaseDir = new File(pBaseDir, dir);
+			}
+		}
+		return pBaseDir;
+	}
+	
+	/** <p>Given a fully qualified name, returns the name of the
+	 * corresponding Java file.</p>
+	 */
+	public File getSourceFile(File pBaseDir, JavaQName pQName) {
+		if (pQName == null) {
+			throw new NullPointerException("The class name must not be null.");
+		}
+		File packageDirectory = getPackageDirectory(pBaseDir, pQName.getPackageName());
+		String name = pQName.getClassName();
+		int offset = name.indexOf('.');
+		if (offset != -1) {
+			throw new IllegalArgumentException("Source files must not be generated for inner classes: " + name);
+		}
+		offset = name.indexOf('.');
+		if (offset != -1) {
+			throw new IllegalArgumentException("Source files must not be generated for inner classes: " + name);
+		}
+		return new File(packageDirectory, name + ".java");
+	}
+	
+	/** <p>Returns a location the given package, relative to the given
+	 * base directory. For example, if you have the base
+	 * directory <code>c:\temp</code> and the package
+	 * <code>com.mycompany.demo</code>, this would yield
+	 * new File("c:\temp\com\mycompany\demo").</p>
+	 *
+	 * @param pBaseDir The base directory or null for the current directory.
+	 * @param pPackage The JavaSource being stored; null or the empty
+	 *   string for the root package
+	 * @return Directory related to the package; this may be null, if
+	 *   the base directory was null and the package was the root
+	 *   package
+	 */
+	public File getLocation(File pBaseDir, String pPackage) {
+		for (StringTokenizer st = new StringTokenizer(pPackage, ".");  st.hasMoreTokens();  ) {
+			pBaseDir = new File(pBaseDir, st.nextToken());
+		}
+		return pBaseDir;
+	}
+	
+	/** <p>Returns a location for storing the JavaSource class, relative
+	 * to the given base directory. For example, if you have the base
+	 * directory <code>c:\temp</code> and the class <code>Sample</code>
+	 * in package <code>com.mycompany.demo</code>, this would yield
+	 * new File("c:\temp\com\mycompany\demo\Sample.java").</p>
+	 *
+	 * @param pBaseDir The base directory or null for the current directory.
+	 * @param pJs The JavaSource being stored.
+	 */
+	public File getLocation(File pBaseDir, JavaSource pJs) {
+		if (pJs.isInnerClass()) {
+			throw new IllegalArgumentException("Inner classes have no assigned location in the file system.");
+		}
+		return new File(getLocation(pBaseDir, pJs.getPackageName()),
+				pJs.getClassName() + ".java");
+	}
+	
+	/** <p>Returns a location for storing the TextFile, relative
+	 * to the given base directory. For example, if you have the base
+	 * directory <code>c:\temp</code> and the class <code>Sample</code>
+	 * in package <code>com.mycompany.demo</code>, this would yield
+	 * new File("c:\temp\com\mycompany\demo\Sample.java").</p>
+	 *
+	 * @param pBaseDir The base directory or null for the current directory.
+	 * @param pTextFile The text file being created.
+	 */
+	public File getLocation(File pBaseDir, TextFile pTextFile) {
+		return new File(getLocation(pBaseDir, pTextFile.getPackageName()), pTextFile.getFileName());
+	}
+	
+	
+	/** <p>Verifies whether the given Java source and the contents of the
+	 * given file are identical.</p>
+	 */
+	protected boolean isSameFile(JavaSource pJs, File pFile) throws IOException {
+		StringWriter sw = new StringWriter();
+		pJs.write(sw);
+		sw.close();
+		return isSameFile(sw.toString(), pFile);
+	}
+	
+	/** <p>Verifies whether the given string and the contents of the given
+	 * file are identical.</p>
+	 */
+	protected boolean isSameFile(String pContents, File pFile) throws IOException {
+		Reader r = new FileReader(pFile);
+		StringWriter sw = new StringWriter();
+		char[] buffer = new char[4096];
+		for (;;) {
+			int len = r.read(buffer);
+			if (len == -1) {
+				break;
+			} else if (len > 0) {
+				sw.write(buffer, 0, len);
+			}
+		}
+		return isSameFile(pContents, sw.toString());
+	}
+	
+	/** <p>Verifies whether the given strings are identical.</p>
+	 */
+	protected boolean isSameFile(String pContents1, String pContents2) {
+		return pContents1.equals(pContents2);
+	}
+	
+	/** <p>Actually creates a file with the given name.</p>
+	 */
+	protected void writeFile(File pFile, JavaSource pJs) throws IOException {
+		final String mName = "writeFile(File,JavaSource)";
+		File p = pFile.getParentFile();
+		if (p != null  &&  !p.exists()) {
+			getLogger().fine(mName, "Creating directory " + p);
+			p.mkdirs();
+		}      
+		
+		if (isOverwriteForced()  ||  !pFile.exists()  ||  !isSameFile(pJs, pFile)) {
+			getLogger().fine(mName, "Creating " + pFile);
+			Writer w = new BufferedWriter(new FileWriter(pFile), 4096);
+			pJs.write(w);
+			w.close();
+			if (isSettingReadOnly()) {
+				pFile.setReadOnly();
+			}
+		} else {
+			getLogger().fine(mName, "Uptodate: " + pFile);
+		}
+	}
+	
+	/** <p>Actually creates a file with the given name.</p>
+	 */
+	protected void writeFile(File pFile, String pContents) throws IOException {
+		final String mName = "writeFile(File,String)";
+		File p = pFile.getParentFile();
+		if (p != null  &&  !p.exists()) {
+			getLogger().fine(mName, "Creating directory " + p);
+			p.mkdirs();
+		}
+		
+		if (isOverwriteForced()  ||  !pFile.exists()  ||  !isSameFile(pContents, pFile)) {
+			getLogger().fine(mName, "Creating " + pFile);
+			Writer w = new BufferedWriter(new FileWriter(pFile), 4096);
+			w.write(pContents);
+			w.close();
+			if (isSettingReadOnly()) {
+				pFile.setReadOnly();
+			}
+		} else {
+			getLogger().fine(mName, "Uptodate: " + pFile);
+		}
+	}
+	
+	/** <p>Writes the given JavaSource class to the file system,
+	 * relative to the given base directory.</p>
+	 * @param pBaseDir The base directory or null for the current directory.
+	 * @param pJs The JavaSource being stored.
+	 * @see JavaSource#write(Writer)
+	 */
+	public void write(File pBaseDir, JavaSource pJs) throws IOException {
+		writeFile(getLocation(pBaseDir, pJs), pJs);
+	}
+	
+	/** <p>Writes the given text file to the file system, relative to the
+	 * given base directory.</p>
+	 * @param pBaseDir The base directory or null for the current directory.
+	 * @param pFile The text file being stored.
+	 * @see JavaSource#write(Writer)
+	 */
+	public void write(File pBaseDir, TextFile pFile) throws IOException {
+		writeFile(getLocation(pBaseDir, pFile), pFile.getContents());
+	}
+	
+	/** Writes all Source files to the FileSystem, relative to the
+	 * given base directory.
+	 * @param pBaseDir The base directory or null for the current directory.
+	 */
+	public void write(File pBaseDir) throws IOException {
+		write(pBaseDir, pBaseDir);
+	}
+
+	/** Writes all Source files to the file system, relative to the
+	 * respective base directory.
+	 * @param pJavaSourceDir The base directory for Java source files.
+	 * @param pResourceDir The base directory for resource files.
+	 */
+	public void write(File pJavaSourceDir, File pResourceDir) throws IOException {
+		for (Iterator iter = getJavaSources();  iter.hasNext();  ) {
+			write(pJavaSourceDir, (JavaSource) iter.next());
+		}
+		for (Iterator iter = getTextFiles();  iter.hasNext();  ) {
+			write(pResourceDir, (TextFile) iter.next());
+		}
+	}
+	
+	/** <p>Creates a new text file.</p>
+	 */
+	public TextFile newTextFile(String pPackageName, String pFileName) {
+		for (Iterator iter = files.iterator();  iter.hasNext();  ) {
+			TextFile f = (TextFile) iter.next();
+			if (f.getPackageName().equals(pPackageName)  &&  f.getFileName().equals(pFileName)) {
+				throw new IllegalStateException("A file named " + pFileName + " in package " + pPackageName + " already exists.");
+			}
+		}
+		for (Iterator iter = sources.keySet().iterator();  iter.hasNext();  ) {
+			JavaQName qName = (JavaQName) iter.next();
+			if (qName.getPackageName().equals(pPackageName)  &&  (qName.getClassName() + ".java").equals(pFileName)) {
+				throw new IllegalStateException("A Java source file names " + pFileName + " in package " + pPackageName + " already exists.");
+			}
+		}
+		
+		TextFile result = new TextFileImpl(pPackageName, pFileName);
+		files.add(result);
+		return result;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceObject.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceObject.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/JavaSourceObject.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.js;
+
+
+/** This class implements a generic JavaSource object.
+ */
+public abstract class JavaSourceObject extends IndentationEngineImpl {
+  protected JavaSourceObject(String pName, JavaQName pType, JavaSource.Protection pProtection) {
+    setName(pName);
+    setType(pType);
+    setProtection(pProtection);
+  }
+
+  protected JavaSourceObject(String pName, JavaQName pType) {
+    this(pName, pType, null);
+  }
+
+  protected JavaSourceObject(String pName, String pType, JavaSource.Protection pProtection) {
+    setName(pName);
+    if (pType == null) {
+      throw new NullPointerException("Type must not be null");
+    }
+    setType(JavaQNameImpl.getInstance(pType));
+    setProtection(pProtection);
+  }
+
+  protected JavaSourceObject(String pName, String pType) {
+    this(pName, pType, null);
+  }
+
+  private String name;
+  /** Returns this JavaSource objects name.
+   * @see #setName
+   */
+  public String getName() { return name; }
+  /** Sets this JavaSource objects name.
+   * @see #getName
+   */
+  public void setName(String n) { name = n; }
+
+  private boolean isFinal = false;
+  /** Returns whether this is a final JavaSource object.
+   *
+   * @see #setFinal
+   */
+  public boolean isFinal() { return isFinal; }
+  /** Sets whether this is a final JavaSource object.
+   *
+   * @see #isFinal
+   */
+  public void setFinal(boolean pFinal) { isFinal = pFinal; }
+
+  private boolean isStatic = false;
+  /** Returns whether this is a static JavaSource object.
+   * @see #setStatic
+   */
+  public boolean isStatic() { return isStatic; }
+  /** Sets whether this is a static JavaSource object.
+   * @see #isStatic
+   */
+  public void setStatic(boolean pStatic) { isStatic = pStatic; }
+
+  private JavaQName type;
+  /** Returns this JavaSource objects type.
+   * @see #setType
+   */
+  public JavaQName getType() { return type; }
+  /** Sets this JavaSource objects type.
+   * @see #getType
+   */
+  public void setType(JavaQName t) { type = t; }
+
+  private JavaSource.Protection protection = JavaSource.DEFAULT_PROTECTION;
+  /** Returns this JavaSource objects protection.
+   * @see #setProtection
+   */
+  public JavaSource.Protection getProtection() { return protection; }
+  /** Sets this JavaSource objects protection.
+   * @param p null, "public", "protected" or "private"
+   * @see #getProtection
+   */
+  public void setProtection(JavaSource.Protection p) {
+  	 protection = (p == null) ? JavaSource.DEFAULT_PROTECTION : p;
+  }
+
+  private JavaComment comment;
+  /** Returns a comment describing this JavaSource object.
+   * @see #newComment
+   */
+  public JavaComment getComment() { return comment; }
+  /** Creates a new Javadoc comment describing this JavaSource object.
+   * @see #getComment
+   */
+  public JavaComment newComment() {
+    if (comment == null) {
+	   comment = new JavaComment();
+	   return comment;
+	 } else {
+	   throw new IllegalStateException("A Javadoc comment has already been created for this object.");
+	 }
+  }
+
+  private boolean bAbstract = false;
+  /** Returns whether this JavaSource object is abstract.
+   */
+  public boolean isAbstract() {
+    return bAbstract;
+  }
+  /** Sets whether this JavaSource object is abstract.
+   */
+  public void setAbstract(boolean isAbstract) {
+    this.bAbstract = isAbstract;
+  }
+
+  private JavaSource javaSource;
+  protected void setJavaSource(JavaSource pSource) {
+    javaSource = pSource;
+  }
+  /** Returns the class, to which this JavaSource object belongs.
+   */
+  public JavaSource getJavaSource() {
+    return javaSource;
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/LocalJavaField.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/LocalJavaField.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/LocalJavaField.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+
+/** <p>Interface of a {@link JavaField}, which is local to a
+ * {@link JavaMethod}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface LocalJavaField extends IndentationEngine, DirectAccessible,
+    IndentedObject {
+  /** <p>Returns the fields name.</p>
+   */
+  public String getName();
+
+  /** <p>Returns the fields type.</p>
+   */
+  public JavaQName getType();
+
+  /** <p>Returns whether the field is final. By default it isn't.</p>
+   */
+  public boolean isFinal();
+
+  /** <p>Sets whether the field is final. By default it isn't.</p>
+   */
+  public void setFinal(boolean pFinal);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Parameter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Parameter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Parameter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+
+/** <p>A parameter, as used by {@link org.apache.ws.jaxme.js.JavaMethod},
+ * or {@link org.apache.ws.jaxme.js.JavaConstructor}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Parameter implements DirectAccessible, IndentedObject {
+  private final JavaQName type;
+  private final String name;
+  private boolean isNullable = true;
+
+  public Parameter(JavaQName pType, String pName) {
+    type = pType;
+    name = pName;
+  }
+  public JavaQName getType() { return type; }
+  public String getName() { return name; }
+  public String toString() { return type.toString() + " " + name; }
+  public void write(IndentationEngine pEngine, IndentationTarget pTarget)
+      throws IOException {
+    pEngine.write(pTarget, getName());
+  }
+  public boolean isNullable() { return isNullable; }
+  public void setNullable(boolean pNullable) { isNullable = pNullable; }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/PlaceHolder.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/PlaceHolder.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/PlaceHolder.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+
+/** <p>Interface of a placeholder. A placeholder is used by one
+ * method to note, that another method should insert code "here".
+ * A placeholder is created by invoking
+ * {@link org.apache.ws.jaxme.js.IndentationEngine#newPlaceHolder(String, boolean)}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface PlaceHolder {
+  /** <p>Returns the placeholders name.</p>
+   */
+  public String getName();
+
+  /** <p>Returns whether the placeholder is automatically removable.</p>
+   */
+  public boolean isAutoRemovable();
+
+  /** <p>Removes the placeholder. If a placeholder isn't automatically
+   * removable, then it must be removed by an explicit invocation of
+   * this method.</p>
+   */
+  public void remove();
+
+  /** <p>Sets a property.</p>
+   */
+  public void setProperty(String pName, Object pValue);
+
+  /** <p>Returns a property value. There is no distinction between the
+   * property value null and the case where the property isn't set.</p>
+   */
+  public Object getProperty(String pName);
+
+  /** <p>Returns the placeholders indentation level.</p>
+   */
+  public int getLevel();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TextFile.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TextFile.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TextFile.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+
+/** <p>Interface of a text file.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface TextFile extends IndentationEngine {
+  /** <p>Returns the text files package name. This package name isn't necessarily
+   * a valid Java package name, for example it may be "META-INF".</p>
+   */
+  public String getPackageName();
+
+  /** <p>Returns the text files file name, without any path component.</p>
+   */
+  public String getFileName();
+
+  /** <p>Returns the text files contents, as a string.</p>
+   */
+  public String getContents();
+
+  /** <p>Sets the text files contents, as a string.</p>
+   */
+  public void setContents(String pContents);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TypedValue.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TypedValue.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/TypedValue.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,11 @@
+package org.apache.ws.jaxme.js;
+
+
+/** This instance specifies an Java source object, which
+ * has a type.
+ */
+public interface TypedValue {
+	/** Returns the objects type.
+	 */
+	public JavaQName getType();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Util.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Util.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/Util.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+/** <p>Various static utility methods.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Util {
+	/** <p>Returns whether the given name is a valid Java identifier.
+	 * Works by using {@link Character#isJavaIdentifierStart(char)} and
+	 * {@link Character#isJavaIdentifierPart(char)}.</p>
+	 * @throws IllegalArgumentException The name is not valid. An explanation
+	 *   why is given in the detail message.
+	 */
+	public static void checkJavaIdentifier(String pName) {
+		if (pName.length() == 0) {
+			throw new IllegalArgumentException("A valid Java identifier must not be empty.");
+		}
+		char c = pName.charAt(0);
+		if (!Character.isJavaIdentifierStart(c)) {
+			throw new IllegalArgumentException("The identifier " + pName +
+			                                    " is no valid Java identifier, because its first character is " + c);
+		}
+		for (int i = 1;  i < pName.length();  i++) {
+			if (!Character.isJavaIdentifierPart(c)) {
+				throw new IllegalArgumentException("The identifier " + pName +
+				                                    " is no valid Java identifier, because it contains the character " + c);
+			}
+		}
+	}
+
+	/** <p>Takes as input an arbitrary String and maps it to a String,
+	 * which is a valid Java identifier. Mapping works as follows:
+	 * <ol>
+	 *   <li>For the first character, invokes {@link Character#isJavaIdentifierStart(char)}.
+	 *     If that method returns false, replaces the character with an
+	 *     underscore ('_').</li>
+	 *   <li>For any following character, invokes {@link Character#isJavaIdentifierPart(char)}.
+	 *     If that method returns false, replaces the character with an
+	 *     underscore ('_').</li>
+	 * </ol>
+	 * </p>
+	 * @param pIdentifier The identifier being mapped
+	 * @throws IllegalArgumentException The parameter <code>pIdentifier</code>
+	 *   cannot be converted into a Java identifier, because it is null or
+	 *   empty. 
+	 */
+	public static String asJavaIdentifier(String pIdentifier) {
+		if (pIdentifier == null  ||  pIdentifier.length() == 0) {
+			throw new IllegalArgumentException("A null or empty String cannot be converted into a valid Java identifier."); 
+		}
+		StringBuffer sb = new StringBuffer();
+		char c = pIdentifier.charAt(0);
+		sb.append(Character.isJavaIdentifierStart(c) ? c : '_');
+		for (int i = 1;  i < pIdentifier.length();  i++) {
+			c = pIdentifier.charAt(i);
+			sb.append(Character.isJavaIdentifierPart(c) ? c : '_');
+		}
+		return sb.toString();
+	}
+
+	/** Converts the given class into an instance of
+	 * {@link JavaSource}.
+	 */
+	public static JavaSource newJavaSource(JavaSourceFactory pFactory, Class pClass) {
+		JavaQName qName = JavaQNameImpl.getInstance(pClass);
+		int modifiers = pClass.getModifiers();
+		JavaSource js = pFactory.newJavaSource(qName, JavaSource.Protection.valueOf(modifiers));
+		js.setAbstract(Modifier.isAbstract(modifiers));
+		js.setStatic(Modifier.isStatic(modifiers));
+		js.setType(Modifier.isInterface(modifiers) ? JavaSource.INTERFACE : JavaSource.CLASS);
+		Class superClass = pClass.getSuperclass();
+		if (superClass != null) {
+			js.addExtends(superClass);
+		}
+		Class[] interfaces = pClass.getInterfaces();
+		if (interfaces != null) {
+			for (int i = 0;  i < interfaces.length;  i++) {
+				js.addImplements(interfaces[i]);
+			}
+		}
+		Constructor[] constructors = pClass.getConstructors();
+		if (constructors != null) {
+			for (int i = 0;  i < constructors.length;  i++) {
+				js.newJavaConstructor(constructors[i]);
+			}
+		}
+		Method[] methods = pClass.getMethods();
+		if (methods != null) {
+			for (int i = 0;  i < methods.length;  i++) {
+				js.newJavaMethod(methods[i]);
+			}
+		}
+		Field[] fields = pClass.getFields();
+		if (fields != null) {
+			for (int i = 0;  i < fields.length;  i++) {
+				js.newJavaField(fields[i]);
+			}
+		}
+		return js;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/WriterTarget.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/WriterTarget.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/WriterTarget.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/** <p>An IndentationTarget writing into a given Writer.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: WriterTarget.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class WriterTarget implements IndentationTarget {
+  public static final String INDENTATION_STRING = "  ";
+  public static final String LINE_SEPARATOR = "\n";
+  private Writer target;
+  private String indentationString;
+  private String lineSeparator;
+
+  public WriterTarget() {}
+
+  public WriterTarget(Writer pTarget) {
+    target = pTarget;
+  }
+
+  public void setTarget(Writer pTarget) {
+    target = pTarget;
+  }
+
+  public Writer getTarget() {
+    return target;
+  }
+
+  public void setIndentationString(String pIndentationString) {
+    indentationString = pIndentationString;
+  }
+
+  public String getIndentationString() {
+    return indentationString == null ? INDENTATION_STRING : indentationString;
+  }
+
+  public void setLineSeparator(String pLineSeparator) {
+    lineSeparator = pLineSeparator;
+  }
+
+  public String getLineSeparator() {
+    return lineSeparator == null ? LINE_SEPARATOR : lineSeparator;
+  }
+
+  public boolean isInterface() {
+    return false;
+  }
+
+  public void indent(int pLevel) throws IOException {
+    for (int i = 0;  i < pLevel;  i++) {
+      target.write(getIndentationString());
+    }
+  }
+
+  public String asString(JavaQName pQName) {
+    return pQName.toString();
+  }
+
+  public void write(String pValue) throws IOException {
+    target.write(pValue);
+  }
+
+  public void write() throws IOException {
+    target.write(getLineSeparator());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/JavaSourceResolver.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/JavaSourceResolver.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/JavaSourceResolver.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,23 @@
+package org.apache.ws.jaxme.js.apps;
+
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaSource;
+
+
+/** Attempts to find a given instance of
+ * {@link org.apache.ws.jaxme.js.JavaSource}.
+ * This is used, for example, in the following case:
+ * <ul>
+ *   <li>A generator would like to know all methods
+ *     of a given class.</li>
+ *   <li>The class is derived from another class.</li>
+ *   <li>The super classes methods should be treated,
+ *     as if they were usual methods.</li>
+ * </ul>
+ */
+public interface JavaSourceResolver {
+	/** Queries for an instance of {@link JavaSource}
+     * with the fully qualified class name <code>pClassName</code>.
+	 */
+    public JavaSource getJavaSource(JavaQName pQName);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcCaller.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcCaller.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcCaller.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,16 @@
+package org.apache.ws.jaxme.js.apps;
+
+import java.util.Vector;
+
+
+/** Interface being implemented by the actual XML-RPC caller.
+ * The main purpose of delegating this to an interface, is the
+ * separation between generated classes and things like
+ * authentication, server location, and so on.
+ */
+public interface XmlRpcCaller {
+	/** Call the server, invoking the method named <code>pName</code>,
+     * passing the arguments given by <code>pVector</code>.
+	 */
+    public Object xmlRpcCall(String pName, Vector pVector) throws Exception;
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcClientGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcClientGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/apps/XmlRpcClientGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,431 @@
+package org.apache.ws.jaxme.js.apps;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.js.pattern.MethodKey;
+
+
+/** This class generates clients for Apache XML-RPC.
+ * The basic idea goes as follows:
+ * <ol>
+ *   <li>Provide a class implementing the interface {@link XmlRpcCaller}.</li>
+ *   <li>Provide a server side class being called via XML-RPC. The class
+ *     must have a public default constructor, should be stateless, and
+ *     all callable methods must be public instance methods.</li>
+ *   <li>Run the generator, specifying a target package.</li>
+ * </ol>
+ * On the client, use the generated class, as if it were the server
+ * side class.
+ */
+public class XmlRpcClientGenerator {
+    private final JavaSourceFactory factory;
+    private final String targetPackage;
+    private final Map methods = new HashMap();
+    private boolean dispatcherImplementsXmlRpcHandler = true;
+
+    /** Returns whether the generated dispatcher implements
+     * XmlRpcHandler. The default value is true.
+     */
+	public boolean isDispatcherImplementsXmlRpcHandler() {
+		return dispatcherImplementsXmlRpcHandler;
+	}
+
+    /** Sets whether the generated dispatcher implements
+     * XmlRpcHandler. The default value is true.
+     */
+    public void setDispatcherImplementsXmlRpcHandler(
+			boolean pDispatcherImplementsXmlRpcHandler) {
+		dispatcherImplementsXmlRpcHandler = pDispatcherImplementsXmlRpcHandler;
+	}
+
+    /** Creates a new instance with the given factory and target package.
+     */
+    public XmlRpcClientGenerator(JavaSourceFactory pFactory, String pTargetPackage) {
+    	factory = pFactory;
+        targetPackage = pTargetPackage;
+    }
+
+    /** Returns the factory, that was submitted to the constructor.
+     */
+    public JavaSourceFactory getFactory() { return factory; }
+
+    /** Returns the target package, that was submitted to the constructor.
+     */
+    public String getTargetPackage() { return targetPackage; }
+
+    /** Generates a name for the method <code>pMethod</code> and
+     * adds it to the method map, the name being the key.
+     * @return The generated name.
+     */
+    protected String addMethod(JavaMethod pMethod) {
+    	String className = pMethod.getJavaSource().getQName().toString();
+        String methodName = pMethod.getName();
+        for (int i = 0;  ;  i++) {
+        	String name = className + "-" + methodName;
+            if (i > 0) {
+            	name += i;
+            }
+            if (!methods.containsKey(name)) {
+            	methods.put(name, pMethod);
+                return name;
+            }
+        }
+    }
+
+    /** Converts the result value <code>pValue</code> into the
+     * requested type <code>pType</code>.
+     */
+    protected Object getResultValue(JavaMethod pMethod, JavaQName pType, Object pValue) {
+        if (JavaQNameImpl.BOOLEAN.equals(pType)) {
+            return new Object[]{"((", Boolean.class, ") ", pValue, ").booleanValue()"};
+        } else if (JavaQNameImpl.BYTE.equals(pType)) {
+    		return new Object[]{"((", Byte.class, ") ", pValue, ").byteValue()"};
+        } else if (JavaQNameImpl.SHORT.equals(pType)) {
+            return new Object[]{"((", Short.class, ") ", pValue, ").shortValue()"};
+        } else if (JavaQNameImpl.INT.equals(pType)) {
+            return new Object[]{"((", Integer.class, ") ", pValue, ").intValue()"};
+        } else if (JavaQNameImpl.LONG.equals(pType)) {
+            return new Object[]{"((", Long.class, ") ", pValue, ").longValue()"};
+        } else if (JavaQNameImpl.FLOAT.equals(pType)) {
+            return new Object[]{"((", Float.class, ") ", pValue, ").floatValue()"};
+        } else if (JavaQNameImpl.DOUBLE.equals(pType)) {
+            return new Object[]{"((", Double.class, ") ", pValue, ").doubleValue()"};
+        } else if (pType.isArray()) {
+            LocalJavaField resultV = pMethod.newJavaField(Vector.class);
+            resultV.addLine("(", Vector.class, ") ", pValue, ";");
+            LocalJavaField resultA = pMethod.newJavaField(pType);
+            pMethod.addIf(resultV , " == null");
+            pMethod.addLine(resultA, " = null;");
+            pMethod.addElse();
+            pMethod.addLine(resultA, " = new ", pType.getInstanceClass(), "[", resultV, ".size()];");
+            DirectAccessible i = pMethod.addForArray(resultA);
+            Object element = new Object[]{resultV, ".elementAt(", i, ")"};
+            pMethod.addLine(resultA, "[", i, "] = ", getResultValue(pMethod, pType.getInstanceClass(), element), ";");
+            pMethod.addEndFor();
+            pMethod.addEndIf();
+            return resultA;
+        } else if (JavaQNameImpl.getInstance(Object.class).equals(pType)) {
+            return pValue;
+        } else {
+        	return new Object[]{"(", pType, ") ", pValue};
+        }
+    }
+
+    /** Converts the given input <code>pValue</code> with type
+     * <code>pType</code> into a valid XML-RPC type.
+     */
+    protected Object getInputValue(JavaMethod pMethod, JavaQName pType, Object pValue) {
+        if (pType.equals(JavaQNameImpl.BOOLEAN)) {
+        	return new Object[]{pValue, " ? ", Boolean.class, ".TRUE : ", Boolean.class, ".FALSE"};
+        } else if (pType.equals(JavaQNameImpl.BYTE)) {
+            return new Object[]{"new ", Byte.class, "(", pValue, ")"};
+        } else if (pType.equals(JavaQNameImpl.SHORT)) {
+            return new Object[]{"new ", Short.class, "(", pValue, ")"};
+        } else if (pType.equals(JavaQNameImpl.INT)) {
+            return new Object[]{"new ", Integer.class, "(", pValue, ")"};
+        } else if (pType.equals(JavaQNameImpl.LONG)) {
+            return new Object[]{"new ", Long.class, "(", pValue, ")"};
+        } else if (pType.equals(JavaQNameImpl.FLOAT)) {
+            return new Object[]{"new ", Float.class, "(", pValue, ")"};
+        } else if (pType.equals(JavaQNameImpl.DOUBLE)) {
+            return new Object[]{"new ", Double.class, "(", pValue, ")"};
+        } else if (pType.isArray()) {
+            if (!(pValue instanceof DirectAccessible)) {
+            	LocalJavaField val = pMethod.newJavaField(pType);
+                val.addLine(pValue);
+                pValue = val;
+            }
+            LocalJavaField v = pMethod.newJavaField(Vector.class);
+            pMethod.addIf(pValue, " == null");
+            pMethod.addLine(v, " = null;");
+            pMethod.addElse();
+            pMethod.addLine(v, " = new ", Vector.class, "();");
+            DirectAccessible i = pMethod.addForArray(pValue);
+            Object element = new Object[]{pValue, "[", i, "]"};
+            pMethod.addLine(v, ".add(", getInputValue(pMethod, pType.getInstanceClass(), element), ");");
+            pMethod.addEndFor();
+            pMethod.addEndIf();
+            return v;
+        } else {
+            return pValue;
+        }
+    }
+
+    /** Generates a method, invoking method <code>pMethod</code> using
+     * the name <code>pName</code>.
+     * @throws NoSuchMethodException
+     * @throws SecurityException
+     */
+    protected JavaMethod getMethod(JavaSource pJs, JavaField pCaller,
+                                   String pName, JavaMethod pMethod)
+            throws SecurityException, NoSuchMethodException {
+    	Method m = XmlRpcCaller.class.getMethod("xmlRpcCall", new Class[]{String.class, Vector.class});
+        Class[] exceptions = m.getExceptionTypes();
+        List exceptionList = new ArrayList();
+        if (exceptions != null) {
+        	for (int i = 0;  i < exceptions.length;  i++) {
+        		JavaQName qName = JavaQNameImpl.getInstance(exceptions[i]);
+                if (!pMethod.isThrowing(qName)) {
+                	exceptionList.add(qName);
+                }
+        	}
+        }
+        
+        JavaMethod jm = pJs.newJavaMethod(pMethod);
+        LocalJavaField v = jm.newJavaField(Vector.class);
+        v.addLine("new ", Vector.class, "()");
+        Parameter[] params = jm.getParams();
+        for (int i = 0;  i < params.length;  i++) {
+        	Parameter p = params[i];
+            jm.addLine(v, ".add(", getInputValue(jm, p.getType(), p), ");");
+        }
+        if (!exceptionList.isEmpty()) {
+        	jm.addTry();
+        }
+        Object result = new Object[]{pCaller, ".xmlRpcCall(",
+        		                     JavaSource.getQuoted(pName), ", ", v, ")"};
+        if (JavaQNameImpl.VOID.equals(jm.getType())) {
+            jm.addLine(result, ";");
+        } else {
+        	jm.addLine("return ", getResultValue(jm, jm.getType(), result), ";");
+        }
+        if (!exceptionList.isEmpty()) {
+            for (int i = 0;  i < exceptionList.size();  i++) {
+            	JavaQName exClass = (JavaQName) exceptionList.get(i);
+                DirectAccessible e = jm.addCatch(exClass);
+                jm.addThrowNew(UndeclaredThrowableException.class, e);
+            }
+            jm.addEndTry();
+        }
+        return jm;
+    }
+
+    protected JavaField getXmlRpcCaller(JavaSource pJs) {
+    	JavaField jf = pJs.newJavaField("caller", XmlRpcCaller.class, JavaSource.PRIVATE);
+        jf.setFinal(true);
+        return jf;
+    }
+
+    protected JavaConstructor getConstructor(JavaSource pJs, JavaField jf) {
+        JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PUBLIC);
+        Parameter param = jcon.addParam(XmlRpcCaller.class, "pCaller");
+        jcon.addLine(jf, " = ", param, ";");
+        return jcon;
+    }
+
+    /** Returns, whether a remote method call is generated for method
+     * <code>pMethod</code>. The default implementation returns true,
+     * if the method is public and not static.
+     */
+    protected boolean isMethodGenerated(JavaMethod pMethod) {
+    	return JavaSource.PUBLIC.equals(pMethod.getProtection())
+          &&  !pMethod.isStatic();
+    }
+
+    /** Creates a new client class, which is invoking the given
+     * server side class <code>pSource</code>.
+     */
+    public JavaSource addClass(JavaSource pSource, JavaSourceResolver pResolver)
+            throws SecurityException, NoSuchMethodException {
+        JavaSource js = getFactory().newJavaSource(JavaQNameImpl.getInstance(getTargetPackage(), pSource.getQName().getClassName()), JavaSource.PUBLIC);
+        JavaField jf = getXmlRpcCaller(js);
+        getConstructor(js, jf);
+        Map keys = new HashMap();
+        addMethods(js, pSource, keys, jf, pResolver);
+        return js;
+    }
+
+    protected void addMethods(JavaSource pResult, JavaSource pSource, Map pKeys,
+                              JavaField pField, JavaSourceResolver pResolver)
+            throws SecurityException, NoSuchMethodException {
+        JavaMethod[] methods = pSource.getMethods();
+        for (int i = 0;  i < methods.length;  i++) {
+            JavaMethod m = methods[i];
+            if (isMethodGenerated(m)) {
+                MethodKey key = new MethodKey(m);
+                if (pKeys.containsKey(key)) {
+                	continue;
+                }
+            	String name = addMethod(m);
+            	pKeys.put(key, getMethod(pResult, pField, name, m));
+            }
+        }
+        if (pResolver != null) {
+            JavaQName[] qNames = pSource.getExtends();
+            for (int i = 0;  i < qNames.length;  i++) {
+            	JavaSource js = pResolver.getJavaSource(qNames[i]);
+                if (js != null) {
+                	addMethods(pResult, js, pKeys, pField, pResolver);
+                }
+            }
+        }
+    }
+
+    /** Generates the abstract invoker class.
+     */
+    public JavaSource getInvokerClass(JavaSource pSource) {
+        JavaInnerClass invoker = pSource.newJavaInnerClass("Invoker", JavaSource.PUBLIC);
+        JavaComment comment = invoker.newComment();
+        comment.addLine("The dispatcher is implemented with a {@link java.util.Map}.");
+        comment.addLine("The map keys are the method names, the values");
+        comment.addLine("are instances of <code>Invoker</code>.");
+        invoker.setType(JavaSource.INTERFACE);
+        JavaMethod jm = invoker.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
+        comment = jm.newComment();
+        comment.addLine("This method creates a new instance of the class being");
+        comment.addLine("called, converts the parameter objects (if required)");
+        comment.addLine("and invokes the requested method. If required, the");
+        comment.addLine("result is converted also and returned.");
+        jm.addParam(Vector.class, "pParams");
+        jm.addThrows(Throwable.class);
+        return invoker;
+    }
+
+    /** Creates the field with the {@link Map} of invokers.
+     */
+    protected JavaField getInvokerMap(JavaSource pSource) {
+    	JavaField result = pSource.newJavaField("map", Map.class, JavaSource.PRIVATE);
+    	result.addLine("new ", HashMap.class, "()");
+        return result;
+    }
+
+    /** Creates a new invoker class for the given method.
+     */
+    protected JavaSource getInvoker(JavaSource pSource, JavaMethod pMethod, JavaQName pInvoker, int pNum) {
+        Parameter[] params = pMethod.getParams();
+
+        JavaInnerClass js = pSource.newJavaInnerClass("Invoker" + pNum, JavaSource.PUBLIC);
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0;  i < params.length;  i++) {
+        	if (i > 0) {
+        		sb.append(", ");
+            }
+            sb.append(params[i].getType());
+        }
+        JavaComment comment = js.newComment();
+        comment.addLine("Invoker for method " + pMethod.getName() + "(" + sb + ")");
+        comment.addLine("in class " + pMethod.getJavaSource().getQName() + ".");
+        js.setStatic(true);
+        js.addImplements(pInvoker);
+        JavaMethod jm = js.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
+        Parameter param = jm.addParam(Vector.class, "params");
+        JavaQName[] classes = pMethod.getExceptions();
+        for (int i = 0;  i < classes.length;  i++) {
+        	jm.addThrows(classes[i]);
+        }
+        List args = new ArrayList();
+        for (int i = 0;  i < params.length;  i++) {
+        	if (i > 0) {
+        		args.add(", ");
+            }
+            Parameter p = params[i];
+            args.add(getResultValue(jm, p.getType(), new Object[]{param, ".elementAt(" + i + ")"}));
+        }
+        Object o = new Object[]{"new ", pMethod.getJavaSource().getQName(), "().",
+        		                pMethod.getName(), "(", args, ")"};
+        if (JavaQNameImpl.VOID.equals(pMethod.getType())) {
+        	jm.addLine(o, ";");
+            jm.addLine("return null;");
+        } else {
+            jm.addLine("return ", getInputValue(jm, pMethod.getType(), o), ";");
+        }
+        return js;
+    }
+
+    /** Creates the dispatchers constructor.
+     */
+    public JavaConstructor getDispatcherConstructor(JavaSource pSource,
+                                                    JavaField pMap,
+                                                    JavaQName pInvoker) {
+        JavaConstructor con = pSource.newJavaConstructor(JavaSource.PUBLIC);
+        JavaComment comment = con.newComment();
+        comment.addLine("Creates a new dispatcher.");
+        int num = 0;
+        for (Iterator iter = methods.entrySet().iterator();  iter.hasNext();  ) {
+            Map.Entry entry = (Map.Entry) iter.next();
+            String name = (String) entry.getKey();
+            JavaMethod method = (JavaMethod) entry.getValue();
+            JavaSource innerClass = getInvoker(pSource, method, pInvoker, num++);
+            con.addLine(pMap, ".put(", JavaSource.getQuoted(name), ", new ", innerClass.getQName(), "());");
+        }
+        return con;
+    }
+
+    /** Creates the dispatchers <code>getInvoker</code> method.
+     */
+    protected JavaMethod getGetInvokerMethod(JavaSource pSource, JavaQName pInvoker, JavaField pMap) {
+    	JavaMethod jm = pSource.newJavaMethod("getInvoker", pInvoker, JavaSource.PROTECTED);
+        Parameter param = jm.addParam(String.class, "pName");
+        jm.addLine("return (", pInvoker, ") ", pMap, ".get(", param, ");");
+        return jm;
+    }
+
+    /** Creates the dispatchers <code>invoke</code> method.
+     */
+    protected JavaMethod getDispatcherInvokeMethod(JavaSource pSource, JavaQName pInvoker) {
+        JavaMethod jm = pSource.newJavaMethod("execute", Object.class, JavaSource.PUBLIC);
+        JavaComment comment = jm.newComment();
+        comment.addLine("Called for invocation of method <code>pName</code> with");
+        comment.addLine("the parameters given by <code>pParams</code>.");
+        Parameter name = jm.addParam(String.class, "pName");
+        Parameter args = jm.addParam(Vector.class, "pParams");
+        jm.addThrows(Exception.class);
+        LocalJavaField invoker = jm.newJavaField(pInvoker);
+        invoker.addLine("getInvoker(", name, ")");
+        jm.addIf(invoker, " == null");
+        jm.addThrowNew(IllegalStateException.class,
+                       JavaSource.getQuoted("Unknown method name: "),
+                       " + ", name);
+        jm.addEndIf();
+        jm.addTry();
+        jm.addLine("return ", invoker, ".invoke(", args, ");");
+        DirectAccessible e = jm.addCatch(Exception.class);
+        jm.addLine("throw ", e, ";");
+        DirectAccessible t = jm.addCatch(Throwable.class);
+        jm.addThrowNew(UndeclaredThrowableException.class, t);
+        jm.addEndTry();
+        return jm;
+    }
+
+    /** Creates the dispatcher class. Make sure, that this method
+     * is invoked <em>after</em> {@link #addClass(JavaSource, JavaSourceResolver)}!
+     * @param pQName Fully qualified class name of the dispatcher class.
+     */
+    public JavaSource getDispatcher(JavaQName pQName) {
+    	JavaSource js = getFactory().newJavaSource(pQName, JavaSource.PUBLIC);
+        if (isDispatcherImplementsXmlRpcHandler()) {
+        	js.addImport(JavaQNameImpl.getInstance("org.apache.xmlrpc.XmlRpcHandler"));
+        }
+    	JavaComment comment = js.newComment();
+        comment.addLine("The dispatcher is being used by the XmlRpcServer.");
+        comment.addLine("It delegates incoming XML-RPC calls to the classes");
+        comment.addLine("and methods, for which client classes have been");
+        comment.addLine("created by the " +
+                        XmlRpcClientGenerator.class.getName() + ".");
+        JavaSource invoker = getInvokerClass(js);
+        JavaField map = getInvokerMap(js);
+        getDispatcherConstructor(js, map, invoker.getQName());
+        getGetInvokerMethod(js, invoker.getQName(), map);
+        getDispatcherInvokeMethod(js, invoker.getQName());
+        return js;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfo.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfo.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfo.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+package org.apache.ws.jaxme.js.beanreader;
+
+import org.apache.ws.jaxme.js.JavaQName;
+
+
+
+/** Data container, which provides the required
+ * information on a particular data bean.
+ */
+public interface BeanInfo {
+	/** Returns the generated schemas target namespace.
+	 */
+	String getTargetNamespace();
+
+	/** Returns the set of bean properties.
+	 */
+	BeanProperty[] getBeanProperties();
+
+	/** Returns the suggested element name.
+	 */
+	String getElementName();
+
+	/** Returns the bean class.
+	 */
+	JavaQName getType();
+
+	/** Returns the bean classes super class.
+	 */
+	JavaQName getSuperType();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfoFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfoFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanInfoFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,378 @@
+package org.apache.ws.jaxme.js.beanreader;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.js.apps.JavaSourceResolver;
+
+
+/** A {@link BeanInfoFactory} is reading and analyzing
+ * a given bean class. It provides the information required
+ * by the {@link BeanSchemaWriter}.
+ */
+public class BeanInfoFactory {
+	private static final JavaQName OBJECT_TYPE = JavaQNameImpl.getInstance(Object.class);
+	private static final JavaQName STRING_TYPE = JavaQNameImpl.getInstance(String.class);
+	private static final JavaQName BYTE_TYPE = JavaQNameImpl.getInstance(Byte.class);
+	private static final JavaQName BYTE_ARRAY_TYPE = JavaQNameImpl.getArray(JavaQNameImpl.BYTE);
+	private static final JavaQName SHORT_TYPE = JavaQNameImpl.getInstance(Short.class);
+	private static final JavaQName INTEGER_TYPE = JavaQNameImpl.getInstance(Integer.class);
+	private static final JavaQName LONG_TYPE = JavaQNameImpl.getInstance(Long.class);
+	private static final JavaQName FLOAT_TYPE = JavaQNameImpl.getInstance(Float.class);
+	private static final JavaQName DOUBLE_TYPE = JavaQNameImpl.getInstance(Double.class);
+	private static final JavaQName BOOLEAN_TYPE = JavaQNameImpl.getInstance(Boolean.class);
+	private static final JavaQName CALENDAR_TYPE = JavaQNameImpl.getInstance(Calendar.class);
+	private static final JavaQName BIG_DECIMAL_TYPE = JavaQNameImpl.getInstance(BigDecimal.class);
+	private static final JavaQName BIG_INTEGER_TYPE = JavaQNameImpl.getInstance(BigInteger.class);
+	private static final Map xsTypesByJavaTypes = new HashMap();
+	private static final JavaQName[] SIMPLE_TYPES;
+	static {
+		xsTypesByJavaTypes.put(STRING_TYPE, new QName(BeanSchemaWriter.XML_SCHEMA_URI, "string"));
+		final QName byteQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "byte");
+		xsTypesByJavaTypes.put(BYTE_TYPE, byteQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.BYTE, byteQName);
+		xsTypesByJavaTypes.put(BYTE_ARRAY_TYPE, new QName(BeanSchemaWriter.XML_SCHEMA_URI, "base64"));
+		final QName shortQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "short");
+		xsTypesByJavaTypes.put(SHORT_TYPE, shortQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.SHORT, shortQName);
+		final QName intQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "int");
+		xsTypesByJavaTypes.put(INTEGER_TYPE, intQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.INT, intQName);
+		final QName longQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "long");
+		xsTypesByJavaTypes.put(LONG_TYPE, longQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.LONG, longQName);
+		final QName floatQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "float");
+		xsTypesByJavaTypes.put(FLOAT_TYPE, floatQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.FLOAT, floatQName);
+		final QName doubleQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "double");
+		xsTypesByJavaTypes.put(DOUBLE_TYPE, doubleQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.DOUBLE, doubleQName);
+		final QName booleanQName = new QName(BeanSchemaWriter.XML_SCHEMA_URI, "boolean");
+		xsTypesByJavaTypes.put(BOOLEAN_TYPE, booleanQName);
+		xsTypesByJavaTypes.put(JavaQNameImpl.BOOLEAN, booleanQName);
+		xsTypesByJavaTypes.put(CALENDAR_TYPE, new QName(BeanSchemaWriter.XML_SCHEMA_URI, "dateTime"));
+		xsTypesByJavaTypes.put(BIG_DECIMAL_TYPE, new QName(BeanSchemaWriter.XML_SCHEMA_URI, "decimal"));
+		xsTypesByJavaTypes.put(BIG_INTEGER_TYPE, new QName(BeanSchemaWriter.XML_SCHEMA_URI, "integer"));
+		SIMPLE_TYPES = (JavaQName[]) xsTypesByJavaTypes.keySet().toArray(new JavaQName[xsTypesByJavaTypes.size()]);
+	}
+	
+	private final JavaSourceResolver resolver;
+	private String targetNamespace;
+	private Map beans = new HashMap();
+
+	/** Creates a new instance.
+	 */
+	public BeanInfoFactory(JavaSourceResolver pClassLoader, JavaQName pQName)
+			throws BeanReaderException {
+		resolver = pClassLoader;
+		JavaSource js = pClassLoader.getJavaSource(pQName);
+		if (js == null) {
+			throw new BeanReaderException("Failed to resolve class " + pQName);
+		}
+		createBeanInfo(js, false);
+	}
+
+	/** Verifies, that the bean class is public, not
+	 * abstract, and is no interface.
+	 */
+	private void verifyAvailable(JavaSource pJs, boolean pIsSuperClass)
+			throws BeanReaderException {
+		if (!pIsSuperClass  &&  !pJs.getProtection().equals(JavaSource.PUBLIC)) {
+			throw new BeanReaderException("The class " + pJs.getType()
+					+ " is not public.");
+		}
+		if (!pIsSuperClass  &&  pJs.isAbstract()) {
+			throw new BeanReaderException("The class " + pJs.getType()
+					+ " is abstract.");
+		}
+		if (pJs.isInterface()) {
+			throw new BeanReaderException("The class " + pJs.getType()
+					+ " is an interface.");
+		}
+	}
+
+	/** Verifies, that the bean class has a default constructor.
+	 */
+	private void verifyDefaultConstructor(JavaSource pJs) throws BeanReaderException {
+		JavaConstructor[] constructors = pJs.getConstructors();
+		if (constructors.length == 0) {
+			return;
+		}
+		for (int i = 0;  i < constructors.length;  i++) {
+			JavaConstructor jc = constructors[i];
+			if (jc.getProtection().equals(JavaSource.PUBLIC)  &&
+				jc.getParams().length == 0) {
+				return;
+			}
+		}
+		throw new BeanReaderException("The class " + pJs.getType()
+				+ " doesn't have a default constructor.");
+	}
+
+	private JavaQName getSuperClass(JavaSource pJs) throws BeanReaderException {
+		JavaQName[] superClasses = pJs.getExtends();
+		switch (superClasses.length) {
+			case 0:
+				return null;
+			case 1:
+				JavaQName superClass = superClasses[0];
+				if (OBJECT_TYPE.equals(superClass)) {
+					return null;
+				}
+				JavaSource js = resolver.getJavaSource(superClass);
+				if (js == null) {
+					throw new BeanReaderException("Failed to resolve class: " + superClass);
+				}
+				createBeanInfo(js, true);
+				return superClass;
+			default:
+				throw new BeanReaderException("The class " + pJs.getQName() + " is extending multiple classes.");
+		}
+	}
+
+	private BeanProperty[] getBeanProperties(JavaSource pJs,
+			BeanProperty[] pSuperTypeProperties)
+			throws BeanReaderException {
+		final Set propertyNames = new HashSet();
+		JavaMethod[] methods = pJs.getMethods();
+		final List result = new ArrayList();
+		for (int i = 0;  i < methods.length;  i++) {
+			JavaMethod m = methods[i];
+			if (!JavaSource.PUBLIC.equals(m.getProtection())
+				||  m.isStatic()
+				||  !m.getName().startsWith("set")) {
+				continue;
+			}
+			String name = m.getName().substring(3);
+			Parameter[] parameters = m.getParams();
+			if (parameters.length != 1) {
+				continue;
+			}
+			JavaQName type = parameters[0].getType();
+			JavaQName[] zeroParameters = new JavaQName[0];
+			JavaMethod getter = pJs.getMethod("get" + name, zeroParameters);
+			if (getter == null) {
+				if (JavaQNameImpl.BOOLEAN.equals(type)) {
+					getter = pJs.getMethod("is" + name, zeroParameters);
+				}
+				if (getter == null) {
+					continue;
+				}
+			}
+			if (!type.equals(getter.getType())  ||
+				!JavaSource.PUBLIC.equals(getter.getProtection())  ||
+				getter.isStatic()) {
+				continue;
+			}
+			BeanProperty p = createBeanProperty(propertyNames, name, type);
+			boolean isSuperTypeProperty = false;
+			for (int j = 0;  j < pSuperTypeProperties.length;  j++) {
+				if (pSuperTypeProperties[j].equals(p)) {
+					isSuperTypeProperty = true;
+					break;
+				}
+			}
+			if (!isSuperTypeProperty) {
+				result.add(p);
+			}
+		}
+		return (BeanProperty[]) result.toArray(new BeanProperty[result.size()]);
+	}
+
+	private JavaQName getInstanceType(JavaQName pType) {
+		if (pType.isArray()  &&  !BYTE_ARRAY_TYPE.equals(pType)) {
+			return pType.getInstanceClass();
+		} else {
+			return pType;
+		}
+	}
+
+	private QName getXsType(JavaQName pType) throws BeanReaderException {
+		JavaQName instanceType = getInstanceType(pType);
+		if (instanceType.isArray()) {
+			if (instanceType.isArray()  &&  !BYTE_ARRAY_TYPE.equals(instanceType)) {
+				throw new BeanReaderException("Multidimensional arrays are unsupported: " + pType);
+			}
+		}
+		return (QName) xsTypesByJavaTypes.get(instanceType);
+	}
+
+	private String getXsTypeName(Set pPropertyNames, JavaQName pType)
+			throws BeanReaderException {
+		JavaQName instanceType = getInstanceType(pType);
+		JavaSource js = resolver.getJavaSource(instanceType);
+		if (js == null) {
+			throw new BeanReaderException("Failed to resolve property type " + instanceType);
+		}
+		createBeanInfo(js, false);
+		final String propertyPrefix = asXmlIdentifier(pType.getInnerClassName());
+		String propertyName = propertyPrefix;
+		for (int i = 0;  pPropertyNames.contains(propertyName);  i++) {
+			propertyName = propertyPrefix + i;
+		}
+		pPropertyNames.add(propertyName);
+		return propertyName;
+	}
+
+	private class BeanPropertyImpl implements BeanProperty {
+		private final JavaQName type;
+		private final QName xsType;
+		private final String xsTypeName, name;
+		BeanPropertyImpl(JavaQName pType, QName pXsType,
+				String pXsTypeName, String pName) {
+			type = pType;
+			xsType = pXsType;
+			xsTypeName = pXsTypeName;
+			name = pName;
+		}
+		public JavaQName getType() { return type; }
+		public QName getXsType() {
+			return xsType == null ? new QName(getTargetNamespace(), xsTypeName) : xsType;
+		}
+		public String getName() {
+			return name;
+		}
+		public boolean equals(Object pOther) {
+			if (pOther == null  ||  !(pOther instanceof BeanPropertyImpl)) {
+				return false;
+			}
+			BeanPropertyImpl other = (BeanPropertyImpl) pOther;
+			return type.equals(other.type)  &&  name.equals(other.name);
+		}
+		public int hashCode() {
+			return (type.hashCode() << 7) + name.hashCode();
+		}
+	}
+
+	private BeanProperty createBeanProperty(Set pPropertyNames,
+			final String pName, final JavaQName pType)
+			throws BeanReaderException {
+		final QName xsType = getXsType(pType);
+		final String xsTypeName;
+		if (xsType == null) {
+			xsTypeName = getXsTypeName(pPropertyNames, pType);
+		} else {
+			xsTypeName = null;
+		}
+		return new BeanPropertyImpl(pType, xsType, xsTypeName, pName);
+	}
+
+	private String asBeanKey(JavaQName pQName) {
+		return pQName.toString().replace('$', '.');
+	}
+
+	private class BeanInfoImpl implements BeanInfo {
+		private BeanProperty[] properties;
+		private final String elementName;
+		private final JavaQName type, superType;
+		BeanInfoImpl(String pElementName, JavaQName pType,
+				JavaQName pSuperType) {
+			elementName = pElementName;
+			type = pType;
+			superType = pSuperType;
+		}
+		public String getTargetNamespace() {
+			return BeanInfoFactory.this.getTargetNamespace();
+		}
+		void setBeanProperties(BeanProperty[] pProperties) { properties = pProperties; }
+		public BeanProperty[] getBeanProperties() { return properties; }
+		public String getElementName() { return elementName; }
+		public JavaQName getType() { return type; }
+		public JavaQName getSuperType() { return superType; }
+	}
+
+	private void createBeanInfo(JavaSource pJs, boolean pIsSuperClass)
+			throws BeanReaderException {
+		final JavaQName type = pJs.getQName();
+		final String key = asBeanKey(type);
+		if (beans.containsKey(key)) {
+			return;
+		}
+		verifyAvailable(pJs, pIsSuperClass);
+		if (!pIsSuperClass) {
+			verifyDefaultConstructor(pJs);
+		}
+
+		final JavaQName superType = getSuperClass(pJs);
+		final BeanProperty[] superTypeProperties;
+		if (superType == null) {
+			superTypeProperties = new BeanProperty[0];
+		} else {
+			superTypeProperties = getBeanInfo(superType).getBeanProperties();
+		}
+		final String elementName = asXmlIdentifier(type.getInnerClassName());
+		BeanInfoImpl beanInfo = new BeanInfoImpl(elementName, type, superType);
+		beans.put(key, beanInfo);
+		final BeanProperty[] properties = getBeanProperties(pJs, superTypeProperties);
+		beanInfo.setBeanProperties(properties);
+	}
+
+	private String asXmlIdentifier(String pJavaIdentifier) {
+		StringBuffer sb = new StringBuffer();
+		for (int i = 0;  i < pJavaIdentifier.length();  i++) {
+			char c = pJavaIdentifier.charAt(i);
+			if (i == 0) {
+				c = Character.toLowerCase(c);
+				if (c < 'a'  ||  c > 'z') {
+					c = '_';
+				}
+			} else {
+				if ((c < 'a'  ||  c > 'z')  &&  (c < 'A'  ||  c > 'Z')  &&
+					(c < '0'  ||  c > '9')) {
+					c = '_';
+				}
+			}
+			sb.append(c);
+		}
+		return sb.toString();
+	}
+
+	/** Returns, whether the given Java type can be mapped to
+	 * an atomic type.
+	 */
+	public boolean isSimpleType(JavaQName pType) {
+		for (int i = 0;  i < SIMPLE_TYPES.length;  i++) {
+			if (SIMPLE_TYPES[i].equals(pType)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/** Returns the bean info for the given type.
+	 */
+	public BeanInfo getBeanInfo(JavaQName pType) {
+		BeanInfo result = (BeanInfo) beans.get(asBeanKey(pType));
+		if (result == null) {
+			throw new IllegalStateException("Unknown bean type: " + pType);
+		}
+		return result;
+	}
+
+	/** Returns the factories target namespace.
+	 */
+	public String getTargetNamespace() {
+		return targetNamespace;
+	}
+
+	/** Sets the factories target namespace.
+	 */
+	public void setTargetNamespace(String pTargetNamespace) {
+		targetNamespace = pTargetNamespace;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanProperty.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanProperty.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanProperty.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,21 @@
+package org.apache.ws.jaxme.js.beanreader;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.js.JavaQName;
+
+
+/** An instance of {@link BeanProperty} is being mapped
+ * to an attribute, or element, in the schema.
+ */
+public interface BeanProperty {
+	/** Returns the properties Java type.
+	 */
+	JavaQName getType();
+	/** Returns the properties XS data type.
+	 */
+	QName getXsType();
+	/** Returns the property name.
+	 */
+	String getName();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanReaderException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanReaderException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanReaderException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+package org.apache.ws.jaxme.js.beanreader;
+
+
+/** An exception, which is being thrown, if an error
+ * was encountered while running the BeanReader.
+ */
+public class BeanReaderException extends Exception {
+	private static final long serialVersionUID = 5230551895989267844L;
+
+	/** Creates a new instance with the given message
+	 * and cause.
+	 */
+	public BeanReaderException(String pMessage, Throwable pCause) {
+		super(pMessage, pCause);
+	}
+
+	/** Creates a new instance with the given message
+	 * and no cause.
+	 */
+	public BeanReaderException(String pMessage) {
+		super(pMessage);
+	}
+
+	/** Creates a new instance with the given cause.
+	 */
+	public BeanReaderException(Throwable pCause) {
+		super(pCause);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanSchemaWriter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanSchemaWriter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/BeanSchemaWriter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,344 @@
+package org.apache.ws.jaxme.js.beanreader;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/** The {@link BeanSchemaWriter} is an object, which takes
+ * as input an instance of {@link JavaSource}, and creates
+ * a corresponding instance of XML Schema.
+ */
+public class BeanSchemaWriter {
+	private static final JavaQName OBJECT_TYPE = JavaQNameImpl.getInstance(Object.class);
+	private static final JavaQName BYTE_ARRAY_TYPE = JavaQNameImpl.getArray(JavaQNameImpl.BYTE);
+	static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema-instance";
+
+	private final BeanInfoFactory factory;
+	private boolean isFiringStartDocument = true;
+	private boolean isFiringXmlnsAttributes = true;
+	private final List prefixes = new ArrayList();
+	private final Map types = new HashMap();
+	private final Map remainingComplexTypes = new HashMap();
+
+	/** Creates a new instance.
+	 */
+	public BeanSchemaWriter(BeanInfoFactory pFactory) {
+		factory = pFactory;
+	}
+
+	private String getAttrPrefix(String pURI, ContentHandler pHandler,
+			AttributesImpl pAttrs) throws SAXException {
+		if (pURI == null  ||  pURI.length() == 0) {
+			return "";
+		} else {
+			return getPrefix(pURI, pHandler, pAttrs);
+		}
+	}
+
+	private String getPrefix(String pURI, ContentHandler pHandler,
+			AttributesImpl pAttrs) throws SAXException {
+		if (pURI == null) {
+			pURI = "";
+		}
+		for (int i = prefixes.size()-2;  i >= 0;  i -= 2) {
+			if (prefixes.get(i+1).equals(pURI)) {
+				return (String) prefixes.get(i);
+			}
+		}
+		final String newPrefix;
+		if (XML_SCHEMA_URI.equals(pURI)) {
+			newPrefix = "xs";
+		} else {
+			String testPrefix = "p";
+			int i = 0;
+			while (prefixes.contains(testPrefix)) {
+				testPrefix = "p" + i++;
+			}
+			newPrefix = testPrefix;
+		}
+		prefixes.add(newPrefix);
+		prefixes.add(pURI);
+		pHandler.startPrefixMapping(newPrefix, pURI);
+		if (isFiringXmlnsAttributes()) {
+			pAttrs.addAttribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, newPrefix,
+					XMLConstants.XMLNS_ATTRIBUTE + ":" + newPrefix,
+					"CDATA", pURI);
+		}
+		return newPrefix;
+	}
+
+	private int getPrefixContext() {
+		return prefixes.size();
+	}
+
+	private void setPrefixContext(int pContext, ContentHandler pHandler)
+			throws SAXException {
+		while (prefixes.size() > pContext) {
+			prefixes.remove(prefixes.size()-1);
+			String prefix = (String) prefixes.remove(prefixes.size()-1);
+			pHandler.endPrefixMapping(prefix);
+		}
+	}
+
+	/** Returns, whether the bean schema writer is firing the
+	 * {@link ContentHandler#startDocument()}, and
+	 * {@link ContentHandler#endDocument()} events. By default,
+	 * it does.
+	 */
+	public boolean isFiringStartDocument() {
+		return isFiringStartDocument;
+	}
+
+	/** Sets, whether the bean schema writer is firing the
+	 * {@link ContentHandler#startDocument()}, and
+	 * {@link ContentHandler#endDocument()} events. By default,
+	 * it does.
+	 */
+	public void setFiringStartDocument(boolean pIsFiringStartDocument) {
+		isFiringStartDocument = pIsFiringStartDocument;
+	}
+
+	/** Returns, whether XML namespace declarations are fired not
+	 * only as {@link ContentHandler#startPrefixMapping(String, String)}
+	 * as events, but as attributes in
+	 * {@link ContentHandler#startElement(String, String, String, org.xml.sax.Attributes)}
+	 * events as well. Defaults to true.
+	 */
+	public boolean isFiringXmlnsAttributes() {
+		return isFiringXmlnsAttributes;
+	}
+
+	/** Sets, whether XML namespace declarations are fired not
+	 * only as {@link ContentHandler#startPrefixMapping(String, String)}
+	 * as events, but as attributes in
+	 * {@link ContentHandler#startElement(String, String, String, org.xml.sax.Attributes)}
+	 * events as well. Defaults to true.
+	 */
+	public void setFiringXmlnsAttributes(boolean pFiringXmlnsAttributes) {
+		isFiringXmlnsAttributes = pFiringXmlnsAttributes;
+	}
+
+	private void writeComplexType(ContentHandler pHandler, BeanInfo pBeanInfo,
+			String pXsType) throws SAXException {
+		AttributesImpl attrs = new AttributesImpl();
+		int ctx = getPrefixContext();
+		addAttr(attrs, pHandler, "name", pXsType);
+		startXsElement(pHandler, "complexType", attrs);
+		JavaQName superClass = pBeanInfo.getSuperType();
+		if (superClass == null  ||  OBJECT_TYPE.equals(superClass)) {
+			writeComplexTypeContents(pHandler, pBeanInfo);
+		} else {
+			BeanInfo beanInfo = factory.getBeanInfo(superClass);
+			QName qName = getXsType(beanInfo);
+			startXsElement(pHandler, "complexContent", new AttributesImpl());
+			int ctx2 = getPrefixContext();
+			AttributesImpl attrs2 = new AttributesImpl();
+			addAttr(attrs2, pHandler, "base", getQName(qName, pHandler, attrs2));
+			startXsElement(pHandler, "extension", attrs2);
+			writeComplexTypeContents(pHandler, pBeanInfo);
+			endXsElement(pHandler, "extension");
+			setPrefixContext(ctx2, pHandler);
+			endXsElement(pHandler, "complexContent");
+		}
+		endXsElement(pHandler, "complexType");
+		setPrefixContext(ctx, pHandler);
+	}
+
+	private void writeComplexTypeContents(ContentHandler pHandler, BeanInfo pBeanInfo) throws SAXException {
+		BeanProperty[] properties = pBeanInfo.getBeanProperties();
+		List elementProperties = new ArrayList();
+		List attributeProperties = new ArrayList();
+		for (int i = 0;  i < properties.length;  i++) {
+			BeanProperty p = properties[i];
+			if (isAttributeProperty(p)) {
+				attributeProperties.add(p);
+			} else {
+				elementProperties.add(p);
+			}
+		}
+		if (elementProperties.size() > 0) {
+			startXsElement(pHandler, "sequence", new AttributesImpl());
+			for (Iterator iter = elementProperties.iterator();  iter.hasNext();  ) {
+				writeParticle(pHandler, (BeanProperty) iter.next());
+			}
+			endXsElement(pHandler, "sequence");
+		}
+		for (Iterator iter = attributeProperties.iterator();  iter.hasNext();  ) {
+			writeAttribute(pHandler, (BeanProperty) iter.next());
+		}
+	}
+
+	private void writeParticle(ContentHandler pHandler, BeanProperty pProperty)
+			throws SAXException {
+		JavaQName type = pProperty.getType();
+		final String minOccurs = "0", maxOccurs;
+		if (type.isArray()) {
+			maxOccurs = "unbounded";
+			type = type.getInstanceClass();
+			if (type.isArray()  &&  !BYTE_ARRAY_TYPE.equals(type)) {
+				throw new IllegalStateException("Unable to handle multidimensional arrays.");
+			}
+		} else {
+			maxOccurs = null;
+		}
+
+		int ctx = getPrefixContext();
+		AttributesImpl attrs = new AttributesImpl();
+		final QName xsType;
+		if (factory.isSimpleType(type)) {
+			xsType = pProperty.getXsType();
+		} else {
+			BeanInfo beanInfo = factory.getBeanInfo(type);
+			xsType = getXsType(beanInfo);
+		}
+		addAttr(attrs, pHandler, "type", getQName(xsType, pHandler, attrs));
+		addAttr(attrs, pHandler, "name", pProperty.getName());
+		addAttr(attrs, pHandler, "minOccurs", minOccurs);
+		if (maxOccurs != null) {
+			addAttr(attrs, pHandler, "maxOccurs", maxOccurs);
+		}
+		startXsElement(pHandler, "element", attrs);
+		endXsElement(pHandler, "element");
+		setPrefixContext(ctx, pHandler);
+	}
+
+	private void writeAttribute(ContentHandler pHandler, BeanProperty pProperty)
+			throws SAXException {
+		int ctx = getPrefixContext();
+		AttributesImpl attrs = new AttributesImpl();
+		addAttr(attrs, pHandler, "name", pProperty.getName());
+		if (pProperty.getType().isPrimitive()) {
+			addAttr(attrs, pHandler, "use", "required");
+		}
+		addAttr(attrs, pHandler, "type", getQName(pProperty.getXsType(), pHandler, attrs));
+		startXsElement(pHandler, "attribute", attrs);
+		endXsElement(pHandler, "attribute");
+		setPrefixContext(ctx, pHandler);
+	}
+
+	private boolean isAttributeProperty(BeanProperty pProperty) {
+		if (factory.isSimpleType(pProperty.getType())) {
+			return true;
+		}
+		if (pProperty.getType().isArray()) {
+			return false;
+		}
+		return false;
+	}
+
+	private QName getXsType(BeanInfo pBeanInfo) throws SAXException {
+		JavaQName qName = pBeanInfo.getType();
+		QName xsType = (QName) types.get(qName);
+		if (xsType == null) {
+			final String xsTypePrefix = "T_" + pBeanInfo.getElementName();
+			String localPart = xsTypePrefix;
+			for (int i = 0;  ;  i++) {
+				xsType = new QName(pBeanInfo.getTargetNamespace(), localPart);
+				if (!types.values().contains(xsType)) {
+					break;
+				}
+				localPart = xsTypePrefix + i;
+			}
+			types.put(qName, xsType);
+			remainingComplexTypes.put(xsType, pBeanInfo);
+		}
+		return xsType;
+	}
+
+	private void addAttr(AttributesImpl pAttrs, ContentHandler pHandler,
+			String pURI, String pLocalName, String pValue)
+			throws SAXException {
+		String prefix = getAttrPrefix(pURI, pHandler, pAttrs);
+		String qName = prefix.length() == 0 ?
+				pLocalName : prefix + ":" + pLocalName;
+		pAttrs.addAttribute(pURI, pLocalName, qName, "CDATA", pValue);
+	}
+
+	private void addAttr(AttributesImpl pAttrs, ContentHandler pHandler,
+			String pLocalName, String pValue) throws SAXException {
+		addAttr(pAttrs, pHandler, "", pLocalName, pValue);
+	}
+
+	private String getQName(QName pQName, ContentHandler pHandler, AttributesImpl pAttrs)
+			throws SAXException {
+		final String prefix = getPrefix(pQName.getNamespaceURI(), pHandler, pAttrs);
+		if (prefix == null  ||  prefix.length() == 0) {
+			return pQName.getLocalPart();
+		} else {
+			return prefix + ":" + pQName.getLocalPart();
+		}
+	}
+
+	protected void writeElement(ContentHandler pHandler, BeanInfo pBeanInfo)
+			throws SAXException {
+		QName xsType = getXsType(pBeanInfo);
+		int ctx = getPrefixContext();
+		AttributesImpl attrs = new AttributesImpl();
+		addAttr(attrs, pHandler, "name", pBeanInfo.getElementName());
+		addAttr(attrs, pHandler, "type", getQName(xsType, pHandler, attrs));
+		startXsElement(pHandler, "element", attrs);
+		endXsElement(pHandler, "element");
+		setPrefixContext(ctx, pHandler);
+	}
+
+	/** Writes the XML schema to the given content handler.
+	 * @throws SAXException Invoking the target handler failed.
+	 */
+	public void write(BeanInfo pBeanInfo, ContentHandler pHandler)
+			throws SAXException {
+		final boolean firingStartDocument = isFiringStartDocument();
+		if (firingStartDocument) {
+			pHandler.startDocument();
+		}
+		int ctx = getPrefixContext();
+		AttributesImpl attrs = new AttributesImpl();
+		final String targetNs = pBeanInfo.getTargetNamespace();
+		// Ensure, that a prefix is declared for the target namespace
+		getPrefix(targetNs, pHandler, attrs);
+		if (targetNs != null  &&  !"".equals(targetNs)) {
+			addAttr(attrs, pHandler, "targetNamespace", targetNs);
+		}
+		startXsElement(pHandler, "schema", attrs);
+		writeElement(pHandler, pBeanInfo);
+		while (!remainingComplexTypes.isEmpty()) {
+			Iterator iter = remainingComplexTypes.entrySet().iterator();
+			Map.Entry entry = (Map.Entry) iter.next();
+			iter.remove();
+			QName xsType = (QName) entry.getKey();
+			BeanInfo beanInfo = (BeanInfo) entry.getValue();
+			writeComplexType(pHandler, beanInfo, xsType.getLocalPart());
+		}
+		endXsElement(pHandler, "schema");
+		setPrefixContext(ctx, pHandler);
+		if (firingStartDocument) {
+			pHandler.endDocument();
+		}
+	}
+
+	private void startXsElement(ContentHandler pHandler, String pLocalName,
+			AttributesImpl pAttrs) throws SAXException {
+		String prefix = getPrefix(XML_SCHEMA_URI, pHandler, pAttrs);
+		pHandler.startElement(XML_SCHEMA_URI,
+				pLocalName, prefix + ":" + pLocalName, pAttrs);
+	}
+
+	private void endXsElement(ContentHandler pHandler, String pLocalName)
+			throws SAXException {
+		String prefix = getPrefix(XML_SCHEMA_URI, pHandler, null);
+		pHandler.endElement(XML_SCHEMA_URI,
+				pLocalName, prefix + ":" + pLocalName);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/beanreader/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,12 @@
+<html><head><title>The bean reader</title></head>
+<body><h1>The bean reader</h1>
+<p>This package contains the <code>BeanReader</code>. The bean reader
+takes as input a Java bean class. The output is an equivalent XML schema:
+Using JaxMe, one can create a marshaller and an unmarshaller, which
+convert an instance of the bean class into an instance of the XML schema,
+or vice versa, convert an instance of the schema into a bean.</p>
+<p>The input may either be a compiled bean class (in which case Java
+reflection is used for analyzing the class) or it may be a set of Java
+source files. JaxMe Java source reflection is used in the latter case.</p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TextFileImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TextFileImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TextFileImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.impl;
+
+import org.apache.ws.jaxme.js.IndentationEngineImpl;
+import org.apache.ws.jaxme.js.TextFile;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TextFileImpl extends IndentationEngineImpl implements TextFile {
+  private final String packageName, fileName;
+  private String contents;
+
+  public TextFileImpl(String pPackageName, String pFileName) {
+    packageName = pPackageName;
+    fileName = pFileName;
+  }
+
+  public String getPackageName() { return packageName; }
+  public String getFileName() { return fileName; }
+  public String getContents() {
+    if (contents == null) {
+      return super.asString();
+    } else {
+     return contents;
+    }
+  }
+  public void setContents(String pContents) { contents = pContents; }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TypedValueImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TypedValueImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/TypedValueImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+package org.apache.ws.jaxme.js.impl;
+
+import java.io.IOException;
+
+import org.apache.ws.jaxme.js.IndentationEngine;
+import org.apache.ws.jaxme.js.IndentationTarget;
+import org.apache.ws.jaxme.js.IndentedObject;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.TypedValue;
+
+
+/** Default implementation of a typed value.
+ */
+public class TypedValueImpl implements TypedValue, IndentedObject {
+	private final Object value;
+	private final JavaQName type;
+
+	/** Creates a new instance with the given value and
+	 * the given type.
+	 */
+	public TypedValueImpl(Object pValue, JavaQName pType) {
+		value = pValue;
+		type = pType;
+	}
+	/** Creates a new instance with the given value and
+	 * the given type.
+	 */
+	public TypedValueImpl(Object pValue, Class pType) {
+		this(pValue, JavaQNameImpl.getInstance(pType));
+	}
+	public JavaQName getType() { return type; }
+	public void write(IndentationEngine pEngine, IndentationTarget pTarget) throws IOException {
+		pEngine.write(pTarget, value);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.js.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Basic implementation of JaxMeJS generic java source generation framework.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/jparser/java15.g
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/jparser/java15.g	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/jparser/java15.g	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1818 @@
+header {
+    package org.apache.ws.jaxme.js.jparser;
+}
+
+/** Java 1.5 Recognizer
+ *
+ * Run 'java Main [-showtree] directory-full-of-java-files'
+ *
+ * [The -showtree option pops up a Swing frame that shows
+ *  the AST constructed from the parser.]
+ *
+ * Run 'java Main <directory full of java files>'
+ *
+ * Contributing authors:
+ *		John Mitchell		johnm at non.net
+ *		Terence Parr		parrt at magelang.com
+ *		John Lilley		jlilley at empathy.com
+ *		Scott Stanchfield	thetick at magelang.com
+ *		Markus Mohnen		mohnen at informatik.rwth-aachen.de
+ *		Peter Williams		pete.williams at sun.com
+ *		Allan Jacobs		Allan.Jacobs at eng.sun.com
+ *		Steve Messick		messick at redhills.com
+ *		John Pybus		john at pybus.org
+ *
+ * Version 1.00 December 9, 1997 -- initial release
+ * Version 1.01 December 10, 1997
+ *		fixed bug in octal def (0..7 not 0..8)
+ * Version 1.10 August 1998 (parrt)
+ *		added tree construction
+ *		fixed definition of WS,comments for mac,pc,unix newlines
+ *		added unary plus
+ * Version 1.11 (Nov 20, 1998)
+ *		Added "shutup" option to turn off last ambig warning.
+ *		Fixed inner class def to allow named class defs as statements
+ *		synchronized requires compound not simple statement
+ *		add [] after builtInType DOT class in primaryExpression
+ *		"const" is reserved but not valid..removed from modifiers
+ * Version 1.12 (Feb 2, 1999)
+ *		Changed LITERAL_xxx to xxx in tree grammar.
+ *		Updated java.g to use tokens {...} now for 2.6.0 (new feature).
+ *
+ * Version 1.13 (Apr 23, 1999)
+ *		Didn't have (stat)? for else clause in tree parser.
+ *		Didn't gen ASTs for interface extends.  Updated tree parser too.
+ *		Updated to 2.6.0.
+ * Version 1.14 (Jun 20, 1999)
+ *		Allowed final/abstract on local classes.
+ *		Removed local interfaces from methods
+ *		Put instanceof precedence where it belongs...in relationalExpr
+ *			It also had expr not type as arg; fixed it.
+ *		Missing ! on SEMI in classBlock
+ *		fixed: (expr) + "string" was parsed incorrectly (+ as unary plus).
+ *		fixed: didn't like Object[].class in parser or tree parser
+ * Version 1.15 (Jun 26, 1999)
+ *		Screwed up rule with instanceof in it. :(  Fixed.
+ *		Tree parser didn't like (expr).something; fixed.
+ *		Allowed multiple inheritance in tree grammar. oops.
+ * Version 1.16 (August 22, 1999)
+ *		Extending an interface built a wacky tree: had extra EXTENDS.
+ *		Tree grammar didn't allow multiple superinterfaces.
+ *		Tree grammar didn't allow empty var initializer: {}
+ * Version 1.17 (October 12, 1999)
+ *		ESC lexer rule allowed 399 max not 377 max.
+ *		java.tree.g didn't handle the expression of synchronized
+ *		statements.
+ * Version 1.18 (August 12, 2001)
+ *	  	Terence updated to Java 2 Version 1.3 by
+ *		observing/combining work of Allan Jacobs and Steve
+ *		Messick.  Handles 1.3 src.  Summary:
+ *		o  primary didn't include boolean.class kind of thing
+ *	  	o  constructor calls parsed explicitly now:
+ * 		   see explicitConstructorInvocation
+ *		o  add strictfp modifier
+ *	  	o  missing objBlock after new expression in tree grammar
+ *		o  merged local class definition alternatives, moved after declaration
+ *		o  fixed problem with ClassName.super.field
+ *	  	o  reordered some alternatives to make things more efficient
+ *		o  long and double constants were not differentiated from int/float
+ *		o  whitespace rule was inefficient: matched only one char
+ *		o  add an examples directory with some nasty 1.3 cases
+ *		o  made Main.java use buffered IO and a Reader for Unicode support
+ *		o  supports UNICODE?
+ *		   Using Unicode charVocabulay makes code file big, but only
+ *		   in the bitsets at the end. I need to make ANTLR generate
+ *		   unicode bitsets more efficiently.
+ * Version 1.19 (April 25, 2002)
+ *		Terence added in nice fixes by John Pybus concerning floating
+ *		constants and problems with super() calls.  John did a nice
+ *		reorg of the primary/postfix expression stuff to read better
+ *		and makes f.g.super() parse properly (it was METHOD_CALL not
+ *		a SUPER_CTOR_CALL).  Also:
+ *
+ *		o  "finally" clause was a root...made it a child of "try"
+ *		o  Added stuff for asserts too for Java 1.4, but *commented out*
+ *		   as it is not backward compatible.
+ *
+ * Version 1.20 (October 27, 2002)
+ *
+ *	  Terence ended up reorging John Pybus' stuff to
+ *	  remove some nondeterminisms and some syntactic predicates.
+ *	  Note that the grammar is stricter now; e.g., this(...) must
+ *	be the first statement.
+ *
+ *	  Trinary ?: operator wasn't working as array name:
+ *		  (isBig ? bigDigits : digits)[i];
+ *
+ *	  Checked parser/tree parser on source for
+ *		  Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4,
+ *		and the 110k-line jGuru server source.
+ *
+ * Version 1.21 (October 17, 2003)
+ *  Fixed lots of problems including:
+ *  Ray Waldin: add typeDefinition to interfaceBlock in java.tree.g
+ *  He found a problem/fix with floating point that start with 0
+ *  Ray also fixed problem that (int.class) was not recognized.
+ *  Thorsten van Ellen noticed that \n are allowed incorrectly in strings.
+ *  TJP fixed CHAR_LITERAL analogously.
+ *
+ * Version 1.21.2 (March, 2003)
+ *	  Changes by Matt Quail to support generics (as per JDK1.5/JSR14)
+ *	  Notes:
+ *	  o We only allow the "extends" keyword and not the "implements"
+ *		keyword, since thats what JSR14 seems to imply.
+ *	  o Thanks to Monty Zukowski for his help on the antlr-interest
+ *		mail list.
+ *	  o Thanks to Alan Eliasen for testing the grammar over his
+ *		Fink source base
+ *
+ * Version 1.22 (July, 2004)
+ *	  Changes by Michael Studman to support Java 1.5 language extensions
+ *	  Notes:
+ *	  o Added support for annotations types
+ *	  o Finished off Matt Quail's generics enhancements to support bound type arguments
+ *	  o Added support for new for statement syntax
+ *	  o Added support for static import syntax
+ *	  o Added support for enum types
+ *	  o Tested against JDK 1.5 source base and source base of jdigraph project
+ *	  o Thanks to Matt Quail for doing the hard part by doing most of the generics work
+ *
+ * Version 1.22.1 (July 28, 2004)
+ *	  Bug/omission fixes for Java 1.5 language support
+ *	  o Fixed tree structure bug with classOrInterface - thanks to Pieter Vangorpto for
+ *		spotting this
+ *	  o Fixed bug where incorrect handling of SR and BSR tokens would cause type
+ *		parameters to be recognised as type arguments.
+ *	  o Enabled type parameters on constructors, annotations on enum constants
+ *		and package definitions
+ *	  o Fixed problems when parsing if ((char.class.equals(c))) {} - solution by Matt Quail at Cenqua
+ *
+ * Version 1.22.2 (July 28, 2004)
+ *	  Slight refactoring of Java 1.5 language support
+ *	  o Refactored for/"foreach" productions so that original literal "for" literal
+ *	    is still used but the for sub-clauses vary by token type
+ *	  o Fixed bug where type parameter was not included in generic constructor's branch of AST
+ *
+ * Version 1.22.3 (August 26, 2004)
+ *	  Bug fixes as identified by Michael Stahl; clean up of tabs/spaces
+ *        and other refactorings
+ *	  o Fixed typeParameters omission in identPrimary and newStatement
+ *	  o Replaced GT reconcilliation code with simple semantic predicate
+ *	  o Adapted enum/assert keyword checking support from Michael Stahl's java15 grammar
+ *	  o Refactored typeDefinition production and field productions to reduce duplication
+ *
+ * This grammar is in the PUBLIC DOMAIN
+ */
+
+class JavaRecognizer extends Parser;
+options {
+	k = 2;							// two token lookahead
+	exportVocab=Java;				// Call its vocabulary "Java"
+	codeGenMakeSwitchThreshold = 2;	// Some optimizations
+	codeGenBitsetTestThreshold = 3;
+	defaultErrorHandler = false;	// Don't generate parser error handlers
+	buildAST = true;
+}
+
+tokens {
+	BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF;
+	INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF;
+	PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE;
+	PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP;
+	POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT;
+	IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION;
+	FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract";
+	STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL; VARIABLE_PARAMETER_DEF;
+	STATIC_IMPORT; ENUM_DEF; ENUM_CONSTANT_DEF; FOR_EACH_CLAUSE; ANNOTATION_DEF; ANNOTATIONS;
+	ANNOTATION; ANNOTATION_MEMBER_VALUE_PAIR; ANNOTATION_FIELD_DEF; ANNOTATION_ARRAY_INIT;
+	TYPE_ARGUMENTS; TYPE_ARGUMENT; TYPE_PARAMETERS; TYPE_PARAMETER; WILDCARD_TYPE;
+	TYPE_UPPER_BOUNDS; TYPE_LOWER_BOUNDS;
+}
+
+{
+	/**
+	 * Counts the number of LT seen in the typeArguments production.
+	 * It is used in semantic predicates to ensure we have seen
+	 * enough closing '>' characters; which actually may have been
+	 * either GT, SR or BSR tokens.
+	 */
+	private int ltCounter = 0;
+}
+
+// Compilation Unit: In Java, this is a single file. This is the start
+// rule for this parser
+compilationUnit
+	:	// A compilation unit starts with an optional package definition
+		(	(annotations "package")=> packageDefinition
+		|	/* nothing */
+		)
+
+		// Next we have a series of zero or more import statements
+		( importDefinition )*
+
+		// Wrapping things up with any number of class or interface
+		// definitions
+		( typeDefinition )*
+
+		EOF!
+	;
+
+
+// Package statement: optional annotations followed by "package" then the package identifier.
+packageDefinition
+	options {defaultErrorHandler = true;} // let ANTLR handle errors
+	:	annotations p:"package"^ {#p.setType(PACKAGE_DEF);} identifier SEMI!
+	;
+
+
+// Import statement: import followed by a package or class name
+importDefinition
+	options {defaultErrorHandler = true;}
+	{ boolean isStatic = false; }
+	:	i:"import"^ {#i.setType(IMPORT);} ( "static"! {#i.setType(STATIC_IMPORT);} )? identifierStar SEMI!
+	;
+
+// A type definition is either a class, interface, enum or annotation with possible additional semis.
+typeDefinition
+	options {defaultErrorHandler = true;}
+	:	m:modifiers!
+		typeDefinitionInternal[#m]
+	|	SEMI!
+	;
+
+// Protected type definitions production for reuse in other productions
+protected typeDefinitionInternal[AST mods]
+	:	classDefinition[#mods]		// inner class
+	|	interfaceDefinition[#mods]	// inner interface
+	|	enumDefinition[#mods]		// inner enum
+	|	annotationDefinition[#mods]	// inner annotation
+	;
+
+// A declaration is the creation of a reference or primitive-type variable
+// Create a separate Type/Var tree for each var in the var list.
+declaration!
+	:	m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t]
+		{#declaration = #v;}
+	;
+
+// A type specification is a type name with possible brackets afterwards
+// (which would make it an array type).
+typeSpec[boolean addImagNode]
+	:	classTypeSpec[addImagNode]
+	|	builtInTypeSpec[addImagNode]
+	;
+
+// Any number of "[]" that occur after a class or built-in type to signify the
+// type is an array
+arraySpecOpt:
+		(options{greedy=true;}: // match as many as possible
+			lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!
+		)*
+	;
+
+// A class type specification is a class type with either:
+// - possible brackets afterwards
+//   (which would make it an array type).
+// - generic type arguments after
+classTypeSpec[boolean addImagNode]
+	:	classOrInterfaceType[false]
+		arraySpecOpt
+		{
+			if ( addImagNode ) {
+				#classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec);
+			}
+		}
+	;
+
+// A non-built in type name, with possible type parameters
+classOrInterfaceType[boolean addImagNode]
+	:	IDENT^ (typeArguments)?
+		(options{greedy=true;}: // match as many as possible
+			DOT^
+			IDENT (typeArguments)?
+		)*
+		{
+			if ( addImagNode ) {
+				#classOrInterfaceType = #(#[TYPE,"TYPE"], #classOrInterfaceType);
+			}
+		}
+	;
+
+// A specialised form of typeSpec where built in types must be arrays
+typeArgumentSpec
+	:	classTypeSpec[true]
+	|	builtInTypeArraySpec[true]
+	;
+
+// A generic type argument is a class type, a possibly bounded wildcard type or a built-in type array
+typeArgument
+	:	(	typeArgumentSpec
+		|	wildcardType
+		)
+		{#typeArgument = #(#[TYPE_ARGUMENT,"TYPE_ARGUMENT"], #typeArgument);}
+	;
+
+// Wildcard type indicating all types (with possible constraint)
+wildcardType
+	:	q:QUESTION^ {#q.setType(WILDCARD_TYPE);}
+		(("extends" | "super")=> typeArgumentBounds)?
+	;
+
+// Type arguments to a class or interface type
+typeArguments
+{int currentLtLevel = 0;}
+	:
+		{currentLtLevel = ltCounter;}
+		LT! {ltCounter++;}
+		typeArgument
+		(options{greedy=true;}: // match as many as possible
+			{inputState.guessing !=0 || ltCounter == currentLtLevel + 1}?
+			COMMA! typeArgument
+		)*
+
+		(	// turn warning off since Antlr generates the right code,
+			// plus we have our semantic predicate below
+			options{generateAmbigWarnings=false;}:
+			typeArgumentsOrParametersEnd
+		)?
+
+		// make sure we have gobbled up enough '>' characters
+		// if we are at the "top level" of nested typeArgument productions
+		{(currentLtLevel != 0) || ltCounter == currentLtLevel}?
+
+		{#typeArguments = #(#[TYPE_ARGUMENTS, "TYPE_ARGUMENTS"], #typeArguments);}
+	;
+
+// this gobbles up *some* amount of '>' characters, and counts how many
+// it gobbled.
+protected typeArgumentsOrParametersEnd
+	:	GT! {ltCounter-=1;}
+	|	SR! {ltCounter-=2;}
+	|	BSR! {ltCounter-=3;}
+	;
+
+// Restriction on wildcard types based on super class or derrived class
+typeArgumentBounds
+	{boolean isUpperBounds = false;}
+	:
+		( "extends"! {isUpperBounds=true;} | "super"! ) classOrInterfaceType[false]
+		{
+			if (isUpperBounds)
+			{
+				#typeArgumentBounds = #(#[TYPE_UPPER_BOUNDS,"TYPE_UPPER_BOUNDS"], #typeArgumentBounds);
+			}
+			else
+			{
+				#typeArgumentBounds = #(#[TYPE_LOWER_BOUNDS,"TYPE_LOWER_BOUNDS"], #typeArgumentBounds);
+			}
+		}
+	;
+
+// A builtin type array specification is a builtin type with brackets afterwards
+builtInTypeArraySpec[boolean addImagNode]
+	:	builtInType
+		(options{greedy=true;}: // match as many as possible
+			lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!
+		)+
+
+		{
+			if ( addImagNode ) {
+				#builtInTypeArraySpec = #(#[TYPE,"TYPE"], #builtInTypeArraySpec);
+			}
+		}
+	;
+
+// A builtin type specification is a builtin type with possible brackets
+// afterwards (which would make it an array type).
+builtInTypeSpec[boolean addImagNode]
+	:	builtInType arraySpecOpt
+		{
+			if ( addImagNode ) {
+				#builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec);
+			}
+		}
+	;
+
+// A type name. which is either a (possibly qualified and parameterized)
+// class name or a primitive (builtin) type
+type
+	:	classOrInterfaceType[false]
+	|	builtInType
+	;
+
+// The primitive types.
+builtInType
+	:	"void"
+	|	"boolean"
+	|	"byte"
+	|	"char"
+	|	"short"
+	|	"int"
+	|	"float"
+	|	"long"
+	|	"double"
+	;
+
+// A (possibly-qualified) java identifier. We start with the first IDENT
+// and expand its name by adding dots and following IDENTS
+identifier
+	:	IDENT ( DOT^ IDENT )*
+	;
+
+identifierStar
+	:	IDENT
+		( DOT^ IDENT )*
+		( DOT^ STAR )?
+	;
+
+// A list of zero or more modifiers. We could have used (modifier)* in
+// place of a call to modifiers, but I thought it was a good idea to keep
+// this rule separate so they can easily be collected in a Vector if
+// someone so desires
+modifiers
+	:
+		(
+			//hush warnings since the semantic check for "@interface" solves the non-determinism
+			options{generateAmbigWarnings=false;}:
+
+			modifier
+			|
+			//Semantic check that we aren't matching @interface as this is not an annotation
+			//A nicer way to do this would be nice
+			{LA(1)==AT && !LT(2).getText().equals("interface")}? annotation
+		)*
+
+		{#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);}
+	;
+
+// modifiers for Java classes, interfaces, class/instance vars and methods
+modifier
+	:	"private"
+	|	"public"
+	|	"protected"
+	|	"static"
+	|	"transient"
+	|	"final"
+	|	"abstract"
+	|	"native"
+	|	"threadsafe"
+	|	"synchronized"
+	|	"volatile"
+	|	"strictfp"
+	;
+
+annotation!
+	:	AT! i:identifier ( LPAREN! ( args:annotationArguments )? RPAREN! )?
+		{#annotation = #(#[ANNOTATION,"ANNOTATION"], i, args);}
+	;
+
+annotations
+    :   (annotation)*
+		{#annotations = #([ANNOTATIONS, "ANNOTATIONS"], #annotations);}
+    ;
+
+annotationArguments
+	:	annotationMemberValueInitializer | anntotationMemberValuePairs
+	;
+
+anntotationMemberValuePairs
+	:	annotationMemberValuePair ( COMMA! annotationMemberValuePair )*
+	;
+
+annotationMemberValuePair!
+	:	i:IDENT ASSIGN! v:annotationMemberValueInitializer
+		{#annotationMemberValuePair = #(#[ANNOTATION_MEMBER_VALUE_PAIR,"ANNOTATION_MEMBER_VALUE_PAIR"], i, v);}
+	;
+
+annotationMemberValueInitializer
+	:
+		conditionalExpression | annotation | annotationMemberArrayInitializer
+	;
+
+// This is an initializer used to set up an annotation member array.
+annotationMemberArrayInitializer
+	:	lc:LCURLY^ {#lc.setType(ANNOTATION_ARRAY_INIT);}
+			(	annotationMemberArrayValueInitializer
+				(
+					// CONFLICT: does a COMMA after an initializer start a new
+					// initializer or start the option ',' at end?
+					// ANTLR generates proper code by matching
+					// the comma as soon as possible.
+					options {
+						warnWhenFollowAmbig = false;
+					}
+				:
+					COMMA! annotationMemberArrayValueInitializer
+				)*
+				(COMMA!)?
+			)?
+		RCURLY!
+	;
+
+// The two things that can initialize an annotation array element are a conditional expression
+// and an annotation (nested annotation array initialisers are not valid)
+annotationMemberArrayValueInitializer
+	:	conditionalExpression
+	|	annotation
+	;
+
+superClassClause!
+	:	( "extends" c:classOrInterfaceType[false] )?
+		{#superClassClause = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],c);}
+	;
+
+// Definition of a Java class
+classDefinition![AST modifiers]
+	:	"class" IDENT
+		// it _might_ have type paramaters
+		(tp:typeParameters)?
+		// it _might_ have a superclass...
+		sc:superClassClause
+		// it might implement some interfaces...
+		ic:implementsClause
+		// now parse the body of the class
+		cb:classBlock
+		{#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],
+								modifiers,IDENT,tp,sc,ic,cb);}
+	;
+
+// Definition of a Java Interface
+interfaceDefinition![AST modifiers]
+	:	"interface" IDENT
+		// it _might_ have type paramaters
+		(tp:typeParameters)?
+		// it might extend some other interfaces
+		ie:interfaceExtends
+		// now parse the body of the interface (looks like a class...)
+		ib:interfaceBlock
+		{#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"],
+									modifiers,IDENT,tp,ie,ib);}
+	;
+
+enumDefinition![AST modifiers]
+	:	"enum" IDENT
+		// it might implement some interfaces...
+		ic:implementsClause
+		// now parse the body of the enum
+		eb:enumBlock
+		{#enumDefinition = #(#[ENUM_DEF,"ENUM_DEF"],
+								modifiers,IDENT,ic,eb);}
+	;
+
+annotationDefinition![AST modifiers]
+	:	AT "interface" IDENT
+		// now parse the body of the annotation
+		ab:annotationBlock
+		{#annotationDefinition = #(#[ANNOTATION_DEF,"ANNOTATION_DEF"],
+									modifiers,IDENT,ab);}
+	;
+
+typeParameters
+{int currentLtLevel = 0;}
+	:
+		{currentLtLevel = ltCounter;}
+		LT! {ltCounter++;}
+		typeParameter (COMMA! typeParameter)*
+		(typeArgumentsOrParametersEnd)?
+
+		// make sure we have gobbled up enough '>' characters
+		// if we are at the "top level" of nested typeArgument productions
+		{(currentLtLevel != 0) || ltCounter == currentLtLevel}?
+
+		{#typeParameters = #(#[TYPE_PARAMETERS, "TYPE_PARAMETERS"], #typeParameters);}
+	;
+
+typeParameter
+	:
+		// I'm pretty sure Antlr generates the right thing here:
+		(id:IDENT) ( options{generateAmbigWarnings=false;}: typeParameterBounds )?
+		{#typeParameter = #(#[TYPE_PARAMETER,"TYPE_PARAMETER"], #typeParameter);}
+	;
+
+typeParameterBounds
+	:
+		"extends"! classOrInterfaceType[false]
+		(BAND! classOrInterfaceType[false])*
+		{#typeParameterBounds = #(#[TYPE_UPPER_BOUNDS,"TYPE_UPPER_BOUNDS"], #typeParameterBounds);}
+	;
+
+// This is the body of a class. You can have classFields and extra semicolons.
+classBlock
+	:	LCURLY!
+			( classField | SEMI! )*
+		RCURLY!
+		{#classBlock = #([OBJBLOCK, "OBJBLOCK"], #classBlock);}
+	;
+
+// This is the body of an interface. You can have interfaceField and extra semicolons.
+interfaceBlock
+	:	LCURLY!
+			( interfaceField | SEMI! )*
+		RCURLY!
+		{#interfaceBlock = #([OBJBLOCK, "OBJBLOCK"], #interfaceBlock);}
+	;
+	
+// This is the body of an annotation. You can have annotation fields and extra semicolons,
+// That's about it (until you see what an annoation field is...)
+annotationBlock
+	:	LCURLY!
+		( annotationField | SEMI! )*
+		RCURLY!
+		{#annotationBlock = #([OBJBLOCK, "OBJBLOCK"], #annotationBlock);}
+	;
+
+// This is the body of an enum. You can have zero or more enum constants
+// followed by any number of fields like a regular class
+enumBlock
+	:	LCURLY!
+			( enumConstant ( options{greedy=true;}: COMMA! enumConstant )* ( COMMA! )? )?
+			( SEMI! ( classField | SEMI! )* )?
+		RCURLY!
+		{#enumBlock = #([OBJBLOCK, "OBJBLOCK"], #enumBlock);}
+	;
+
+// An annotation field
+annotationField!
+	:	mods:modifiers
+		(	td:typeDefinitionInternal[#mods]
+			{#annotationField = #td;}
+		|	t:typeSpec[false]		// annotation field
+			(	i:IDENT				// the name of the field
+
+				LPAREN! RPAREN!
+
+				rt:declaratorBrackets[#t]
+
+				( "default" amvi:annotationMemberValueInitializer )?
+
+				SEMI
+
+				{#annotationField =
+					#(#[ANNOTATION_FIELD_DEF,"ANNOTATION_FIELD_DEF"],
+						 mods,
+						 #(#[TYPE,"TYPE"],rt),
+						 i,amvi
+						 );}
+			|	v:variableDefinitions[#mods,#t] SEMI	// variable
+				{#annotationField = #v;}
+			)
+		)
+	;
+
+//An enum constant may have optional parameters and may have a
+//a class body
+enumConstant!
+	:	an:annotations
+		i:IDENT
+		(	LPAREN!
+			a:argList
+			RPAREN!
+		)?
+		( b:enumConstantBlock )?
+		{#enumConstant = #([ENUM_CONSTANT_DEF, "ENUM_CONSTANT_DEF"], an, i, a, b);}
+	;
+
+//The class-like body of an enum constant
+enumConstantBlock
+	:	LCURLY!
+		( enumConstantField | SEMI! )*
+		RCURLY!
+		{#enumConstantBlock = #([OBJBLOCK, "OBJBLOCK"], #enumConstantBlock);}
+	;
+
+//An enum constant field is just like a class field but without
+//the posibility of a constructor definition or a static initializer
+enumConstantField!
+	:	mods:modifiers
+		(	td:typeDefinitionInternal[#mods]
+			{#enumConstantField = #td;}
+
+		|	// A generic method has the typeParameters before the return type.
+			// This is not allowed for variable definitions, but this production
+			// allows it, a semantic check could be used if you wanted.
+			(tp:typeParameters)? t:typeSpec[false]		// method or variable declaration(s)
+			(	IDENT									// the name of the method
+
+				// parse the formal parameter declarations.
+				LPAREN! param:parameterDeclarationList RPAREN!
+
+				rt:declaratorBrackets[#t]
+
+				// get the list of exceptions that this method is
+				// declared to throw
+				(tc:throwsClause)?
+
+				( s2:compoundStatement | SEMI )
+				{#enumConstantField = #(#[METHOD_DEF,"METHOD_DEF"],
+							 mods,
+							 tp,
+							 #(#[TYPE,"TYPE"],rt),
+							 IDENT,
+							 param,
+							 tc,
+							 s2);}
+			|	v:variableDefinitions[#mods,#t] SEMI
+				{#enumConstantField = #v;}
+			)
+		)
+
+	// "{ ... }" instance initializer
+	|	s4:compoundStatement
+		{#enumConstantField = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);}
+	;
+
+// An interface can extend several other interfaces...
+interfaceExtends
+	:	(
+		e:"extends"!
+		classOrInterfaceType[false] ( COMMA! classOrInterfaceType[false] )*
+		)?
+		{#interfaceExtends = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],
+								#interfaceExtends);}
+	;
+
+// A class can implement several interfaces...
+implementsClause
+	:	(
+			i:"implements"! classOrInterfaceType[false] ( COMMA! classOrInterfaceType[false] )*
+		)?
+		{#implementsClause = #(#[IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"],
+								 #implementsClause);}
+	;
+
+// Now the various things that can be defined inside a class
+classField!
+	:	// method, constructor, or variable declaration
+		mods:modifiers
+		(	td:typeDefinitionInternal[#mods]
+			{#classField = #td;}
+
+		|	(tp:typeParameters)?
+			(
+				h:ctorHead s:constructorBody // constructor
+				{#classField = #(#[CTOR_DEF,"CTOR_DEF"], mods, tp, h, s);}
+
+				|	// A generic method/ctor has the typeParameters before the return type.
+					// This is not allowed for variable definitions, but this production
+					// allows it, a semantic check could be used if you wanted.
+					t:typeSpec[false]		// method or variable declaration(s)
+					(	IDENT				// the name of the method
+
+						// parse the formal parameter declarations.
+						LPAREN! param:parameterDeclarationList RPAREN!
+
+						rt:declaratorBrackets[#t]
+
+						// get the list of exceptions that this method is
+						// declared to throw
+						(tc:throwsClause)?
+
+						( s2:compoundStatement | SEMI )
+						{#classField = #(#[METHOD_DEF,"METHOD_DEF"],
+									 mods,
+									 tp,
+									 #(#[TYPE,"TYPE"],rt),
+									 IDENT,
+									 param,
+									 tc,
+									 s2);}
+					|	v:variableDefinitions[#mods,#t] SEMI
+						{#classField = #v;}
+					)
+			)
+		)
+
+	// "static { ... }" class initializer
+	|	"static" s3:compoundStatement
+		{#classField = #(#[STATIC_INIT,"STATIC_INIT"], s3);}
+
+	// "{ ... }" instance initializer
+	|	s4:compoundStatement
+		{#classField = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);}
+	;
+
+// Now the various things that can be defined inside a interface
+interfaceField!
+	:	// method, constructor, or variable declaration
+		mods:modifiers
+		(	td:typeDefinitionInternal[#mods]
+			{#interfaceField = #td;}
+
+		|	(tp:typeParameters)?
+			// A generic method has the typeParameters before the return type.
+			// This is not allowed for variable definitions, but this production
+			// allows it, a semantic check could be used if you want a more strict
+			// grammar.
+			t:typeSpec[false]		// method or variable declaration(s)
+			(	IDENT				// the name of the method
+
+				// parse the formal parameter declarations.
+				LPAREN! param:parameterDeclarationList RPAREN!
+
+				rt:declaratorBrackets[#t]
+
+				// get the list of exceptions that this method is
+				// declared to throw
+				(tc:throwsClause)?
+
+				SEMI
+				
+				{#interfaceField = #(#[METHOD_DEF,"METHOD_DEF"],
+							 mods,
+							 tp,
+							 #(#[TYPE,"TYPE"],rt),
+							 IDENT,
+							 param,
+							 tc);}
+			|	v:variableDefinitions[#mods,#t] SEMI
+				{#interfaceField = #v;}
+			)
+		)
+	;
+
+constructorBody
+	:	lc:LCURLY^ {#lc.setType(SLIST);}
+			( options { greedy=true; } : explicitConstructorInvocation)?
+			(statement)*
+		RCURLY!
+	;
+
+/** Catch obvious constructor calls, but not the expr.super(...) calls */
+explicitConstructorInvocation
+	:	"this"! lp1:LPAREN^ argList RPAREN! SEMI!
+		{#lp1.setType(CTOR_CALL);}
+	|	"super"! lp2:LPAREN^ argList RPAREN! SEMI!
+		{#lp2.setType(SUPER_CTOR_CALL);}
+	;
+
+variableDefinitions[AST mods, AST t]
+	:	variableDeclarator[getASTFactory().dupTree(mods),
+							getASTFactory().dupTree(t)]
+		(	COMMA!
+			variableDeclarator[getASTFactory().dupTree(mods),
+							getASTFactory().dupTree(t)]
+		)*
+	;
+
+/** Declaration of a variable. This can be a class/instance variable,
+ *  or a local variable in a method
+ *  It can also include possible initialization.
+ */
+variableDeclarator![AST mods, AST t]
+	:	id:IDENT d:declaratorBrackets[t] v:varInitializer
+		{#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v);}
+	;
+
+declaratorBrackets[AST typ]
+	:	{#declaratorBrackets=typ;}
+		(lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);} RBRACK!)*
+	;
+
+varInitializer
+	:	( ASSIGN^ initializer )?
+	;
+
+// This is an initializer used to set up an array.
+arrayInitializer
+	:	lc:LCURLY^ {#lc.setType(ARRAY_INIT);}
+			(	initializer
+				(
+					// CONFLICT: does a COMMA after an initializer start a new
+					// initializer or start the option ',' at end?
+					// ANTLR generates proper code by matching
+					// the comma as soon as possible.
+					options {
+						warnWhenFollowAmbig = false;
+					}
+				:
+					COMMA! initializer
+				)*
+				(COMMA!)?
+			)?
+		RCURLY!
+	;
+
+
+// The two "things" that can initialize an array element are an expression
+// and another (nested) array initializer.
+initializer
+	:	expression
+	|	arrayInitializer
+	;
+
+// This is the header of a method. It includes the name and parameters
+// for the method.
+// This also watches for a list of exception classes in a "throws" clause.
+ctorHead
+	:	IDENT // the name of the method
+
+		// parse the formal parameter declarations.
+		LPAREN! parameterDeclarationList RPAREN!
+
+		// get the list of exceptions that this method is declared to throw
+		(throwsClause)?
+	;
+
+// This is a list of exception classes that the method is declared to throw
+throwsClause
+	:	"throws"^ identifier ( COMMA! identifier )*
+	;
+
+// A list of formal parameters
+//	 Zero or more parameters
+//	 If a parameter is variable length (e.g. String... myArg) it is the right-most parameter
+parameterDeclarationList
+	// The semantic check in ( .... )* block is flagged as superfluous, and seems superfluous but
+	// is the only way I could make this work. If my understanding is correct this is a known bug
+	:	(	( parameterDeclaration )=> parameterDeclaration
+			( options {warnWhenFollowAmbig=false;} : ( COMMA! parameterDeclaration ) => COMMA! parameterDeclaration )*
+			( COMMA! variableLengthParameterDeclaration )?
+		|
+			variableLengthParameterDeclaration
+		)?
+		{#parameterDeclarationList = #(#[PARAMETERS,"PARAMETERS"],
+									#parameterDeclarationList);}
+	;
+
+// A formal parameter.
+parameterDeclaration!
+	:	pm:parameterModifier t:typeSpec[false] id:IDENT
+		pd:declaratorBrackets[#t]
+		{#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"],
+									pm, #([TYPE,"TYPE"],pd), id);}
+	;
+
+variableLengthParameterDeclaration!
+	:	pm:parameterModifier t:typeSpec[false] TRIPLE_DOT! id:IDENT
+		pd:declaratorBrackets[#t]
+		{#variableLengthParameterDeclaration = #(#[VARIABLE_PARAMETER_DEF,"VARIABLE_PARAMETER_DEF"],
+												pm, #([TYPE,"TYPE"],pd), id);}
+	;
+
+parameterModifier
+	//final can appear amongst annotations in any order - greedily consume any preceding
+	//annotations to shut nond-eterminism warnings off
+	:	(options{greedy=true;} : annotation)* (f:"final")? (annotation)*
+		{#parameterModifier = #(#[MODIFIERS,"MODIFIERS"], #parameterModifier);}
+	;
+
+// Compound statement. This is used in many contexts:
+// Inside a class definition prefixed with "static":
+// it is a class initializer
+// Inside a class definition without "static":
+// it is an instance initializer
+// As the body of a method
+// As a completely indepdent braced block of code inside a method
+// it starts a new scope for variable definitions
+
+compoundStatement
+	:	lc:LCURLY^ {#lc.setType(SLIST);}
+			// include the (possibly-empty) list of statements
+			(statement)*
+		RCURLY!
+	;
+
+
+statement
+	// A list of statements in curly braces -- start a new scope!
+	:	compoundStatement
+
+	// declarations are ambiguous with "ID DOT" relative to expression
+	// statements. Must backtrack to be sure. Could use a semantic
+	// predicate to test symbol table to see what the type was coming
+	// up, but that's pretty hard without a symbol table ;)
+	|	(declaration)=> declaration SEMI!
+
+	// An expression statement. This could be a method call,
+	// assignment statement, or any other expression evaluated for
+	// side-effects.
+	|	expression SEMI!
+
+	//TODO: what abour interfaces, enums and annotations
+	// class definition
+	|	m:modifiers! classDefinition[#m]
+
+	// Attach a label to the front of a statement
+	|	IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement
+
+	// If-else statement
+	|	"if"^ LPAREN! expression RPAREN! statement
+		(
+			// CONFLICT: the old "dangling-else" problem...
+			// ANTLR generates proper code matching
+			// as soon as possible. Hush warning.
+			options {
+				warnWhenFollowAmbig = false;
+			}
+		:
+			"else"! statement
+		)?
+
+	// For statement
+	|	forStatement
+
+	// While statement
+	|	"while"^ LPAREN! expression RPAREN! statement
+
+	// do-while statement
+	|	"do"^ statement "while"! LPAREN! expression RPAREN! SEMI!
+
+	// get out of a loop (or switch)
+	|	"break"^ (IDENT)? SEMI!
+
+	// do next iteration of a loop
+	|	"continue"^ (IDENT)? SEMI!
+
+	// Return an expression
+	|	"return"^ (expression)? SEMI!
+
+	// switch/case statement
+	|	"switch"^ LPAREN! expression RPAREN! LCURLY!
+			( casesGroup )*
+		RCURLY!
+
+	// exception try-catch block
+	|	tryBlock
+
+	// throw an exception
+	|	"throw"^ expression SEMI!
+
+	// synchronize a statement
+	|	"synchronized"^ LPAREN! expression RPAREN! compoundStatement
+
+	// asserts (uncomment if you want 1.4 compatibility)
+	|	"assert"^ expression ( COLON! expression )? SEMI!
+
+	// empty statement
+	|	s:SEMI {#s.setType(EMPTY_STAT);}
+	;
+
+forStatement
+	:	f:"for"^
+		LPAREN!
+			(	(forInit SEMI)=>traditionalForClause
+			|	forEachClause
+			)
+		RPAREN!
+		statement					 // statement to loop over
+	;
+
+traditionalForClause
+	:
+		forInit SEMI!	// initializer
+		forCond SEMI!	// condition test
+		forIter			// updater
+	;
+
+forEachClause
+	:
+		p:parameterDeclaration COLON! expression
+		{#forEachClause = #(#[FOR_EACH_CLAUSE,"FOR_EACH_CLAUSE"], #forEachClause);}
+	;
+
+casesGroup
+	:	(	// CONFLICT: to which case group do the statements bind?
+			// ANTLR generates proper code: it groups the
+			// many "case"/"default" labels together then
+			// follows them with the statements
+			options {
+				greedy = true;
+			}
+			:
+			aCase
+		)+
+		caseSList
+		{#casesGroup = #([CASE_GROUP, "CASE_GROUP"], #casesGroup);}
+	;
+
+aCase
+	:	("case"^ expression | "default") COLON!
+	;
+
+caseSList
+	:	(statement)*
+		{#caseSList = #(#[SLIST,"SLIST"],#caseSList);}
+	;
+
+// The initializer for a for loop
+forInit
+		// if it looks like a declaration, it is
+	:	((declaration)=> declaration
+		// otherwise it could be an expression list...
+		|	expressionList
+		)?
+		{#forInit = #(#[FOR_INIT,"FOR_INIT"],#forInit);}
+	;
+
+forCond
+	:	(expression)?
+		{#forCond = #(#[FOR_CONDITION,"FOR_CONDITION"],#forCond);}
+	;
+
+forIter
+	:	(expressionList)?
+		{#forIter = #(#[FOR_ITERATOR,"FOR_ITERATOR"],#forIter);}
+	;
+
+// an exception handler try/catch block
+tryBlock
+	:	"try"^ compoundStatement
+		(handler)*
+		( finallyClause )?
+	;
+
+finallyClause
+	:	"finally"^ compoundStatement
+	;
+
+// an exception handler
+handler
+	:	"catch"^ LPAREN! parameterDeclaration RPAREN! compoundStatement
+	;
+
+
+// expressions
+// Note that most of these expressions follow the pattern
+//   thisLevelExpression :
+//	   nextHigherPrecedenceExpression
+//		   (OPERATOR nextHigherPrecedenceExpression)*
+// which is a standard recursive definition for a parsing an expression.
+// The operators in java have the following precedences:
+//	lowest  (13)  = *= /= %= += -= <<= >>= >>>= &= ^= |=
+//			(12)  ?:
+//			(11)  ||
+//			(10)  &&
+//			( 9)  |
+//			( 8)  ^
+//			( 7)  &
+//			( 6)  == !=
+//			( 5)  < <= > >=
+//			( 4)  << >>
+//			( 3)  +(binary) -(binary)
+//			( 2)  * / %
+//			( 1)  ++ -- +(unary) -(unary)  ~  !  (type)
+//				  []   () (method call)  . (dot -- identifier qualification)
+//				  new   ()  (explicit parenthesis)
+//
+// the last two are not usually on a precedence chart; I put them in
+// to point out that new has a higher precedence than '.', so you
+// can validy use
+//	 new Frame().show()
+//
+// Note that the above precedence levels map to the rules below...
+// Once you have a precedence chart, writing the appropriate rules as below
+//   is usually very straightfoward
+
+
+
+// the mother of all expressions
+expression
+	:	assignmentExpression
+		{#expression = #(#[EXPR,"EXPR"],#expression);}
+	;
+
+
+// This is a list of expressions.
+expressionList
+	:	expression (COMMA! expression)*
+		{#expressionList = #(#[ELIST,"ELIST"], expressionList);}
+	;
+
+
+// assignment expression (level 13)
+assignmentExpression
+	:	conditionalExpression
+		(	(	ASSIGN^
+			|	PLUS_ASSIGN^
+			|	MINUS_ASSIGN^
+			|	STAR_ASSIGN^
+			|	DIV_ASSIGN^
+			|	MOD_ASSIGN^
+			|	SR_ASSIGN^
+			|	BSR_ASSIGN^
+			|	SL_ASSIGN^
+			|	BAND_ASSIGN^
+			|	BXOR_ASSIGN^
+			|	BOR_ASSIGN^
+			)
+			assignmentExpression
+		)?
+	;
+
+
+// conditional test (level 12)
+conditionalExpression
+	:	logicalOrExpression
+		( QUESTION^ assignmentExpression COLON! conditionalExpression )?
+	;
+
+
+// logical or (||) (level 11)
+logicalOrExpression
+	:	logicalAndExpression (LOR^ logicalAndExpression)*
+	;
+
+
+// logical and (&&) (level 10)
+logicalAndExpression
+	:	inclusiveOrExpression (LAND^ inclusiveOrExpression)*
+	;
+
+
+// bitwise or non-short-circuiting or (|) (level 9)
+inclusiveOrExpression
+	:	exclusiveOrExpression (BOR^ exclusiveOrExpression)*
+	;
+
+
+// exclusive or (^) (level 8)
+exclusiveOrExpression
+	:	andExpression (BXOR^ andExpression)*
+	;
+
+
+// bitwise or non-short-circuiting and (&) (level 7)
+andExpression
+	:	equalityExpression (BAND^ equalityExpression)*
+	;
+
+
+// equality/inequality (==/!=) (level 6)
+equalityExpression
+	:	relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)*
+	;
+
+
+// boolean relational expressions (level 5)
+relationalExpression
+	:	shiftExpression
+		(	(	(	LT^
+				|	GT^
+				|	LE^
+				|	GE^
+				)
+				shiftExpression
+			)*
+		|	"instanceof"^ typeSpec[true]
+		)
+	;
+
+
+// bit shift expressions (level 4)
+shiftExpression
+	:	additiveExpression ((SL^ | SR^ | BSR^) additiveExpression)*
+	;
+
+
+// binary addition/subtraction (level 3)
+additiveExpression
+	:	multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)*
+	;
+
+
+// multiplication/division/modulo (level 2)
+multiplicativeExpression
+	:	unaryExpression ((STAR^ | DIV^ | MOD^ ) unaryExpression)*
+	;
+
+unaryExpression
+	:	INC^ unaryExpression
+	|	DEC^ unaryExpression
+	|	MINUS^ {#MINUS.setType(UNARY_MINUS);} unaryExpression
+	|	PLUS^ {#PLUS.setType(UNARY_PLUS);} unaryExpression
+	|	unaryExpressionNotPlusMinus
+	;
+
+unaryExpressionNotPlusMinus
+	:	BNOT^ unaryExpression
+	|	LNOT^ unaryExpression
+	|	(	// subrule allows option to shut off warnings
+			options {
+				// "(int" ambig with postfixExpr due to lack of sequence
+				// info in linear approximate LL(k). It's ok. Shut up.
+				generateAmbigWarnings=false;
+			}
+		:	// If typecast is built in type, must be numeric operand
+			// Have to backtrack to see if operator follows
+		(LPAREN builtInTypeSpec[true] RPAREN unaryExpression)=>
+		lpb:LPAREN^ {#lpb.setType(TYPECAST);} builtInTypeSpec[true] RPAREN!
+		unaryExpression
+
+		// Have to backtrack to see if operator follows. If no operator
+		// follows, it's a typecast. No semantic checking needed to parse.
+		// if it _looks_ like a cast, it _is_ a cast; else it's a "(expr)"
+	|	(LPAREN classTypeSpec[true] RPAREN unaryExpressionNotPlusMinus)=>
+		lp:LPAREN^ {#lp.setType(TYPECAST);} classTypeSpec[true] RPAREN!
+		unaryExpressionNotPlusMinus
+
+	|	postfixExpression
+	)
+	;
+
+// qualified names, array expressions, method invocation, post inc/dec
+postfixExpression
+	:
+		primaryExpression
+
+		(
+			/*
+			options {
+				// the use of postfixExpression in SUPER_CTOR_CALL adds DOT
+				// to the lookahead set, and gives loads of false non-det
+				// warnings.
+				// shut them off.
+				generateAmbigWarnings=false;
+			}
+		:	*/
+			//type arguments are only appropriate for a parameterized method
+			//semantic check may be needed here to ensure this
+			DOT^ (typeArguments)? IDENT
+			(	lp:LPAREN^ {#lp.setType(METHOD_CALL);}
+				argList
+				RPAREN!
+			)?
+		|	DOT^ "this"
+
+		|	DOT^ "super"
+			(	// (new Outer()).super() (create enclosing instance)
+				lp3:LPAREN^ argList RPAREN!
+				{#lp3.setType(SUPER_CTOR_CALL);}
+			|	DOT^ (typeArguments)? IDENT
+				(	lps:LPAREN^ {#lps.setType(METHOD_CALL);}
+					argList
+					RPAREN!
+				)?
+			)
+		|	DOT^ newExpression
+		|	lb:LBRACK^ {#lb.setType(INDEX_OP);} expression RBRACK!
+		)*
+
+		(	// possibly add on a post-increment or post-decrement.
+			// allows INC/DEC on too much, but semantics can check
+			in:INC^ {#in.setType(POST_INC);}
+	 	|	de:DEC^ {#de.setType(POST_DEC);}
+		)?
+ 	;
+
+// the basic element of an expression
+primaryExpression
+	:	identPrimary ( options {greedy=true;} : DOT^ "class" )?
+	|	constant
+	|	"true"
+	|	"false"
+	|	"null"
+	|	newExpression
+	|	"this"
+	|	"super"
+	|	LPAREN! assignmentExpression RPAREN!
+		// look for int.class and int[].class
+	|	builtInType
+		( lbt:LBRACK^ {#lbt.setType(ARRAY_DECLARATOR);} RBRACK! )*
+		DOT^ "class"
+	;
+
+/** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class,
+ *  and a.b.c.class refs. Also this(...) and super(...). Match
+ *  this or super.
+ */
+identPrimary
+	:	(ta1:typeArguments!)?
+		IDENT
+		// Syntax for method invocation with type arguments is
+		// <String>foo("bla")
+		(
+			options {
+				// .ident could match here or in postfixExpression.
+				// We do want to match here. Turn off warning.
+				greedy=true;
+				// This turns the ambiguity warning of the second alternative
+				// off. See below. (The "false" predicate makes it non-issue)
+				warnWhenFollowAmbig=false;
+			}
+			// we have a new nondeterminism because of
+			// typeArguments... only a syntactic predicate will help...
+			// The problem is that this loop here conflicts with
+			// DOT typeArguments "super" in postfixExpression (k=2)
+			// A proper solution would require a lot of refactoring...
+		:	(DOT (typeArguments)? IDENT) =>
+				DOT^ (ta2:typeArguments!)? IDENT
+		|	{false}?	// FIXME: this is very ugly but it seems to work...
+						// this will also produce an ANTLR warning!
+				// Unfortunately a syntactic predicate can only select one of
+				// multiple alternatives on the same level, not break out of
+				// an enclosing loop, which is why this ugly hack (a fake
+				// empty alternative with always-false semantic predicate)
+				// is necessary.
+		)*
+		(
+			options {
+				// ARRAY_DECLARATOR here conflicts with INDEX_OP in
+				// postfixExpression on LBRACK RBRACK.
+				// We want to match [] here, so greedy. This overcomes
+				// limitation of linear approximate lookahead.
+				greedy=true;
+			}
+		:	(	lp:LPAREN^ {#lp.setType(METHOD_CALL);}
+				// if the input is valid, only the last IDENT may
+				// have preceding typeArguments... rather hacky, this is...
+				{if (#ta2 != null) astFactory.addASTChild(currentAST, #ta2);}
+				{if (#ta2 == null) astFactory.addASTChild(currentAST, #ta1);}
+				argList RPAREN!
+			)
+		|	( options {greedy=true;} :
+				lbc:LBRACK^ {#lbc.setType(ARRAY_DECLARATOR);} RBRACK!
+			)+
+		)?
+	;
+
+/** object instantiation.
+ *  Trees are built as illustrated by the following input/tree pairs:
+ *
+ *  new T()
+ *
+ *  new
+ *   |
+ *   T --  ELIST
+ *		   |
+ *		  arg1 -- arg2 -- .. -- argn
+ *
+ *  new int[]
+ *
+ *  new
+ *   |
+ *  int -- ARRAY_DECLARATOR
+ *
+ *  new int[] {1,2}
+ *
+ *  new
+ *   |
+ *  int -- ARRAY_DECLARATOR -- ARRAY_INIT
+ *								  |
+ *								EXPR -- EXPR
+ *								  |	  |
+ *								  1	  2
+ *
+ *  new int[3]
+ *  new
+ *   |
+ *  int -- ARRAY_DECLARATOR
+ *				|
+ *			  EXPR
+ *				|
+ *				3
+ *
+ *  new int[1][2]
+ *
+ *  new
+ *   |
+ *  int -- ARRAY_DECLARATOR
+ *			   |
+ *		 ARRAY_DECLARATOR -- EXPR
+ *			   |			  |
+ *			 EXPR			 1
+ *			   |
+ *			   2
+ *
+ */
+newExpression
+	:	"new"^ (typeArguments)? type
+		(	LPAREN! argList RPAREN! (classBlock)?
+
+			//java 1.1
+			// Note: This will allow bad constructs like
+			//	new int[4][][3] {exp,exp}.
+			//	There needs to be a semantic check here...
+			// to make sure:
+			//   a) [ expr ] and [ ] are not mixed
+			//   b) [ expr ] and an init are not used together
+
+		|	newArrayDeclarator (arrayInitializer)?
+		)
+	;
+
+argList
+	:	(	expressionList
+		|	/*nothing*/
+			{#argList = #[ELIST,"ELIST"];}
+		)
+	;
+
+newArrayDeclarator
+	:	(
+			// CONFLICT:
+			// newExpression is a primaryExpression which can be
+			// followed by an array index reference. This is ok,
+			// as the generated code will stay in this loop as
+			// long as it sees an LBRACK (proper behavior)
+			options {
+				warnWhenFollowAmbig = false;
+			}
+		:
+			lb:LBRACK^ {#lb.setType(ARRAY_DECLARATOR);}
+				(expression)?
+			RBRACK!
+		)+
+	;
+
+constant
+	:	NUM_INT
+	|	CHAR_LITERAL
+	|	STRING_LITERAL
+	|	NUM_FLOAT
+	|	NUM_LONG
+	|	NUM_DOUBLE
+	;
+
+
+//----------------------------------------------------------------------------
+// The Java scanner
+//----------------------------------------------------------------------------
+class JavaLexer extends Lexer;
+
+options {
+	exportVocab=Java;		// call the vocabulary "Java"
+	testLiterals=false;		// don't automatically test for literals
+	k=4;					// four characters of lookahead
+	charVocabulary='\u0003'..'\uFFFF';
+	// without inlining some bitset tests, couldn't do unicode;
+	// I need to make ANTLR generate smaller bitsets; see
+	// bottom of JavaLexer.java
+	codeGenBitsetTestThreshold=20;
+}
+
+{
+	/** flag for enabling the "assert" keyword */
+	private boolean assertEnabled = true;
+	/** flag for enabling the "enum" keyword */
+	private boolean enumEnabled = true;
+
+	/** Enable the "assert" keyword */
+	public void enableAssert(boolean shouldEnable) { assertEnabled = shouldEnable; }
+	/** Query the "assert" keyword state */
+	public boolean isAssertEnabled() { return assertEnabled; }
+	/** Enable the "enum" keyword */
+	public void enableEnum(boolean shouldEnable) { enumEnabled = shouldEnable; }
+	/** Query the "enum" keyword state */
+	public boolean isEnumEnabled() { return enumEnabled; }
+}
+
+// OPERATORS
+QUESTION		:	'?'		;
+LPAREN			:	'('		;
+RPAREN			:	')'		;
+LBRACK			:	'['		;
+RBRACK			:	']'		;
+LCURLY			:	'{'		;
+RCURLY			:	'}'		;
+COLON			:	':'		;
+COMMA			:	','		;
+//DOT			:	'.'		;
+ASSIGN			:	'='		;
+EQUAL			:	"=="	;
+LNOT			:	'!'		;
+BNOT			:	'~'		;
+NOT_EQUAL		:	"!="	;
+DIV				:	'/'		;
+DIV_ASSIGN		:	"/="	;
+PLUS			:	'+'		;
+PLUS_ASSIGN		:	"+="	;
+INC				:	"++"	;
+MINUS			:	'-'		;
+MINUS_ASSIGN	:	"-="	;
+DEC				:	"--"	;
+STAR			:	'*'		;
+STAR_ASSIGN		:	"*="	;
+MOD				:	'%'		;
+MOD_ASSIGN		:	"%="	;
+SR				:	">>"	;
+SR_ASSIGN		:	">>="	;
+BSR				:	">>>"	;
+BSR_ASSIGN		:	">>>="	;
+GE				:	">="	;
+GT				:	">"		;
+SL				:	"<<"	;
+SL_ASSIGN		:	"<<="	;
+LE				:	"<="	;
+LT				:	'<'		;
+BXOR			:	'^'		;
+BXOR_ASSIGN		:	"^="	;
+BOR				:	'|'		;
+BOR_ASSIGN		:	"|="	;
+LOR				:	"||"	;
+BAND			:	'&'		;
+BAND_ASSIGN		:	"&="	;
+LAND			:	"&&"	;
+SEMI			:	';'		;
+
+
+// Whitespace -- ignored
+WS	:	(	' '
+		|	'\t'
+		|	'\f'
+			// handle newlines
+		|	(	options {generateAmbigWarnings=false;}
+			:	"\r\n"	// Evil DOS
+			|	'\r'	// Macintosh
+			|	'\n'	// Unix (the right way)
+			)
+			{ newline(); }
+		)+
+		{ _ttype = Token.SKIP; }
+	;
+
+// Single-line comments
+SL_COMMENT
+	:	"//"
+		(~('\n'|'\r'))* ('\n'|'\r'('\n')?)
+		{$setType(Token.SKIP); newline();}
+	;
+
+// multiple-line comments
+ML_COMMENT
+	:	"/*"
+		(	/*	'\r' '\n' can be matched in one alternative or by matching
+				'\r' in one iteration and '\n' in another. I am trying to
+				handle any flavor of newline that comes in, but the language
+				that allows both "\r\n" and "\r" and "\n" to all be valid
+				newline is ambiguous. Consequently, the resulting grammar
+				must be ambiguous. I'm shutting this warning off.
+			 */
+			options {
+				generateAmbigWarnings=false;
+			}
+		:
+			{ LA(2)!='/' }? '*'
+		|	'\r' '\n'		{newline();}
+		|	'\r'			{newline();}
+		|	'\n'			{newline();}
+		|	~('*'|'\n'|'\r')
+		)*
+		"*/"
+		{$setType(Token.SKIP);}
+	;
+
+
+// character literals
+CHAR_LITERAL
+	:	'\'' ( ESC | ~('\''|'\n'|'\r'|'\\') ) '\''
+	;
+
+// string literals
+STRING_LITERAL
+	:	'"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"'
+	;
+
+
+// escape sequence -- note that this is protected; it can only be called
+// from another lexer rule -- it will not ever directly return a token to
+// the parser
+// There are various ambiguities hushed in this rule. The optional
+// '0'...'9' digit matches should be matched here rather than letting
+// them go back to STRING_LITERAL to be matched. ANTLR does the
+// right thing by matching immediately; hence, it's ok to shut off
+// the FOLLOW ambig warnings.
+protected
+ESC
+	:	'\\'
+		(	'n'
+		|	'r'
+		|	't'
+		|	'b'
+		|	'f'
+		|	'"'
+		|	'\''
+		|	'\\'
+		|	('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+		|	'0'..'3'
+			(
+				options {
+					warnWhenFollowAmbig = false;
+				}
+			:	'0'..'7'
+				(
+					options {
+						warnWhenFollowAmbig = false;
+					}
+				:	'0'..'7'
+				)?
+			)?
+		|	'4'..'7'
+			(
+				options {
+					warnWhenFollowAmbig = false;
+				}
+			:	'0'..'7'
+			)?
+		)
+	;
+
+
+// hexadecimal digit (again, note it's protected!)
+protected
+HEX_DIGIT
+	:	('0'..'9'|'A'..'F'|'a'..'f')
+	;
+
+
+// a dummy rule to force vocabulary to be all characters (except special
+// ones that ANTLR uses internally (0 to 2)
+protected
+VOCAB
+	:	'\3'..'\377'
+	;
+
+
+// an identifier. Note that testLiterals is set to true! This means
+// that after we match the rule, we look in the literals table to see
+// if it's a literal or really an identifer
+IDENT
+	options {testLiterals=true;}
+	:	('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
+		{
+			// check if "assert" keyword is enabled
+			if (assertEnabled && "assert".equals($getText)) {
+				$setType(LITERAL_assert); // set token type for the rule in the parser
+			}
+			// check if "enum" keyword is enabled
+			if (enumEnabled && "enum".equals($getText)) {
+				$setType(LITERAL_enum); // set token type for the rule in the parser
+			}
+		}
+	;
+
+
+// a numeric literal
+NUM_INT
+	{boolean isDecimal=false; Token t=null;}
+	:	'.' {_ttype = DOT;}
+			(
+				(('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})?
+				{
+				if (t != null && t.getText().toUpperCase().indexOf('F')>=0) {
+					_ttype = NUM_FLOAT;
+				}
+				else {
+					_ttype = NUM_DOUBLE; // assume double
+				}
+				})
+				|
+				// JDK 1.5 token for variable length arguments
+				(".." {_ttype = TRIPLE_DOT;})
+			)?
+
+	|	(	'0' {isDecimal = true;} // special case for just '0'
+			(	('x'|'X')
+				(											// hex
+					// the 'e'|'E' and float suffix stuff look
+					// like hex digits, hence the (...)+ doesn't
+					// know when to stop: ambig. ANTLR resolves
+					// it correctly by matching immediately. It
+					// is therefor ok to hush warning.
+					options {
+						warnWhenFollowAmbig=false;
+					}
+				:	HEX_DIGIT
+				)+
+
+			|	//float or double with leading zero
+				(('0'..'9')+ ('.'|EXPONENT|FLOAT_SUFFIX)) => ('0'..'9')+
+
+			|	('0'..'7')+									// octal
+			)?
+		|	('1'..'9') ('0'..'9')*  {isDecimal=true;}		// non-zero decimal
+		)
+		(	('l'|'L') { _ttype = NUM_LONG; }
+
+		// only check to see if it's a float if looks like decimal so far
+		|	{isDecimal}?
+			(	'.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})?
+			|	EXPONENT (f3:FLOAT_SUFFIX {t=f3;})?
+			|	f4:FLOAT_SUFFIX {t=f4;}
+			)
+			{
+			if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
+				_ttype = NUM_FLOAT;
+			}
+			else {
+				_ttype = NUM_DOUBLE; // assume double
+			}
+			}
+		)?
+	;
+
+// JDK 1.5 token for annotations and their declarations
+AT
+	:	'@'
+	;
+
+// a couple protected methods to assist in matching floating point numbers
+protected
+EXPONENT
+	:	('e'|'E') ('+'|'-')? ('0'..'9')+
+	;
+
+
+protected
+FLOAT_SUFFIX
+	:	'f'|'F'|'d'|'D'
+	;

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/AntlrTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/AntlrTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/AntlrTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.junit;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for JavaParser.
+ */
+public class AntlrTest extends TestCase {
+
+	/**
+	 * Tests the JavaParser.
+	 */
+	public void test() throws Throwable {
+		final String path = System.getProperty("js.src")
+			+ "/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java";
+		org.apache.ws.jaxme.js.util.JavaParser.main(new String[]{path});
+	}
+	
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BasicTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BasicTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BasicTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,245 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.junit;
+
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.PlaceHolder;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/** <p>Basic test</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class BasicTest extends TestCase {
+   private static final String PACKAGE_NAME = "foo";
+   private static final String CLASS_NAME = "Bar";
+
+	public BasicTest(String pName) {
+     super(pName);
+	}
+
+   public JavaSource getSource(JavaSource.Protection pProtection) {
+      JavaSourceFactory factory = new JavaSourceFactory();
+      JavaSource js;
+      JavaConstructor jcon;
+      JavaMethod jm;
+      JavaField jf;
+      LocalJavaField lfj;
+      if (pProtection == null) {
+        js = factory.newJavaSource(JavaQNameImpl.getInstance(PACKAGE_NAME, CLASS_NAME));
+        js.newJavaInnerClass("Bof");
+        jf = js.newJavaField("someField", int.class);
+        jcon = js.newJavaConstructor();
+        jm = js.newJavaMethod("test", void.class);
+        lfj = jm.newJavaField(String.class, "localTest");
+      } else {
+        js = factory.newJavaSource(JavaQNameImpl.getInstance(PACKAGE_NAME, CLASS_NAME), pProtection);
+        js.newJavaInnerClass("Bof", pProtection);
+        jf = js.newJavaField("someField", int.class, pProtection);
+        jcon = js.newJavaConstructor(pProtection);
+        jm = js.newJavaMethod("test", void.class, pProtection);
+        lfj = jm.newJavaField(String.class, "localTest");
+      }
+      lfj.setFinal(true);
+      lfj.addLine(JavaSource.getQuoted("abc"));
+
+      jcon.addLine(jf, " = 0;");
+      jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("Not implemented"));
+      return js;
+   }
+
+   public String getResult(JavaSource.Protection pProtection) {
+      String p = (pProtection == null  ||  pProtection.equals(JavaSource.DEFAULT_PROTECTION)) ?
+        "" : (pProtection.toString() + " ");
+      return "package foo;\n" +
+              "\n" +
+              p + "class Bar {\n" +
+              "  " + p + "class Bof {\n" +
+              "  }\n" +
+              "\n" +
+              "  " + p + "int someField;\n" +
+              "\n" +
+              "\n" +
+              "  " + p + "Bar() {\n" +
+              "    someField = 0;\n" +
+              "  }\n" +
+              "\n" +
+              "  " + p + "void test() {\n" +
+              "    final String localTest = \"abc\";\n" +
+              "    throw new NullPointerException(\"Not implemented\");\n" +
+              "  }\n" +
+              "\n" +
+              "}\n";
+   }
+
+   private String dump(String s, int offset) {
+      String dump = s.substring(offset);
+      if (dump.length() > 32) {
+         dump = dump.substring(0, 32);
+      }
+      return dump;
+   }
+
+   private String hexDump(String s, int offset) {
+      String dump = s.substring(offset);
+      if (dump.length() > 16) {
+         dump = dump.substring(0, 16);
+      }
+      StringBuffer sb = new StringBuffer();
+      byte[] bytes = dump.getBytes();
+      for (int i = 0;  i < bytes.length;  i++) {
+         String h = Integer.toHexString(bytes[i]);
+         while (h.length() < 2) {
+            h = "0" + h;
+         }
+         sb.append(h);
+      }
+      return sb.toString();
+   }
+
+   public void assertStringEquals(String s1, String s2) {
+      int l1 = s1.length();
+      int l2 = s2.length();
+      if (l1 != l2) {
+         System.err.println("Lengths differ: " + l1 + " <=> " + l2);
+      }
+      int len = (l1 > l2) ? l2 : l1;
+      for (int i = 0;  i < len;  i++) {
+         if (s1.charAt(i) != s2.charAt(i)) {
+            String s = "Strings differ at offset " + len + ": ";
+            StringBuffer sb = new StringBuffer();
+            for (int j = 0;  j < s.length();  j++) {
+               sb.append(" ");
+            }
+            System.err.println(s + dump(s1, i) + " <=> " + dump(s2, i));
+            System.err.println(sb + hexDump(s1, i) + " <=> " + hexDump(s2, i));
+            break;
+         }
+      }
+      Assert.assertEquals(s1, s2);
+   }
+
+   public void testNull() {
+      JavaSource js = getSource(null);
+      assertStringEquals(getResult(null), js.toString());
+   }
+
+   public void testDefaultProtection() {
+      JavaSource js = getSource(JavaSource.DEFAULT_PROTECTION);
+      assertStringEquals(getResult(JavaSource.DEFAULT_PROTECTION), js.toString());
+   }
+
+   public void testPrivate() {
+      JavaSource js = getSource(JavaSource.PRIVATE);
+      assertStringEquals(getResult(JavaSource.PRIVATE), js.toString());
+   }
+
+   public void testProtected() {
+      JavaSource js = getSource(JavaSource.PROTECTED);
+      assertStringEquals(getResult(JavaSource.PROTECTED), js.toString());
+   }
+
+   public void testPublic() {
+      JavaSource js = getSource(JavaSource.PUBLIC);
+      assertStringEquals(getResult(JavaSource.PUBLIC), js.toString());
+   }
+
+   public void testAbstract() {
+     JavaSourceFactory factory = new JavaSourceFactory();
+     JavaSource js = factory.newJavaSource(JavaQNameImpl.getInstance("com.foo", "Bar"), JavaSource.PUBLIC);
+     js.setAbstract(true);
+     JavaMethod jm = js.newJavaMethod("test", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+     jm.setAbstract(true);
+     assertStringEquals("public abstract void test();\n", jm.asString());
+     assertStringEquals("package com.foo;\n" +
+                  "\n" +
+                  "public abstract class Bar {\n" +
+                  "  public abstract void test();\n" +
+                  "\n" +
+                  "}\n", js.asString());
+   }
+
+   private JavaSource getPlaceHolderSource(boolean pAutoMode) {
+     JavaSourceFactory factory = new JavaSourceFactory();
+     JavaSource js = factory.newJavaSource(JavaQNameImpl.getInstance("com.foo", "Bar"), JavaSource.PUBLIC);
+     JavaMethod main = js.newJavaMethod("main", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+     main.addParam(String[].class, "pArgs");
+     main.setStatic(true);
+     main.addThrows(Exception.class);
+     main.addFor(int.class, " i = 1;  i < 10;  i++");
+     main.newPlaceHolder("test", pAutoMode);
+     main.addEndFor();
+     js.setDynamicImports(true);
+     return js;
+   }
+
+   public void testPlaceHolders() {
+     boolean[] autoRemovable = new boolean[]{false, true};
+     for (int i = 0;  i < autoRemovable.length;  i++) {
+       boolean autoMode = autoRemovable[i];
+       JavaSource js = getPlaceHolderSource(autoMode);
+  
+       if (autoMode) {
+         assertStringEquals("package com.foo;\n" +
+                      "\n" +
+                      "public class Bar {\n" +
+                      "  public static void main(java.lang.String[] pArgs) throws java.lang.Exception {\n" +
+                      "    for (int i = 1;  i < 10;  i++) {\n" +
+                      "    }\n" +
+                      "  }\n" +
+                      "\n" +
+                      "}\n", js.asString());
+       } else {
+         boolean gotException = false;
+         try {
+           js.asString();
+         } catch (IllegalStateException e) {
+           gotException = true;
+         }
+         assertTrue(gotException);
+       }
+
+       js = getPlaceHolderSource(autoMode);
+       JavaMethod main = js.getMethod("main", new JavaQName[]{JavaQNameImpl.getInstance(String[].class)});
+       PlaceHolder test = main.getPlaceHolder("test");
+       assertNotNull(test);
+       test.remove();
+       main.addLine("// I am here");
+
+       String expect = "package com.foo;\n" +
+                       "\n" +
+                       "public class Bar {\n" +
+                       "  public static void main(java.lang.String[] pArgs) throws java.lang.Exception {\n" +
+                       "    for (int i = 1;  i < 10;  i++) {\n" +
+                       "      // I am here\n" +
+                       "    }\n" +
+                       "  }\n" +
+                       "\n" +
+                       "}\n";
+       String got = js.asString();
+       assertStringEquals(expect, got);
+     }
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BeanReaderTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BeanReaderTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/BeanReaderTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,315 @@
+package org.apache.ws.jaxme.js.junit;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.Util;
+import org.apache.ws.jaxme.js.apps.JavaSourceResolver;
+import org.apache.ws.jaxme.js.beanreader.BeanInfo;
+import org.apache.ws.jaxme.js.beanreader.BeanInfoFactory;
+import org.apache.ws.jaxme.js.beanreader.BeanProperty;
+import org.apache.ws.jaxme.js.beanreader.BeanReaderException;
+import org.apache.ws.jaxme.js.beanreader.BeanSchemaWriter;
+import org.apache.ws.jaxme.js.util.JavaParser;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+
+/** Test case for the {@link BeanSchemaWriter}.
+ */
+public class BeanReaderTest extends TestCase {
+	private static final String JAVA_SOURCE_1 =
+		"package foo.bar;\n" +
+		"\n" +
+		"import java.math.BigDecimal;\n" +
+		"import java.math.BigInteger;\n" +
+		"import java.util.Calendar;\n" +
+		"\n" +
+		"import foo.bar.PrimitiveSimpleTypeBean.SimpleTypeBean;\n" +
+		"\n" +
+		"public class MyBean {\n" +
+		"	public static class SimpleTypeArraysBean extends PrimitiveSimpleTypeArraysBean {\n" +
+		"		private Byte[] objectByteArray;\n" +
+		"		private Short[] objectShortArray;\n" +
+		"		private Integer[] objectIntArray;\n" +
+		"		private Long[] objectLongArray;\n" +
+		"		private Float[] objectFloatArray;\n" +
+		"		private Double[] objectDoubleArray;\n" +
+		"		private Boolean[] objectBooleanArray;\n" +
+		"		private Calendar[] calendarArray;\n" +
+		"		private BigInteger[] bigIntegerArray;\n" +
+		"		private BigDecimal[] bigDecimalArray;\n" +
+		"		private byte[][] base64Array;\n" +
+		"\n" +
+		"		public Byte[] getObjectByteArray() { return objectByteArray; }\n" +
+		"		public Short[] getObjectShortArray() { return objectShortArray; }\n" +
+		"		public Integer[] getObjectIntArray() { return objectIntArray; }\n" +
+		"		public Long[] getObjectLongArray() { return objectLongArray; }\n" +
+		"		public Float[] getObjectFloatArray() { return objectFloatArray; }\n" +
+		"		public Double[] getObjectDoubleArray() { return objectDoubleArray; }\n" +
+		"		public Boolean[] getObjectBooleanArray() { return objectBooleanArray; }\n" +
+		"		public Calendar[] getCalendarArray() { return calendarArray; }\n" +
+		"		public BigInteger[] getBigIntegerArray() { return bigIntegerArray; }\n" +
+		"		public BigDecimal[] getBigDecimalArray() { return bigDecimalArray; }\n" +
+		"		public byte[][] getBase64Array() { return base64Array; }\n" +
+		"\n" +
+		"		public void setObjectByteArray(Byte[] pValue) { objectByteArray = pValue; }\n" +
+		"		public void setObjectShortArray(Short[] pValue) { objectShortArray = pValue; }\n" +
+		"		public void setObjectIntArray(Integer[] pValue) { objectIntArray = pValue; }\n" +
+		"		public void setObjectLongArray(Long[] pValue) { objectLongArray = pValue; }\n" +
+		"		public void setObjectFloatArray(Float[] pValue) { objectFloatArray = pValue; }\n" +
+		"		public void setObjectDoubleArray(Double[] pValue) { objectDoubleArray = pValue; }\n" +
+		"		public void setObjectBooleanArray(Boolean[] pValue) { objectBooleanArray = pValue; }\n" +
+		"		public void setCalendarArray(Calendar[] pValue) { calendarArray = pValue; }\n" +
+		"		public void setBigDecimalArray(BigDecimal[] pValue) { bigDecimalArray = pValue; }\n" +
+		"		public void setBigIntegerArray(BigInteger[] pValue) { bigIntegerArray = pValue; }\n" +
+		"		public void setBase64Array(byte[][] pValue) { base64Array = pValue; }\n" +
+		"	}\n" +
+		"\n" +
+		"	private SimpleTypeBean simpleTypeBean;\n" +
+		"	private SimpleTypeArraysBean simpleTypeArraysBean;\n" +
+		"	private SimpleTypeBean[] simpleTypeArray;\n" +
+		"	private SimpleTypeArraysBean[] simpleTypeArraysArray;\n" +
+		"   private MyBean mySubBean;\n" +
+		"\n" +
+		"	public SimpleTypeBean getSimpleTypeBean() { return simpleTypeBean; }\n" +
+		"	public void setSimpleTypeBean(SimpleTypeBean pBean) { simpleTypeBean = pBean; }\n" +
+		"	public SimpleTypeArraysBean getSimpleTypeArraysBean() { return simpleTypeArraysBean; }\n" +
+		"	public void setSimpleTypeArraysBean(SimpleTypeArraysBean pBean) { simpleTypeArraysBean = pBean; }\n" +
+		"	public SimpleTypeBean[] getSimpleTypeArray() { return simpleTypeArray; }\n" +
+		"	public void setSimpleTypeArray(SimpleTypeBean[] pArray) { simpleTypeArray = pArray; }\n" +
+		"	public SimpleTypeArraysBean[] getSimpleTypeArraysArray() { return simpleTypeArraysArray; }\n" +
+		"	public void setSimpleTypeArraysArray(SimpleTypeArraysBean[] pArray) { simpleTypeArraysArray = pArray; }\n" +
+		"   public MyBean getMySubBean() { return mySubBean; }\n" +
+		"   public void setMySubBean(MyBean pBean) { mySubBean = pBean; }\n" +
+		"}\n";
+
+	private static final String JAVA_SOURCE_2 =
+		"package foo.bar;\n" +
+		"\n" +
+		"public class PrimitiveSimpleTypeArraysBean {\n" +
+		"	private short[] primitiveShortField;\n" +
+		"	private int[] primitiveIntField;\n" +
+		"	private long[] primitiveLongField;\n" +
+		"	private float[] primitiveFloatField;\n" +
+		"	private double[] primitiveDoubleField;\n" +
+		"	private boolean[] primitiveBooleanField;\n" +
+		"	\n" +
+		"	public short[] getPrimitiveShortField() { return primitiveShortField; }\n" +
+		"	public int[] getPrimitiveIntField() { return primitiveIntField; }\n" +
+		"	public long[] getPrimitiveLongField() { return primitiveLongField; }\n" +
+		"	public float[] getPrimitiveFloatField() { return primitiveFloatField; }\n" +
+		"	public double[] getPrimitiveDoubleField() { return primitiveDoubleField; }\n" +
+		"	public boolean[] isPrimitiveBooleanField() { return primitiveBooleanField; }\n" +
+		"	\n" +
+		"	public void setPrimitiveShortField(short[] pValue) { primitiveShortField = pValue; }\n" +
+		"	public void setPrimitiveIntField(int[] pValue) { primitiveIntField = pValue; }\n" +
+		"	public void setPrimitiveLongField(long[] pValue) { primitiveLongField = pValue; }\n" +
+		"	public void setPrimitiveFloatField(float[] pValue) { primitiveFloatField = pValue; }\n" +
+		"	public void setPrimitiveDoubleField(double[] pValue) { primitiveDoubleField = pValue; }\n" +
+		"	public void setPrimitiveBooleanField(boolean[] pValue) { primitiveBooleanField = pValue; }\n" +
+		"}\n";
+
+	private static final String JAVA_SOURCE_3 =
+		"package foo.bar;\n" +
+		"\n" +
+		"import java.math.BigDecimal;\n" +
+		"import java.math.BigInteger;\n" +
+		"import java.util.Calendar;\n" +
+		"\n" +
+		"public class PrimitiveSimpleTypeBean {\n" +
+		"	public static class SimpleTypeBean extends PrimitiveSimpleTypeBean {\n" +
+		"		private Byte objectByteField;\n" +
+		"		private Short objectShortField;\n" +
+		"		private Integer objectIntField;\n" +
+		"		private Long objectLongField;\n" +
+		"		private Float objectFloatField;\n" +
+		"		private Double objectDoubleField;\n" +
+		"		private Boolean objectBooleanField;\n" +
+		"		private Calendar calendarField;\n" +
+		"		private BigDecimal bigDecimalField;\n" +
+		"		private BigInteger bigIntegerField;\n" +
+		"		private byte[] base64Field;\n" +
+		"		\n" +
+		"		public Byte getObjectByteField() { return objectByteField; }\n" +
+		"		public Short getObjectShortField() { return objectShortField; }\n" +
+		"		public Integer getObjectIntField() { return objectIntField; }\n" +
+		"		public Long getObjectLongField() { return objectLongField; }\n" +
+		"		public Float getObjectFloatField() { return objectFloatField; }\n" +
+		"		public Double getObjectDoubleField() { return objectDoubleField; }\n" +
+		"		public Boolean getObjectBooleanField() { return objectBooleanField; }\n" +
+		"		public Calendar getCalendarField() { return calendarField; }\n" +
+		"		public BigDecimal getBigDecimalField() { return bigDecimalField; }\n" +
+		"		public BigInteger getBigIntegerField() { return bigIntegerField; }\n" +
+		"		public byte[] getBase64Field() { return base64Field; }\n" +
+		"\n" +
+		"		public void setObjectByteField(Byte pValue) { objectByteField = pValue; }\n" +
+		"		public void setObjectShortField(Short pValue) { objectShortField = pValue; }\n" +
+		"		public void setObjectIntField(Integer pValue) { objectIntField = pValue; }\n" +
+		"		public void setObjectLongField(Long pValue) { objectLongField = pValue; }\n" +
+		"		public void setObjectFloatField(Float pValue) { objectFloatField = pValue; }\n" +
+		"		public void setObjectDoubleField(Double pValue) { objectDoubleField = pValue; }\n" +
+		"		public void setObjectBooleanField(Boolean pValue) { objectBooleanField = pValue; }\n" +
+		"		public void setCalendarField(Calendar pValue) { calendarField = pValue; }\n" +
+		"		public void setBigDecimalField(BigDecimal pValue) { bigDecimalField = pValue; }\n" +
+		"		public void setBigIntegerField(BigInteger pValue) { bigIntegerField = pValue; }\n" +
+		"		public void setBase64Field(byte[] pValue) { base64Field = pValue; }\n" +
+		"\n" +
+		"		// Example of overwriting a parent objects property\n" +
+		"		public void setPrimitiveIntField(int pValue) { super.setPrimitiveIntField(pValue); }\n" +
+		"		public int getPrimitiveIntField() { return super.getPrimitiveIntField(); }\n" +
+		"	}\n" +
+		"\n" +
+		"	private byte primitiveByteField;\n" +
+		"	private short primitiveShortField;\n" +
+		"	private int primitiveIntField;\n" +
+		"	private long primitiveLongField;\n" +
+		"	private float primitiveFloatField;\n" +
+		"	private double primitiveDoubleField;\n" +
+		"	private boolean primitiveBooleanField;\n" +
+		"	\n" +
+		"	public byte getPrimitiveByteField() { return primitiveByteField; }\n" +
+		"	public short getPrimitiveShortField() { return primitiveShortField; }\n" +
+		"	public int getPrimitiveIntField() { return primitiveIntField; }\n" +
+		"	public long getPrimitiveLongField() { return primitiveLongField; }\n" +
+		"	public float getPrimitiveFloatField() { return primitiveFloatField; }\n" +
+		"	public double getPrimitiveDoubleField() { return primitiveDoubleField; }\n" +
+		"	public boolean isPrimitiveBooleanField() { return primitiveBooleanField; }\n" +
+		"	\n" +
+		"	public void setPrimitiveByteField(byte pValue) { primitiveByteField = pValue; }\n" +
+		"	public void setPrimitiveShortField(short pValue) { primitiveShortField = pValue; }\n" +
+		"	public void setPrimitiveIntField(int pValue) { primitiveIntField = pValue; }\n" +
+		"	public void setPrimitiveLongField(long pValue) { primitiveLongField = pValue; }\n" +
+		"	public void setPrimitiveFloatField(float pValue) { primitiveFloatField = pValue; }\n" +
+		"	public void setPrimitiveDoubleField(double pValue) { primitiveDoubleField = pValue; }\n" +
+		"	public void setPrimitiveBooleanField(boolean pValue) { primitiveBooleanField = pValue; }\n" +
+		"}\n";
+
+	final String[] sources = new String[]{
+			JAVA_SOURCE_1, JAVA_SOURCE_2, JAVA_SOURCE_3
+	};
+
+	private String asKey(JavaQName pQName) {
+		return pQName.toString().replace('$', '.');
+	}
+
+	private void register(Map pSourcesByName, JavaSource pJs) {
+		String qName = asKey(pJs.getQName());
+		pSourcesByName.put(qName, pJs);
+		JavaInnerClass[] innerClasses = pJs.getInnerClasses();
+		for (int i = 0;  i < innerClasses.length;  i++) {
+			register(pSourcesByName, innerClasses[i]);
+		}
+	}
+
+	private JavaSourceResolver getResolver()
+			throws TokenStreamException, RecognitionException {
+		final Map sourcesByName = new HashMap();
+		final JavaSourceFactory jsf = new JavaSourceFactory();
+		JavaParser parser = new JavaParser(jsf);
+		for (int i = 0;  i < sources.length;  i++) {
+			List list = parser.parse(new StringReader(sources[i]));
+			for (int j = 0;  j < list.size();  j++) {
+				JavaSource js = (JavaSource) list.get(i);
+				register(sourcesByName, js);
+			}
+		}
+		return new JavaSourceResolver(){
+			public JavaSource getJavaSource(JavaQName pQName) {
+				String key = asKey(pQName);
+				JavaSource js = (JavaSource) sourcesByName.get(key);
+				if (js != null) {
+					return js;
+				}
+				Class c;
+				try {
+					c = Class.forName(key);
+				} catch (ClassNotFoundException e) {
+					return null;
+				}
+				return Util.newJavaSource(jsf, c);
+			}
+		};
+	}
+
+	/** Tests creating a bean info factory.
+	 */
+	public void testBeanInfoFactory() throws Exception {
+		BeanInfoFactory bif = newBeanInfoFactory();
+		checkRootBean(bif);
+		checkPrimitiveSimpleTypeBean(bif);
+		checkSimpleTypeBean(bif);
+	}
+
+	private void checkSimpleTypeBean(BeanInfoFactory pFactory) {
+		JavaQName primitiveSimpleTypeBeanType = JavaQNameImpl.getInstance("foo.bar.PrimitiveSimpleTypeBean");
+		JavaQName simpleTypeBeanType = JavaQNameImpl.getInstance("foo.bar.PrimitiveSimpleTypeBean.SimpleTypeBean");
+		BeanInfo bi = pFactory.getBeanInfo(simpleTypeBeanType);
+		assertEquals("simpleTypeBean", bi.getElementName());
+		assertEquals(primitiveSimpleTypeBeanType, bi.getSuperType());
+		assertNull(bi.getTargetNamespace());
+		assertEquals(asKey(simpleTypeBeanType), asKey(bi.getType()));
+		BeanProperty[] props = bi.getBeanProperties();
+		assertEquals(11, props.length);
+	}
+
+	private void checkPrimitiveSimpleTypeBean(BeanInfoFactory pFactory) {
+		JavaQName primitiveSimpleTypeBeanType = JavaQNameImpl.getInstance("foo.bar.PrimitiveSimpleTypeBean");
+		BeanInfo bi = pFactory.getBeanInfo(primitiveSimpleTypeBeanType);
+		assertEquals("primitiveSimpleTypeBean", bi.getElementName());
+		assertNull(bi.getSuperType());
+		assertNull(bi.getTargetNamespace());
+		assertEquals(primitiveSimpleTypeBeanType, bi.getType());
+		BeanProperty[] props = bi.getBeanProperties();
+		assertEquals(7, props.length);
+	}
+
+	private void checkRootBean(BeanInfoFactory pFactory) {
+		JavaQName myBeanType = JavaQNameImpl.getInstance("foo.bar.MyBean");
+		BeanInfo bi = pFactory.getBeanInfo(myBeanType);
+		assertEquals("myBean", bi.getElementName());
+		assertNull(bi.getSuperType());
+		assertNull(bi.getTargetNamespace());
+		assertEquals(myBeanType, bi.getType());
+		BeanProperty[] myBeanProperties = bi.getBeanProperties();
+		assertEquals(5, myBeanProperties.length);
+	}
+
+	private BeanInfoFactory newBeanInfoFactory() throws BeanReaderException, TokenStreamException, RecognitionException {
+		return new BeanInfoFactory(getResolver(), getRootBeanType());
+	}
+
+	private JavaQName getRootBeanType() {
+		return JavaQNameImpl.getInstance("foo.bar.MyBean");
+	}
+
+	/** Tests creating an XML schema.
+	 */
+	public void testCreateSchema() throws Exception {
+		StringWriter sw = new StringWriter();
+		TransformerHandler t = ((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler();
+		t.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes");
+		t.setResult(new StreamResult(sw));
+		BeanInfoFactory beanInfoFactory = newBeanInfoFactory();
+		BeanInfo beanInfo = beanInfoFactory.getBeanInfo(getRootBeanType());
+		new BeanSchemaWriter(beanInfoFactory).write(beanInfo, t);
+		System.out.println(sw.toString());
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/MultipleInheritanceTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/MultipleInheritanceTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/MultipleInheritanceTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.junit;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
+
+import junit.framework.TestCase;
+
+
+/** <p>This example demonstrates implementation of multiple
+ * inheritance with the ProxyGenerator. The class MyObservableList,
+ * an extension of {@link ObservableList}, is a subclass of
+ * {@link Observable}, but can also be viewed as a subclass
+ * of {@link ArrayList} (or whatever implementation of
+ * {@link List} you choose in the constructor. The
+ * {@link Observer Observers} are notified whenever an object
+ * is added to the list.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: MultipleInheritanceTest.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class MultipleInheritanceTest extends TestCase implements Observer {
+  public class MyObservableList extends ObservableList {
+    MyObservableList(List pList) {
+      super(pList);
+    }
+    public boolean add(Object o) {
+      boolean result = super.add(o);
+      setChanged();
+      notifyObservers();
+      clearChanged();
+      return result;
+    }
+  }
+
+  private int size;
+  public void update(Observable o, Object arg) {
+    size = ((List) o).size();
+  }
+
+  public MultipleInheritanceTest(String arg0) {
+    super(arg0);
+  }
+
+  public void testObserver() {
+    size = 0;
+    MyObservableList mol = new MyObservableList(new ArrayList());
+    mol.add("s");
+    assertEquals(0, size);
+    mol.addObserver(this);
+    mol.add("t");
+    assertEquals(2, size);
+    mol.add(new Integer(4));
+    assertEquals(3, size);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/TypesafeEnumerationTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/TypesafeEnumerationTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/TypesafeEnumerationTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.junit;
+
+import junit.framework.TestCase;
+
+
+/** <p>This example demonstrates implementation of multiple
+ * inheritance with the ProxyGenerator. The class MyObservableList,
+ * an extension of {@link org.apache.ws.jaxme.js.junit.ObservableList},
+ * is a subclass of {@link java.util.Observable}, but can also be viewed
+ * as a subclass of {@link java.util.ArrayList} (or whatever
+ * implementation of {@link java.util.List} you choose in the constructor.
+ * The {@link java.util.Observer Observers} are notified whenever an object
+ * is added to the list.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: TypesafeEnumerationTest.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class TypesafeEnumerationTest extends TestCase {
+  public TypesafeEnumerationTest(String arg0) {
+    super(arg0);
+  }
+
+  public void testJOE() {
+	 assertEquals("JOE", EnumExample.JOE.getName());
+	 assertEquals("John Doe", EnumExample.JOE.getValue());
+  }
+
+  public void testPOPEYE() {
+	 assertEquals("POPEYE", EnumExample.POPEYE.getName());
+	 assertEquals("Olivia's Lover", EnumExample.POPEYE.getValue());
+  }
+
+  public void testDONALD() {
+	 assertEquals("DONALD", EnumExample.DONALD.getName());
+	 assertEquals("The Duck King", EnumExample.DONALD.getValue());
+  }
+
+  public void testgetInstanceByName() {
+	 EnumExample joe = EnumExample.getInstanceByName("JOE");
+	 assertEquals(joe, EnumExample.JOE);
+	 assertTrue(joe == EnumExample.JOE);
+	 EnumExample popeye = EnumExample.getInstanceByName("POPEYE");
+	 assertEquals(popeye, EnumExample.POPEYE);
+	 assertTrue(popeye == EnumExample.POPEYE);
+	 EnumExample donald = EnumExample.getInstanceByName("DONALD");
+	 assertEquals(donald, EnumExample.DONALD);
+	 assertTrue(donald == EnumExample.DONALD);
+	 Throwable ok = null;
+	 try {
+		EnumExample.getInstanceByName("foo");
+	 } catch (Throwable t) {
+		ok = t;
+	 }
+	 assertTrue(ok != null  &&  ok instanceof IllegalArgumentException);
+  }
+
+  public void testgetInstanceByValue() {
+	 EnumExample joe = EnumExample.getInstanceByValue("John " + "Doe");
+	 assertEquals(joe, EnumExample.JOE);
+	 assertTrue(joe == EnumExample.JOE);
+	 EnumExample popeye = EnumExample.getInstanceByValue("Olivia's " + "Lover");
+	 assertEquals(popeye, EnumExample.POPEYE);
+	 assertTrue(popeye == EnumExample.POPEYE);
+	 EnumExample donald = EnumExample.getInstanceByValue("The Duck" + " King");
+	 assertEquals(donald, EnumExample.DONALD);
+	 assertTrue(donald == EnumExample.DONALD);
+	 Throwable ok = null;
+	 try {
+		EnumExample.getInstanceByValue("bar");
+	 } catch (Throwable t) {
+		ok = t;
+	 }
+	 assertTrue(ok != null  &&  ok instanceof IllegalArgumentException);
+  }
+
+  public void testGetInstances() {
+  	 EnumExample[] instances = EnumExample.getInstances();
+  	 assertEquals(instances.length, 3);
+    assertEquals(EnumExample.JOE, instances[0]);
+	 assertEquals(EnumExample.POPEYE, instances[1]);
+	 assertEquals(EnumExample.DONALD, instances[2]);
+  }
+
+  public void testEquals() {
+	 assertTrue(!EnumExample.JOE.equals(EnumExample.POPEYE));
+	 assertTrue(!EnumExample.JOE.equals(EnumExample.DONALD));
+	 assertTrue(!EnumExample.POPEYE.equals(EnumExample.DONALD));
+  }
+
+  public void testHashCode() {
+	 assertTrue(EnumExample.JOE.hashCode() == EnumExample.JOE.getName().hashCode());
+	 assertTrue(EnumExample.POPEYE.hashCode() == EnumExample.POPEYE.getName().hashCode());
+	 assertTrue(EnumExample.DONALD.hashCode() == EnumExample.DONALD.getName().hashCode());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/VersionTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/VersionTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/VersionTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.junit;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.framework.TestCase;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.sqls.BinaryColumn;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.StringColumn;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.hsqldb.HsqlDbSQLFactoryImpl;
+
+
+/**
+ * @author <a href="mailto:jwi at softwareag.com">Jochen Wiedmann</a>
+ */
+public class VersionTest extends TestCase {
+	private static final Logger logger = LoggerAccess.getLogger(VersionTest.class);
+	public VersionTest(String pName) { super(pName); }
+	private Connection connection;
+
+	private SQLFactory factory;
+	private Schema schema;
+	private Table mainTable, subTable, subsubTable;
+	
+	protected SQLFactory getSQLFactory() {
+		if (factory == null) {
+			factory = new HsqlDbSQLFactoryImpl();
+		}
+		return factory;
+	}
+	
+	protected Table getMainTable() {
+		if (mainTable == null) {
+			Table mt = getSchema().newTable("MAIN");
+			Column mtId = mt.newColumn("ID", Column.Type.BIGINT);
+			Column mtVer = mt.newColumn("VER", Column.Type.INTEGER);
+			StringColumn mtName = (StringColumn) mt.newColumn("NAME", Column.Type.VARCHAR);
+			mtName.setLength(60);
+			BinaryColumn mtSig = (BinaryColumn) mt.newColumn("SIG", Column.Type.BINARY);
+			mtSig.setLength(16);
+			mt.newColumn("DATE", Column.Type.DATE);
+			
+			Index primaryKey = mt.newPrimaryKey();
+			primaryKey.addColumn(mtId);
+			primaryKey.addColumn(mtVer);
+			mainTable = mt;
+		}
+		return mainTable;
+	}
+	
+	protected Table getSubTable() {
+		if (subTable == null) {
+			Table st = getSchema().newTable("SUB");
+			StringColumn stId = (StringColumn) st.newColumn("ID", Column.Type.VARCHAR);
+			stId.setLength(32);
+			
+			Column stMtId = st.newColumn("MTID", Column.Type.BIGINT);
+			Column stMtVer = st.newColumn("MTVER", Column.Type.INTEGER);
+			StringColumn stAddress = (StringColumn) st.newColumn("ADDRESS", Column.Type.VARCHAR);
+			stAddress.setLength(60);
+			StringColumn stEmail = (StringColumn) st.newColumn("EMAIL", Column.Type.VARCHAR);
+			stEmail.setLength(60);
+			stEmail.setNullable(true);
+			
+			Index primaryKey = st.newPrimaryKey();
+			primaryKey.addColumn(stId);
+			
+			ForeignKey foreignKey = st.newForeignKey(getMainTable());
+			foreignKey.addColumnLink(stMtId, getMainTable().getColumn("ID"));
+			foreignKey.addColumnLink(stMtVer, getMainTable().getColumn("VER"));
+			
+			subTable = st;
+		}
+		return subTable;
+	}
+	
+	protected Table getSubSubTable() {
+		if (subsubTable == null) {
+			Table sst = getSchema().newTable("SUBSUB");
+			StringColumn sstId = (StringColumn) sst.newColumn("ID", Column.Type.VARCHAR);
+			sstId.setLength(32);
+			
+			Column sstMtId = sst.newColumn("MTID", Column.Type.BIGINT);
+			Column sstMtVer = sst.newColumn("MTVER", Column.Type.INTEGER);
+			ForeignKey foreignKeySt = sst.newForeignKey(getMainTable());
+			foreignKeySt.addColumnLink(sstMtId, getMainTable().getColumn("ID"));
+			foreignKeySt.addColumnLink(sstMtVer, getMainTable().getColumn("VER"));
+			
+			StringColumn sstStId = (StringColumn) sst.newColumn("SSTID", Column.Type.VARCHAR);
+			sstStId.setLength(32);
+			ForeignKey foreignKeySst = sst.newForeignKey(getSubTable());
+			foreignKeySst.addColumnLink(sstStId, getSubTable().getColumn("ID"));
+			
+			sst.newColumn("MTTS", Column.Type.TIMESTAMP);
+		}
+		return subsubTable;
+	}
+	
+	protected Schema getSchema() {
+		if (schema == null) {
+			schema = getSQLFactory().getDefaultSchema();
+			getMainTable();
+			getSubTable();
+			getSubSubTable();
+		}
+		return schema;
+	}
+	
+	protected Connection getConnection() throws ClassNotFoundException, SQLException {
+		if (connection == null) {
+			final String mName = "getConnection";
+			String driver = System.getProperty("jdbc.driver");
+			if (driver == null) {
+				driver = "org.hsqldb.jdbcDriver";
+				logger.fine(mName, "System property 'jdbc.driver' not set, using default JDBC driver: " + driver);
+			} else {
+				logger.fine(mName, "Using JDBC driver: " + driver);
+			}
+			try {
+				Class.forName(driver);
+			} catch (ClassNotFoundException e) {
+				try {
+                    ClassLoader cl = Thread.currentThread().getContextClassLoader();
+                    if (cl == null) {
+                        throw new ClassNotFoundException(driver);
+                    }
+                    cl.loadClass(driver);
+				} catch (ClassNotFoundException ex) {
+					throw e;
+				}
+			}
+			
+			String url = System.getProperty("jdbc.url");
+			if (url == null) {
+				url = "jdbc:hsqldb:build/db/db";
+				logger.fine(mName, "System property 'jdbc.url' not set, using default JDBC url: " + url);
+			} else {
+				logger.fine(mName, "Using JDBC url: " + url);
+			}
+			
+			String user = System.getProperty("jdbc.user");
+			String password;
+			if (user == null) {
+				user = "sa";
+				password = "";
+				logger.fine(mName, "System property 'jdbc.user' not set, using default JDBC user: " + user);
+			} else {
+				password = System.getProperty("jdbc.password");
+				logger.fine(mName, "Using JDBC user: " + user);
+			}
+			
+			connection = DriverManager.getConnection(url, user, password);
+		}
+		return connection;
+	}
+	
+	private String[] stmts = new String[] {
+		"DELETE FROM SUBSUB",
+		"DELETE FROM SUB",
+		"DELETE FROM MAIN",
+		"INSERT INTO MAIN VALUES (456, 'foo Main', 1, '000102030405060708090a0b0c0d0e0f', '2003-06-09')",
+		"INSERT INTO MAIN VALUES (456, 'foo Main 2', 22, 'a0a1a2a3a4a5a6a7a8a9aaabacadaeaf', '2003-06-10')",
+		"INSERT INTO MAIN VALUES (457, 'bar Main', 3, 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff', '2003-06-10')",
+		"INSERT INTO SUB VALUES (456, 1, 'Somewhere', '23423423', 'some at where')",
+		"INSERT INTO SUB VALUES (456, 22, 'Somewhere', '23423434', 'some at where')",
+		"INSERT INTO SUB VALUES (456, 22, 'Someone', '23421425', 'some at one')",
+		"INSERT INTO SUB VALUES (457, 3, 'Somewhere', '23423426', 'some at where')",
+		"INSERT INTO SUB VALUES (457, 3, 'Someone', '23421427', 'some at one')",
+		"INSERT INTO SUBSUB VALUES ('324987', 456, 1, '23423423', '2003-06-10 12:00:00')",
+		"INSERT INTO SUBSUB VALUES ('124987', 456, 22, '23423434', '2003-06-10 12:00:01')",
+		"INSERT INTO SUBSUB VALUES ('124988', 456, 22, '23423434', '2003-06-10 12:00:02')",
+		"INSERT INTO SUBSUB VALUES ('124989', 456, 22, '23421425', '2003-06-10 12:00:03')",
+		"INSERT INTO SUBSUB VALUES ('124990', 457, 3, '23423426', '2003-06-10 12:00:04')",
+		"INSERT INTO SUBSUB VALUES ('124991', 457, 3, '23421427', '2003-06-10 12:00:04')"
+	};
+	
+	public void testCreate() throws ClassNotFoundException, SQLException {
+		Connection conn = getConnection();
+		for (int i = 0;  i < stmts.length;  i++) {
+			PreparedStatement stmt = conn.prepareStatement(stmts[i]);
+			try {
+				stmt.executeUpdate();
+			} catch (SQLException e) {
+				if (stmts[i].startsWith("DROP TABLE ")  &&  "S0002".equals(e.getSQLState())) {
+					continue;
+				}
+				throw e;
+			}
+		}
+	}
+	
+	public void testClone() throws SQLException, ClassNotFoundException {
+		Connection conn = getConnection();
+		Object[] values = new Object[]{new Long(456), new Integer(1)};
+		Object[] updatedValues = (new MAINCloner()).clone(conn, values);
+		assertEquals(456, ((Long) updatedValues[0]).longValue());
+		assertEquals(2, ((Integer) updatedValues[2]).intValue());
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+package org.apache.ws.jaxme.js.junit;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Vector;
+
+import org.apache.ws.jaxme.js.apps.XmlRpcCaller;
+import org.apache.ws.jaxme.js.junit.xmlrpcclient.Dispatcher;
+
+import junit.framework.TestCase;
+
+
+/** A unit test for the
+ * {@link org.apache.ws.jaxme.js.apps.XmlRpcClientGenerator}.
+ */
+public class XmlRpcClientTest extends TestCase {
+	private final XmlRpcCaller caller = new XmlRpcCaller(){
+        Dispatcher dispatcher = new Dispatcher();
+        public Object xmlRpcCall(String pName, Vector pVector) {
+            try {
+                return dispatcher.execute(pName, pVector);
+            } catch (RuntimeException e) {
+                throw e;
+            } catch (Throwable t) {
+                throw new UndeclaredThrowableException(t);
+            }
+        }        
+    };
+    private final XmlRpcClientTestRemoteClass server = new XmlRpcClientTestRemoteClass();
+    private final org.apache.ws.jaxme.js.junit.xmlrpcclient.XmlRpcClientTestRemoteClass client
+        = new org.apache.ws.jaxme.js.junit.xmlrpcclient.XmlRpcClientTestRemoteClass(caller);
+
+    /** Creates a new instance with the given name.
+	 */
+	public XmlRpcClientTest(String pArg0) {
+		super(pArg0);
+	}
+
+    private void checkSum(int pSum) {
+    	assertEquals(pSum, server.getSum());
+        assertEquals(pSum, client.getSum());
+        String sumAsString = Integer.toString(pSum);
+        try {
+        	assertEquals(sumAsString, server.getSumAsString());
+        } catch (IOException e) {
+            // This IOException is never actually thrown.
+            // However, the try .. catch clause ensures, that
+            // it is present in the signature of server.getSumAsString().
+        }
+        try {
+        	assertEquals(sumAsString, client.getSumAsString());
+        } catch (IOException e) {
+            // This IOException is never actually thrown.
+            // However, the try .. catch clause ensures, that
+            // it is present in the signature of client.getSumAsString().
+        }
+    }
+
+    /** Creates a dispatcher and uses it to run the
+     * various methods.
+	 */
+    public void testXmlRpcClient() {
+        checkSum(0);
+        server.add(1);
+        checkSum(1);
+        client.add(1);
+        checkSum(2);
+        server.add(new int[]{2,3,2});
+        checkSum(9);
+        client.add(new int[]{0,-1,0,2});
+        checkSum(10);
+        server.add("4");
+        checkSum(14);
+        client.add("-8");
+        checkSum(6);
+    }    
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTestRemoteClass.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTestRemoteClass.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/XmlRpcClientTestRemoteClass.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+package org.apache.ws.jaxme.js.junit;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+
+/** A test class, does nothing useful.
+ */
+public class XmlRpcClientTestRemoteClass {
+	private static int sum = 0;
+	/** Adds <code>pValue</code> to the sum.
+	 */
+    public void add(int pValue) {
+    	sum += pValue;
+    }
+    /** Adds the given <code>pValues</code> to the sum.
+     */
+    public void add(int[] pValues) {
+    	for (int i = 0;  i < pValues.length;  i++) {
+    		add(pValues[i]);
+        }
+    }
+
+    /** Converts the given string into an int and
+     * adds it to the sum.
+     */
+    public void add(String pValue) {
+    	add(Integer.parseInt(pValue));
+    }
+
+    /** Returns the sum.
+     */
+    public int getSum() {
+        return sum;
+    }
+
+    /** Converts the sum into a string and returns it.
+     * @throws IOException Never actually thrown, just to verify
+     *   whether exceptions in the signature are handled properly.
+     */
+    public String getSumAsString() throws IOException, MalformedURLException {
+    	return Integer.toString(sum);
+    }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/create.sql
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/create.sql	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/create.sql	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,3 @@
+CREATE CACHED TABLE MAIN (  ID BIGINT NOT NULL,  NAME VARCHAR(60) NOT NULL,  VER INT NOT NULL,  SIG BINARY(16) NOT NULL,  DATE DATE NOT NULL,  PRIMARY KEY (ID, VER));
+CREATE CACHED TABLE SUB (  MTID BIGINT NOT NULL,  MTVER INT NOT NULL,  ADDRESS VARCHAR(60) NOT NULL,  ID VARCHAR(32) NOT NULL,  EMAIL VARCHAR(60),  PRIMARY KEY (ID),  FOREIGN KEY (MTID, MTVER) REFERENCES MAIN (ID, VER));
+CREATE CACHED TABLE SUBSUB (  ID VARCHAR(32) NOT NULL,  MTID BIGINT NOT NULL,  MTVER INT NOT NULL,  SSTID VARCHAR(32) NOT NULL,  MTTS TIMESTAMP NOT NULL,  PRIMARY KEY (ID),  FOREIGN KEY (MTID, MTVER) REFERENCES MAIN (ID, VER),  FOREIGN KEY (SSTID) REFERENCES SUB (ID));

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/drop.sql
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/drop.sql	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/junit/drop.sql	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,3 @@
+DROP TABLE SUBSUB;
+DROP TABLE SUB;
+DROP TABLE MAIN;

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.js Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+This package contains the
+<a href='http://ws.apache.org/jaxme/js/index.html'>JaxMeJS</a>
+java source generation framework.
+This is a generic component.
+JaxMe specific code is factored out into the 
+<a href='../generator/package-summary.html'>JaxMe generator package</a>.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Ant.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Ant.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Ant.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,667 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.pattern;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.apps.XmlRpcClientGenerator;
+import org.apache.ws.jaxme.js.pattern.VersionGenerator.TableInfo;
+import org.apache.ws.jaxme.logging.AntProjectLoggerFactory;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.logging.LoggerFactory;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.ColumnImpl;
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+
+/** <p>A set of Ant tasks for running the generators in the
+ * pattern package.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: Ant.java 232162 2005-07-28 19:47:58Z jochen $
+ */
+public class Ant {
+  protected abstract static class ReallyBasicAntTask extends Task {
+    private File destDir;
+    private boolean settingLoggerFactory = true;
+    private String classpathRef;
+    private Path classpath;
+    /** Sets, whether the Ant task initializes its own logger factory.
+     * Defaults to true.
+     */
+    public void setSettingLoggerFactory(boolean pSettingLoggerFactory) {
+      settingLoggerFactory = pSettingLoggerFactory;
+    }
+    /** Returns, whether the Ant task initializes its own logger factory.
+     * Defaults to true.
+     */
+    public boolean isSettingLoggerFactory() {
+      return settingLoggerFactory;
+    }
+    /** Sets, the destination directory, where sources are being generated to.
+     * Defaults to the current directory.
+     */
+    public void setDestDir(File pDir) {
+      destDir = pDir;
+    }
+    /** Sets, the destination directory, where sources are being generated to.
+     * Defaults to the current directory.
+     */
+    public File getDestDir() {
+       return destDir;
+    }
+    /** Sets a classpath reference, being used to load compiled classes
+     * or ressources.
+     */
+    public void setClasspathRef(String pRef) {
+    	if(classpath != null) {
+    		throw new BuildException("The 'classpathRef' attribute and the nested 'classpath' element are mutually exclusive.",
+                                     getLocation());
+        }
+        classpathRef = pRef;
+    }
+    /** Returns a classpath reference, being used to load compiled classes
+     * or ressources.
+     */
+    public String getClasspathRef() {
+    	return classpathRef;
+    }
+    /** Sets a classpath, being used to load compiled classes
+     * or ressources.
+     */
+    public void addClasspath(Path pClasspath) {
+    	if (classpath != null) {
+    		throw new BuildException("Multiple nested 'classpath' elements are forbidden.", getLocation());
+        }
+        if (classpathRef != null) {
+            throw new BuildException("The 'classpathRef' attribute and the nested 'classpath' element are mutually exclusive.",
+                    getLocation());
+        }
+        classpath = pClasspath;
+    }
+    /** Returns a classpath, being used to load compiled classes
+     * or ressources.
+     */
+    public Path getClasspath() {
+    	return classpath;
+    }
+    /** <p>Performs validation of the attributes and nested elements.</p>
+     */
+    public void finish() {
+    }
+    /** Abstract method, which is invoked to do the real work.
+     * @throws Exception
+     */
+    public abstract void doExecute() throws Exception;
+
+    public void execute() {
+      if (isSettingLoggerFactory()) {
+        LoggerFactory loggerFactory = LoggerAccess.getLoggerFactory();
+        if (!(loggerFactory instanceof AntProjectLoggerFactory)) {
+          LoggerAccess.setLoggerFactory(new AntProjectLoggerFactory(this));
+        }
+      }
+      Path classPath = getClasspath();
+      if (classPath == null) {
+      	String cRef = getClasspathRef();
+        if (cRef != null) {
+        	classPath = (Path) getProject().getReference(cRef);
+            if (classPath == null) {
+            	throw new BuildException("The reference " + cRef + " is not set.", getLocation());
+            }
+        }
+      }
+      AntClassLoader acl;
+      if (classPath == null) {
+      	acl = null;
+      } else {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+        	cl = getClass().getClassLoader();
+            if (cl == null) {
+            	cl = ClassLoader.getSystemClassLoader();
+            }
+        }
+        acl = new AntClassLoader(cl, getProject(), classPath, true);
+        acl.setThreadContextLoader();
+      }
+      try {
+          finish();
+          doExecute();
+      } catch (BuildException e) {
+      	  throw e;
+      } catch (Exception e) {
+      	  throw new BuildException(e, getLocation());
+      } finally {
+      	  if (acl != null) {
+      	  	  acl.resetThreadContextLoader();
+          }
+      }
+    }
+  }
+
+  protected abstract static class BasicAntTask extends ReallyBasicAntTask {
+    private JavaQName targetClass;
+    /** Sets the name of the class being generated.
+     */
+    public void setTargetClass(String pTargetClass) {
+	   targetClass = getJavaQName(pTargetClass);
+    }
+    public void finish() {
+		  if (targetClass == null) {
+		    throw new BuildException("The attribute 'targetClass' must be set.");
+		  }
+	  }
+      /** Abstract method, which is invoked to generate the target class.
+       */
+	  public abstract void generate(JavaSourceFactory pFactory, JavaQName pTargetClass)
+	      throws Exception;
+	  public void doExecute() {
+	 	  finish();
+	 	  try {
+			  JavaSourceFactory factory = new JavaSourceFactory();
+			  generate(factory, targetClass);
+			  factory.write(getDestDir());
+	 	  } catch (Exception e) {
+	 		  throw new BuildException(e, getLocation());
+	 	  }
+	  }
+  }
+
+  protected static JavaQName getJavaQName(String pName) {
+      return JavaQNameImpl.getInstance(pName);
+  }
+
+  /** The <code>AntProxyGenerator</code> is an Ant task
+   * providing access to the {@link ProxyGenerator}.
+   */
+  public static class AntProxyGenerator extends BasicAntTask {
+    private JavaQName extendedClass;
+    private List implementedInterfaces = new ArrayList();
+
+    /** Sets the class being extended, if any.
+     */
+    public void setExtendedClass(String pTargetClass) {
+      extendedClass = getJavaQName(pTargetClass);
+    }
+    /** Adds a new interface being implemented.
+     */
+    public InterfaceDescription createImplementedInterface() {
+      InterfaceDescription result = new InterfaceDescription();
+      implementedInterfaces.add(result);
+      return result;
+    }
+    public void finish() {
+    	super.finish();
+      if (implementedInterfaces.size() == 0) {
+        throw new BuildException("You must specify at least one interface being implemented (child element 'implementedInterface')");
+      }
+    }
+    public void generate(JavaSourceFactory pFactory, JavaQName pTargetClass)
+        throws BuildException {
+        ProxyGenerator proxyGenerator = new ProxyGenerator();
+        if (extendedClass != null) {
+          proxyGenerator.setExtendedClass(extendedClass);
+        }
+        try {
+            proxyGenerator.generate(pFactory, pTargetClass,
+                                    (InterfaceDescription[])
+                                      implementedInterfaces.toArray(new InterfaceDescription[implementedInterfaces.size()]));
+        } catch (Exception e) {
+        	throw new BuildException(e, getLocation());
+        }
+    }
+  }
+
+  /** Ant task for generating typesafe enumerations.
+   */
+  public static class AntTypesafeEnumerationGenerator extends BasicAntTask {
+	  private List items = new ArrayList();
+	  private boolean isAddingEquals = true;
+
+      /** Sets whether the equals and hashCode methods are being
+       * generated. Defaults to true.
+       */ 
+	  public void setAddingEquals(boolean pAddingEquals) {
+	 	  isAddingEquals = pAddingEquals;
+	  }
+
+      /** Creates a new, nested item.
+       */ 
+	  public TypesafeEnumerationGenerator.Item createItem() {
+	 	  TypesafeEnumerationGenerator.Item item = new TypesafeEnumerationGenerator.Item();
+	 	  items.add(item);
+	 	  return item;
+	  }
+
+    public void finish() {
+	 	  super.finish();
+	 	  if (items.size() == 0) {
+	 		  throw new BuildException("The generated enumeration must have at least a single item.");
+	 	  }
+	  }
+
+    public void generate(JavaSourceFactory pFactory, JavaQName pTargetClass)
+        throws Exception {
+    	TypesafeEnumerationGenerator generator = new TypesafeEnumerationGenerator();
+    	generator.setAddingEquals(isAddingEquals);
+		  TypesafeEnumerationGenerator.Item[] myItems = (TypesafeEnumerationGenerator.Item[])
+		  this.items.toArray(new TypesafeEnumerationGenerator.Item[this.items.size()]);
+		  generator.generate(pFactory, pTargetClass, myItems);
+    }
+  }
+
+  /** Ant task for the {@link org.apache.ws.jaxme.js.pattern.ChainGenerator}.
+   */
+  public static class AntChainGenerator extends ReallyBasicAntTask {
+     private List chains = new ArrayList();
+     /** Creates a new, nested element with another chain being
+      * generated.
+      */
+     public ChainGenerator createChain() {
+        ChainGenerator chain = new ChainGenerator();
+        chains.add(chain);
+        return chain;
+     }
+     public void finish() {
+        if (chains.size() == 0) {
+           throw new BuildException("At least one nested 'chain' element must be given.",
+                                     getLocation());
+        }
+     }
+     public void doExecute() {
+        JavaSourceFactory pFactory = new JavaSourceFactory();
+        for (Iterator iter = chains.iterator();  iter.hasNext();  ) {
+           ChainGenerator chain = (ChainGenerator) iter.next();
+           try {
+           	  chain.generate(pFactory);
+           } catch (Exception e) {
+           	  throw new BuildException(e, getLocation());
+           }
+        }
+        try {
+           pFactory.write(getDestDir());
+        } catch (IOException e) {
+           throw new BuildException(e, getLocation());
+        }
+     }
+  }
+
+  /** Ant task for the {@link org.apache.ws.jaxme.js.pattern.VersionGenerator}
+   */
+  public static class AntVersionGenerator extends BasicAntTask {
+    private String driver, url, user, password, schema, verColumn;
+    private List tables;
+    private boolean isGeneratingLogging;
+
+    /** Returns the JDBC driver.
+     */
+    public String getDriver() { return driver; }
+    /** Sets the JDBC driver.
+     */
+    public void setDriver(String pDriver) { driver = pDriver; }
+    /** Returns the JDBC password.
+     */
+    public String getPassword() { return password; }
+    /** Sets the JDBC password.
+     */
+    public void setPassword(String pPassword) { password = pPassword; }
+    /** Returns the JDBC URL.
+     */
+    public String getUrl() { return url; }
+    /** Sets the JDBC URL.
+     */
+    public void setUrl(String pUrl) { url = pUrl; }
+    /** Returns the JDBC user.
+     */
+    public String getUser() { return user; }
+    /** Sets the JDBC user.
+     */
+    public void setUser(String pUser) { user = pUser; }
+    /** Returns the database schema name.
+     */
+    public String getSchema() { return schema; }
+    /** Sets the database schema name.
+     */
+    public void setSchema(String pSchema) { schema = pSchema; }
+    /** Sets the table list; the table names are separated with white space.
+     */
+    public void setTables(String pTables) {
+      tables = new ArrayList();
+      for (StringTokenizer st = new StringTokenizer(pTables);  st.hasMoreTokens();  ) {
+        String tableName = st.nextToken();
+        tables.add(tableName);
+      }
+    }
+    /** Returns the table list.
+     */
+    public List getTables() {
+      return tables;
+    }
+    /** Sets the column with the version number.
+     */
+    public void setVerColumn(String pColumn) {
+      verColumn = pColumn;
+    }
+    /** Returns the column with the version number.
+     */
+    public String getVerColumn() {
+      return verColumn;
+    }
+    /** Sets whether logging statements are being generated.
+     */
+    public void setGeneratingLogging(boolean pGeneratingLogging) {
+      isGeneratingLogging = pGeneratingLogging;
+    }
+    /** Returns whether logging statements are being generated.
+     */
+    public boolean isGeneratingLogging() {
+      return isGeneratingLogging;
+    }
+
+    protected Connection getConnection() throws ClassNotFoundException, SQLException {
+       String myUrl = getUrl();
+       if (myUrl == null) {
+         throw new NullPointerException("Missing 'url' attribute");
+       }
+
+       String myDriver = getDriver();
+       if (myDriver != null) {
+         try {
+           Class.forName(myDriver);
+         } catch (ClassNotFoundException ex) {
+           try {
+             ClassLoader cl = Thread.currentThread().getContextClassLoader();
+             if (cl == null) {
+               throw new ClassNotFoundException(myDriver);
+             }
+             cl.loadClass(myDriver);
+           } catch (ClassNotFoundException ex2) {
+             throw ex;
+           }
+         }
+       }       
+
+       return DriverManager.getConnection(myUrl, getUser(), getPassword());
+    }
+
+    private class IdIncrementer implements VersionGenerator.ColumnUpdater {
+      private final List columns;
+      IdIncrementer(List pColumns) {
+        columns = pColumns;
+      }
+      public void update(JavaMethod pMethod, TableInfo pTableInfo, DirectAccessible pConnection, DirectAccessible pMap, DirectAccessible pRow) {
+        for (Iterator iter = columns.iterator();  iter.hasNext();  ) {
+          Integer columnNum = (Integer) iter.next();
+          pMethod.addLine(pRow, "[", columnNum, "] = Long.toString(Long.parseLong((String) ",
+                          pRow, "[", columnNum, "])+1);");
+        }
+      }
+    } 
+
+    private class VerNumIncrementer implements VersionGenerator.ColumnUpdater {
+      private final int columnNumber;
+      VerNumIncrementer(int pColumnNumber) {
+        columnNumber = pColumnNumber;
+      }
+      public void update(JavaMethod pMethod, TableInfo pTableInfo, DirectAccessible pConnection, DirectAccessible pMap, DirectAccessible pRow) {
+        pMethod.addLine(pRow, "[" + columnNumber + "] = new Integer(((Integer) ",
+                        pRow, "[" + columnNumber + "]).intValue()+1);");
+      }
+    }
+
+    public void generate(JavaSourceFactory pFactory, JavaQName pTargetClass) throws Exception {
+      List myTables = getTables();
+      if (myTables == null) {
+        throw new NullPointerException("Missing 'tables' attribute");
+      }
+      if (getVerColumn() == null) {
+        throw new NullPointerException("Missing 'verColumn' attribute");
+      }
+      Column.Name columnName = new ColumnImpl.NameImpl(getVerColumn());
+
+      SQLFactory factory = new SQLFactoryImpl();
+      Schema sch = factory.getSchema(getConnection(), getSchema());
+
+      VersionGenerator versionGenerator = new VersionGenerator();
+      versionGenerator.setGeneratingLogging(isGeneratingLogging());
+      boolean isFirstTable = true;
+
+      for (Iterator iter = myTables.iterator();  iter.hasNext();  ) {
+        String tableName = (String) iter.next();
+        Table table = sch.getTable(tableName);
+        if (table == null) {
+          throw new IllegalArgumentException("Invalid table name: " + tableName);
+        }
+
+        VersionGenerator.ColumnUpdater columnUpdater;
+        if (isFirstTable) {
+          Column column = null;
+          int columnNum = -1;
+          int i = 0;
+          for (Iterator colIter = table.getColumns();  colIter.hasNext();  i++) {
+            Column colIterColumn = (Column) colIter.next();
+            if (colIterColumn.getName().equals(columnName)) {
+              column = colIterColumn;
+              columnNum = i;
+              break;
+            }
+          }
+          if (column == null) {
+            throw new IllegalArgumentException("No column " + columnName +
+                                               " found in table " + table.getQName());
+          }
+          isFirstTable = false;
+          columnUpdater = new VerNumIncrementer(columnNum);
+        } else {
+          List pkColumns = new ArrayList();
+          Index primaryKey = table.getPrimaryKey();
+          if (primaryKey != null) {
+            for (Iterator pkIter = primaryKey.getColumns();  pkIter.hasNext();  ) {
+              Column pkColumn = (Column) pkIter.next();
+              int columnNum = -1;
+              int i = 0;
+              for (Iterator colIter = table.getColumns();  colIter.hasNext();  i++) {
+                Column colIterColumn = (Column) colIter.next();
+                if (colIterColumn.getName().equals(pkColumn.getName())) {
+                  columnNum = i;
+                  break;
+                }
+              }
+              if (columnNum == -1) {
+                throw new IllegalStateException("Primary key column " + pkColumn.getQName() +
+                                                " not found in table " + table.getQName());
+              }
+              pkColumns.add(new Integer(columnNum));
+            }
+          }
+          if (pkColumns.size() == 0) {
+            throw new IllegalArgumentException("The table " + table.getQName() +
+                                               " doesn't have a primary key.");
+          }
+          columnUpdater = new IdIncrementer(pkColumns);
+        }
+        versionGenerator.addTable(table, columnUpdater);
+      }
+
+      JavaSource js = pFactory.newJavaSource(pTargetClass);
+      versionGenerator.getCloneMethod(js);
+    }
+  }
+
+    /** An ant task for the {@link org.apache.ws.jaxme.js.apps.XmlRpcClientGenerator}.
+     */
+    public static class XmlRpcGenerator extends ReallyBasicAntTask {
+    	/** The nested child element "dispatcher".
+    	 */
+        public static class Dispatcher {
+            private String name;
+            private boolean implementingXmlRpcHandler = true;
+
+            /** Sets the fully qualified name of the dispatcher class.
+             */
+            public void setName(String pName) {
+                name = pName;
+            }
+
+            /** Returns the fully qualified name of the dispatcher class.
+             */
+            public String getName() {
+                return name;
+            }
+
+            /** Returns whether the dispatcher will implement
+             * XmlRpcHandler. Defaults to true.
+             */
+            public boolean isImplementingXmlRpcHandler() {
+            	return implementingXmlRpcHandler;
+            }
+
+            /** Sets whether the dispatcher will implement
+             * XmlRpcHandler. Defaults to true.
+             */
+            public void setImplementingXmlRpcHandler(boolean pImplementingXmlRpcHandler) {
+                implementingXmlRpcHandler = pImplementingXmlRpcHandler;
+            }
+        }
+
+        private final List serverClasses = new ArrayList();
+        private final JavaSourceFactory jsf = new JavaSourceFactory();
+        private String targetPackage;
+        private Dispatcher dispatcher;
+
+        /** Creates the dispatcher.
+         */
+        public Dispatcher createDispatcher() {
+            if (dispatcher != null) {
+                throw new BuildException("The nested 'dispatcher' element must not be used more than once.");
+            }
+            dispatcher = new Dispatcher();
+            return dispatcher;
+        }
+
+        /** Returns the dispatcher.
+         */
+        public Dispatcher getDispatcher() {
+        	return dispatcher;
+        }
+
+        /** Sets the target package.
+         */
+        public void setTargetPackage(String pPackage) {
+        	targetPackage = pPackage;
+        }
+
+        /** Returns the target package.
+         */
+        public String getTargetPackage() {
+            return targetPackage;
+        }
+
+        /** Creates a new, nested element with a {@link FileSet} of
+         * server side classes, for which client stubs are being
+         * generated.
+         */
+        public FileSet createServerClasses() {
+            FileSet fs = (FileSet) getProject().createDataType("fileset");
+            serverClasses.add(fs);
+            return fs;
+        }
+
+        public void finish() {
+            super.finish();
+            if (targetPackage == null) {
+            	throw new BuildException("Missing 'targetPackage' attribute",
+                                         getLocation());
+            }
+            if (serverClasses.size() == 0) {
+            	throw new BuildException("Missing nested element 'serverClasses'",
+                                         getLocation());
+            }
+        }
+
+		public void doExecute() throws Exception {
+            JavaSourceFactory jsf = new JavaSourceFactory();
+            JavaSourceFactory inputs = new JavaSourceFactory();
+            XmlRpcClientGenerator gen = new XmlRpcClientGenerator(jsf, getTargetPackage());
+            List sources = new ArrayList();
+            for (int i = 0;  i < serverClasses.size();  i++) {
+            	FileSet fs = (FileSet) serverClasses.get(i);
+                DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+                String[] files = ds.getIncludedFiles();
+                for (int j = 0;  j < files.length;  j++) {
+                    String s = files[j];
+                    Reflector r;
+                    if (s.endsWith(".class")) {
+                        s = s.substring(0, s.length() - ".class".length());
+                        r = new CompiledClassReflector(s.replace('/', '.'), Thread.currentThread().getContextClassLoader());
+                    } else if (s.endsWith(".java")) {
+                        r = new SourceReflector(new File(ds.getBasedir(), s));
+                    } else {
+                    	throw new BuildException("Unknown extension in file name: " + s
+                                                 + ", expected .class or .java",
+                                                 getLocation());
+                    }
+                    JavaSource js = r.getJavaSource(inputs);
+                    sources.add(js);
+                }
+            }
+            for (int i = 0;  i < sources.size();  i++) {
+                JavaSource js = (JavaSource) sources.get(i);
+                if (js.isAbstract()) {
+                	getProject().log("Ignoring abstract class " + js.getQName(), Project.MSG_VERBOSE);
+                } else {
+                	getProject().log("Generating XML-RPC client for " + js.getQName(), Project.MSG_DEBUG);
+                	gen.addClass(js, inputs);
+                }
+            }
+
+            Dispatcher disp = getDispatcher();
+            if (disp != null) {
+                gen.setDispatcherImplementsXmlRpcHandler(disp.isImplementingXmlRpcHandler());
+            	gen.getDispatcher(JavaQNameImpl.getInstance(disp.getName()));
+            }
+            jsf.write(getDestDir());
+		}
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ChainGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ChainGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ChainGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,389 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.pattern;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.Parameter;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+
+/** <p>This class generates so-called event chains. A chain is an
+ * interface and an object implementing the interface. Internally
+ * the implementation is using a list of chained objects, which
+ * you can assume to implement the same interface.</p>
+ * <p>Any event is passed to the first object in the list. The object
+ * may decide to resolve the event immediately and return. It may
+ * also call pass the event to the next object, take the returned
+ * value, possibly modify it and return the result. Finally, the
+ * chained object may decide to emit another event (which is passed
+ * along the same chain), and use the returned value.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ChainGenerator {
+	private String controllerInterfaceName;
+    private JavaSource controllerInterface;
+    private JavaQName chainInterface, proxyClass, implClass;
+
+    /** <p>Sets the controller interface name.</p>
+     */
+    public void setControllerInterfaceName(String pInterfaceName) throws ClassNotFoundException {
+        controllerInterfaceName = pInterfaceName;
+    }
+
+    /** Returns the controller interface.
+     */
+    public JavaSource getControllerInterface() {
+    	return controllerInterface;
+    }
+
+    private JavaSource loadSource(ClassLoader pClassLoader,
+                                  String pName,
+                                  JavaSourceFactory pFactory)
+            throws RecognitionException, TokenStreamException, IOException {
+    	URL url = pClassLoader.getResource(pName.replace('.', '/') + ".java");
+        if (url == null) {
+            return null;
+        } else {
+            return new SourceReflector(url).getJavaSource(pFactory);
+        }
+    }
+
+    private void loadSources(ClassLoader pClassLoader, JavaQName pQName,
+                             JavaSourceFactory pFactory,
+                             List pSources, Set pNames)
+            throws RecognitionException, TokenStreamException, IOException {
+        if (pNames.contains(pQName)) {
+        	return;
+        }
+        pNames.add(pQName);
+        JavaSource js = loadSource(Thread.currentThread().getContextClassLoader(),
+        		                   pQName.toString(), pFactory);
+        if (js == null) {
+        	return;
+        }
+        pSources.add(js);
+        JavaQName[] superInterfaces = js.getExtends();
+        for (int i = 0;  i < superInterfaces.length;  i++) {
+        	loadSources(pClassLoader, superInterfaces[i],
+                        pFactory, pSources, pNames);
+        }
+    }
+
+    private JavaSource[] loadSources(ClassLoader pClassLoader, String pName)
+            throws RecognitionException, TokenStreamException, IOException {
+        JavaSourceFactory jsf = new JavaSourceFactory();
+        List sources = new ArrayList();
+        Set names = new HashSet();
+        loadSources(pClassLoader, JavaQNameImpl.getInstance(pName),
+                    jsf, sources, names);
+        if (sources.isEmpty()) {
+        	return null;
+        } else {
+        	return (JavaSource[]) sources.toArray(new JavaSource[sources.size()]);
+        }
+    }
+
+    /** <p>Initializes the controller interface.</p>
+     * @throws ClassNotFoundException
+     * @throws IOException
+     * @throws TokenStreamException
+     * @throws RecognitionException
+     */
+    protected JavaSource[] initControllerInterface()
+            throws ClassNotFoundException, RecognitionException, TokenStreamException, IOException {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        JavaSource[] result;
+        try {
+            if (cl == null) {
+                throw new ClassNotFoundException(controllerInterfaceName);
+            }
+            CompiledClassReflector r = new CompiledClassReflector(controllerInterfaceName, cl);
+            result = new JavaSource[]{r.getJavaSource(new JavaSourceFactory())};
+        } catch (ClassNotFoundException e) {
+            result = loadSources(Thread.currentThread().getContextClassLoader(),
+                                 controllerInterfaceName);
+            if (result == null) {
+            	throw e;
+            }
+        }
+        if (!result[0].isInterface()) {
+        	throw new ClassCastException("The controller must be an interface");
+        }
+        return result;
+   }
+
+   /** <p>Sets the interface name being generated for the chain objects.</p>
+    */
+   public void setChainInterfaceName(String pInterfaceName) {
+      JavaQName qName = JavaQNameImpl.getInstance(pInterfaceName);
+      setChainInterface(qName);
+   }
+
+   /** <p>Sets the interface being generated for the chain objects.</p>
+    */
+   public void setChainInterface(JavaQName pInterface) {
+      chainInterface = pInterface;
+   }
+
+   /** <p>Returns the interface being generated for the chain objects.</p>
+    */
+   public JavaQName getChainInterface() {
+      return chainInterface;
+   }
+
+   /** <p>Sets the class name being generated for the chain objects.</p>
+    */
+   public void setProxyClassName(String pClassName) {
+      JavaQName qName = JavaQNameImpl.getInstance(pClassName);
+      setProxyClass(qName);
+   }
+
+   /** <p>Sets the class being generated for the chain objects.</p>
+    */
+   public void setProxyClass(JavaQName pClassName) {
+      proxyClass = pClassName;
+   }
+
+   /** <p>Returns the class being generated for the chain objects. Defaults
+    * to <code>getChainInterface() + "Impl"</code>.</p>
+    */
+   public JavaQName getProxyClass() {
+      if (proxyClass == null) {
+         JavaQName chainClass = getChainInterface();
+         if (chainClass == null) {
+            return null; 
+         } else {
+            return JavaQNameImpl.getInstance(chainClass.getPackageName(),
+                                                             chainClass.getClassName() + "Impl");
+         }
+      } else {
+         return proxyClass;
+      }
+   }
+
+   /** <p>Sets the name of the chain implementation class.</p>
+    */
+   public void setImplementationClassName(String pClassName) {
+      setImplementationClass(JavaQNameImpl.getInstance(pClassName));
+   }
+
+   /** <p>Sets the chain implementation class.</p>
+    */
+   public void setImplementationClass(JavaQName pClassName) {
+      implClass = pClassName;
+   }
+
+   /** <p>Returns the chain implementation classes name. Defaults to
+    * <code>getControllerInterface() + "Impl"</code>.</p>
+    */
+   public JavaQName getImplementationClass() {
+      if (implClass == null) {
+         if (controllerInterface == null) {
+            return null;
+         } else {
+            JavaQName controllerClass = controllerInterface.getQName();
+            return JavaQNameImpl.getInstance(controllerClass.getPackageName(),
+                                              controllerClass.getClassName() + "Impl");
+         }
+      } else {
+         return implClass;
+      }
+   }
+
+   /** Validates the input data.
+    */
+   public void finish() {
+      if (controllerInterface == null) {
+         throw new NullPointerException("A controller interface must be given.");
+      }
+      if (chainInterface == null) {
+         throw new NullPointerException("A chain interface must be given.");
+      }
+   }
+
+   private class ProxyInterfaceGenerator extends ProxyGenerator {
+   	public JavaMethod getInterfaceMethod(JavaSource pSource, JavaMethod pMethod) {
+   		JavaMethod jm = pSource.newJavaMethod(pMethod);
+   		Parameter[] parameters = jm.getParams();
+   		JavaQName controllerInterfaceQName = getControllerInterface().getQName();
+   		jm.clearParams();
+   		jm.addParam(controllerInterfaceQName, "pController");
+   		for (int i = 0;  i < parameters.length;  i++) {
+   			jm.addParam(parameters[i]);
+   		}
+   		return jm;
+   	}
+   	public JavaSource generate(JavaSourceFactory pInterfaceFactory,
+							   JavaQName pTargetClass,
+							   InterfaceDescription[] pDescription) throws Exception {
+   		JavaSource result = super.generate(pInterfaceFactory, pTargetClass,
+   				pDescription);
+   		result.clearImplements();
+   		return result;
+   	}
+   }
+
+   private class ProxyImplementationGenerator extends ProxyGenerator {
+   	protected JavaField getBackingObjectField(JavaSource pJs, InterfaceDescription[] pInterfaces) {
+   		return pJs.newJavaField("backingObject", getChainInterface(), JavaSource.PRIVATE);
+   	}
+   	protected JavaConstructor getConstructor(JavaSource pJs,
+											 InterfaceDescription[] pInterfaces) {
+   		JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PROTECTED);
+   		jcon.addParam(getChainInterface(), "o");
+   		jcon.addIf("o == null");
+   		jcon.addThrowNew(NullPointerException.class,
+   				JavaSource.getQuoted("The supplied object must not be null."));
+   		jcon.addEndIf();
+   		jcon.addLine("backingObject = o;");
+   		return jcon;
+   	}
+
+   	public JavaMethod getInterfaceMethod(JavaSource pSource, JavaMethod pMethod) {
+   		JavaMethod jm = pSource.newJavaMethod(pMethod);
+   		Parameter[] parameters = jm.getParams();
+   		JavaQName controllerInterfaceQName = getControllerInterface().getQName();
+   		jm.clearParams();
+   		jm.addParam(controllerInterfaceQName, "pController");
+   		for (int i = 0;  i < parameters.length;  i++) {
+   			jm.addParam(parameters[i]);
+   		}
+   		List callParameters = new ArrayList();
+   		callParameters.add("pController");
+   		for (int i = 0;  i < parameters.length;  i++) {
+   			Parameter parameter = parameters[i];
+   			callParameters.add(", "); 
+   			callParameters.add(parameter.getName());
+   		}
+        jm.addLine((JavaQNameImpl.VOID.equals(pMethod.getType()) ? "" : "return "),
+        		   "backingObject.",
+   				   pMethod.getName(), "(", callParameters, ");");
+   		return jm;
+   	}
+   	public JavaSource generate(JavaSourceFactory pImplementationFactory,
+							   JavaQName pTargetClass,
+							   InterfaceDescription[] pDescription) throws Exception {
+   		JavaSource result = super.generate(pImplementationFactory, pTargetClass, pDescription);
+   		result.clearImplements();
+   		result.addImplements(getChainInterface());
+   		return result;
+   	}
+   }
+
+   private class ControllerImplementationGenerator extends ProxyGenerator {
+   	protected JavaField getBackingObjectField(JavaSource pJs, InterfaceDescription[] pInterfaces) {
+   		return pJs.newJavaField("backingObject", getChainInterface(), JavaSource.PRIVATE);
+   	}
+   	protected JavaConstructor getConstructor(JavaSource pJs,
+											 InterfaceDescription[] pInterfaces) {
+   		JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PUBLIC);
+   		jcon.addParam(getChainInterface(), "o");
+   		jcon.addIf("o == null");
+   		jcon.addThrowNew(NullPointerException.class,
+   				JavaSource.getQuoted("The supplied object must not be null."));
+   		jcon.addEndIf();
+   		jcon.addLine("backingObject = o;");
+   		return jcon;
+   	}
+   	public JavaMethod getInterfaceMethod(JavaSource pSource,
+   			                             JavaMethod pMethod) {
+   		JavaMethod jm = pSource.newJavaMethod(pMethod);
+   		Parameter[] parameters = jm.getParams();
+   		List callParameters = new ArrayList();
+   		callParameters.add("this");
+   		for (int i = 0;  i < parameters.length;  i++) {
+   			Parameter parameter = parameters[i];
+   			callParameters.add(", "); 
+   			callParameters.add(parameter.getName());
+   		}
+   		jm.addLine((JavaQNameImpl.VOID.equals(pMethod.getType()) ? "" : "return "),
+   				"backingObject.",
+   				pMethod.getName(), "(", callParameters, ");");
+   		return jm;
+   	}
+   	protected JavaMethod getGetHeadOfChainMethod(JavaSource pSource) {
+   		JavaMethod jm = pSource.newJavaMethod("getHeadOfChain",
+   				getChainInterface(),
+   				JavaSource.PUBLIC);
+   		jm.addLine("return backingObject;");
+   		return jm;
+   	}
+   	public JavaSource generate(JavaSourceFactory pImplementationFactory,
+							   JavaQName pTargetClass,
+							   InterfaceDescription[] pDescription) throws Exception {
+   		JavaSource result = super.generate(pImplementationFactory, pTargetClass, pDescription);
+   		getGetHeadOfChainMethod(result);
+   		return result;
+   	}
+   }
+
+   /** Performs the actual work by generating classes using
+    * the given <code>pFactory</code>.
+    */
+   public JavaSource[] generate(JavaSourceFactory pFactory) throws Exception {
+
+      JavaSource[] sources = initControllerInterface();
+      controllerInterface = sources[0];
+      InterfaceDescription[] interfaces = new InterfaceDescription[sources.length];
+      for (int i = 0;  i < interfaces.length;  i++) {
+      	 InterfaceDescription controllerDescription = new InterfaceDescription();
+      	 controllerDescription.setInterface(sources[i].getQName().toString());
+      	 controllerDescription.setMandatory(true);
+         interfaces[i] = controllerDescription;
+      }
+
+      ProxyGenerator proxyInterfaceGenerator = new ProxyInterfaceGenerator();
+      JavaSource proxyInterface = proxyInterfaceGenerator.generate(pFactory, getChainInterface(), interfaces);
+      proxyInterface.setType(JavaSource.INTERFACE);
+
+      ProxyGenerator proxyImpGenerator = new ProxyImplementationGenerator();
+      JavaSource proxyImplementation = proxyImpGenerator.generate(pFactory, getProxyClass(), interfaces);
+
+      ProxyGenerator controllerImplementationGenerator = new ControllerImplementationGenerator();
+      JavaSource controllerImplementation = controllerImplementationGenerator.generate(pFactory, getImplementationClass(), interfaces);
+
+      return new JavaSource[]{controllerImplementation, proxyInterface, proxyImplementation};
+   }
+
+   public static void main(String[] args) throws Exception {
+	   ChainGenerator cg = new ChainGenerator();
+	   cg.setChainInterfaceName("org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain");
+	   cg.setControllerInterfaceName("org.apache.ws.jaxme.generator.sg.ComplexTypeSG");
+	   cg.setImplementationClassName("org.apache.ws.jaxme.generator.sg.ComplexTypeSGImpl");
+	   cg.setProxyClassName("org.apache.ws.jaxme.generator.sg.ComplexTypeSGChainImpl");
+	   JavaSourceFactory f = new JavaSourceFactory();
+	   cg.generate(f);
+	   f.write(new File("/tmp/qName"));
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/CompiledClassReflector.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/CompiledClassReflector.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/CompiledClassReflector.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,70 @@
+package org.apache.ws.jaxme.js.pattern;
+
+import java.lang.reflect.Method;
+
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+
+
+/** Reflector for gathering information on a compiled class.
+ */
+public class CompiledClassReflector implements Reflector {
+	private final Class compiledClass;
+
+	/** Creates a new instance of <code>CompiledClassReflector</code>,
+	 * reading information from the given class.
+	 * @param pClass
+	 */
+	public CompiledClassReflector(Class pClass) {
+		compiledClass = pClass;
+	}
+	
+	/** Creates a new instance of <code>CompiledClassReflector</code>,
+	 * which loads the class named <code>pName</code> through
+	 * {@link ClassLoader pClassLoader}.
+	 */
+	public CompiledClassReflector(String pName, ClassLoader pClassLoader)
+	        throws ClassNotFoundException {
+		this(pClassLoader.loadClass(pName));
+	}
+	
+	/** <p>Converts the given {@link Method} into an instance of
+	 * {@link JavaSource}.</p>
+	 */
+	protected JavaMethod getMethod(JavaSource pSource, Method pMethod) {
+		JavaMethod method = pSource.newJavaMethod(pMethod.getName(),
+				                                  JavaQNameImpl.getInstance(pMethod.getReturnType()),
+												  JavaSource.PUBLIC);
+		Class[] classes = pMethod.getParameterTypes();
+		for (int i = 0;  i < classes.length;  i++) {
+			method.addParam(classes[i], "arg" + i);
+		}
+		Class[] exceptions = pMethod.getExceptionTypes();
+		for (int i = 0;  i < exceptions.length;  i++) {
+			method.addThrows(exceptions[i]);
+		}
+		return method;
+	}
+	
+	/** Returns the compiled class being used to gather information.
+	 */
+	public Class getCompiledClass() {
+		return compiledClass;
+	}
+	
+	/** Reads the interface methods and converts them
+	 * into an instance of {@link JavaSource}.
+	 */
+	public JavaSource getJavaSource(JavaSourceFactory pFactory) {
+        Class c = getCompiledClass();
+		JavaSource js = new JavaSourceFactory().newJavaSource(JavaQNameImpl.getInstance(c.getName()));
+		Method[] methods = c.getMethods();
+		for (int i = 0;  i < methods.length;  i++) {
+			Method m = methods[i];
+			getMethod(js, m);
+		}
+		return js;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/InterfaceDescription.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/InterfaceDescription.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/InterfaceDescription.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,149 @@
+package org.apache.ws.jaxme.js.pattern;
+
+import java.net.URL;
+
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+
+
+/** The <code>InterfaceDescription</code> is used by the
+ * {@link ProxyGenerator} as information storage about
+ * the interfaces being implemented.<br>
+ * The main purporse of an intermediate class is to
+ * encapsulate the way, how information about these
+ * classes is gathered:
+ * <ol>
+ *   <li>If the interface being implemented is a compiled
+ *     class, then Java reflection is used.</li>
+ *   <li>Otherwise, if the interface being implemented is
+ *     present as a Java source file, then the
+ *     {@link org.apache.ws.jaxme.js.util.JavaParser}
+ *     is used.</li>
+ * </ol
+ */
+public class InterfaceDescription {
+      private boolean isMandatory = true;
+      private String interfaceName;
+      private String type;
+      private JavaSource javaSource;
+
+      private ClassLoader[] getClassLoaders() {
+      	  return new ClassLoader[]{
+      		  Thread.currentThread().getContextClassLoader(),
+			  getClass().getClassLoader(),
+			  ClassLoader.getSystemClassLoader()
+      	  };
+      }
+      
+      /** Sets the name of the interface being implemented.
+       */
+      public void setInterface(String pName) {
+      	  interfaceName = pName;
+      }
+      
+      /** Returns the name of the interface being implemented.
+       */
+      public String getInterface() {
+      	  return interfaceName;
+      }
+      
+      /** Sets, how to gather information about the interface.
+       * Supported values are "Reflection" (Java reflection),
+       * or "Source" ({@link org.apache.ws.jaxme.js.util.JavaParser}).
+       * The default is null, in which case "Reflection" and "Source"
+       * are tried, in that order.
+       */
+      public void setType(String pType) {
+      	  if (pType == null
+      	      ||  "Reflection".equalsIgnoreCase(pType)
+			  ||  "Source".equalsIgnoreCase(pType)) {
+      		  type = pType;
+      	  } else {
+      		  throw new IllegalArgumentException("Invalid type: " + pType +
+      		                                     ", expected 'Reflection', 'Source', or null.");
+      	  }
+      }
+      
+      /** Returns, how to gather information about the interface.
+       * Supported values are "Reflection" (Java reflection),
+       * or "Source" ({@link org.apache.ws.jaxme.js.util.JavaParser}).
+       * The default is null, in which case "Reflection" and "Source"
+       * are tried, in that order.
+       */
+      public String getType() {
+      	  return type;
+      }
+      
+      /** Sets whether this interface is mandatory. By default interfaces
+       * are mandatory and the backing objects must implement this interface.
+       * If an interface isn't mandatory, then a Proxy instance can be created
+       * even for objects which don't implement the interface. However, in that
+       * case it may happen that a ClassCastException is thrown while invoking
+       * a method declared by the interface.
+       */
+      public void setMandatory(boolean pMandatory) { isMandatory = pMandatory; }
+
+      /** Returns whether this interface is mandatory. By default interfaces
+       * are mandatory and the backing objects must implement this interface.
+       * If an interface isn't mandatory, then a Proxy instance can be created
+       * even for objects which don't implement the interface. However, in that
+       * case it may happen that a ClassCastException is thrown while invoking
+       * a method declared by the interface.
+       */
+      public boolean isMandatory() { return isMandatory; }
+
+      /** Returns an instance of {@link JavaSource}, matching
+       * the interface {@link #getInterface()}.
+       */
+      public JavaSource getJavaSource() throws Exception {
+          if (javaSource == null) {
+          	  javaSource = initJavaSource();
+          }
+          return javaSource;
+      }
+
+      /** Initializes the object, after all parameters are set.
+       */
+      private JavaSource initJavaSource() throws Exception {
+      	  Exception ex = null;
+      	  String mode = getType();
+      	  if (mode == null  ||  "Reflection".equals(mode)) {
+      	  	  try {
+                  ClassLoader[] cls = getClassLoaders();
+                  for (int i = 0;  i < cls.length;  i++) {
+                  	  if (cls[i] == null) {
+                          continue;
+                  	  }
+                      
+                      Class c = cls[i].loadClass(getInterface());
+                      if (c != null) {
+                      	  return new CompiledClassReflector(c).getJavaSource(new JavaSourceFactory());
+                      }
+                  }
+      	  	  } catch (Exception e) {
+                  if (ex == null) {
+                	  ex = e;
+                  }
+      	  	  }
+      	  }
+      	  if (mode == null  ||  "Source".equals(mode)) {
+      	  	  ClassLoader[] cls = getClassLoaders();
+      	  	  for (int i = 0;  i < cls.length;  i++) {
+                  if (cls[i] == null) {
+                  	  continue;
+                  }
+      	  	  	  URL url = cls[i].getResource(getInterface().replace('.', '/') + ".java");
+      	  	  	  if (url != null) {
+      	  	  	  	  SourceReflector reflector = new SourceReflector(url);
+      	  	  	  	  return reflector.getJavaSource(new JavaSourceFactory());
+      	  	  	  }
+      	  	  }
+      	  }
+      	  if (ex == null) {
+      	  	throw new IllegalStateException("Failed to locate Java class "
+      	  			+ getInterface());
+      	  } else {
+      	  	throw ex;
+      	  }
+      }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/MethodKey.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/MethodKey.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/MethodKey.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+package org.apache.ws.jaxme.js.pattern;
+
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.Parameter;
+
+
+/** This class is a key for generated methods. The main
+ * purpose is to determine, whether some method is
+ * present in more than one interface. In that case
+ * we have to ensure, that it is generated only once.
+ */
+public class MethodKey implements Comparable {
+	private JavaMethod method;
+
+	/** Creates a new instance of {@link MethodKey}.
+     */
+    public MethodKey(JavaMethod pMethod) {
+    	method = pMethod;
+    }
+
+    /** <p>Returns whether this method key equals the object <code>o</code>.
+     * This is the case, if <code>o != null</code>,
+     * <code>o instanceof MethodKey</code>,
+     * and <code>compareTo(o) == 0</code>.</p>
+     */
+    public boolean equals(Object o) {
+    	if (o == null  ||  !(o instanceof MethodKey)) { return false; }
+    	return compareTo(o) == 0;
+    }
+    
+    /** <p>Compares this GeneratedMethod to the given GeneratedMethod <code>o</code>.
+     * More precise, compares the method name, the number of parameters
+     * and the class names of the parameters, in that order.</p>
+     * @throws ClassCastException The object o is not an instance of MethodKey.
+     */
+    public int compareTo(Object o) {
+    	MethodKey other = (MethodKey) o;
+    	int result = method.getName().compareTo(other.method.getName());
+    	if (result != 0) {
+    		return result;
+    	}
+    	Parameter[] params = method.getParams();
+    	Parameter[] oparams = other.method.getParams();
+    	result = params.length - oparams.length;
+    	if (result != 0) {
+    		return result;
+    	}
+    	for (int i = 0;  i < params.length;  i++) {
+    		result = params[i].getType().toString().compareTo(oparams[i].getType().toString());
+    		if (result != 0) {
+    			return result;
+    		}
+    	}
+    	return 0;
+    }
+    public int hashCode() {
+    	int result = method.getName().hashCode();
+    	Parameter[] params = method.getParams();
+    	result += params.length;
+    	for (int i = 0;  i < params.length;  i++) {
+    		result += params[i].getType().toString().hashCode();
+    	}
+    	return result;
+    }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ProxyGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ProxyGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ProxyGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.pattern;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.Parameter;
+
+
+/** <p>This class is a generator for the proxy object pattern. A proxy
+ * object performs the same task as an object created by the
+ * {@link java.lang.reflect.Proxy} class: It delegates its method
+ * calls to an internal instance.</p>
+ * <p>In the case of {@link java.lang.reflect.Proxy} this works by
+ * invoking a so-called {@link java.lang.reflect.InvocationHandler}.
+ * The InvocationHandler calls the actual object via Java reflection.</p>
+ * <p>In our case, the proxy object is an instance of a generated
+ * class. The main advantage of the generated approach is that you
+ * can customize the proxy class quite easily by overwriting it.
+ * Compared to the creation of an InvocationHandler, this saves a
+ * lot of hazzle.</p>
+ */
+public class ProxyGenerator {
+    private JavaQName extendedClass;
+
+	/** <p>Returns the class extended by the generated proxy class.
+	 * Defaults to {@link java.lang.Object}.</p>
+	 */
+	public JavaQName getExtendedClass() {
+		return extendedClass;
+	}
+
+	/** <p>Sets the class extended by the generated proxy class.
+	 * Defaults to {@link java.lang.Object}.</p>
+	 */
+	public void setExtendedClass(JavaQName pExtendedClass) {
+		extendedClass = pExtendedClass;
+	}
+
+	/** <p>Generated an instance of {@link JavaMethod} for the given
+	 * {@link JavaMethod}.</p>
+	 */
+	protected JavaMethod getInterfaceMethod(JavaSource pJs,
+											JavaMethod pMethod) {
+		JavaMethod jm = pJs.newJavaMethod(pMethod);
+		Parameter[] parameters = jm.getParams();
+		List callParameters = new ArrayList();
+		for (int i = 0;  i < parameters.length;  i++) {
+			Parameter parameter = parameters[i];
+			if (callParameters.size() > 0) {
+				callParameters.add(", "); 
+			}
+			callParameters.add(parameter.getName());
+		}
+        if (pMethod.getType().equals(JavaQNameImpl.VOID)) {
+        	jm.addLine("((", pMethod.getJavaSource().getQName(), ") backingObject).",
+        			   pMethod.getName(), "(", callParameters, ");");
+        } else {
+            jm.addLine("return ",
+            		   "((", pMethod.getJavaSource().getQName(), ") backingObject).",
+					   pMethod.getName(), "(", callParameters, ");");
+        }
+		return jm;
+	}
+
+	/** <p>Generates the methods for a given interface.</p>
+	 *
+	 * @param pJs The Java class being generated
+	 * @param pGeneratedMethods A set of already generated methods; each entry in the
+	 *    set is an instance of {@link MethodKey}. The method creates a new instance
+	 *    of {@link MethodKey} and adds it to the set. A warning is written to
+	 *    {@link System#err}, if the method isn't unique.
+	 * @throws ClassNotFoundException
+	 */
+	protected void generateInterfaceMethods(JavaSource pJs, Map pGeneratedMethods,
+			                                JavaSource pInterface)
+	        throws ClassNotFoundException {
+        JavaMethod[] methods = pInterface.getMethods();
+		for (int i = 0;  i < methods.length;  i++) {
+			JavaMethod method = methods[i];
+            if (method.isStatic()) {
+            	continue;
+            }
+            if (!JavaSource.PUBLIC.equals(method.getProtection())) {
+            	continue;
+            }
+			MethodKey key = new MethodKey(method);
+			JavaMethod existingMethod = (JavaMethod) pGeneratedMethods.get(key);
+			if (existingMethod == null) {
+                JavaMethod generatedMethod = getInterfaceMethod(pJs, method);
+                pGeneratedMethods.put(key, generatedMethod);
+			} else {
+                System.err.println("The methods "
+                        + existingMethod.getJavaSource().getQName()
+                        + "." + existingMethod.getName() + " and "
+                        + pInterface.getQName() + "."
+                        + method.getName() + " are identical, ignoring the latter.");
+			}
+		}
+	}
+
+	/** <p>Creates a constructor with protected access and a single argument,
+	 * the backing object.</p>
+	 */
+	protected JavaConstructor getConstructor(JavaSource pJs,
+			                                 InterfaceDescription[] pInterfaces)
+            throws Exception{
+		JavaConstructor jcon = pJs.newJavaConstructor(JavaSource.PROTECTED);
+		jcon.addParam(Object.class, "o");
+		jcon.addIf("o == null");
+		jcon.addThrowNew(NullPointerException.class,
+				         JavaSource.getQuoted("The supplied object must not be null."));
+		jcon.addEndIf();
+		for (int i = 0;  i < pInterfaces.length;  i++) {
+			if (pInterfaces[i].isMandatory()) {
+                JavaSource js = pInterfaces[i].getJavaSource();
+				jcon.addIf("!(o instanceof ", js.getQName(), ")");
+				jcon.addThrowNew(ClassCastException.class,
+						         JavaSource.getQuoted("The supplied instance of "),
+								 " + o.getClass().getName() + ",
+								 JavaSource.getQuoted(" is not implementing "),
+								 " + ", js.getQName(), ".class.getName()");
+				jcon.addEndIf();
+			}
+		}
+		jcon.addLine("backingObject = o;");
+		return jcon;
+	}
+
+	/** <p>Creates the class.</p>
+	 */
+	protected JavaSource getJavaSource(JavaSourceFactory pFactory, JavaQName pTargetName) {
+		return pFactory.newJavaSource(pTargetName, JavaSource.PUBLIC);
+	}
+
+	/** <p>Generates the <code>backingObject</code> field.</p>
+	 */
+	protected JavaField getBackingObjectField(JavaSource pJs, InterfaceDescription[] pInterfaces) {
+		return pJs.newJavaField("backingObject", Object.class, JavaSource.PRIVATE);
+	}
+
+	/** <p>Generates a class implementing the given interfaces.</p>
+	 * @param pFactory The ProxyGenerator will use this factory for creating
+	 *    instances of JavaSource.
+	 * @param pTargetName Name of the generated class
+	 * @param pInterfaces The interfaces being implemented by the generated class.
+	 * @throws ClassNotFoundException
+	 */
+	public JavaSource generate(JavaSourceFactory pFactory, JavaQName pTargetName,
+			                   InterfaceDescription[] pInterfaces)
+            throws Exception {
+		JavaSource js = getJavaSource(pFactory, pTargetName);
+		if (getExtendedClass() != null) {
+			js.addExtends(getExtendedClass());
+		}
+		for (int i = 0;  i < pInterfaces.length;  i++) {
+            JavaQName qName = pInterfaces[i].getJavaSource().getQName();
+			js.addImplements(qName);
+		}
+
+		getBackingObjectField(js, pInterfaces);
+		getConstructor(js, pInterfaces);
+
+		Map methods = new HashMap();
+		for (int i = 0;  i < pInterfaces.length;  i++) {
+			generateInterfaceMethods(js, methods, pInterfaces[i].getJavaSource());
+		}
+
+		return js;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Reflector.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Reflector.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/Reflector.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,14 @@
+package org.apache.ws.jaxme.js.pattern;
+
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+
+
+/** The <code>Reflector</code> obtains informations on a certain
+ * class by converting it into an instance of {@link JavaSource}.
+ */
+public interface Reflector {
+	/** Returns the converted information.
+	 */
+    public JavaSource getJavaSource(JavaSourceFactory pFactory) throws Exception;
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/SourceReflector.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/SourceReflector.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/SourceReflector.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+package org.apache.ws.jaxme.js.pattern;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.util.JavaParser;
+
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+
+/** Reflector for gathering information about a Java
+ * source file.
+ */
+public class SourceReflector implements Reflector {
+    private final File file;
+    private final URL url;
+
+	/** Creates a new <code>SourceReflector</code>, which
+     * is going to read the Java source file <code>pFile</code>.
+	 */
+	public SourceReflector(File pFile) {
+		file = pFile;
+        url = null;
+	}
+
+    /** Creates a new <code>SourceReflector</code>, which
+     * is going to read the Java source file from <code>pURL</code>.
+     */
+	public SourceReflector(URL pURL) {
+		file = null;
+        url = pURL;
+	}
+
+	public JavaSource getJavaSource(final JavaSourceFactory pFactory)
+            throws RecognitionException, TokenStreamException, IOException {
+        List result;
+        if (file == null) {
+            InputStream istream = null;
+            try {
+                istream = url.openStream();
+                Reader r = new InputStreamReader(istream);
+                result = new JavaParser(pFactory).parse(r);
+                istream.close();
+                istream = null;
+            } finally {
+                if (istream != null) { try { istream.close(); } catch (Throwable ignore) {} }
+            }
+        } else {
+            Reader r = null;
+            try {
+                r = new FileReader(file);
+                result = new JavaParser(pFactory).parse(r);
+                r.close();
+                r = null;
+            } finally {
+                if (r != null) { try { r.close(); } catch (Throwable ignore) {} }
+            }
+        }
+        if (result.size() > 1) {
+            throw new RecognitionException("The Java source file contained multiple classes.");
+        }
+        if (result.size() > 1) {
+        	throw new RecognitionException("The Java source file contained multiple classes.");
+        }
+        return (JavaSource) result.get(0);
+	}
+
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/TypesafeEnumerationGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/TypesafeEnumerationGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/TypesafeEnumerationGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.pattern;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.Util;
+
+/** <p>This class is a generator for the typesafe enumeration
+ * pattern. It creates a class that contains only a few,
+ * specified instances. Other instances cannot be created.</p>
+ * <p>Any instance has a name and a value. The name
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: TypesafeEnumerationGenerator.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class TypesafeEnumerationGenerator {
+  public static class Item {
+    private String name;
+	 private String value;
+
+	 /** <p>Sets the enumeration items name. This must be a valid
+	  * Java identifier.</p>
+	  */
+	 public void setName(String pName) {
+		if (pName != null) {
+		  Util.checkJavaIdentifier(pName);
+		}
+		name = pName;
+	 }
+
+	 /** <p>Returns the enumeration items name.</p>
+	  */
+	 public String getName() {
+		return name;
+	 }
+
+	 /** <p>Sets the enumeration items value.</p>
+	  */
+	 public void setValue(String pValue) {
+		value = pValue;
+	 }
+
+	 /** <p>Returns the enumeration items value.</p>
+	  */
+	 public String getValue() {
+		return value;
+	 }
+
+	 /** <p>Verifies the enumeration item.</p>
+	  * @throws IllegalStateException The enumeration items value is not set.
+	  */
+	 public void finish() {
+		if (getValue() == null) {
+		  throw new IllegalStateException("The enumeration items 'value' attribute is not set.");
+		}
+		if (getName() == null) {
+		  try {
+			 Util.asJavaIdentifier(getValue().toUpperCase());
+		  } catch (Exception e) {
+			 throw new IllegalStateException("The enumeration items 'name' attribute is not set " +
+					                            " and the value " + getValue() +
+					                            " cannot be converted into a valid Java identifier.");
+		  }
+		}
+	 }
+  }
+
+  private boolean isAddingEquals = true;
+
+  /** <p>Sets whether the generator should add implementations for the methods
+	* {@link Object#equals(java.lang.Object)} and {@link Object#hashCode()}
+	* or not. Defaults to true.</p>
+	*/
+  public void setAddingEquals(boolean pAddingEquals) {
+	 isAddingEquals = pAddingEquals;
+  }
+
+  /** <p>Returns whether the generator should add implementations for the methods
+	* {@link Object#equals(java.lang.Object)} and {@link Object#hashCode()}
+	* or not. Defaults to true.</p>
+	*/
+  public boolean isAddingEquals() {
+  	 return isAddingEquals;
+  }
+
+  /** <p>Generates a new typesafe enumeration.</p>
+	* @param pFactory The factory to use for generating the items.
+	* @param pTargetClass Fully qualified name of the class being generated.
+	* @param pItems The enumeration items; a public, static, final instance
+	*   will be generated for any element in the array
+	*/
+  public JavaSource generate(JavaSourceFactory pFactory, JavaQName pTargetClass,
+	                           Item[] pItems) {
+	 JavaSource result = pFactory.newJavaSource(pTargetClass, JavaSource.PUBLIC);
+    doGenerate(result, pItems);
+	 return result;
+  }
+
+  /** <p>Generates a new typesafe enumeration, which is an inner class of
+	* the class <code>pSource</code>.</p>
+	* @param pSource The class, which shall have an inner class
+	* @param pName Name of the inner class
+	* @param pItems The enumeration items; a public, static, final instance
+	*   will be generated for any element in the array
+	*/
+  public JavaInnerClass generate(JavaSource pSource, String pName, Item[] pItems) {
+	 JavaInnerClass result = pSource.newJavaInnerClass(pName, JavaSource.PUBLIC);
+	 result.setStatic(true);
+	 doGenerate(result, pItems);
+	 return result;
+  }
+
+  /** <p>Does the actual generation, invoked by the <code>generate()</code>
+	* frontends.</p>
+	*/
+  private void doGenerate(JavaSource pSource, Item[] pItems) {
+	 Set names = new HashSet();
+	 Set values = new HashSet();
+	 for (int i = 0;  i < pItems.length;  i++) {
+		String itemName = pItems[i].getName();
+		String itemValue = pItems[i].getValue();
+		if (itemName == null) {
+		  itemName = Util.asJavaIdentifier(itemValue.toUpperCase());
+		  pItems[i].setName(itemName);
+		}
+		if (names.contains(itemName)) {
+		  throw new IllegalStateException("The item name " + itemName + " is not unique.");
+		}
+		if (values.contains(itemValue)) {
+		  throw new IllegalStateException("The item value " + itemValue + " is not unique.");
+		}
+		names.add(itemName);
+		names.add(itemValue);
+	 }
+
+	 pSource.addImplements(Serializable.class);
+	 JavaField name = pSource.newJavaField("name", String.class, JavaSource.PRIVATE);
+	 name.setFinal(true);
+	 JavaField value = pSource.newJavaField("value", String.class, JavaSource.PRIVATE);
+	 name.setFinal(true);
+	 JavaConstructor jcon = pSource.newJavaConstructor(JavaSource.PRIVATE);
+	 jcon.addParam(String.class, "pName");
+	 jcon.addParam(String.class, "pValue");
+	 jcon.addLine("name = pName;");
+	 jcon.addLine("value = pValue;");
+    List instanceList = new ArrayList();
+	 for (int i = 0;  i < pItems.length;  i++) {
+      Item item = pItems[i];
+		String itemName = item.getName();
+		String itemValue = item.getValue();
+		JavaField instance = pSource.newJavaField(itemName, pSource.getQName(),
+			                                       JavaSource.PUBLIC);
+		instance.newComment().addLine("The enumeration item with name " + itemName +
+			                           " and value " + itemValue + ".");
+		instance.setStatic(true);
+		instance.setFinal(true);
+		instance.addLine("new ", pSource.getQName(), "(", JavaSource.getQuoted(itemName),
+		                 ", ", JavaSource.getQuoted(itemValue), ")");
+
+		if (i > 0) instanceList.add(", ");
+	   instanceList.add(instance);
+    }
+
+	 JavaQName arrayType = JavaQNameImpl.getArray(pSource.getQName());
+	 JavaField allInstances = pSource.newJavaField("allInstances", arrayType,
+		                                              JavaSource.PRIVATE);
+	 allInstances.setStatic(true);
+	 allInstances.setFinal(true);
+	 allInstances.addLine("new ", arrayType, "{", instanceList, "}");
+
+	 JavaMethod getName = pSource.newJavaMethod("getName", String.class,
+		                                           JavaSource.PUBLIC);
+	 getName.newComment().addLine("The enumeration items name.");
+	 getName.addLine("return ", name, ";");
+
+	 JavaMethod getValue = pSource.newJavaMethod("getValue", String.class,
+	                                            JavaSource.PUBLIC);
+	 getValue.newComment().addLine("The enumeration items value.");
+	 getValue.addLine("return ", value, ";");
+
+	 JavaMethod getInstances = pSource.newJavaMethod("getInstances", arrayType,
+		                                              JavaSource.PUBLIC);
+	 getInstances.setStatic(true);
+	 getInstances.addLine("return ", allInstances, ";");
+
+	 JavaMethod getInstanceByName = pSource.newJavaMethod("getInstanceByName",
+		                                                   pSource.getQName(),
+		                                                   JavaSource.PUBLIC);
+    getInstanceByName.setStatic(true);
+	 getInstanceByName.addParam(String.class, "pName");
+	 JavaComment jc = getInstanceByName.newComment();
+	 jc.addLine("Returns the item with the given name.</p>");
+	 jc.addThrows(IllegalArgumentException.class.getName() +
+		           " The name <code>pName</code> is invalid and no such item exists.");
+	 getInstanceByName.addLine(String.class, " s = pName.intern();");
+	 boolean first = true;
+	 for (int i = 0;  i < pItems.length;  i++) {
+		Item item = pItems[i];
+		Object[] args = new Object[]{JavaSource.getQuoted(item.getName()), " == s"};
+	 	getInstanceByName.addIf(first, args);
+	 	getInstanceByName.addLine("return ", item.getName(), ";");
+	 	first = false;
+	 }
+	 getInstanceByName.addElse();
+	 getInstanceByName.addLine("throw new ", IllegalArgumentException.class, "(",
+	                           JavaSource.getQuoted("Invalid name: "),
+                              " + pName);");
+	 getInstanceByName.addEndIf();
+
+	 JavaMethod getInstanceByValue = pSource.newJavaMethod("getInstanceByValue",
+																			 pSource.getQName(),
+																			 JavaSource.PUBLIC);
+	 getInstanceByValue.setStatic(true);
+	 getInstanceByValue.addParam(String.class, "pValue");
+	 jc = getInstanceByValue.newComment();
+	 jc.addLine("Returns the item with the given value.</p>");
+	 jc.addThrows(IllegalArgumentException.class.getName() +
+					  " The name <code>pValue</code> is invalid and no such item exists.");
+	 getInstanceByValue.addLine(String.class, " s = pValue.intern();");
+	 first = true;
+	 for (int i = 0;  i < pItems.length;  i++) {
+		Item item = pItems[i];
+		Object[] args = new Object[]{JavaSource.getQuoted(item.getValue()), " == s"};
+		getInstanceByValue.addIf(first, args);
+		getInstanceByValue.addLine("return ", item.getName(), ";");
+		first = false;
+	 }
+	 getInstanceByValue.addElse();
+	 getInstanceByValue.addLine("throw new ", IllegalArgumentException.class, "(",
+									    JavaSource.getQuoted("Invalid name: "),
+									    " + pValue);");
+	 getInstanceByValue.addEndIf();
+
+	 if (isAddingEquals()) {
+	 	JavaMethod equals = pSource.newJavaMethod("equals", JavaQNameImpl.BOOLEAN,
+	 	                                          JavaSource.PUBLIC);
+	 	equals.addParam(Object.class, "o");
+	 	equals.addIf("o == null  ||  !(o instanceof ", pSource.getQName(), ")");
+	 	equals.addLine("return false;");
+	 	equals.addEndIf();
+	 	equals.addLine("return name.equals(((", pSource.getQName(), ") o).name);");
+
+      JavaMethod hashCode = pSource.newJavaMethod("hashCode", JavaQNameImpl.INT,
+                                                  JavaSource.PUBLIC);
+      hashCode.addLine("return name.hashCode();");
+	 }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/VersionGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/VersionGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/VersionGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1013 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.pattern;
+
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaComment;
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnSet;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>The VersionGenerator is able to clone a version of a row
+ * in a database. That is nothing special. A simple INSERT does
+ * the same.</p>
+ * <p>The difference is that the VersionGenerator is able to
+ * clone rows in other tables referencing the cloned table
+ * as well, updating the references, and clone and update rows
+ * referencing these cloned and updated rows, and so on.</p>
+ * <p>In other words: The VersionGenerator derives a new
+ * version of a complex object stored in the database.</p>
+ * <p>The VersionGenerator operates on a list of tables. This
+ * list must not contain forward or self references. In other
+ * words: Under no circumstances may a table in the list contain
+ * a foreign key referencing another table, which follows later.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class VersionGenerator {
+	/** <p>The ColumnUpdater is able to update one or more columns in a
+	 * table. Such a column update is required, because the cloned tables
+	 * must not have the same primary key.</p>
+	 * <p>The typical use is to specify a ColumnUpdater for the head
+	 * table, which bumps the version number. For any child table
+	 * you could specify a ColumnUpdater which generates a new primary
+	 * key.</p>
+	 */
+	public interface ColumnUpdater {
+		/** <p>Generates code for updating a table row. The row is supplied
+		 * as an array of objects. The order of objects matches the columns
+		 * of the given table.</p>
+		 * @param pMethod The method being created; may be used to generate
+		 *   local fields, etc.
+		 * @param pTableInfo The table being updated
+		 * @param pMap A local Java field with a Map of rows, that have already
+		 *   been cloned. The keys and values are both instances of the generated
+		 *   inner class DataCache. The keys are holding the primary keys of
+		 *   the original rows (which have been cloned) and the values are the
+		 *   primary keys of the created rows (the generated clones).
+		 * @param pConnection A local Java field with an open database connection
+		 * @param pRow A local Java field with an array of values being cloned
+		 */
+		public void update(JavaMethod pMethod, TableInfo pTableInfo,
+						   DirectAccessible pConnection,
+						   DirectAccessible pMap,
+						   DirectAccessible pRow);
+	}
+	
+	/** <p>This class is used internally to maintain the informations on
+	 * the tables being cloned.</p>
+	 */
+	public static class TableInfo {
+		private final Table table;
+		private final String propertyName;
+		private boolean isReferenced;
+		private boolean hasPrimaryKey;
+		private final List columnUpdaters = new ArrayList();
+		TableInfo(Table pTable, String pPropertyName) {
+			table = pTable;
+			propertyName = pPropertyName;
+		}
+		public Table getTable() { return table; }
+		public String getPropertyName() { return propertyName; }
+		public void add(ColumnUpdater pColumnUpdater) {
+			columnUpdaters.add(pColumnUpdater);
+		}
+		public Iterator getColumnUpdaters() { return columnUpdaters.iterator(); }
+		
+		public void setReferenced(boolean pReferenced) {
+			isReferenced = true;
+		}
+		public boolean isReferenced() {
+			return isReferenced;
+		}
+		public boolean hasPrimaryKey() {
+			return hasPrimaryKey;
+		}
+		public void setPrimaryKey(boolean pPrimaryKey) {
+			hasPrimaryKey  = pPrimaryKey;
+		}
+	}
+	
+	/** <p>An implementation of {@link ColumnUpdater}, which updates foreign
+	 * key references.</p>
+	 */
+	private class ForeignKeyUpdater implements ColumnUpdater {
+		private final ForeignKey foreignKey;
+		private final TableInfo referencedTable;
+		
+		private ForeignKeyUpdater(ForeignKey pForeignKey, TableInfo pReferencedTable) {
+			foreignKey = pForeignKey;
+			referencedTable = pReferencedTable;
+		}
+		
+		public void update(JavaMethod pMethod, TableInfo pTableInfo,
+						   DirectAccessible pConnection,
+						   DirectAccessible pMap, DirectAccessible pRow) {
+			Table table = foreignKey.getTable();
+			List params = new ArrayList();
+			for (Iterator iter = foreignKey.getColumns();  iter.hasNext();  ) {
+				Column primaryKeyColumn = (Column) iter.next();
+				int index = -1;
+				int i = 0;
+				for (Iterator iter2 = table.getColumns();  iter2.hasNext();  ++i) {
+					Column tableColumn = (Column) iter2.next();
+					if (tableColumn.equals(primaryKeyColumn)) {
+						index = i;
+						break; 
+					}
+				}
+				if (index == -1) {
+					throw new IllegalStateException("Key column " + primaryKeyColumn.getQName() + " not found.");
+				}
+				if (params.size() > 0) {
+					params.add("  ||  ");
+				}
+				params.add(new Object[]{pRow, "[" + index + "] != null"});
+			}
+
+			pMethod.addIf(params);
+			LocalJavaField referencedKey = getCacheDataClassInstance(pMethod,
+																	 referencedTable,
+																	 foreignKey, pRow);
+			LocalJavaField mappedKey = pMethod.newJavaField(referencedKey.getType());
+			mappedKey.addLine("(", referencedKey.getType(), ") ", pMap, ".get(",
+					referencedKey, ")");
+			pMethod.addIf(mappedKey, " == null");
+			pMethod.addThrowNew(IllegalStateException.class,
+					JavaSource.getQuoted("Unknown reference: "), " + ",
+					referencedKey);
+			pMethod.addEndIf();
+			int valNum = 0;
+			for (Iterator iter = referencedTable.getTable().getPrimaryKey().getColumns();  iter.hasNext();  ) {
+				Column referencedKeyColumn = (Column) iter.next();
+				Column localColumn = null;
+				for (Iterator iter2 = foreignKey.getColumnLinks();  iter2.hasNext();  ) {
+					ForeignKey.ColumnLink link = (ForeignKey.ColumnLink) iter2.next();
+					if (link.getReferencedColumn().equals(referencedKeyColumn)) {
+						localColumn = link.getLocalColumn();
+						break;
+					}
+				}
+				if (localColumn == null) {
+					throw new IllegalStateException("Unable to find the column referencing " + referencedKeyColumn.getQName());
+				}
+				
+				int colNum = -1, i = 0;
+				for (Iterator iter2 = pTableInfo.getTable().getColumns();  iter2.hasNext();  ) {
+					Column col = (Column) iter2.next();
+					if (col.equals(localColumn)) {
+						colNum = i;
+						break;
+					}
+					++i;
+				}
+				if (colNum == -1) {
+					throw new IllegalStateException("Unable to find the column " + localColumn.getQName() + " in table " + pTableInfo.getTable().getQName());
+				}
+				pMethod.addLine(pRow, "[" + colNum + "] = ", mappedKey, ".getValues()[" + valNum++ + "];");
+			}
+
+			pMethod.addEndIf();
+		}
+	}
+	
+	private List tablesByOrder = new ArrayList();
+	private Map tablesByName = new HashMap();
+	private Set propertyNames = new HashSet();
+	private boolean generatingLogging;
+	
+	private boolean isReferencing(Table pReferencingTable, Table pReferencedTable) {
+		for (Iterator iter = pReferencingTable.getForeignKeys();  iter.hasNext();  ) {
+			ForeignKey foreignKey = (ForeignKey) iter.next();
+			if (foreignKey.getReferencedTable().equals(pReferencedTable)) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	/** <p>Returns whether the generator is creating logging statements. By default
+	 * no logging statements are created.</p>
+	 * <p>The default
+	 * implementation creates logging statements suitable for the JaxMe logging
+	 * package. To change this, create a subclass and overwrite the following
+	 * methods: {@link #logEntering(JavaMethod, Object)},
+	 * {@link #logExiting(JavaMethod, Object)}, {@link #logFinest(JavaMethod, Object, Object)},
+	 * {@link #logFinestEntering(JavaMethod, Object)}, and
+	 * {@link #logFinestExiting(JavaMethod, Object)}.</p>
+	 * @see #setGeneratingLogging(boolean)
+	 */
+	public boolean isGeneratingLogging() {
+		return generatingLogging;
+	}
+	
+	/** <p>Sets whether the generator is creating logging statements. By default
+	 * no logging statements are created.</p>
+	 * <p>The default
+	 * implementation creates logging statements suitable for the JaxMe logging
+	 * package. To change this, create a subclass and overwrite the following
+	 * methods: {@link #logEntering(JavaMethod, Object)},
+	 * {@link #logExiting(JavaMethod, Object)}, {@link #logFinest(JavaMethod, Object, Object)},
+	 * {@link #logFinestEntering(JavaMethod, Object)}, and
+	 * {@link #logFinestExiting(JavaMethod, Object)}.</p>
+	 * @see #isGeneratingLogging()
+	 */
+	public void setGeneratingLogging(boolean pGeneratingLogging) {
+		generatingLogging = pGeneratingLogging;
+	}
+	
+	/** <p>Creates the code for initialization of the logging framework.
+	 * The default implementation generates code creating an instance of
+	 * {@link org.apache.ws.jaxme.logging.Logger}.</p>
+	 */
+	protected void initLogging(JavaSource pSource) {
+		if (isGeneratingLogging()) {
+			JavaField jf = pSource.newJavaField("logger", Logger.class, JavaSource.PRIVATE);
+			jf.setFinal(true);
+			jf.setStatic(true);
+			jf.addLine(LoggerAccess.class, ".getLogger(", pSource.getQName(), ".class)");
+		}
+	}
+	
+	/** <p>Creates code for logging the entrance into a method with
+	 * fine level.</p>
+	 * <p><em>Note:</em> The method should consider the {@link #isGeneratingLogging()}
+	 * value.</p>
+	 *
+	 * @param pMethod The method in which a logging statement should be inserted
+	 * @param pValues An array of additional values, possibly null
+	 */
+	protected void logEntering(JavaMethod pMethod, Object pValues) {
+		if (isGeneratingLogging()) {
+			LocalJavaField mName = pMethod.newJavaField(String.class, "mName");
+			mName.addLine(JavaSource.getQuoted(pMethod.getLoggingSignature()));
+			mName.setFinal(true);
+			if (pValues == null) {
+				pMethod.addLine("logger.entering(", mName, ");");
+			} else {
+				pMethod.addLine("logger.entering(", mName, ", ", pValues, ");");         
+			}
+		}
+	}
+	
+	/** <p>Creates code for logging the entrance into a method with
+	 * finest level.</p>
+	 * <p><em>Note:</em> The method should consider the {@link #isGeneratingLogging()}
+	 * value.</p>
+	 * <p><em>Implementation note:</em> The default implementation is
+	 * equivalent to <code>logFinest(pMethod, "->", pValues)</code>.</p>
+	 *
+	 * @param pMethod The method in which a logging statement should be inserted
+	 * @param pValues An array of additional values, possibly null
+	 */
+	protected void logFinestEntering(JavaMethod pMethod, Object pValues) {
+		if (isGeneratingLogging()) {
+			LocalJavaField mName = pMethod.newJavaField(String.class, "mName");
+			mName.addLine(JavaSource.getQuoted(pMethod.getLoggingSignature()));
+			mName.setFinal(true);
+			logFinest(pMethod, JavaSource.getQuoted("->"), pValues);
+		}
+	}
+	
+	/** <p>Creates code for logging the exit from a method with
+	 * fine level.</p>
+	 * <p><em>Note:</em> The method should consider the {@link #isGeneratingLogging()}
+	 * value.</p>
+	 *
+	 * @param pMethod The method in which a logging statement should be inserted
+	 * @param pValues An array of additional values, possibly null
+	 */
+	protected void logExiting(JavaMethod pMethod, Object pValues) {
+		if (isGeneratingLogging()) {
+			if (pValues == null) {
+				pMethod.addLine("logger.exiting(mName);");
+			} else {
+				pMethod.addLine("logger.exiting(mName, ", pValues, ");");        
+			}
+		}
+	}
+	
+	/** <p>Creates code for logging the exit from a method with
+	 * fine level.</p>
+	 * <p><em>Note:</em> The method should consider the {@link #isGeneratingLogging()}
+	 * value.</p>
+	 * <p><em>Implementation note:</em> The default implementation is
+	 * equivalent to <code>logFinest(pMethod, "<-", pValues)</code>.</p>
+	 *
+	 * @param pMethod The method in which a logging statement should be inserted
+	 * @param pValues An array of additional values, possibly null
+	 */
+	protected void logFinestExiting(JavaMethod pMethod, Object pValues) {
+		logFinest(pMethod, JavaSource.getQuoted("->"), pValues);
+	}
+	
+	/** <p>Creates code for logging a message with finest level.</p>
+	 * <p><em>Note:</em> The method should consider the {@link #isGeneratingLogging()}
+	 * value.</p>
+	 *
+	 * @param pMethod The method in which a logging statement should be inserted
+	 * @param pMsg The message being logged
+	 * @param pValues An array of additional values, possibly null
+	 */
+	protected void logFinest(JavaMethod pMethod, Object pMsg, Object pValues) {
+		if (isGeneratingLogging()) {
+			if (pValues == null) {
+				pMethod.addLine("logger.finest(mName, ", pMsg, ");");
+			} else {
+				pMethod.addLine("logger.finest(mName, ", pMsg, ", ", pValues, ");");
+			}
+		}
+	}
+	
+	/** Adds a new table to the list of tables. The table must not
+	 * contain a forward reference. Additionally, the table must not
+	 * be referenced by any other table, which has already been added
+	 * to the list.</p>
+	 * @param pTable The table being cloned
+	 * @param pUpdater The column updater to use for changing the
+	 *   updated columns.
+	 */
+	public void addTable(Table pTable, ColumnUpdater pUpdater) {
+		String name = pTable.getQName();
+		if (tablesByName.containsKey(pTable)) {
+			throw new IllegalStateException("A table " + name + " has already been added.");
+		}
+		if (isReferencing(pTable, pTable)) {
+			throw new IllegalStateException("The table " + name + " is containing self references.");
+		}
+		for (Iterator iter = tablesByOrder.iterator();  iter.hasNext();  ) {
+			TableInfo tableInfo = (TableInfo) iter.next();
+			if (isReferencing(tableInfo.getTable(), pTable)) {
+				throw new IllegalStateException("The table " + tableInfo.getTable().getQName() +
+						" contains a forward reference to the table " + name + ".");
+			}
+		}
+		
+		String s = pTable.getName().getName();
+		String t = s;
+		int num = 0;
+		for (;;) {
+			t = Character.toUpperCase(t.charAt(0)) + t.substring(1);
+			if (!propertyNames.contains(t)) {
+				break;
+			}
+			t = s + num++;
+		}
+		propertyNames.add(t);
+		
+		TableInfo tableInfo = new TableInfo(pTable, t);
+		tableInfo.setPrimaryKey(pTable.getPrimaryKey() != null);
+		if (pUpdater != null) {
+			tableInfo.add(pUpdater);
+		}
+		
+		for (Iterator iter = pTable.getForeignKeys();  iter.hasNext();  ) {
+			ForeignKey foreignKey = (ForeignKey) iter.next();
+			Table referencedTable = foreignKey.getReferencedTable();
+			for (Iterator iter2 = tablesByOrder.iterator();  iter2.hasNext();  ) {
+				TableInfo referencedTableInfo = (TableInfo) iter2.next();
+				if (referencedTableInfo.getTable().equals(referencedTable)) {
+					ColumnUpdater columnUpdater = new ForeignKeyUpdater(foreignKey, referencedTableInfo);
+					tableInfo.add(columnUpdater);
+					if (!referencedTableInfo.hasPrimaryKey()) {
+						throw new IllegalStateException("The table " + pTable.getQName() +
+								" is referencing table " + referencedTable.getQName() +
+						", which doesn't have a primary key.");
+					}
+					referencedTableInfo.setReferenced(true);
+				}
+			}
+		}
+		
+		tablesByName.put(name, tableInfo);
+		tablesByOrder.add(tableInfo);
+	}
+	
+	/** <p>Returns the name of the inner class CacheData.</p>
+	 */
+	protected JavaQName getCacheDataClassName(JavaQName pQName) {
+		return JavaQNameImpl.getInnerInstance(pQName, "CacheData");
+	}
+	
+	/** <p>Generates the innner class CacheData.</p>
+	 */
+	protected JavaInnerClass getCacheDataClass(JavaSource pSource) {
+		JavaInnerClass jic = pSource.newJavaInnerClass("CacheData", JavaSource.PRIVATE);
+		
+		JavaField name = jic.newJavaField("name", String.class, JavaSource.PRIVATE);
+		name.setFinal(true);
+		JavaField values = jic.newJavaField("values", Object[].class, JavaSource.PRIVATE);
+		values.setFinal(true);
+		
+		JavaConstructor jcon = jic.newJavaConstructor(JavaSource.PRIVATE);
+		DirectAccessible pName = jcon.addParam(String.class, "pName");
+		DirectAccessible pValues = jcon.addParam(Object[].class, "pValues");
+		jcon.addLine(name, " = ", pName, ";");
+		jcon.addLine(values, " = ", pValues, ";");
+		
+		JavaMethod getNameMethod = jic.newJavaMethod("getName", String.class, JavaSource.PUBLIC);
+		getNameMethod.addLine("return ", name, ";");
+		
+		JavaMethod getValuesMethod = jic.newJavaMethod("getValues", Object[].class, JavaSource.PUBLIC);
+		getValuesMethod.addLine("return ", values, ";");
+		
+		{
+			JavaMethod jm = jic.newJavaMethod("toString", String.class, JavaSource.PUBLIC);
+			LocalJavaField sb = jm.newJavaField(StringBuffer.class, "sb");
+			sb.addLine("new ", StringBuffer.class, "(", name, ")");
+			DirectAccessible loopVar = jm.addForArray(values);
+			jm.addLine(sb, ".append(", JavaSource.getQuoted(", "), ").append(",
+					values, "[", loopVar, "]);");
+			jm.addEndFor();
+			jm.addLine("return ", sb, ".toString();");
+			
+		}
+		
+		{
+			JavaMethod jm = jic.newJavaMethod("hashCode", int.class, JavaSource.PUBLIC);
+			LocalJavaField hashCodeResult = jm.newJavaField(int.class, "result");
+			hashCodeResult.addLine(name, ".hashCode() + ", values, ".length;");
+			DirectAccessible loopVar = jm.addForArray(values);
+			LocalJavaField o = jm.newJavaField(Object.class, "o");
+			o.addLine(values, "[", loopVar, "]");
+			jm.addIf(o, " != null");
+			jm.addLine(hashCodeResult, " += ", o, ".hashCode();");
+			jm.addEndIf();
+			jm.addEndFor();
+			jm.addLine("return ", hashCodeResult, ";");
+		}
+		
+		{
+			JavaMethod jm = jic.newJavaMethod("equals", boolean.class, JavaSource.PUBLIC);
+			DirectAccessible o = jm.addParam(Object.class, "o");
+			jm.addIf(o, " == null  ||  !(", o, " instanceof ", jic.getQName(), ")");
+			jm.addLine("return false;");
+			jm.addEndIf();
+			LocalJavaField other = jm.newJavaField(jic.getQName(), "other");
+			other.addLine("(", jic.getQName(), ") ", o);
+			jm.addIf("!", name, ".equals(", other, ".name)  ||  ", values, ".length != ",
+					other, ".values.length");
+			jm.addLine("return false;");
+			jm.addEndIf();
+			DirectAccessible loopVar = jm.addForArray(values);
+			LocalJavaField v = jm.newJavaField(Object.class, "v");
+			v.addLine(values, "[", loopVar, "]");
+			jm.addIf(v, " == null");
+			jm.addIf(other, ".values[", loopVar, "] != null");
+			jm.addLine("return false;");
+			jm.addEndIf();
+			jm.addElse();
+			jm.addIf("!", v, ".equals(", other, ".values[", loopVar, "])");
+			jm.addLine("return false;");
+			jm.addEndIf();
+			jm.addEndIf();
+			jm.addEndFor();
+			jm.addLine("return true;");
+		}
+		
+		return jic;
+	}
+	
+	/** <p>Generates code for reading a ResultSet's column.</p>
+	 */
+	protected void setResultSetValue(JavaMethod pMethod, Column pColumn,
+									 DirectAccessible pResultSet,
+									 int pColumnNum, Object pTarget) {
+		Integer p = new Integer(pColumnNum+1);
+		
+		Column.Type type = pColumn.getType();
+		if (Column.Type.BIGINT.equals(type)) {
+			LocalJavaField l = pMethod.newJavaField(long.class);
+			l.addLine(pResultSet, ".getLong(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = new ",
+					Long.class, "(", l, ");");
+			pMethod.addEndIf();
+		} else if (pColumn.isBinaryColumn()) {
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = ",
+					pResultSet, ".getBytes(", p, ");");
+		} else if (Column.Type.BIT.equals(type)) {
+			LocalJavaField b = pMethod.newJavaField(boolean.class);
+			b.addLine(pResultSet, ".getBoolean(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = ", b,
+					" ? ", Boolean.class, ".TRUE : ", Boolean.class, ".FALSE;");
+			pMethod.addEndIf();
+		} else if (pColumn.isStringColumn()) {
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = ",
+					pResultSet, ".getString(", p, ");");
+		} else if (Column.Type.DATE.equals(type)) {
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = ",
+					pResultSet, ".getDate(", p, ");");
+		} else if (Column.Type.DOUBLE.equals(type)) {
+			LocalJavaField d = pMethod.newJavaField(double.class);
+			d.addLine(pResultSet, ".getDouble(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = new ",
+					Double.class, "(", d, ");");
+			pMethod.addEndIf();
+		} else if (Column.Type.FLOAT.equals(type)) {
+			LocalJavaField f = pMethod.newJavaField(float.class);
+			f.addLine(pResultSet, ".getFloat(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = new ",
+					Float.class, "(", f, ");");
+			pMethod.addEndIf();
+		} else if (Column.Type.INTEGER.equals(type)) {
+			LocalJavaField i = pMethod.newJavaField(int.class);
+			i.addLine(pResultSet, ".getInt(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = new ",
+					Integer.class, "(", i, ");");
+			pMethod.addEndIf();
+		} else if (Column.Type.SMALLINT.equals(type)) {
+			LocalJavaField s = pMethod.newJavaField(short.class);
+			s.addLine(pResultSet, ".getShort(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = new ",
+					Short.class, "(", s, ");");
+			pMethod.addEndIf();
+		} else if (Column.Type.TIME.equals(type)) {
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = ",
+					pResultSet, ".getTime(", p, ");");
+		} else if (Column.Type.TIMESTAMP.equals(type)) {
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = ",
+					pResultSet, ".getTimestamp(", p, ");");
+		} else if (Column.Type.TINYINT.equals(type)) {
+			LocalJavaField b = pMethod.newJavaField(short.class);
+			b.addLine(pResultSet, ".getByte(", p, ");");
+			pMethod.addIf("!", pResultSet, ".wasNull()");
+			pMethod.addLine(pTarget, "[", Integer.toString(pColumnNum), "] = new ",
+					Byte.class, "(", b, ");");
+			pMethod.addEndIf();
+		} else {
+			throw new IllegalStateException("Unknown column type: " + type);
+		}
+	}
+	
+	/** <p>Generates code for setting a PreparedStatement's parameter.</p>
+	 */
+	protected void setPreparedStatementValue(JavaMethod pMethod, Column pColumn,
+											 Object pStmt, Object pParamNum,
+											 Object pValue) {
+		if (!(pValue instanceof DirectAccessible)) {
+			LocalJavaField v = pMethod.newJavaField(Object.class);
+			v.addLine(pValue);
+			pValue = v;
+		}
+		
+		Column.Type type = pColumn.getType();
+		pMethod.addIf(pValue, " == null");
+		pMethod.addLine(pStmt, ".setNull(", pParamNum, ", ", Types.class, ".",
+				type, ");");
+		pMethod.addElse();
+		if (Column.Type.BIGINT.equals(type)) {
+			pMethod.addLine(pStmt, ".setLong(", pParamNum, ", ((", Long.class,
+					") ", pValue, ").longValue());");
+		} else if (pColumn.isBinaryColumn()) {
+			pMethod.addLine(pStmt, ".setBytes(", pParamNum, ", (", byte[].class,
+					") ", pValue, ");");
+		} else if (Column.Type.BIT.equals(type)) {
+			pMethod.addLine(pStmt, ".setBoolean(", pParamNum, ", ((", Boolean.class,
+					") ", pValue, ").booleanValue());");
+		} else if (pColumn.isStringColumn()) {
+			pMethod.addLine(pStmt, ".setString(", pParamNum, ", (", String.class,
+					") ", pValue, ");");
+		} else if (Column.Type.DATE.equals(type)) {
+			pMethod.addLine(pStmt, ".setDate(", pParamNum, ", (", Date.class,
+					") ", pValue, ");");
+		} else if (Column.Type.DOUBLE.equals(type)) {
+			pMethod.addLine(pStmt, ".setDouble(", pParamNum, ", ((", Double.class,
+					") ", pValue, ").doubleValue());");
+		} else if (Column.Type.FLOAT.equals(type)) {
+			pMethod.addLine(pStmt, ".setFloat(", pParamNum, ", ((", Float.class,
+					") ", pValue, ").floatValue());");
+		} else if (Column.Type.INTEGER.equals(type)) {
+			pMethod.addLine(pStmt, ".setInt(", pParamNum, ", ((", Integer.class,
+					") ", pValue, ").intValue());");
+		} else if (Column.Type.SMALLINT.equals(type)) {
+			pMethod.addLine(pStmt, ".setShort(", pParamNum, ", ((", Short.class,
+					") ", pValue, ").shortValue());");
+		} else if (Column.Type.TIME.equals(type)) {
+			pMethod.addLine(pStmt, ".setTime(", pParamNum, ", (", Time.class,
+					") ", pValue, ");");
+		} else if (Column.Type.TIMESTAMP.equals(type)) {
+			pMethod.addLine(pStmt, ".setTimestamp(", pParamNum, ", (", Timestamp.class,
+					") ", pValue, ");");
+		} else if (Column.Type.TINYINT.equals(type)) {
+			pMethod.addLine(pStmt, ".setByte(", pParamNum, ", ((", Byte.class, ") ",
+					pValue, ").byteValue());");
+		} else {
+			throw new IllegalStateException("Unknown column type: " + type);
+		}
+		
+		pMethod.addEndIf();
+	}
+	
+	/** <p>Generates code for reading all rows matching the given key.</p>
+	 */
+	protected void getSelectRowsCode(JavaMethod pMethod,
+									 TableInfo pTableInfo,
+									 ColumnSet pColumnSet,
+									 DirectAccessible pConn,
+									 DirectAccessible pMap,
+									 DirectAccessible pValues,
+									 boolean pReturnValue) {
+		Table table = pTableInfo.getTable();
+		SelectStatement statement = table.getSelectStatement();
+		statement.getWhere().addColumnSetQuery(pColumnSet, statement.getTableReference());
+		String s = table.getSchema().getSQLFactory().newSQLGenerator().getQuery(statement);
+		Object query = JavaSource.getQuoted(s);
+		if (isGeneratingLogging()) {
+			LocalJavaField q = pMethod.newJavaField(String.class);
+			q.addLine(query);
+			query = q;
+			logFinest(pMethod, query, pValues);
+		}
+		
+		LocalJavaField stmt = pMethod.newJavaField(PreparedStatement.class);
+		stmt.addLine(pConn, ".prepareStatement(", JavaSource.getQuoted(s), ");");
+		LocalJavaField isStmtClosed = pMethod.newJavaField(boolean.class);
+		isStmtClosed.addLine("false");
+		pMethod.addTry();
+		
+		int paramNum = 0;
+		for (Iterator iter = pColumnSet.getColumns();  iter.hasNext();  ) {
+			Object v = new Object[]{pValues, "[", Integer.toString(paramNum), "]"};
+			Column column = (Column) iter.next();
+			setPreparedStatementValue(pMethod, column, stmt, Integer.toString(++paramNum), v);
+		}
+		LocalJavaField rs = pMethod.newJavaField(ResultSet.class, "rs");
+		rs.addLine(stmt, ".executeQuery()");
+		LocalJavaField isRsClosed = pMethod.newJavaField(boolean.class);
+		isRsClosed.addLine("false");
+		LocalJavaField result;
+		if (pReturnValue) {
+			result = pMethod.newJavaField(Object[].class, "result");
+			result.addLine("null");
+		} else {
+			result = null;
+		}
+		pMethod.addTry();
+		
+		pMethod.addWhile(rs, ".next()");
+		if (result != null) {
+			pMethod.addIf(result, " != null");
+			pMethod.addThrowNew(IllegalStateException.class,
+					JavaSource.getQuoted("Expected a single row only."));
+			pMethod.addEndIf();
+		}
+		
+		int resultColumnSize = 0;
+		for (Iterator iter = table.getColumns();  iter.hasNext();  iter.next()) {
+			++resultColumnSize;
+		}
+		LocalJavaField row = pMethod.newJavaField(Object[].class, "row");
+		row.addLine("new ", Object.class, "[" + resultColumnSize + "];");
+		
+		int resultColumnNum = 0;
+		for (Iterator iter = table.getColumns();  iter.hasNext();  ) {
+			Column column = (Column) iter.next();
+			setResultSetValue(pMethod, column, rs, resultColumnNum++, row);
+		}
+		
+		pMethod.addLine(((result == null) ? "" : "result = "),
+				getInsertRowMethodName(pTableInfo), "(", pConn, ", ", pMap, ", ",
+				row, ");");
+		
+		pMethod.addEndWhile();
+		pMethod.addLine(isRsClosed, " = true;");
+		pMethod.addLine(rs, ".close();");
+		
+		pMethod.addFinally();
+		pMethod.addIf("!", isRsClosed);
+		pMethod.addTry();
+		pMethod.addLine(rs, ".close();");
+		pMethod.addCatch(Throwable.class, "pIgnore");
+		pMethod.addEndTry();
+		pMethod.addEndIf();
+		pMethod.addEndTry();
+		
+		pMethod.addLine(isStmtClosed, " = true;");
+		pMethod.addLine(stmt, ".close();");
+		if (result != null) {
+			logExiting(pMethod, result);
+			pMethod.addLine("return ", result, ";");
+		} else {
+			logFinestExiting(pMethod, null);
+		}
+		
+		pMethod.addFinally();
+		pMethod.addIf("!", isStmtClosed);
+		pMethod.addTry();
+		pMethod.addLine(stmt, ".close();");
+		pMethod.addCatch(Throwable.class, "pIgnore");
+		pMethod.addEndTry();
+		pMethod.addEndIf();
+		pMethod.addEndTry();
+		
+	}
+	
+	/** <p>Returns the name of the method for cloning one row from the
+	 * given table.</p>
+	 */
+	protected String getInsertRowMethodName(TableInfo pTableInfo) {
+		return "clone" + pTableInfo.getPropertyName() + "Row";
+	}
+	
+	/** <p>Creates an instance of the inner class CacheData by reading
+	 * the key from the given row.</p>
+	 */
+	protected LocalJavaField getCacheDataClassInstance(JavaMethod pMethod,
+													   TableInfo pTableInfo,
+													   ColumnSet pColumnSet,
+													   DirectAccessible pValues) {
+		Table table = pColumnSet.getTable();
+		List params = new ArrayList();
+		for (Iterator iter = pColumnSet.getColumns();  iter.hasNext();  ) {
+			Column primaryKeyColumn = (Column) iter.next();
+			int index = -1;
+			int i = 0;
+			for (Iterator iter2 = table.getColumns();  iter2.hasNext();  ++i) {
+				Column tableColumn = (Column) iter2.next();
+				if (tableColumn.equals(primaryKeyColumn)) {
+					index = i;
+					break; 
+				}
+			}
+			if (index == -1) {
+				throw new IllegalStateException("Key column " + primaryKeyColumn.getQName() + " not found.");
+			}
+			if (params.size() > 0) {
+				params.add(", ");
+			}
+			params.add(new Object[]{pValues, "[" + index + "]"});
+		}
+		
+		JavaQName cacheDataClass = getCacheDataClassName(pMethod.getJavaSource().getQName());
+		LocalJavaField jf = pMethod.newJavaField(cacheDataClass);
+		jf.addLine("new ", cacheDataClass, "(",
+				   JavaSource.getQuoted(pTableInfo.getPropertyName()),
+				   ", new ", Object[].class, "{", params, "})");
+		return jf;
+	}
+
+	/** <p>Updates a row by reading the values from an instance of the inner
+	 * class CacheData.</p>
+	 */
+	protected void getApplyCacheData(JavaMethod pMethod,
+									 TableInfo pTableInfo,
+									 ColumnSet pColumnSet,
+									 DirectAccessible pRow,
+									 DirectAccessible pData) {
+		Table table = pTableInfo.getTable();
+		for (Iterator iter = pColumnSet.getColumns();  iter.hasNext();  ) {
+			Column primaryKeyColumn = (Column) iter.next();
+			int index = -1;
+			int i = 0;
+			for (Iterator iter2 = table.getColumns();  iter2.hasNext();  ++i) {
+				Column tableColumn = (Column) iter2.next();
+				if (tableColumn.equals(primaryKeyColumn)) {
+					index = i;
+					break; 
+				}
+			}
+			if (index == -1) {
+				throw new IllegalStateException("Key column " + primaryKeyColumn.getQName() + " not found.");
+			}
+			pMethod.addLine(pRow, "[" + index + "] = ", pData, "[" + (i+1) + "];");
+		}
+	}
+	
+	/** <p>Creates a method for cloning one row from the given table.</p>
+	 */
+	protected JavaMethod getInsertRowMethod(JavaSource pSource, TableInfo pTableInfo) {
+		Table table = pTableInfo.getTable();
+		JavaMethod jm = pSource.newJavaMethod(getInsertRowMethodName(pTableInfo),
+				Object[].class, JavaSource.PRIVATE);
+		jm.addThrows(SQLException.class);
+		DirectAccessible connection = jm.addParam(Connection.class, "pConn");
+		DirectAccessible map = jm.addParam(Map.class, "pMap");
+		DirectAccessible values = jm.addParam(Object[].class, "pValue");
+		
+		logFinestEntering(jm, values);
+		
+		LocalJavaField baseKey = null;
+		if (table.getPrimaryKey() != null) {
+			baseKey = getCacheDataClassInstance(jm, pTableInfo,
+					table.getPrimaryKey(), values);
+			jm.addIf(map, ".containsKey(", baseKey, ")");
+			logFinestExiting(jm, JavaSource.getQuoted("null (Already cloned)"));
+			jm.addLine("return null;");
+			jm.addEndIf();
+		}
+		
+		for (Iterator iter = pTableInfo.getColumnUpdaters();  iter.hasNext();  ) {
+			((ColumnUpdater) iter.next()).update(jm, pTableInfo, connection, map, values);
+		}
+		
+		jm.addLine(jm.getName(), "(", connection, ", ", values, ");");
+		
+		if (baseKey != null) {
+			LocalJavaField clonedKey = getCacheDataClassInstance(jm, pTableInfo,
+					table.getPrimaryKey(),
+					values);
+			jm.addLine(map, ".put(", baseKey, ", ", clonedKey, ");");
+		}
+		
+		
+		// Clone objects referencing this object
+		LocalJavaField referencedValues = null;
+		for (Iterator referencingIter = tablesByOrder.iterator();  referencingIter.hasNext();  ) {
+			TableInfo prevTableInfo = (TableInfo) referencingIter.next();
+			Table prevTable = prevTableInfo.getTable();
+			for (Iterator fkIter = prevTable.getForeignKeys();  fkIter.hasNext();  ) {
+				ForeignKey fk = (ForeignKey) fkIter.next();
+				if (fk.getReferencedTable().equals(table)) {
+					if (referencedValues == null) {
+						referencedValues = jm.newJavaField(Object[].class);
+						referencedValues.addLine(baseKey, ".getValues()");
+					}
+					getSelectRowsCode(jm, prevTableInfo, fk, connection, map, referencedValues, false);
+				}
+			}
+		}
+		
+		logFinestExiting(jm, values);
+		jm.addLine("return ", values, ";");
+		
+		return jm;
+	}
+	
+	/** <p>Creates a method for cloning one row from the given table.</p>
+	 */
+	protected JavaMethod getInnerInsertRowMethod(JavaSource pSource, TableInfo pTableInfo) {
+		Table table = pTableInfo.getTable();
+		JavaMethod jm = pSource.newJavaMethod(getInsertRowMethodName(pTableInfo),
+				JavaQNameImpl.VOID, JavaSource.PRIVATE);
+		jm.addThrows(SQLException.class);
+		DirectAccessible connection = jm.addParam(Connection.class, "pConn");
+		DirectAccessible values = jm.addParam(Object[].class, "pValue");
+		
+		logFinestEntering(jm, null);
+		
+		InsertStatement insertStatement = table.getInsertStatement();
+		String s = table.getSchema().getSQLFactory().newSQLGenerator().getQuery(insertStatement);
+		Object query = JavaSource.getQuoted(s);
+		if (isGeneratingLogging()) {
+			LocalJavaField q = jm.newJavaField(String.class);
+			q.addLine(query);
+			query = q;
+			logFinest(jm, query, values);
+		}
+		LocalJavaField stmt = jm.newJavaField(PreparedStatement.class, "stmt");
+		stmt.setFinal(true);
+		stmt.addLine(connection, ".prepareStatement(", query, ");");
+		LocalJavaField isStmtClosed = jm.newJavaField(boolean.class, "isStmtClosed");
+		isStmtClosed.addLine("false");
+		jm.addTry();
+		
+		int paramNum = 0;
+		for (Iterator iter = table.getColumns();  iter.hasNext();  ) {
+			Column column = (Column) iter.next();
+			Object v = new Object[]{ values, "[", Integer.toString(paramNum), "]" };
+			setPreparedStatementValue(jm, column, stmt, Integer.toString(++paramNum), v);
+		}
+		
+		jm.addLine(stmt, ".executeUpdate();");
+		jm.addLine(isStmtClosed, " = true;");
+		jm.addLine(stmt, ".close();");
+		
+		jm.addFinally();
+		jm.addIf("!", isStmtClosed);
+		jm.addTry();
+		jm.addLine(stmt, ".close();");
+		jm.addCatch(Throwable.class, "ignore");
+		jm.addEndTry();
+		jm.addEndIf();
+		jm.addEndTry();
+		
+		logFinestExiting(jm, null);
+		return jm;
+	}
+	
+	
+	/** <p>Actually creates the public "clone" method.</p>
+	 */
+	protected JavaMethod getPublicCloneMethod(JavaSource pSource) {
+		TableInfo headTable;
+		{
+			Iterator iter = tablesByOrder.iterator();
+			if (!iter.hasNext()) {
+				throw new IllegalStateException("No tables have been added.");
+			}
+			headTable = (TableInfo) iter.next();
+		}
+		
+		JavaQName resultType = JavaQNameImpl.getInstance(Object[].class);
+		JavaMethod jm = pSource.newJavaMethod("clone", resultType, JavaSource.PUBLIC);
+		jm.addThrows(SQLException.class);
+		JavaComment jc = jm.newComment();
+		jc.addLine("<p>This method takes as input the key values of a row in the table " +
+				headTable.getTable().getQName() + ".");
+		jc.addLine("The key values are given by the array <code>pRow</code>:");
+		jc.addLine("<ul>");
+		int i = 0;
+		for (Iterator iter = headTable.getTable().getPrimaryKey().getColumns();
+				iter.hasNext();  i++) {
+			Column col = (Column) iter.next();
+			jc.addLine("  <li><code>pRow[" + i+ "] = " + col.getQName() + "</code></li>");
+		}
+		jc.addLine("</ul>");
+		jc.addLine("The method updates the rows version number and creates a new row");
+		jc.addLine("with the updated values.</p>");
+		{
+			Iterator iter = tablesByOrder.iterator();
+			iter.next();
+			if (iter.hasNext()) {
+				jc.addLine("<p>Once the new row is created, the method searches for entries");
+				jc.addLine("referencing the old row in the following tables:");
+				jc.addLine("<table>");
+				do {
+					TableInfo subTable = (TableInfo) iter.next();
+					jc.addLine("  <tr><td>" + subTable.getTable().getQName() + "</td></tr>");
+				} while (iter.hasNext());
+				jc.addLine("All the referencing entries are cloned as well, with updated");
+				jc.addLine("references.");
+			}
+		}
+		
+		DirectAccessible conn = jm.addParam(Connection.class, "pConn");
+		DirectAccessible row = jm.addParam(resultType, "pRow");
+		
+		logEntering(jm, new Object[]{"new ", Object[].class, "{", conn, ", ", row, "}"});
+		
+		LocalJavaField map = jm.newJavaField(Map.class, "clonedObjects");
+		map.addLine("new ", HashMap.class, "()");
+		
+		getSelectRowsCode(jm, headTable, headTable.getTable().getPrimaryKey(),
+				conn, map, row, true);
+		return jm;
+	}
+	
+	/** <p>Creates a method for updating one row in the head table.</p>
+	 */
+	public JavaMethod getCloneMethod(JavaSource pSource) {
+		initLogging(pSource);
+		
+		for (Iterator iter = tablesByOrder.iterator();  iter.hasNext();  ) {
+			TableInfo tableInfo = (TableInfo) iter.next();
+			
+			getInsertRowMethod(pSource, tableInfo);
+			getInnerInsertRowMethod(pSource, tableInfo);
+		}
+		getCacheDataClass(pSource);
+		getPublicCloneMethod(pSource);
+		
+		return null;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ant.properties
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ant.properties	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/ant.properties	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,23 @@
+###############################################################################
+#
+# Copyright 2003, 2004  The Apache Software Foundation
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+###############################################################################
+proxyGenerator=org.apache.ws.jaxme.js.pattern.Ant$AntProxyGenerator
+enumGenerator=org.apache.ws.jaxme.js.pattern.Ant$AntTypesafeEnumerationGenerator
+chainGenerator=org.apache.ws.jaxme.js.pattern.Ant$AntChainGenerator
+versionGenerator=org.apache.ws.jaxme.js.pattern.Ant$AntVersionGenerator
+linkChecker=org.apache.ws.jaxme.js.util.AntLinkChecker
+xmlRpcGenerator=org.apache.ws.jaxme.js.pattern.Ant$XmlRpcGenerator
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/pattern/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html><head><title>The pattern package</title></head>
+<body>
+<h1>The pattern package</h1>
+<p>This package contains a set of design patterns implemented with
+the JaxMe JavaSource generator framework. It is provided both for
+demonstration and actual use. Each pattern is accompanied with a
+corresponding Ant task that allows to invoke the respective generator
+from within an Ant build script. The patterns are:</p>
+<table border="1">
+  <tr><th>Design pattern(s)</th><th>Class</th><th>Ant task</th><th>Description</th></tr>
+  <tr>
+    <td>Proxy objects<br>Multiple inheritance</td>
+    <td>{@link org.apache.ws.jaxme.js.pattern.ProxyGenerator}</td>
+    <td>proxyGenerator</td>
+    <td>Proxy are instances that delegate most or all method calls to another
+      object. Proxy objects in Java are typically created by the class
+      {@link java.lang.reflect.Proxy}. Compared to this class, the generator
+      has the advantage, that it is much easier to adapt the proxy object
+      to your own needs: In our case you simple subclass the generated
+      Proxy class.<br>
+      Proxy objects can also be used to implement something like multiple
+      inheritance. This is demonstrated in the Unit test
+      {@link org.apache.ws.jaxme.js.junit.MultipleInheritanceTest},
+      where a subclass of {@link java.util.Observable} is created,
+      that is also an instance of {@link java.util.List} by inheriting
+      from {@link java.util.ArrayList}.</td>
+  </tr>
+  <tr>
+    <td>Typesafe enumerations</td>
+    <td>{@link org.apache.ws.jaxme.js.pattern.TypesafeEnumerationGenerator}</td>
+    <td>enumGenerator</td>
+    <td>A typesafe enumeration is a Java class that guarantees that only a
+      specified set of instances can exist. These instances are part of the
+      class and accessible through public, static, final fields.</td>
+  </tr>
+  <tr>
+    <td>Proxy chains</td>
+    <td>{@link org.apache.ws.jaxme.js.pattern.ChainGenerator}</td>
+    <td>chainGenerator</td>
+    <td>A proxy chain can be viewed as a set of event handlers implementing
+      a common interface. The interface methods are the events being processed.
+      Each element in the chain can decide to process an event alone (by
+      returning immediately), to delegate the event to the next element
+      in the chain (by calling the interface method in its superclass)
+      or to post process the result of the delegated event.</td>
+  </tr>
+</table>
+</body></html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/AntLinkChecker.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/AntLinkChecker.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/AntLinkChecker.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.logging.AntProjectLoggerFactory;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.logging.LoggerFactory;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.TaskAdapter;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class AntLinkChecker extends TaskAdapter {
+  public class CheckedURL {
+    private URL name;
+    public void setName(URL pName) {
+      if (name != null) {
+        throw new IllegalStateException("An 'URL' element must have exactly one 'name' or 'file' attribute. These attributes are mutually exclusive.");
+      }
+      name = pName;
+    }
+    public void setFile(File pName) throws MalformedURLException {
+      if (name != null) {
+        throw new IllegalStateException("An 'URL' element must have exactly one 'name' or 'file' attribute. These attributes are mutually exclusive.");
+      }
+      name = pName.toURL();
+    }
+    public URL getName() {
+      return name;
+    }
+    public void finish() {
+      if (name == null) {
+        throw new IllegalStateException("An 'URL' element must have exactly one 'name' or 'file' attribute.");
+      }
+    }
+  }
+
+  public class MyLinkChecker extends LinkChecker {
+    private boolean isSettingLoggerFactory = true;
+    public CheckedURL createURL() {
+      CheckedURL url = new CheckedURL();
+      AntLinkChecker.this.addURL(url);
+      return url;
+    }
+    public boolean isSettingLoggerFactory() {
+      return isSettingLoggerFactory;
+    }
+    public void setSettingLoggerFactory(boolean pSettingLoggerFactory) {
+      isSettingLoggerFactory = pSettingLoggerFactory;
+    }
+  }
+
+  private MyLinkChecker checker = new MyLinkChecker();
+  private List urls = new ArrayList();
+
+  void addURL(CheckedURL pURL) {
+     urls.add(pURL);
+  }
+
+  public AntLinkChecker() {
+    setProxy(checker);
+  }
+
+  protected LoggerFactory initLogging() {
+    if (!checker.isSettingLoggerFactory()) {
+      return null;
+    }
+    LoggerFactory loggerFactory = LoggerAccess.getLoggerFactory();
+    if (loggerFactory instanceof AntProjectLoggerFactory) {
+      return null;
+    }
+    LoggerAccess.setLoggerFactory(new AntProjectLoggerFactory(this));
+    return loggerFactory;
+  }
+
+  protected void stopLogging(LoggerFactory pLoggerFactory) {
+    if (pLoggerFactory != null) {
+      LoggerAccess.setLoggerFactory(pLoggerFactory);
+    }
+  }
+
+  public void execute() {
+    log("execute: ->", Project.MSG_VERBOSE);
+    LoggerFactory loggerFactory = initLogging();
+    checker.setLogger(LoggerAccess.getLogger(LinkChecker.class));
+    try {
+      for (Iterator iter = urls.iterator();  iter.hasNext();  ) {
+        CheckedURL url = (CheckedURL) iter.next();
+        checker.addURL(url.getName());
+      }
+      checker.parse();
+    } finally {
+      stopLogging(loggerFactory);
+    }
+    log("execute: <-", Project.MSG_VERBOSE);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/JavaParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/JavaParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/JavaParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,515 @@
+package org.apache.ws.jaxme.js.util;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.js.AbstractJavaMethod;
+import org.apache.ws.jaxme.js.JavaConstructor;
+import org.apache.ws.jaxme.js.JavaField;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.JavaSourceFactory;
+import org.apache.ws.jaxme.js.JavaSourceObject;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.js.jparser.JavaLexer;
+import org.apache.ws.jaxme.js.jparser.JavaRecognizer;
+import org.apache.ws.jaxme.js.jparser.JavaTokenTypes;
+
+import antlr.RecognitionException;
+import antlr.TokenStream;
+import antlr.TokenStreamException;
+import antlr.collections.AST;
+
+
+/** <p>The <code>JavaParser</code> is a utility class, that
+ * reads Java sources and converts them into instances of
+ * {@link org.apache.ws.jaxme.js.JavaSource}.</p>
+ */
+public class JavaParser {
+	private final JavaSourceFactory factory;
+    private final List importStatements = new ArrayList();
+    private final List generatedClasses = new ArrayList();
+    private final List currentClasses = new ArrayList();
+    private String packageName;
+
+	/** <p>Creates a new instance of <code>JavaParser</code>,
+     * that will use the given {@link JavaSourceFactory} for
+     * creating instances of {@link JavaSource}.</p>
+	 */
+    public JavaParser(JavaSourceFactory pFactory) {
+    	factory = pFactory;
+    }
+
+    /** Returns the factory.
+     */
+    public JavaSourceFactory getFactory() {
+        return factory;
+    }
+
+    /** Returns the package name.
+     */
+    public String getPackageName() {
+        return packageName;
+    }
+
+    /** Sets the package name.
+     */
+    public void setPackageName(String pPackageName) {
+        packageName = pPackageName;
+    }
+
+    /** <p>Parses the given file.</p>
+     * @return List of classes, that have been read.
+     */
+    public List parse(File pFile) throws RecognitionException, TokenStreamException, FileNotFoundException {
+    	return parse(new FileReader(pFile));
+    }
+
+    /** <p>Parses the input read from the given
+     * {@link Reader} <code>pReader</code>.</p>
+     * @return List of classes, that have been read.
+     */
+    public List parse(Reader pReader) throws RecognitionException, TokenStreamException {
+    	return parse(new JavaLexer(pReader));
+    }
+
+    private void showAST(int pLevel, AST pAST) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0;  i < pLevel;  i++) {
+        	sb.append("  ");
+        }
+        System.out.println(sb.toString() + pAST.getType() + " " + pAST.getText());
+        for (AST child = pAST.getFirstChild();  child != null;  child = child.getNextSibling()) {
+        	showAST(pLevel+1, child);
+        }
+    }
+
+    private void reset() {
+        packageName = null;
+        importStatements.clear();
+    }
+
+    /** Parses the given {@link TokenStream} <code>pStream</code>.
+     * @return List of classes, that have been read.
+     */
+    public List parse(TokenStream pStream) throws RecognitionException, TokenStreamException {
+    	reset();
+        JavaRecognizer parser = new JavaRecognizer(pStream);
+    	parser.compilationUnit();
+    	for (AST ast = parser.getAST();  ast != null;  ast = ast.getNextSibling()) {
+    		if (false) {
+    			showAST(0, ast);
+    		}
+            parseAST(ast);
+        }
+        return generatedClasses;
+    }
+
+    private void parsePackageName(AST pAST) {
+        setPackageName(parseIdentifier(pAST));
+    }
+
+    private void addImportStatement(JavaQName pQName) {
+        importStatements.add(pQName);
+    }
+
+    private void parseImportStatement(AST pAST) {
+        addImportStatement(JavaQNameImpl.getInstance(parseIdentifier(pAST)));
+    }
+
+    private String parseIdentifier(AST pAST) {
+    	StringBuffer sb = new StringBuffer();
+        for (AST child = pAST.getFirstChild();  child != null;  child = child.getNextSibling()) {
+        	parseIdentifier(child, sb);
+        }
+        return sb.toString();
+    }
+
+    private String parseSimpleIdentifier(AST pAST) {
+        StringBuffer sb = new StringBuffer();
+        parseIdentifier(pAST, sb);
+        return sb.toString();
+    }
+
+    private void parseIdentifier(AST pAST, StringBuffer sb) {
+    	switch (pAST.getType()) {
+	        case JavaTokenTypes.ANNOTATIONS:
+	        	// Ignore this
+	        	break;
+	        case JavaTokenTypes.LITERAL_void:
+            case JavaTokenTypes.LITERAL_boolean:
+	        case JavaTokenTypes.LITERAL_byte:
+	        case JavaTokenTypes.LITERAL_char:
+	        case JavaTokenTypes.LITERAL_short:
+	        case JavaTokenTypes.LITERAL_int:
+	        case JavaTokenTypes.LITERAL_long:
+	        case JavaTokenTypes.LITERAL_float:
+	        case JavaTokenTypes.LITERAL_double:
+	        	sb.append(pAST.getText());
+	            break;
+	        case JavaTokenTypes.IDENT:
+	        	sb.append(pAST.getText());
+	            break;
+	        case JavaTokenTypes.DOT:
+	        	boolean first = true;
+                for (AST child = pAST.getFirstChild();  child != null;  child = child.getNextSibling()) {
+	        		if (first) {
+	        			first = false;
+                    } else {
+                    	sb.append('.');
+                    }
+                    parseIdentifier(child, sb);
+                }
+                break;
+            case JavaTokenTypes.ARRAY_DECLARATOR:
+                sb.append("[]");
+                for (AST child = pAST.getFirstChild();  child != null;
+                	 child = child.getNextSibling()) {
+                	parseIdentifier(child, sb);
+                }
+                break;
+            default:
+                throw new IllegalStateException("Unknown token: " + pAST.getType());
+        }
+    }
+
+    private AST findChild(AST pAST, int pType) {
+    	for (AST child = pAST.getFirstChild();  child != null;  child = child.getNextSibling()) {
+    		if (child.getType() == pType) {
+    			return child;
+            }
+        }
+        return null;
+    }
+
+    private JavaSource getJavaSource(JavaSource pOuterClass, AST pAST) {
+        AST classNameAST = findChild(pAST, JavaRecognizer.IDENT);
+        if (classNameAST == null) {
+            throw new IllegalStateException("Missing class name");
+        }
+        String className = classNameAST.getText();
+        if (pOuterClass == null) {
+            String packageName = getPackageName();
+            JavaQName qName = JavaQNameImpl.getInstance(packageName, className);
+            JavaSource js = factory.newJavaSource(qName, JavaSource.DEFAULT_PROTECTION);
+            generatedClasses.add(js);
+            return js;
+        } else {
+            return pOuterClass.newJavaInnerClass(className, JavaSource.DEFAULT_PROTECTION);
+        }
+    }
+
+    private void parseModifiers(JavaSourceObject pObject, AST pAST) {
+        AST modifiers = findChild(pAST, JavaRecognizer.MODIFIERS);
+        if (modifiers == null) {
+        	throw new IllegalStateException("Missing MODIFIERS");
+        }
+        for (AST child = modifiers.getFirstChild();  child != null;  child = child.getNextSibling()) {
+            switch (child.getType()) {
+                case JavaTokenTypes.LITERAL_public:
+                    pObject.setProtection(JavaSource.PUBLIC);
+                    break;
+                case JavaTokenTypes.LITERAL_protected:
+                    pObject.setProtection(JavaSource.PROTECTED);
+                    break;
+                case JavaTokenTypes.LITERAL_private:
+                    pObject.setProtection(JavaSource.PRIVATE);
+                    break;
+                case JavaTokenTypes.LITERAL_static:
+                    pObject.setStatic(true);
+                    break;
+                case JavaTokenTypes.ABSTRACT:
+                    pObject.setAbstract(true);
+                    break;
+                case JavaTokenTypes.FINAL:
+                	pObject.setFinal(true);
+                    break;
+            }
+        }
+    }
+
+    private void parseModifiers(AST pAST) {
+        AST modifiers = findChild(pAST, JavaRecognizer.MODIFIERS);
+        if (modifiers == null) {
+            throw new IllegalStateException("Missing MODIFIERS");
+        }
+    }
+
+    private void parseModifiers(JavaSource pSource, AST pAST) {
+        AST modifiers = findChild(pAST, JavaRecognizer.MODIFIERS);
+        if (modifiers == null) {
+            throw new IllegalStateException("Missing MODIFIERS");
+        }
+        for (AST child = modifiers.getFirstChild();  child != null;  child = child.getNextSibling()) {
+            switch (child.getType()) {
+                case JavaTokenTypes.LITERAL_public:
+                    pSource.setProtection(JavaSource.PUBLIC);
+                    break;
+                case JavaTokenTypes.LITERAL_protected:
+                    pSource.setProtection(JavaSource.PROTECTED);
+                    break;
+                case JavaTokenTypes.LITERAL_private:
+                    pSource.setProtection(JavaSource.PRIVATE);
+                    break;
+                case JavaTokenTypes.LITERAL_static:
+                    pSource.setStatic(true);
+                    break;
+                case JavaTokenTypes.ABSTRACT:
+                    pSource.setAbstract(true);
+                    break;
+                case JavaTokenTypes.FINAL:
+                	//pSource.setFinal(true);
+                    break;
+            }
+        }
+    }
+
+    private JavaQName getQName(String pName) {
+        if (pName.endsWith("[]")) {
+        	return JavaQNameImpl.getArray(getQName(pName.substring(0, pName.length()-2)));
+        }
+    	int offset = pName.indexOf('.');
+    	String firstIdent;
+    	String suffix;
+        if (offset > 0) {
+            firstIdent = pName.substring(0, offset);
+            suffix = pName.substring(offset+1);
+        } else {
+        	firstIdent = pName;
+            suffix = "";
+        }
+        for (int i = 0;  i < importStatements.size();  i++) {
+        	JavaQName qName = (JavaQName) importStatements.get(i);
+            if (qName.getClassName().equals(firstIdent)) {
+            	for (StringTokenizer st = new StringTokenizer(suffix, ".");  st.hasMoreTokens();  ) {
+            		String s = st.nextToken();
+                    qName = JavaQNameImpl.getInnerInstance(qName, s);
+                }
+                return qName;
+            }
+        }
+
+        if (currentClasses.size() > 0) {
+        	JavaSource currentClass = (JavaSource) currentClasses.get(currentClasses.size()-1);
+        	JavaInnerClass[] innerClasses = currentClass.getInnerClasses();
+        	for (int i = 0;  i < innerClasses.length;  i++) {
+        		if (innerClasses[i].getQName().getInnerClassName().equals(pName)) {
+        			return innerClasses[i].getQName();
+        		}
+        	}
+        }
+
+        if ("void".equals(pName)
+            ||  "byte".equals(pName)
+            ||  "char".equals(pName)
+            ||  "short".equals(pName)
+            ||  "int".equals(pName)
+            ||  "long".equals(pName)
+            ||  "float".equals(pName)
+            ||  "double".equals(pName)
+            ||  "boolean".equals(pName)) {
+        	return JavaQNameImpl.getInstance(pName);
+        } else {
+        	try {
+        		Class c = Class.forName("java.lang." + pName);
+        		return JavaQNameImpl.getInstance(c);
+        	} catch (ClassNotFoundException e) {
+        	}
+        	if (packageName == null  ||  packageName.length() == 0) {
+        		return JavaQNameImpl.getInstance(pName);
+        	} else {
+        		return JavaQNameImpl.getInstance(packageName, pName);
+        	}
+        }
+    }
+
+    private void parseImplementsOrExtends(JavaSource pSource, AST pAST, int pType) {
+        AST implementsAST = findChild(pAST, pType);
+        if (implementsAST == null) {
+        	throw new IllegalStateException("AST implements not found");
+        }
+        if (implementsAST.getFirstChild() != null) {
+            String ident = parseIdentifier(implementsAST);
+            JavaQName qName = getQName(ident);
+            if (pType == JavaRecognizer.IMPLEMENTS_CLAUSE) {
+            	pSource.addImplements(qName);
+            } else {
+            	pSource.addExtends(qName);
+            }
+        }
+    }
+
+    private JavaField getJavaField(JavaSource pSource, AST pAST) {
+        AST fieldNameAST = findChild(pAST, JavaRecognizer.IDENT);
+        if (fieldNameAST == null) {
+            throw new IllegalStateException("Missing IDENT AST");
+        }
+        String fieldName = fieldNameAST.getText();
+        AST type = findChild(pAST, JavaRecognizer.TYPE);
+        if (type == null) {
+            throw new IllegalStateException("Missing TYPE AST");
+        }
+        String typeName = parseIdentifier(type);
+        JavaQName typeQName = getQName(typeName);
+        return pSource.newJavaField(fieldName, typeQName, JavaSource.DEFAULT_PROTECTION);
+    }
+
+    private void parseFieldDefinition(JavaSource pSource, AST pAST) {
+    	JavaField jf = getJavaField(pSource, pAST);
+        parseModifiers(jf, pAST);
+    }
+
+
+    private JavaMethod getJavaMethod(JavaSource pSource, AST pAST) {
+        AST fieldNameAST = findChild(pAST, JavaRecognizer.IDENT);
+        if (fieldNameAST == null) {
+            throw new IllegalStateException("Missing IDENT AST");
+        }
+        String fieldName = fieldNameAST.getText();
+        AST type = findChild(pAST, JavaRecognizer.TYPE);
+        if (type == null) {
+            throw new IllegalStateException("Missing TYPE AST");
+        }
+        String typeName = parseIdentifier(type);
+        if (typeName == null) {
+            throw new IllegalStateException("Missing identifier for " + fieldName);
+        }
+        JavaQName typeQName = getQName(typeName);
+        return pSource.newJavaMethod(fieldName, typeQName, JavaSource.DEFAULT_PROTECTION);
+    }
+
+    private Parameter getParameter(AbstractJavaMethod pMethod, AST pAST) {
+    	AST paramNameAST = findChild(pAST, JavaRecognizer.IDENT);
+        if (paramNameAST == null) {
+            throw new IllegalStateException("Missing IDENT AST");
+        }
+        String paramName = paramNameAST.getText();
+        AST type = findChild(pAST, JavaRecognizer.TYPE);
+        if (type == null) {
+            throw new IllegalStateException("Missing TYPE AST");
+        }
+        String typeName = parseIdentifier(type);
+        JavaQName typeQName = getQName(typeName);
+        return pMethod.addParam(typeQName, paramName);
+    }
+
+    private void parseParameter(AbstractJavaMethod pMethod, AST pAST) {
+        getParameter(pMethod, pAST);
+        parseModifiers(pAST);
+    }
+
+    private void parseParameters(AbstractJavaMethod pMethod, AST pAST) {
+        AST params = findChild(pAST, JavaRecognizer.PARAMETERS);
+        if (params == null) {
+        	throw new IllegalStateException("Missing PARAMETERS AST");
+        }
+        for (AST child = params.getFirstChild();  child != null;  child = child.getNextSibling()) {
+        	switch (child.getType()) {
+        	    case JavaRecognizer.PARAMETER_DEF:
+                    parseParameter(pMethod, child);
+                    break;
+            }
+        }
+    }
+
+    private void parseExceptions(AbstractJavaMethod pMethod, AST pAST) {
+        AST throwsClause = findChild(pAST, JavaTokenTypes.LITERAL_throws);
+        if (throwsClause != null) {
+        	for (AST child = throwsClause.getFirstChild();  child != null;  child = child.getNextSibling()) {
+        		String ident = parseSimpleIdentifier(child);
+                JavaQName qName = getQName(ident);
+                pMethod.addThrows(qName);
+            }
+        }
+    }
+
+    private void parseMethodDefinition(JavaSource pSource, AST pAST) {
+    	JavaMethod jm = getJavaMethod(pSource, pAST);
+        parseModifiers(jm, pAST);
+        parseParameters(jm, pAST);
+        parseExceptions(jm, pAST);
+    }
+
+    private void parseConstructorDefinition(JavaSource pSource, AST pAST) {
+    	JavaConstructor jc = pSource.newJavaConstructor(JavaSource.DEFAULT_PROTECTION);
+        parseModifiers(jc, pAST);
+        parseParameters(jc, pAST);
+        parseExceptions(jc, pAST);
+    }
+
+    private void parseObjects(JavaSource pSource, AST pAST) {
+    	AST objBlock = findChild(pAST, JavaRecognizer.OBJBLOCK);
+        if (objBlock == null) {
+        	throw new IllegalStateException("Missing OBKBLOCK");
+        }
+        for (AST child = objBlock.getFirstChild();  child != null;  child = child.getNextSibling()) {
+            switch (child.getType()) {
+                case JavaTokenTypes.VARIABLE_DEF:
+                	parseFieldDefinition(pSource, child);
+                    break;
+                case JavaTokenTypes.METHOD_DEF:
+                	parseMethodDefinition(pSource, child);
+                    break;
+                case JavaTokenTypes.CTOR_DEF:
+                    parseConstructorDefinition(pSource, child);
+                    break;
+                case JavaTokenTypes.CLASS_DEF:
+                	parseClassDefinition(pSource, JavaSource.CLASS, child);
+                    break;
+                case JavaTokenTypes.INTERFACE_DEF:
+                    parseClassDefinition(pSource, JavaSource.CLASS, child);
+                    break;
+            }
+        }
+    }
+
+    private void parseClassDefinition(JavaSource pOuterClass,
+                                      JavaSource.Type pType, AST pAST) {
+    	JavaSource currentClass = getJavaSource(pOuterClass, pAST);
+    	currentClasses.add(currentClass);
+    	try {
+	        currentClass.setType(pType);
+	        parseModifiers(currentClass, pAST);
+	        parseImplementsOrExtends(currentClass, pAST, JavaRecognizer.EXTENDS_CLAUSE);
+	        if (!JavaSource.INTERFACE.equals(pType)) {
+	        	parseImplementsOrExtends(currentClass, pAST, JavaRecognizer.IMPLEMENTS_CLAUSE);
+	        }
+	        parseObjects(currentClass, pAST);
+    	} finally {
+    		currentClasses.remove(currentClasses.size()-1);
+    	}
+    }
+
+    private void parseAST(AST pAST) {
+        switch (pAST.getType()) {
+            case JavaRecognizer.PACKAGE_DEF:
+                parsePackageName(pAST);
+            	break;
+            case JavaRecognizer.IMPORT:
+                parseImportStatement(pAST);
+                break;
+            case JavaRecognizer.CLASS_DEF:
+            	parseClassDefinition(null, JavaSource.CLASS, pAST);
+                break;
+            case JavaRecognizer.INTERFACE_DEF:
+            	parseClassDefinition(null, JavaSource.INTERFACE, pAST);
+                break;
+        }
+    }
+
+    /** For tests
+     */
+    public static void main(String[] args) throws Exception {
+    	for (int i = 0;  i < args.length;  i++) {
+    		new JavaParser(new JavaSourceFactory()).parse(new File(args[i]));
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/LinkChecker.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/LinkChecker.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/LinkChecker.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,487 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.js.util;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.parser.ParserDelegator;
+
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+
+
+/** <p>Basic implementation of a link checker for the JaxMe
+ * HTML distribution.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class LinkChecker {
+  Logger logger = LoggerAccess.getLogger(LinkChecker.class);
+  private Map urls = new HashMap();
+  private Map checkedUrls = new HashMap();
+  private int severity = Event.ERROR;
+  private String proxyHost;
+  private String proxyPort;
+  private boolean haveErrors;
+
+  private class Event {
+    public static final int SUCCESS = 0;
+    public static final int WARNING = 1;
+    public static final int ERROR = 2;
+    int mySeverity;
+    private URL url;
+    private int pos = -1;
+    private String msg;
+    private Event(int pSeverity, URL pURL, int pPos, String pMsg) {
+      mySeverity = pSeverity;
+      url = pURL;
+      pos = pPos;
+      msg = pMsg;
+    }
+    public String getMsg() {
+      return msg;
+    }
+    public String toString() {
+      StringBuffer result = new StringBuffer();
+      if (mySeverity == SUCCESS) {
+        result.append("SUCCESS");
+      } else if (mySeverity == WARNING) {
+        result.append("WARNING");
+      } else {
+        result.append("  ERROR");
+      }
+      result.append(" at ").append(url);
+      if (pos != -1) {
+        result.append(", char ").append(pos);
+      }
+      result.append(": ").append(getMsg());
+      return result.toString();
+    }
+  }
+
+  private class RefEvent extends Event {
+    private URL referencedURL;
+    private RefEvent(int pSeverity, URL pURL, URL pRefURL, int pPos, String pMsg) {
+      super(pSeverity, pRefURL, pPos, pMsg);
+      referencedURL = pURL;
+    }
+    public String getMsg() {
+      return "Failed to reference " + referencedURL + ": " + super.getMsg();
+    }
+  }
+
+  private class CheckedURL {
+    URL url;
+    URL referencingURL;
+    int referencingPos;
+    InputStream stream;
+    boolean checkExistsOnly;
+    boolean isExtern;
+    private List anchors;
+    private List refAnchors;
+
+    private class AnchorReference {
+      String name;
+      URL ref;
+      int pos;
+    }
+
+    private CheckedURL(URL pURL, URL pRefURL, int pPos) {
+      referencingURL = pRefURL;
+      referencingPos = pPos;
+      String ref = pURL.getRef();
+      String anchor = null;
+      if (ref != null) {
+        String s = pURL.toString();
+        try {
+          if (s.endsWith("#" + ref)) {
+            pURL = new URL(s.substring(0, s.length()-ref.length()-1));
+            anchor = ref;
+          } else {
+            throw new MalformedURLException();
+          }
+        } catch (MalformedURLException e) {
+          handleRefError(pURL, pRefURL, pPos, "Unable to parse URL: " + pURL);
+        }
+      }
+      url = pURL;
+      if (anchor != null  &&  pRefURL != null) {
+        addAnchorRef(anchor, pRefURL, pPos);
+      }
+    }
+
+    public void addAnchor(String pName) {
+      if (anchors == null) {
+        anchors = new ArrayList();
+      }
+      anchors.add(pName);
+    }
+
+    public void addAnchorRef(String pAnchor, URL pRefURL, int pPos) {
+      AnchorReference anchorReference = new AnchorReference();
+      anchorReference.name = pAnchor;
+      anchorReference.ref = pRefURL;
+      anchorReference.pos = pPos;
+      if (refAnchors == null) {
+        refAnchors = new ArrayList();
+      }
+      refAnchors.add(anchorReference);
+    }
+
+    public void validate() {
+      if (refAnchors != null) {
+        for (Iterator iter = refAnchors.iterator();  iter.hasNext();  ) {
+          AnchorReference anchorReference = (AnchorReference) iter.next();
+          if (anchors == null  ||  !anchors.contains(anchorReference.name)) {
+            handleRefError(url, anchorReference.ref, anchorReference.pos,
+                           "Invalid anchor: " + anchorReference.name);
+          }
+        }
+        refAnchors.clear();
+      }
+    }
+  }
+
+  protected void addEvent(Event pEvent) {
+    final String mName = "addEvent";
+    logger.entering(mName, pEvent.toString());
+    if (pEvent.mySeverity >= Event.ERROR) {
+      haveErrors = true;
+    }
+    if (pEvent.mySeverity >= getSeverity()) {
+      System.err.println(pEvent.toString());
+    }
+    logger.exiting(mName);
+  }
+
+  protected void handleError(URL pURL, int pPos, String pMsg) {
+    addEvent(new Event(Event.ERROR, pURL, pPos, pMsg));
+  }
+
+  protected void handleRefError(URL pURL, URL pRefURL, int pPos, String pMsg) {
+    if (pRefURL == null) {
+      handleError(pURL, pPos, pMsg);
+    }
+    addEvent(new RefEvent(Event.ERROR, pURL, pRefURL, pPos, pMsg));
+  }
+
+  protected void handleWarning(URL pURL, int pPos, String pMsg) {
+    addEvent(new Event(Event.WARNING, pURL, pPos, pMsg));
+  }
+
+  private class URLChecker extends HTMLEditorKit.ParserCallback {
+    CheckedURL url;
+    private URLChecker(CheckedURL pURL) {
+      url = pURL;
+    }
+
+    protected void addLink(String pTagName, String pAttributeName,
+                             String pAttributeValue, int pPos, boolean pCheckExistsOnly) {
+      final String mName = "URLChecker.addLink";
+      logger.finest(mName, "->", new Object[]{pTagName, pAttributeName, pAttributeValue,
+                    Integer.toString(pPos), pCheckExistsOnly ? Boolean.TRUE : Boolean.FALSE});
+      logger.finest(mName, "My URL: " + this.url.url);
+      // First try, whether this is an absolute URL
+      URL myUrl = null;
+      boolean isAbsolute = false;
+      try {
+        myUrl = new URL(pAttributeValue);
+        isAbsolute = true;
+      } catch (MalformedURLException e) {
+      }
+
+      if (!isAbsolute) {
+        try {
+          myUrl = new URL(this.url.url, pAttributeValue);
+        } catch (MalformedURLException e) {
+          
+          LinkChecker.this.handleError(this.url.url, pPos,
+                                       "Failed to parse URL of attribute " + pAttributeName + " in tag " + pTagName);
+          return;
+        }
+      }
+
+      if ("mailto".equals(myUrl.getProtocol())) {
+        return;
+      }
+
+      CheckedURL checkedURL = new CheckedURL(myUrl, this.url.url, pPos);
+      checkedURL.checkExistsOnly = pCheckExistsOnly;
+      checkedURL.isExtern = isAbsolute;
+      addURL(checkedURL);
+      logger.finest(mName, "<-");
+    }
+
+    protected void handleTag(HTML.Tag t, MutableAttributeSet a, int pPos) {
+      final String mName = "URLChecker.handleTag";
+      logger.finest(mName, "->", new Object[]{t, a, Integer.toString(pPos)});
+      String tagName = t.toString().toLowerCase();
+      for (Enumeration en = a.getAttributeNames();  en.hasMoreElements();  ) {
+        Object attributeNameObj = en.nextElement();
+        String attributeName = attributeNameObj.toString().toLowerCase();
+        Object o = a.getAttribute(attributeNameObj);
+        if (o instanceof String) {
+          String attributeValue = (String) o;
+          if (tagName.equals("a")) {
+            if (attributeName.equals("href")) {
+              addLink(tagName, attributeName, attributeValue, pPos, false);
+            } else if (attributeName.equals("name")) {
+              url.addAnchor(attributeValue);
+            }
+          } else if (tagName.equals("img")) {
+            if (attributeName.equals("src")) {
+              addLink(tagName, attributeName, attributeValue, pPos, true);
+            }
+          }
+        } else if (o instanceof Boolean) {
+          // Ignore this
+        } else {
+          handleWarning(url.url, pPos, "Unknown attribute type: " + (o == null ? "null" : o.getClass().getName()));
+        }
+      }
+      logger.finest(mName, "<-");
+    }
+    public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pPos) {
+      super.handleSimpleTag(t, a, pPos);
+      handleTag(t, a, pPos);
+    }
+    public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pPos) {
+      super.handleStartTag(t, a, pPos);
+      handleTag(t, a, pPos);
+    }
+    public void handleError(String pErrorMsg, int pPos) {
+      super.handleError(pErrorMsg, pPos);
+      handleWarning(url.url, pPos, "Error reported by parser: " + pErrorMsg);
+    }
+  }
+
+  public Logger getLogger() {
+    return logger;
+  }
+
+  public void setLogger(Logger pLogger) {
+    logger = pLogger;
+  }
+
+  public void setSeverity(String pSeverity) {
+    if (pSeverity.equalsIgnoreCase("success")) {
+      severity = Event.SUCCESS;
+    } else if (pSeverity.equalsIgnoreCase("warning")) {
+      severity = Event.WARNING;
+    } else if (pSeverity.equalsIgnoreCase("error")) {
+      severity = Event.ERROR;
+    } else {
+      throw new IllegalArgumentException("Invalid severity, neither of success|warning|error: " + pSeverity);
+    }
+  }
+
+  public int getSeverity() {
+    return severity;
+  }
+
+  public void setProxy(String pProxy) {
+    if (pProxy == null  &&  "".equals(pProxy)) {
+      setProxyHost(null);
+      setProxyPort(null);
+    } else {
+      int offset = pProxy.indexOf(':');
+      if (offset == -1) {
+        setProxyHost(pProxy);
+        setProxyPort(null);
+      } else {
+        setProxyHost(pProxy.substring(0, offset));
+        setProxyPort(pProxy.substring(offset+1));
+      }
+    }
+  }
+
+  public void setProxyHost(String pHost) {
+    if (pHost != null  &&  "".equals(pHost)) {
+      pHost = null;
+    }
+    proxyHost = pHost;
+  }
+
+  public String getProxyHost() {
+    return proxyHost;
+  }
+
+  public void setProxyPort(String pPort) {
+    if (pPort != null  &&  "".equals(pPort)) {
+      pPort = null;
+    }
+    proxyPort = pPort;
+  }
+
+  public String getProxyPort() {
+    return proxyPort;
+  }
+
+  public void addURL(URL pURL, InputStream pStream) {
+    CheckedURL url = new CheckedURL(pURL, null, -1);
+    url.stream = pStream;
+    addURL(url);
+  }
+
+  public void addURL(URL pURL) {
+    addURL(new CheckedURL(pURL, null, -1));
+  }
+
+  public void addURL(CheckedURL pURL) {
+    final String mName = "addURL(URL)";
+    logger.finest(mName, "->", new Object[]{pURL.url, pURL.referencingURL, Integer.toString(pURL.referencingPos)});
+    if (urls.containsKey(pURL.url)  ||  checkedUrls.containsKey(pURL.url)) {
+      logger.exiting(mName, "Already registered");
+      return;
+    }
+    urls.put(pURL.url, pURL);
+    logger.finest(mName, "<-", "New URL");
+  }
+
+  public void parse(CheckedURL pURL) throws IOException {
+    final String mName = "parse(CheckedURL)";
+    logger.finest(mName, "->", pURL.url);
+    logger.fine(mName, "Open", pURL.url);
+    InputStream stream = pURL.stream;
+    if (stream == null) {
+      try {
+        stream = pURL.url.openStream();
+      } catch (IOException e) {
+        handleRefError(pURL.url, pURL.referencingURL, pURL.referencingPos,
+                       "Failed to open URL: " + e.getMessage());
+        return;
+      }
+    }
+
+    if (pURL.checkExistsOnly  ||  pURL.isExtern) {
+      stream.close();
+    } else {
+      BufferedInputStream bStream = new BufferedInputStream(stream, 4096);
+      ParserDelegator parser = new ParserDelegator();
+      HTMLEditorKit.ParserCallback callback = new URLChecker(pURL);
+      parser.parse(new InputStreamReader(bStream), callback, false);
+      bStream.close();
+    }
+    logger.finest(mName, "<-");
+  }
+
+  public void parse() {
+    final String mName = "parse";
+    logger.finest(mName, "->");
+    haveErrors = false;
+
+    boolean isProxySetSet = System.getProperties().contains("http.proxySet");
+    String proxySet = System.getProperty("http.proxySet");
+    boolean isProxyHostSet = System.getProperties().contains("http.proxyHost");
+    String myProxyHost = System.getProperty("http.proxyHost");
+    boolean isProxyPortSet = System.getProperties().contains("http.proxyPort");
+    String myProxyPort = System.getProperty("http.proxyPort");
+
+    String host = getProxyHost();
+    if (host != null) {
+      System.setProperty("http.proxySet", "true");
+      System.setProperty("http.proxyHost", host);
+      String port = getProxyPort();
+      if (port != null) {
+        System.setProperty("http.proxyPort", port);
+      }
+    }
+
+    try {
+      while (!urls.isEmpty()) {
+        Iterator iter = urls.values().iterator();
+        CheckedURL checkedURL = (CheckedURL) iter.next();
+        try {
+          parse(checkedURL);
+        } catch (IOException e) {
+        } finally {
+          urls.remove(checkedURL.url);
+          checkedUrls.put(checkedURL.url, checkedURL);
+        }
+      }
+    } finally {
+      if (host != null) {
+        if (isProxySetSet) {
+          System.setProperty("http.proxySet", proxySet);
+        } else {
+          System.getProperties().remove("http.proxySet");
+        }
+        if (isProxyHostSet) {
+          System.setProperty("http.proxyHost", myProxyHost);
+        } else {
+          System.getProperties().remove("http.proxyHost");
+        }
+        if (isProxyPortSet) {
+          System.setProperty("http.proxyPort", myProxyPort);
+        } else {
+          System.getProperties().remove("http.proxyPort");
+        }
+      }
+    }
+
+    for (Iterator iter = checkedUrls.values().iterator();  iter.hasNext();  ) {
+      CheckedURL checkedURL = (CheckedURL) iter.next();
+      checkedURL.validate();
+    }
+
+    if (!haveErrors) {
+      System.out.println("No errors found.");
+    }
+
+    logger.finest(mName, "<-");
+  }
+
+  public static void main(String[] args) {
+    LinkChecker checker = new LinkChecker();
+
+    for (int i = 0;  i < args.length;  i++) {
+      URL url;
+      InputStream stream;
+      try {
+        url = new URL(args[i]);
+        stream = url.openStream();
+      } catch (IOException e) {
+        try {
+          File f = new File(args[i]);
+          stream = new FileInputStream(f);
+          url = f.toURL();
+        } catch (IOException f) {
+          System.err.println("Failed to open URL: " + args[i]);
+          continue;
+        }
+      }
+      checker.addURL(url, stream);
+      checker.parse();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/js/util/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.js.util Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Utility classes used in JaxMeJS generic java source generation framework.
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLogger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLogger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLogger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+
+/** A wrapper for the Ant logger.
+ */
+public class AntProjectLogger implements Logger {
+    private final String cName;
+    private final Task task;
+    
+    /** Creates a new instance for the given task.
+     */
+    public AntProjectLogger(String pName, Task pTask) {
+        cName = pName;
+        task = pTask;
+    }
+    
+    public boolean isFinestEnabled() { return true; }
+    public boolean isFinerEnabled() { return true; }
+    public boolean isFineEnabled() { return true; }
+    public boolean isInfoEnabled() { return true; }
+    public boolean isWarnEnabled() { return true; }
+    public boolean isErrorEnabled() { return true; }
+    
+    protected String asString(Object[] pDetails) {
+        if (pDetails == null) {
+            return "";
+        }
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0;  i < pDetails.length;  i++) {
+            if (i > 0) {
+                sb.append(", ");
+            }
+            sb.append(pDetails[i]);
+        }
+        return sb.toString();
+    }
+    
+    protected void log(int pLevel, String mName, String pMsg) {
+        task.log(cName + "." + mName + ": " + pMsg, pLevel);
+    }
+    
+    public void entering(String mName, Object[] pDetails) {
+        log(Project.MSG_VERBOSE, mName, "-> " + asString(pDetails));
+    }
+    
+    public void entering(String mName) {
+        log(Project.MSG_VERBOSE, mName, "->");
+    }
+    
+    public void entering(String mName, Object pDetails) {
+        log(Project.MSG_VERBOSE, mName, "-> " + pDetails);
+    }
+    
+    public void exiting(String mName, Object[] pDetails) {
+        log(Project.MSG_VERBOSE, mName, "<- " + asString(pDetails));
+    }
+    
+    public void exiting(String mName) {
+        log(Project.MSG_VERBOSE, mName, "<-");
+    }
+    
+    public void exiting(String mName, Object pDetails) {
+        log(Project.MSG_VERBOSE, mName, "<- " + pDetails);
+    }
+    
+    public void throwing(String mName, Throwable pThrowable) {
+        StringWriter sw = new StringWriter();
+        pThrowable.printStackTrace(new PrintWriter(sw));
+        error(mName, sw.toString());
+    }
+    
+    public void finest(String mName, String pMsg, Object[] pDetails) {
+        finest(mName, pMsg + ", " + asString(pDetails));
+    }
+    
+    public void finest(String mName, String pMsg) {
+        log(Project.MSG_DEBUG, mName, pMsg);
+    }
+    
+    public void finest(String mName, String pMsg, Object pDetails) {
+        finest(mName, pMsg + ", " + pDetails);
+    }
+    
+    public void finer(String mName, String pMsg, Object[] pDetails) {
+        finer(mName, pMsg + ", " + asString(pDetails));
+    }
+    
+    public void finer(String mName, String pMsg) {
+        log(Project.MSG_DEBUG, mName, pMsg);
+    }
+    
+    public void finer(String mName, String pMsg, Object pDetails) {
+        finer(mName, pMsg + ", " + pDetails);
+    }
+    
+    public void fine(String mName, String pMsg, Object[] pDetails) {
+        fine(mName, pMsg + ", " + asString(pDetails));
+    }
+    
+    public void fine(String mName, String pMsg) {
+        log(Project.MSG_VERBOSE, mName, pMsg);
+    }
+    
+    public void fine(String mName, String pMsg, Object pDetails) {
+        fine(mName, pMsg + ", " + pDetails);
+    }
+    
+    public void info(String mName, String pMsg, Object[] pDetails) {
+        info(mName, pMsg + ", " + asString(pDetails));
+    }
+    
+    public void info(String mName, String pMsg) {
+        log(Project.MSG_INFO, mName, pMsg);
+    }
+    
+    public void info(String mName, String pMsg, Object pDetails) {
+        info(mName, pMsg + ", " + pDetails);
+    }
+    
+    public void warn(String mName, String pMsg, Object[] pDetails) {
+        warn(mName, pMsg + ", " + asString(pDetails));
+    }
+    
+    public void warn(String mName, String pMsg) {
+        log(Project.MSG_WARN, mName, pMsg);
+    }
+    
+    public void warn(String mName, String pMsg, Object pDetails) {
+        warn(mName, pMsg + ", " + pDetails);
+    }
+    
+    public void error(String mName, String pMsg, Object[] pDetails) {
+        error(mName, pMsg + ", " + asString(pDetails));
+    }
+    
+    public void error(String mName, String pMsg) {
+        log(Project.MSG_ERR, mName, pMsg);
+    }
+    
+    public void error(String mName, String pMsg, Object pDetails) {
+        error(mName, pMsg + ", " + pDetails);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLoggerFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLoggerFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/AntProjectLoggerFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import org.apache.tools.ant.Task;
+
+
+/** <p>A LoggerFactory logging via an Ant project.</p>
+ */
+public class AntProjectLoggerFactory extends LoggerFactoryImpl {
+    final Task task;
+
+    /** Creates a new logger factory for the given task.
+     */
+    public AntProjectLoggerFactory(Task pTask) {
+        task = pTask;
+    }
+
+    public Logger newLogger(String pName) {
+        return new AntProjectLogger(pName, task);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLogger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLogger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLogger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.util.logging.Level;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaUtilLogger implements Logger {
+   private final java.util.logging.Logger myLogger;
+   private final String cName;
+
+   public JavaUtilLogger(String pCName) {
+      cName = pCName;
+      myLogger = java.util.logging.Logger.getLogger(cName);
+   }
+
+   public void entering(String mName, Object[] pDetails) {
+      myLogger.entering(cName, mName, pDetails);
+   }
+
+   public void entering(String mName) {
+      myLogger.entering(cName, mName);
+   }
+
+   public void entering(String mName, Object pDetails) {
+      myLogger.entering(cName, mName, pDetails);
+   }
+
+   public void exiting(String mName, Object[] pDetails) {
+      myLogger.exiting(cName, mName, pDetails);
+   }
+
+   public void exiting(String mName) {
+      myLogger.exiting(cName, mName);
+   }
+
+   public void exiting(String mName, Object pDetails) {
+      myLogger.exiting(cName, mName, pDetails);
+   }
+
+   public void throwing(String mName, Throwable t) {
+      myLogger.throwing(cName, mName, t);
+   }
+
+   public void finest(String mName, String pMsg, Object[] pDetails) {
+      myLogger.logp(Level.FINEST, cName, mName, pMsg, pDetails);
+   }
+
+   public void finest(String mName, String pMsg) {
+      myLogger.logp(Level.FINEST, cName, mName, pMsg);
+   }
+
+   public void finest(String mName, String pMsg, Object pDetails) {
+      myLogger.logp(Level.FINEST, cName, mName, pMsg, pDetails);
+   }
+
+   public void finer(String mName, String pMsg, Object[] pDetails) {
+      myLogger.logp(Level.FINER, cName, mName, pMsg, pDetails);
+   }
+
+   public void finer(String mName, String pMsg) {
+      myLogger.logp(Level.FINER, cName, mName, pMsg);
+   }
+
+   public void finer(String mName, String pMsg, Object pDetails) {
+      myLogger.logp(Level.FINER, cName, mName, pMsg, pDetails);
+   }
+
+   public void fine(String mName, String pMsg, Object[] pDetails) {
+      myLogger.logp(Level.FINE, cName, mName, pMsg, pDetails);
+   }
+
+   public void fine(String mName, String pMsg) {
+      myLogger.logp(Level.FINE, cName, mName, pMsg);
+   }
+
+   public void fine(String mName, String pMsg, Object pDetails) {
+      myLogger.logp(Level.FINE, cName, mName, pMsg, pDetails);
+   }
+
+   public void info(String mName, String pMsg, Object[] pDetails) {
+      myLogger.logp(Level.INFO, cName, mName, pMsg, pDetails);
+   }
+
+   public void info(String mName, String pMsg) {
+      myLogger.logp(Level.INFO, cName, mName, pMsg);
+   }
+
+   public void info(String mName, String pMsg, Object pDetails) {
+      myLogger.logp(Level.INFO, cName, mName, pMsg, pDetails);
+   }
+
+   public void warn(String mName, String pMsg, Object[] pDetails) {
+      myLogger.logp(Level.WARNING, cName, mName, pMsg, pDetails);
+   }
+
+   public void warn(String mName, String pMsg) {
+      myLogger.logp(Level.WARNING, cName, mName, pMsg);
+   }
+
+   public void warn(String mName, String pMsg, Object pDetails) {
+      myLogger.logp(Level.WARNING, cName, mName, pMsg, pDetails);
+   }
+
+   public void error(String mName, String pMsg, Object[] pDetails) {
+      myLogger.logp(Level.SEVERE, cName, mName, pMsg, pDetails);
+   }
+
+   public void error(String mName, String pMsg) {
+      myLogger.logp(Level.SEVERE, cName, mName, pMsg);
+   }
+
+   public void error(String mName, String pMsg, Object pDetails) {
+      myLogger.logp(Level.SEVERE, cName, mName, pMsg, pDetails);
+   }
+
+	public boolean isFinestEnabled() {
+      return myLogger.isLoggable(Level.FINEST);
+	}
+
+	public boolean isFinerEnabled() {
+      return myLogger.isLoggable(Level.FINER);
+	}
+
+	public boolean isFineEnabled() {
+      return myLogger.isLoggable(Level.FINE);
+	}
+
+	public boolean isInfoEnabled() {
+      return myLogger.isLoggable(Level.INFO);
+	}
+
+	public boolean isWarnEnabled() {
+      return myLogger.isLoggable(Level.WARNING);
+	}
+
+	public boolean isErrorEnabled() {
+      return myLogger.isLoggable(Level.SEVERE);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLoggerFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLoggerFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/JavaUtilLoggerFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+/** <p>An logger factory creating instances of {@link JavaUtilLogger}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JavaUtilLoggerFactory extends LoggerFactoryImpl {
+	public Logger newLogger(String pName) {
+		return new JavaUtilLogger(pName);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLogger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLogger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLogger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import org.apache.log4j.Level;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Log4jLogger implements Logger {
+   private final org.apache.log4j.Logger logger;
+
+   public Log4jLogger(String pCName) {
+      logger = org.apache.log4j.Logger.getLogger(pCName); 
+   }
+
+   protected String format(String pMethodName, String pMsg, Object[] pDetails) {
+      final StringBuffer sb = new StringBuffer(pMethodName);
+      sb.append(": ").append(pMsg);
+      if (pDetails != null) {
+         for (int i = 0;  i < pDetails.length;  i++) {
+            sb.append(", ");
+            sb.append(pDetails[i]);
+         }
+      }
+      return sb.toString();
+   }
+
+   protected String format(String pMethodName, Object[] pDetails) {
+      final StringBuffer sb = new StringBuffer(pMethodName);
+      if (pDetails != null) {
+         String add = ": ";
+         for (int i = 0;  i < pDetails.length;  i++) {
+            sb.append(add);
+            add = ", ";
+            sb.append(pDetails[i]);
+         }
+      }
+      return sb.toString();
+   }
+
+	public void entering(String pMethodName, Object[] pDetails) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(format(pMethodName + " ->", pDetails));
+      }
+	}
+
+	public void entering(String pMethodName) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(pMethodName + " ->");
+      }
+	}
+
+	public void entering(String pMethodName, Object pDetails) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(pMethodName + " ->: " + pDetails);
+      }
+	}
+
+	public void exiting(String pMethodName, Object[] pDetails) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(format(pMethodName + " <-", pDetails));
+      }
+	}
+
+	public void exiting(String pMethodName) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(pMethodName + " <-");
+      }
+	}
+
+	public void exiting(String pMethodName, Object pDetails) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(pMethodName + " <-: " + pDetails);
+      }
+	}
+
+	public void throwing(String pMethodName, Throwable pThrowable) {
+      logger.error(pMethodName, pThrowable);
+	}
+
+	public boolean isFinestEnabled() {
+      return logger.isDebugEnabled();
+	}
+
+	public void finest(String pMethodName, String pMsg, Object[] pDetails) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(format(pMethodName, pMsg, pDetails));
+      }
+	}
+
+	public void finest(String pMethodName, String pMsg) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(pMethodName + ": " + pMsg);
+      }
+	}
+
+	public void finest(String pMethodName, String pMsg, Object pDetails) {
+      if (logger.isDebugEnabled()) {
+         logger.debug(pMethodName + ": " + pMsg + ", " + pDetails);
+      }
+	}
+
+	public void finer(String pMethodName, String pMsg, Object[] pDetails) {
+      finest(pMethodName, pMsg, pDetails);
+	}
+
+	public boolean isFinerEnabled() {
+      return isFinestEnabled();
+	}
+
+	public void finer(String pMethodName, String pMsg) {
+      finest(pMethodName, pMsg);
+	}
+
+	public void finer(String pMethodName, String pMsg, Object pDetails) {
+      finest(pMethodName, pMsg, pDetails);
+	}
+
+	public boolean isFineEnabled() {
+      return isFinestEnabled();
+	}
+
+	public void fine(String pMethodName, String pMsg, Object[] pDetails) {
+      finest(pMethodName, pMsg, pDetails);
+	}
+
+	public void fine(String pMethodName, String pMsg) {
+      finest(pMethodName, pMsg);
+	}
+
+	public void fine(String pMethodName, String pMsg, Object pDetails) {
+      finest(pMethodName, pMsg, pDetails);
+	}
+
+	public boolean isInfoEnabled() {
+      return logger.isInfoEnabled();
+	}
+
+	public void info(String pMethodName, String pMsg, Object[] pDetails) {
+      if (logger.isInfoEnabled()) {
+         logger.info(format(pMethodName, pMsg, pDetails));
+      }
+	}
+
+	public void info(String pMethodName, String pMsg) {
+      if (logger.isInfoEnabled()) {
+         logger.info(pMethodName + ": " + pMsg);
+      }
+	}
+
+	public void info(String pMethodName, String pMsg, Object pDetails) {
+      if (logger.isInfoEnabled()) {
+         logger.info(pMethodName + ": " + pMsg + ", " + pDetails);
+      }
+	}
+
+	public boolean isWarnEnabled() {
+      return logger.isEnabledFor(Level.WARN);
+	}
+
+	public void warn(String pMethodName, String pMsg, Object[] pDetails) {
+      if (logger.isEnabledFor(Level.WARN)) {
+         logger.warn(format(pMethodName, pMsg, pDetails));
+      }
+	}
+
+	public void warn(String pMethodName, String pMsg) {
+      if (logger.isEnabledFor(Level.WARN)) {
+         logger.warn(pMethodName + ": " + pMsg);
+      }
+	}
+
+	public void warn(String pMethodName, String pMsg, Object pDetails) {
+      if (logger.isEnabledFor(Level.WARN)) {
+         logger.warn(pMethodName + ": " + pMsg + ", " + pDetails);
+      }
+	}
+
+	public boolean isErrorEnabled() {
+      return logger.isEnabledFor(Level.ERROR);
+	}
+
+	public void error(String pMethodName, String pMsg, Object[] pDetails) {
+      if (logger.isEnabledFor(Level.ERROR)) {
+         logger.error(format(pMethodName, pMsg, pDetails));
+      }
+	}
+
+	public void error(String pMethodName, String pMsg) {
+      if (logger.isEnabledFor(Level.ERROR)) {
+         logger.error(pMethodName + ": " + pMsg);
+      }
+	}
+
+	public void error(String pMethodName, String pMsg, Object pDetails) {
+      if (logger.isEnabledFor(Level.ERROR)) {
+         logger.error(pMethodName + ": " + pMsg + ", " + pDetails);
+      }
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLoggerFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLoggerFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Log4jLoggerFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+/** <p>An logger factory creating instances of {@link JavaUtilLogger}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Log4jLoggerFactory extends LoggerFactoryImpl {
+	public Logger newLogger(String pName) {
+		return new Log4jLogger(pName);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Logger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Logger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/Logger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+/** <p>The Logger interface describes an object which is able to log
+ * a message.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Logger {
+   /** <p>Logs the message that a method is entered.</p>
+    */
+   public void entering(String pMethodName, Object[] pDetails);
+
+   /** <p>Logs the message that a method is entered.</p>
+    */
+   public void entering(String pMethodName);
+
+   /** <p>Logs the message that a method is entered.</p>
+    */
+   public void entering(String pMethodName, Object pDetails1);
+
+   /** <p>Logs the message that a method is exiting.</p>
+    */
+   public void exiting(String pMethodName, Object[] pDetails);
+
+   /** <p>Logs the message that a method is exiting.</p>
+    */
+   public void exiting(String pMethodName);
+
+   /** <p>Logs the message that a method is exiting.</p>
+    */
+   public void exiting(String pMethodName, Object pDetails1);
+
+   /** <p>Logs the given Throwable.</p>
+    */
+   public void throwing(String pMethodName, Throwable pThrowable);
+
+   /** <p>Returns whether finest logging is enabled.</p>
+    */
+   public boolean isFinestEnabled();
+
+   /** <p>Logs the given message with finest level.</p>
+    */
+   public void finest(String pMethodName, String pMsg, Object[] pDetails);
+
+   /** <p>Logs the given message with finest level.</p>
+    */
+   public void finest(String pMethodName, String pMsg);
+
+   /** <p>Logs the given message with finest level.</p>
+    */
+   public void finest(String pMethodName, String pMsg, Object pDetails);
+
+   /** <p>Logs the given message with finer level.</p>
+    */
+   public void finer(String pMethodName, String pMsg, Object[] pDetails);
+
+   /** <p>Returns whether fine logging is enabled.</p>
+    */
+   public boolean isFinerEnabled();
+
+   /** <p>Logs the given message with finer level.</p>
+    */
+   public void finer(String pMethodName, String pMsg);
+
+   /** <p>Logs the given message with finer level.</p>
+    */
+   public void finer(String pMethodName, String pMsg, Object pDetails);
+
+   /** <p>Returns whether fine logging is enabled.</p>
+    */
+   public boolean isFineEnabled();
+
+   /** <p>Logs the given message with fine level.</p>
+    */
+   public void fine(String pMethodName, String pMsg, Object[] pDetails);
+
+   /** <p>Logs the given message with fine level.</p>
+    */
+   public void fine(String pMethodName, String pMsg);
+
+   /** <p>Logs the given message with fine level.</p>
+    */
+   public void fine(String pMethodName, String pMsg, Object pDetails);
+
+   /** <p>Returns whether info logging is enabled.</p>
+    */
+   public boolean isInfoEnabled();
+
+   /** <p>Logs the given message with info level.</p>
+    */
+   public void info(String pMethodName, String pMsg, Object[] pDetails);
+
+   /** <p>Logs the given message with info level.</p>
+    */
+   public void info(String pMethodName, String pMsg);
+
+   /** <p>Logs the given message with info level.</p>
+    */
+   public void info(String pMethodName, String pMsg, Object pDetails);
+
+   /** <p>Returns whether warning logging is enabled.</p>
+    */
+   public boolean isWarnEnabled();
+
+   /** <p>Logs the given message with warning level.</p>
+    */
+   public void warn(String pMethodName, String pMsg, Object[] pDetails);
+
+   /** <p>Logs the given message with warning level.</p>
+    */
+   public void warn(String pMethodName, String pMsg);
+
+   /** <p>Logs the given message with warning level.</p>
+    */
+   public void warn(String pMethodName, String pMsg, Object pDetails);
+
+   /** <p>Returns whether error logging is enabled.</p>
+    */
+   public boolean isErrorEnabled();
+
+   /** <p>Logs the given message with error level.</p>
+    */
+   public void error(String pMethodName, String pMsg, Object[] pDetails);
+
+   /** <p>Logs the given message with error level.</p>
+    */
+   public void error(String pMethodName, String pMsg);
+
+   /** <p>Logs the given message with error level.</p>
+    */
+   public void error(String pMethodName, String pMsg, Object pDetails);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerAccess.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerAccess.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerAccess.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+
+/** <p>This class implements access to the Loggers through static
+ * methods. The class typically configures itself from the
+ * environment. However, you may choose to configure the class
+ * explicitly by invoking {@link #setLoggerFactory(LoggerFactory)}.
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class LoggerAccess {
+   private static LoggerFactory theFactory;
+
+   /** <p>Sets the logger factory.</p>
+    */
+   public static synchronized void setLoggerFactory(LoggerFactory pFactory) {
+      theFactory = pFactory;
+   }
+
+   /** <p>Instantiates the given {@link LoggerFactory}.</p>
+    */
+   private static LoggerFactory newLoggerFactory(String pName) {
+      Class c = null;
+      Throwable t = null;
+      try {
+         c = Class.forName(pName);
+      } catch (Throwable th) {
+         t = th;
+      }
+      if (c == null) {
+         try {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            if (cl == null) {
+               cl = LoggerAccess.class.getClassLoader();
+               if (cl == null) {
+               	  cl = ClassLoader.getSystemClassLoader();
+               }
+            }
+            c = cl.loadClass(pName);
+         } catch (Throwable th) {
+            if (t == null) {
+               t = th;
+            }
+         }
+      }
+      if (c == null) {
+         if (t == null) {
+            t = new ClassNotFoundException(pName);
+         }
+         t.printStackTrace();
+         return null;
+      }
+
+      try {
+         return (LoggerFactory) c.newInstance();
+      } catch (Throwable th) {
+         t.printStackTrace();
+         return null;
+      }
+   }
+
+   /** <p>Creates a new instance of {@link LoggerFactory}. The
+    * implementation class is determined as follows:
+    * <ol>
+    *   <li>If the system property <code>org.apache.ws.jaxme.logging.LoggerFactory</code>
+    *     is set, uses the given class name.</li>
+    *   <li>If the resource
+    *     <code>META-INF/services/org.apache.ws.jaxme.logging.LoggerFactory</code>
+    *     exists, uses the given class name.</li>
+    *   <li>Otherwise returns a default instance logging to
+    *     <code>System.err</code>.</li>
+    * </ol>
+    */
+   public static LoggerFactory newLoggerFactory() {
+      String p = LoggerFactory.class.getName();
+      String v = System.getProperty(p);
+      LoggerFactory result;
+      if (v != null) {
+         result = newLoggerFactory(v);
+         if (result != null) {
+            return result; 
+         }
+      }
+
+      String res = "META-INF/services/" + p;
+      ClassLoader cl = LoggerAccess.class.getClassLoader();
+      if (cl == null) {
+      	 cl = ClassLoader.getSystemClassLoader();
+      }
+      URL url = cl.getResource(res);
+      if (url == null) {
+         cl = Thread.currentThread().getContextClassLoader();
+         if (cl != null) {
+         	url = cl.getResource(res);
+         }
+      }
+      if (url != null) {
+         InputStream istream = null;
+         try {
+            istream = url.openStream();
+            BufferedReader reader = new BufferedReader(new InputStreamReader(istream));
+            v = reader.readLine();
+            if (v != null) {
+               result = newLoggerFactory(v);
+            }
+            istream.close();
+            istream = null;
+         } catch (Throwable t) {
+            t.printStackTrace();
+         } finally {
+            if (istream != null) { try { istream.close(); } catch (Throwable ignore) {} }
+         }
+      }
+
+      return new LoggerFactoryImpl() {
+         public Logger newLogger(String pName) {
+            return new LoggerImpl(pName);
+         }
+      };
+   }
+
+   /** <p>Returns the logger factory. If a logger factory is set (by
+    * previous calls to {@link #newLoggerFactory()} or
+    * {@link #setLoggerFactory(LoggerFactory)}), returns that factory. Otherwise
+    * invokes these methods and returns the result.</p>
+    */
+   public static synchronized LoggerFactory getLoggerFactory() {
+      if (theFactory == null) {
+         setLoggerFactory(newLoggerFactory());
+      }
+      return theFactory;
+   }
+
+   /** <p>Returns a new logger with the given name.</p>
+    */
+   public static synchronized Logger getLogger(String pName) {
+      LoggerFactory factory = getLoggerFactory();
+      return factory.getLogger(pName);
+   }
+
+   /** <p>Shortcut for <code>getLogger(pClass.getName())</code>.</p>
+    */
+   public static synchronized Logger getLogger(Class pClass) {
+      return getLogger(pClass.getName());
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+
+/** <p>The LoggerFactory is responsible for creating
+ * {@link Logger} instances.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface LoggerFactory {
+   /** <p>Creates a Logger with the given name.</p>
+    */
+   public Logger getLogger(String pName);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/** <p>Default implementation of a {@link LoggerFactory}. The default
+ * implementation holds an internal Map of Loggers.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class LoggerFactoryImpl implements LoggerFactory {
+   private Map loggers = new HashMap();
+
+   /** <p>Creates a new {@link Logger} with the given name. The logger
+    * will be added to an internal {@link Map} and the next call to
+    * {@link #getLogger(String)} with the same name will return
+    * this {@link Logger}.</p>
+    */
+   public abstract Logger newLogger(String pName);
+
+   /** <p>Returns a {@link Logger} with the name <code>pName</code>.
+    * If the internal {@link Map} of loggers already contains a {@link Logger}
+    * with name <code>pName</code>, returns that one. Otherwise creates
+    * a new instance by calling {@link #newLogger(String)}, stores
+    * the instance in the internal {@link Map} and returns it.</p> 
+    */
+	public Logger getLogger(String pName) {
+      Logger result = (Logger) loggers.get(pName);
+      if (result == null) {
+         result = newLogger(pName);
+         loggers.put(pName, result);
+      }
+      return result;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/LoggerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Date;
+
+
+/** <p>Base implementation of a Logger.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class LoggerImpl implements Logger {
+   private final String cName;
+   private boolean loggingTime, loggingThread;
+
+   public LoggerImpl(String pCName) {
+      cName = pCName;
+   }
+
+   public boolean isLoggingTime() {
+      return loggingTime;
+   }
+
+   public boolean isLoggingThread() {
+      return loggingThread;
+   }
+
+   public void setLoggingTime(boolean pLoggingTime) {
+      loggingTime = pLoggingTime;
+   }
+
+   public void setLoggingThread(boolean pLoggingThread) {
+      loggingThread = pLoggingThread;
+   }
+
+   protected void log(String pMsg) {
+      System.err.println(pMsg);
+   }
+
+   protected void log(String pLevel, String pCName, String pMName, String pMsg) {
+      log(pLevel, pCName, pMName, new Object[]{pMsg});
+   }
+
+   protected void log(String pLevel, String pCName, String pMName,
+                       String pMsg, Object[] pDetails) {
+      if (pDetails == null) {
+         log(pLevel, pCName, pMName, new Object[]{pMsg});
+      } else {
+         Object[] o = new Object[pDetails.length+1];
+         o[0] = pMsg;
+         for (int i = 0;  i < pDetails.length;  i++) {
+            o[i+1] = pDetails[i];
+         }
+         log(pLevel, pCName, pMName, o);
+      }
+   }
+
+   protected void log(String pLevel, String pCName, String pMName,
+                       Object[] pDetails) {
+      StringBuffer sb = new StringBuffer();
+      if (loggingTime) {
+         sb.append(new Date());
+         sb.append(", ");
+      }
+      if (loggingThread) {
+         sb.append(Thread.currentThread().getName());
+         sb.append(", ");
+      }
+      sb.append(": ");
+      sb.append(pLevel).append(", ").append(pMName).append(", ");
+      if (pDetails != null) {
+         for (int i = 0;  i < pDetails.length;  i++) {
+            sb.append(", ").append(pDetails[i]);
+         }
+      }
+      log(sb.toString());
+   }
+
+   public boolean isFinestEnabled() { return true; }
+   public boolean isFinerEnabled() { return true; }
+   public boolean isFineEnabled() { return true; }
+   public boolean isInfoEnabled() { return true; }
+   public boolean isWarnEnabled() { return true; }
+   public boolean isErrorEnabled() { return true; }
+
+   public void finest(String mName, String pMsg, Object[] pDetails) {
+      log("FINEST", cName, mName, pMsg, pDetails);
+   }
+
+   public void finest(String mName, String pMsg) {
+      log("FINEST", cName, mName, pMsg);
+   }
+
+   public void finest(String mName, String pMsg, Object pDetails) {
+      log("FINEST", cName, mName, new Object[]{pMsg, pDetails});
+   }
+
+   public void finer(String mName, String pMsg, Object[] pDetails) {
+      log("FINER", cName, mName, pMsg, pDetails);
+   }
+
+   public void finer(String mName, String pMsg) {
+      log("FINER", cName, mName, pMsg);
+   }
+
+   public void finer(String mName, String pMsg, Object pDetails) {
+      log("FINER", cName, mName, new Object[]{pMsg, pDetails});
+   }
+
+   public void fine(String mName, String pMsg, Object[] pDetails) {
+      log("FINE", cName, mName, pMsg, pDetails);
+   }
+
+   public void fine(String mName, String pMsg) {
+      log("FINE", cName, mName, pMsg);
+   }
+
+   public void fine(String mName, String pMsg, Object pDetails) {
+      log("FINE", cName, mName, new Object[]{pMsg, pDetails});
+   }
+
+   public void info(String mName, String pMsg, Object[] pDetails) {
+      log("INFO", cName, mName, pMsg, pDetails);
+   }
+
+   public void info(String mName, String pMsg) {
+      log("INFO", cName, mName, pMsg);
+   }
+
+   public void info(String mName, String pMsg, Object pDetails) {
+      log("INFO", cName, mName, new Object[]{pMsg, pDetails});
+   }
+
+   public void warn(String mName, String pMsg, Object[] pDetails) {
+      log("WARN", cName, mName, pMsg, pDetails);
+   }
+
+   public void warn(String mName, String pMsg) {
+      log("WARN", cName, mName, pMsg);
+   }
+
+   public void warn(String mName, String pMsg, Object pDetails) {
+      log("WARN", cName, mName, new Object[]{pMsg, pDetails});
+   }
+
+   public void error(String mName, String pMsg, Object[] pDetails) {
+      log("ERROR", cName, mName, pMsg, pDetails);
+   }
+
+   public void error(String mName, String pMsg) {
+      log("ERROR", cName, mName, pMsg);
+   }
+
+   public void error(String mName, String pMsg, Object pDetails) {
+      log("ERROR", cName, mName, new Object[]{pMsg, pDetails});
+   }
+
+	public void entering(String mName, Object[] pDetails) {
+      log("->", cName, mName, pDetails);
+	}
+
+	public void entering(String mName) {
+      log("->", cName, mName, (Object[]) null);
+	}
+
+	public void entering(String mName, Object pDetails) {
+      log("->", cName, mName, new Object[]{pDetails});
+	}
+
+	public void exiting(String mName, Object[] pDetails) {
+      log("<-", cName, mName, pDetails);
+	}
+
+	public void exiting(String mName) {
+      log("<-", cName, mName, (Object[]) null);
+	}
+
+	public void exiting(String mName, Object pDetails) {
+      log("<-", cName, mName, new Object[]{pDetails});
+	}
+
+	public void throwing(String mName, Throwable pThrowable) {
+      StringWriter sw = new StringWriter();
+      pThrowable.printStackTrace(new PrintWriter(sw));
+      log("THROWABLE", cName, mName, sw.toString());
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintStreamLogger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintStreamLogger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintStreamLogger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.io.PrintStream;
+
+
+/** <p>A Logger implementation writing to an instance of
+ * {@link PrintStream}.</p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class PrintStreamLogger extends LoggerImpl {
+   private PrintStream stream;
+
+	public PrintStreamLogger(String pCName, PrintStream pStream) {
+      super(pCName);
+      stream = pStream;
+	}
+
+   public void log(String pMsg) {
+      stream.println(pMsg);
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintWriterLogger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintWriterLogger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/PrintWriterLogger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.logging;
+
+import java.io.PrintWriter;
+
+
+/** <p>A Logger implementation writing to an instance of
+ * {@link PrintWriter}.</p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class PrintWriterLogger extends LoggerImpl {
+   private PrintWriter writer;
+
+	public PrintWriterLogger(String pCName, PrintWriter pWriter) {
+      super(pCName);
+      writer = pWriter;
+	}
+
+   public void log(String pMsg) {
+      writer.println(pMsg);
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/logging/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html><head><title>The logging framework</title></head>
+<body>
+<h1>The logging framework</h1>
+<p>This package provides a minimal logging framework. The approach
+is simplistic and designed for reuse of existing other frameworks.
+In particular, log4j and the java.util.logging package are being
+supported. So is logging to System.err.</p>
+<p>Logging works by obtaining a Logger. The Logger is an implementation
+of {@link org.apache.ws.jaxme.logging.Logger}.´To get a Logger, use the
+{@link org.apache.ws.jaxme.logging.LoggerFactory}. Available implementations
+of Logger use the log4j framework, the Java logging framework, or
+System.err. To choose a certain Logger, use the system property
+<code>org.apache.ws.jaxme.logging.LoggerFactory</code> or
+the resource <code>META-INF/services/org.apache.ws.jaxme.logging.LoggerFactory</code>.
+If neither is present, a default implementation will be created.</p>
+</body></html>

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BinaryColumn.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BinaryColumn.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BinaryColumn.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** <p>Interface of a column with datatype {@link Column.Type#BINARY}
+ * or {@link Column.Type#VARBINARY}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface BinaryColumn extends Column {
+  /** <p>Returns whether the column has fixed or variable length.</p>
+   */
+  public boolean hasFixedLength();
+
+  /** <p>If the column has fixed length: Sets the columns length.
+   * Otherwise sets the columns maximum length.</p>
+   */
+  public void setLength(Long pLength);
+
+  /** <p>Shortcut for <code>setLength(new Integer(pLength))</code>.</p>
+   */
+  public void setLength(long pLength);
+
+  /** <p>If the column has fixed length: Returns the columns length.
+   * Otherwise returns the columns maximum length.</p>
+   */
+  public Long getLength();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BooleanConstraint.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BooleanConstraint.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/BooleanConstraint.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls;
+
+import org.apache.ws.jaxme.sqls.impl.BooleanConstraintImpl;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface BooleanConstraint extends Constraint, Parts {
+	/** <p>The type of a boolean constraint.</p>
+	 */
+	public interface Type {
+		/** A boolean constraint matching the "equal" condition.
+		 */
+		public static final Type EQ = new BooleanConstraintImpl.TypeImpl("EQ");
+		/** A boolean constraint matching the "not equal" condition.
+		 */
+		public static final Type NE = new BooleanConstraintImpl.TypeImpl("NE");
+		/** A boolean constraint matching the "lower than" condition.
+		 */
+		public static final Type LT = new BooleanConstraintImpl.TypeImpl("LT");
+		/** A boolean constraint matching the "greater than" condition.
+		 */
+		public static final Type GT = new BooleanConstraintImpl.TypeImpl("GT");
+		/** A boolean constraint matching the "lower or equal" condition.
+		 */
+		public static final Type LE = new BooleanConstraintImpl.TypeImpl("LE");
+		/** A boolean constraint matching the "greater or equal" condition.
+		 */
+		public static final Type GE = new BooleanConstraintImpl.TypeImpl("GE");
+		/** A boolean constraint matching the "LIKE" condition.
+		 */
+		public static final Type LIKE = new BooleanConstraintImpl.TypeImpl("LIKE");
+		/** A boolean constraint matching the "IS NULL" condition.
+		 */
+		public static final Type ISNULL = new BooleanConstraintImpl.TypeImpl("ISNULL");
+		/** A boolean constraint matching the "IN" condition.
+		 */
+		public static final Type IN = new BooleanConstraintImpl.TypeImpl("IN");
+		/** A boolean constraint matching the "EXISTS" condition.
+		 */
+		public static final Type EXISTS = new BooleanConstraintImpl.TypeImpl("EXISTS");
+		/** A boolean constraint matching the "BETWEEN" condition.
+		 */
+		public static final Type BETWEEN = new BooleanConstraintImpl.TypeImpl("BETWEEN");
+	}
+	
+	/** <p>Returns the boolean constraints type.</p>
+	 */
+	public BooleanConstraint.Type getType();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Case.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Case.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Case.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** Interface of a "case value when x then a when y then b else c end" statement
+ */
+public interface Case {
+	/** Interface of a single "when x then a" clause.
+	 */
+    public interface When {
+    	/** Returns the condition. In a "when x then a" clause
+         * the condition is "x".
+    	 */
+        public Object getCondition();
+        /** Returns the value. In a "when x then a" clause
+         * the condition is "a".
+         */
+        public Object getValue();
+    }
+
+    /** Sets the value being checked.
+     */
+    public void setCheckedValue(Object pValue);
+    /** Returns the value being checked.
+     */
+    public Object getCheckedValue();
+    /** Adds a new clause "when pCondition then pValue".
+     */
+    public void addWhen(Object pCondition, Object pValue);
+    /** Adds a new when clause.
+     */
+    public void addWhen(When pWhen);
+    /** Sets the value for the "else" clause.
+     */
+    public void setElseValue(Object pValue);
+    /** Returns the value for the "else" clause.
+     */
+    public Object getElseValue();
+    /** Returns the case clauses type.
+     */
+    public Column.Type getType();
+    /** Returns the array of "when" clauses.
+     */
+    public When[] getWhens();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Column.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Column.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Column.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.sql.Types;
+
+import org.apache.ws.jaxme.sqls.impl.ColumnImpl;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Column {
+  public interface Name extends SQLFactory.Ident {
+  }
+
+  public interface Type {
+    /** <p>Returns the types name. The types name is human readable.</p>
+     */
+    public String getName();
+    /** <p>Returns the types JDBC type. The JDBC type is a constant,
+     * as specified by {@link java.sql.Types}.</p>
+     */
+    public int getJDBCType();
+
+    public static final Type BIGINT = new ColumnImpl.TypeImpl("BIGINT", Types.BIGINT);
+    public static final Type BINARY = new ColumnImpl.TypeImpl("BINARY", Types.BINARY);
+    public static final Type BIT = new ColumnImpl.TypeImpl("BIT", Types.BIT);
+    public static final Type CHAR = new ColumnImpl.TypeImpl("CHAR", Types.CHAR);
+    public static final Type DATE = new ColumnImpl.TypeImpl("DATE", Types.DATE);
+    public static final Type INTEGER = new ColumnImpl.TypeImpl("INTEGER", Types.INTEGER);
+    public static final Type FLOAT = new ColumnImpl.TypeImpl("FLOAT", Types.FLOAT);
+    public static final Type DOUBLE = new ColumnImpl.TypeImpl("DOUBLE", Types.DOUBLE);
+    public static final Type SMALLINT = new ColumnImpl.TypeImpl("SMALLINT", Types.SMALLINT);
+    public static final Type TIME = new ColumnImpl.TypeImpl("TIME", Types.TIME);
+    public static final Type TIMESTAMP = new ColumnImpl.TypeImpl("TIMESTAMP", Types.TIMESTAMP);
+    public static final Type TINYINT = new ColumnImpl.TypeImpl("TINYINT", Types.TINYINT);
+    public static final Type VARCHAR = new ColumnImpl.TypeImpl("VARCHAR", Types.VARCHAR);
+    public static final Type VARBINARY = new ColumnImpl.TypeImpl("VARBINARY", Types.VARBINARY);
+    public static final Type BLOB = new ColumnImpl.TypeImpl("CLOB", Types.BLOB);
+    public static final Type OTHER = new ColumnImpl.TypeImpl("OTHER", Types.OTHER);
+    public static final Type CLOB = new ColumnImpl.TypeImpl("CLOB", Types.CLOB);
+  }
+
+  /** <p>Returns the columns table.</p>
+   */
+  public Table getTable();
+
+  /** <p>Returns the columns name.</p>
+   */
+  public Name getName();
+
+  /** <p>Returns the columns fully qualified name, which is
+   * <code>getTable().getQName() + "." + getName()</code>.</p>
+   */
+  public String getQName();
+
+  /** <p>Returns the columns type.</p>
+   */
+  public Type getType();
+
+  /** <p>Returns whether this column is part of the primary key.</p>
+   */
+  public boolean isPrimaryKeyPart();
+
+  /** <p>Sets whether the column is nullable. By default columns are not
+   * nullable.</p>
+   */
+  public void setNullable(boolean pNullable);
+
+  /** <p>Returns whether the column is nullable. By default columns are not
+   * nullable.</p>
+   */
+  public boolean isNullable();
+
+  /** <p>Returns whether this Column may be casted to a {@link StringColumn}.</p>
+   */
+  public boolean isStringColumn();
+
+  /** <p>Returns whether this Column may be casted to a {@link BinaryColumn}.</p>
+   */
+  public boolean isBinaryColumn();
+
+  /** <p>Allows the user to attach application specific data to the column.</p>
+   */
+  public void setCustomData(Object pData);
+
+  /** <p>Allows the user to retrieve application specific data, which has
+   * previously been attached to the column.</p>
+   */
+  public Object getCustomData();
+
+  /** <p>Returns whether this column is a true column or a virtual column.</p>
+   */
+  public boolean isVirtual();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnReference.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnReference.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnReference.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>Interface of a column reference.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ColumnReference {
+   /** <p>Returns the {@link TableReference} that created the
+    * column reference.</p>
+    */
+   public TableReference getTableReference();
+
+   /** <p>Returns the referenced {@link Column}.</p>
+    */
+   public Column getColumn();
+
+   /** <p>Sets the references alias name, if any. Null indicates,
+    * that an alias name may be choosen.</p>
+    */
+   public void setAlias(String pName);
+
+   /** <p>Sets the references alias name, if any. Null indicates,
+    * that an alias name may be choosen.</p>
+    */
+   public void setAlias(Column.Name pName);
+
+   /** <p>Returns the references alias name, if any. Null indicates,
+    * that an alias name may be choosen.</p>
+    */
+   public Column.Name getAlias();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnSet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnSet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ColumnSet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Iterator;
+
+/** <p>A common base interface for {@link Index} and {@link ForeignKey}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ColumnSet {
+   /** <p>Returns the table on which the foreign key is defined.</p>
+   */
+  public Table getTable();
+
+   /** <p>Returns the column sets columns. In the case of an {@link Index},
+    * these are the columns that have been added via {@link Index#addColumn(Column)}.
+    * In the case of a {@link ForeignKey}, these are the local columns of
+    * column links.</p>
+   */
+  public Iterator getColumns();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/CombinedConstraint.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/CombinedConstraint.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/CombinedConstraint.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.ws.jaxme.sqls.impl.CombinedConstraintImpl;
+
+
+/** Interface of a <code>WHERE</code> or <code>ON</code>
+ * clause.
+ */
+public interface CombinedConstraint extends Constraint {
+	/** Specifies, how the various boolean constraints are
+     * combined.
+	 */
+    public interface Type {
+        /** Specifies, that boolean constraints are combined with a
+         * boolean <code>AND</code>.
+         */
+    	public final static Type AND = new CombinedConstraintImpl.TypeImpl("AND");
+        /** Specifies, that boolean constraints are combined with a
+         * boolean <code>OR</code>.
+         */
+    	public final static Type OR = new CombinedConstraintImpl.TypeImpl("OR");
+    }
+
+   /** Returns the type, either of
+    * {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type#AND} or
+    * {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type#OR}.
+    */
+   public CombinedConstraint.Type getType();
+
+   /** Creates an AndConstraint and inserts it at the current position.
+    */
+   public CombinedConstraint createAndConstraint();
+
+   /** Creates an OrConstraint and inserts it at the current position.
+    */
+   public CombinedConstraint createOrConstraint();
+
+   /** Creates an "equals" condition (=) and inserts it at the current position.
+    */
+   public BooleanConstraint createEQ();
+
+   /** Creates a "not equals" condition (<>) and inserts it at the current position.
+    */
+   public BooleanConstraint createNE();
+
+   /** Creates a "lower than" condition (<) and inserts it at the current position.
+    */
+   public BooleanConstraint createLT();
+
+   /** Creates a "greater than" condition (>) and inserts it at the current position.
+    */
+   public BooleanConstraint createGT();
+
+   /** Creates a "lower or equal" condition (<=) and inserts it at the current position.
+    */
+   public BooleanConstraint createLE();
+
+   /** Creates a "greater or equal" condition (>=) and inserts it at the current position.
+    */
+   public BooleanConstraint createGE();
+
+   /** Creates a "LIKE" condition and inserts it at the current position.
+    */
+   public BooleanConstraint createLIKE();
+
+   /** Creates an "IS NULL" condition and inserts it at the current position.
+    */
+   public BooleanConstraint createISNULL();
+
+   /** Creates an "IN" condition and inserts it at the current position.
+    */
+   public BooleanConstraint createIN();
+
+   /** Creates an "EXISTS" condition with the given select
+    * statement and inserts it at the current position.
+    */
+   public void createEXISTS(SelectStatement pStatement);
+
+   /** Creates a "BETWEEN" condition with the given select
+    * statement and inserts it at the current position.
+    */
+   public BooleanConstraint createBETWEEN();
+
+   /** Creates a JOIN condition matching the given foreign key. In other
+    * words, if the foreign key consists of the columns <code>A</code> and
+    * <code>B</code> referencing the columns <code>X</code> and <code>Y</code>,
+    * then the following will be added: <code>A=X AND B=Y</code>.
+    * @param pKey The foreign key being matched.
+    * @param pReferencingTable A reference to the table returned by the
+    *   foreign keys {@link org.apache.ws.jaxme.sqls.ForeignKey#getTable()}
+    *   method.
+    * @param pReferencedTable A reference to the table returned by the
+    *   foreign keys {@link org.apache.ws.jaxme.sqls.ForeignKey#getReferencedTable()}
+    *   method.
+    */
+   public void addJoin(ForeignKey pKey, TableReference pReferencingTable,
+                       TableReference pReferencedTable);
+
+   /** Creates a JOIN condition matching the given column reference.
+    * In other words, if the referencing
+    * {@link org.apache.ws.jaxme.sqls.ColumnSet} contains the
+    * columns A and B, and the referenced column set contains
+    * {@link org.apache.ws.jaxme.sqls.ColumnSet},
+    * X and Y, then the following will be added: <code>A=X AND B=Y</code>.
+    */
+   public void addJoin(TableReference pReferencingTable,
+                       ColumnSet pReferencingColumnSet,
+                       TableReference pReferencedTable,
+                       ColumnSet pReferencedColumnSet);
+
+   /** Clones the given {@link org.apache.ws.jaxme.sqls.Constraint},
+    * mapping the column references
+    * from the given constraint to the values in the given map.
+    * @param pMap A Map with the constraints <code>pConstraint</code> table
+    *   references as keys. The values are table references of the current
+    *   constraints statement.
+    * @param pConstraint The constraint being cloned.
+    */
+   public void addConstraint(Map pMap, Constraint pConstraint);
+
+   /** Adds a check for the columns of the given column set. For example,
+    * if the column set consists of the columns <code>A</code> and <code>B</code>,
+    * then the following will be added: <code>A=? AND B=?</code>.
+    */
+   public void addColumnSetQuery(ColumnSet pSet, TableReference pTableReference);
+
+   /** Returns the number of parts, that have been added with the
+    * various <code>createSomething()</code> methods.
+    */
+   public int getNumParts();
+
+   /** Returns an Iterator to the parts, that have been added with the
+    * various <code>createSomething()</code> methods.
+    */
+   public Iterator getParts();
+
+   /** Returns whether the combined constraint is inverted by adding
+    * a prepending <code>NOT</code>.
+    */
+   public boolean isNOT();
+
+   /** Sets whether the combined constraint is inverted by adding
+    * a prepending <code>NOT</code>.
+    */
+   public void setNOT(boolean pNOT);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ConstrainedStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ConstrainedStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ConstrainedStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** <p>Interface of a {@link org.apache.ws.jaxme.sqls.Statement} supporting
+ * a WHERE clause.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ConstrainedStatement extends Statement {
+   /** <p>Returns a combined constraint with {@link CombinedConstraint#getType()}
+    * == {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type#AND}.</p>
+    */
+   public CombinedConstraint getWhere();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Constraint.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Constraint.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Constraint.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>Interface of a constraint, used in a WHERE or ON condition.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Constraint {
+   /** <p>Returns the enclosing {@link ConstrainedStatement}.</p>
+    */
+   public ConstrainedStatement getConstrainedStatement();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/DeleteStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/DeleteStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/DeleteStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface DeleteStatement extends ConstrainedStatement {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Expression.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Expression.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Expression.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+package org.apache.ws.jaxme.sqls;
+
+import org.apache.ws.jaxme.sqls.impl.ExpressionImpl;
+
+
+/** Interface of an arithmetic expression.
+ */
+public interface Expression extends Parts {
+	/** An expression: The sum of its parts.
+	 */
+	public static final Type SUM = new ExpressionImpl.TypeImpl("SUM");
+	/** An expression: The product of its parts.
+	 */
+	public static final Type PRODUCT = new ExpressionImpl.TypeImpl("PRODUCT");
+	/** An expression: The difference of its two parts.
+	 */
+	public static final Type DIFFERENCE = new ExpressionImpl.TypeImpl("DIFFERENCE");
+	/** An expression: The quotient of its two parts.
+	 */
+	public static final Type QUOTIENT = new ExpressionImpl.TypeImpl("QUOTIENT");
+
+	/** <p>The type of a boolean constraint.</p>
+	 */
+	public interface Type extends SQLFactory.Ident {
+	}
+
+	/** Returns the expression type.
+	 */
+	public Type getType();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ForeignKey.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ForeignKey.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ForeignKey.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+
+/** <p>Interface of a foreign key.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ForeignKey extends ColumnSet {
+   public class Mode implements Serializable {
+      private String name;
+      private Mode(String pName) {
+         name = pName;
+      }
+      public String getName() { return name; }
+      public String toString() { return name; }
+      public static final Mode CASCADE = new Mode("CASCADE");
+      public static final Mode REJECT = new Mode("REJECT");
+      public static final Mode SETNULL = new Mode("SETNULL");
+      private static final Mode[] instances = new Mode[]{
+         CASCADE, REJECT, SETNULL
+      };
+      public static Mode[] getInstances() {
+         return instances;
+      }
+      public static Mode valueOf(String pMode) {
+         for (int i = 0;  i < instances.length;  i++) {
+            if (instances[i].getName().equals(pMode)) {
+               return instances[i];
+            }
+         }
+         throw new IllegalArgumentException("Unknown mode: " + pMode);
+      }
+      public int hashCode() {
+         return name.hashCode();
+      }
+      public boolean equals(Object o) {
+         return o != null  &&  (o instanceof Mode)  &&  name.equals(((Mode) o).name);
+      }
+   }
+
+   public interface ColumnLink {
+      /** <p>Returns the column referencing a column in the referenced
+       * table.</p>
+       */
+      public Column getLocalColumn();
+      /** <p>Returns the column being referenced in the referenced
+       * table.</p>
+       */
+      public Column getReferencedColumn();
+   }
+
+   /** <p>Returns the referenced table.</p>
+    */
+   public Table getReferencedTable();
+
+   /** <p>Sets the OnDelete mode.</p>
+    */
+   public void setOnDelete(Mode pMode);
+
+   /** <p>Returns the OnDelete mode.</p>
+    */
+   public Mode getOnDelete();
+
+   /** <p>Sets the OnUpdate mode.</p>
+    */
+   public void setOnUpdate(Mode pMode);
+
+   /** <p>Returns the OnUpdate mode.</p>
+    */
+   public Mode getOnUpdate();
+
+   /** <p>Adds a reference between the given columns.</p>
+    * @param pColumn A column of the table, on which the foreign key is
+    *   defined
+    * @param pReferencedColumn A column of the referenced table
+    */
+   public void addColumnLink(Column pColumn, Column pReferencedColumn);
+
+   /** <p>Adds a reference between the given columns.</p>
+    * @param pName Column name of the table, on which the foreign
+    *   key is defined
+    * @param pReferencedName Column name of the referenced table.
+    */
+   public void addColumnLink(Column.Name pName, Column.Name pReferencedName);
+
+   /** <p>Adds a reference between the given columns.</p>
+    * @param pName Column name of the table, on which the foreign
+    *   key is defined
+    * @param pReferencedName Column name of the referenced table.
+    */
+   public void addColumnLink(String pName, String pReferencedName);
+
+   /** <p>Returns all column references in the foreign key. Any instance
+    * returned by the {@link Iterator} is an instance of
+    * {@link ForeignKey.ColumnLink}.</p>
+    */
+   public Iterator getColumnLinks();
+
+   /** <p>Returns the set of referenced columns.</p>
+    */
+   public ColumnSet getReferencedColumns();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Function.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Function.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Function.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Function extends Parts {
+  /** <p>Returns the functions name.</p>
+   */
+  public String getName();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Index.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Index.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Index.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** <p>Interface of an index declaration.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Index extends ColumnSet {
+   public interface Name extends SQLFactory.Ident {
+   }
+
+   /** <p>Sets the index name. Explicit setting of an index name
+    * is not required.</p>
+    */
+   public void setName(Index.Name pName);
+   /** <p>Sets the index name. Explicit setting of an index name
+    * is not required.</p>
+    */
+   public void setName(String pName);
+   /** <p>Returns the index name. Explicit setting of an index name
+    * is not required.</p>
+    */
+   public Index.Name getName();
+   /** <p>Adds a column to the index. The column must have the
+    * same table.</p>
+    */
+   public void addColumn(Column pColumn);
+
+   /** <p>Adds the column with the given name to the index
+    * by invoking {@link #addColumn(Column)}.</p>
+    */
+   public void addColumn(Column.Name pName);
+
+   /** <p>Adds the column with the given name to the index
+    * by invoking {@link #addColumn(Column)}.</p>
+    */
+   public void addColumn(String pName);
+
+   /** <p>Returns whether the index is unique.</p>
+    */
+   public boolean isUnique();
+
+   /** <p>Returns whether the index is a primary key index.</p>
+    */
+   public boolean isPrimaryKey();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/InsertStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/InsertStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/InsertStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** <p>Interface of an INSERT statement.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface InsertStatement extends SetStatement {
+      /** <p>Adds a subselect; the columns returned by the subselect
+       * will be inserted. This is used for bulk inserts like
+       * <code>INSERT INTO foo (col1, col2, col2) (SELECT * FROM ...)</code>.</p>
+       * @param pStatement The statement being performed to create
+       *   the rows being inserted.
+       */
+      public void setSubSelect(SelectStatement pStatement);
+
+      /** <p>Returns a subselect previously being added with
+       * {@link #setSubSelect(SelectStatement)}, or null.</p>
+       */
+      public SelectStatement getSubSelect();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/JoinReference.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/JoinReference.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/JoinReference.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>This interface allows to specify join constraints.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JoinReference extends SelectTableReference {
+   /** <p>Returns whether this is a left join, as created by
+    * {@link SelectTableReference#join(Table)}.</p>
+    */
+   public boolean isJoin();
+
+   /** <p>Returns whether this is a left outer join, as created by
+    * {@link SelectTableReference#leftOuterJoin(Table)}.</p>
+    */
+   public boolean isLeftOuterJoin();
+
+   /** <p>If this is a left join or a left outer join: Returns
+    * the joins left table.</p>
+    */
+   public SelectTableReference getLeftJoinedTableReference();
+
+   /** <p>Returns the references ON condition, if any. The method
+    * result is a combined constraint with {@link CombinedConstraint#getType()}
+    * == {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type#AND}.</p>
+    */
+   public CombinedConstraint getOn();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ObjectFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ObjectFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/ObjectFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls;
+
+import org.apache.ws.jaxme.sqls.Expression.Type;
+
+
+/** A factory object for creating all the objects used by
+ * the SQL factory.
+ */
+public interface ObjectFactory {
+    /** Returns an instance of
+     * {@link org.apache.ws.jaxme.sqls.RawSQLCode}.
+     */
+    public RawSQLCode newRawSQL(String pRawSQLCode);
+    
+    /** <p>Returns an instance of
+     * {@link org.apache.ws.jaxme.sqls.JoinReference}.</p>
+     */
+    public JoinReference newJoinReference(SelectTableReference pSelectTableReference,
+            Table pTable,
+            boolean pIsLeftOuterJoin);
+    
+    /** Returns an instance of {@link org.apache.ws.jaxme.sqls.Function}.
+     */
+    public Function newFunction(Statement pStatement, String pName);
+    
+    /** Returns an instance of
+     * {@link org.apache.ws.jaxme.sqls.Table}, which allows to embed
+     * the given instance of
+     * {@link org.apache.ws.jaxme.sqls.SelectStatement} into another
+     * SELECT statement.
+     */
+    public Table newView(SelectStatement pSelectStatement, Table.Name pName);
+
+    /** Creates a new instance of
+     * {@link org.apache.ws.jaxme.sqls.Constraint} constraining
+     * the given {@link org.apache.ws.jaxme.sqls.ConstrainedStatement}.
+     */
+    public CombinedConstraint newCombinedConstraint(ConstrainedStatement pStatement,
+            										CombinedConstraint.Type pType);
+
+    /** Creates a new instance of {@link org.apache.ws.jaxme.sqls.Case}.
+     */
+    public Case newCase(Column.Type pType);
+
+    /** Creates a new instance of {@link ColumnReference}.
+     */
+    public ColumnReference newColumnReference(TableReference pTableReference, Column pColumn);
+
+	/** Creates a new instance of {@link Expression}.
+	 */
+	public Expression createExpression(Statement pStatement, Type sum);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Parts.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Parts.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Parts.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Parts {
+  /** <p>Inserts a constant value.</p>
+   */
+  public void addPart(Value pValue);
+
+  /** <p>Inserts a column reference.</p>
+   */
+  public void addPart(ColumnReference pColumn);
+
+  /** <p>Inserts a set of column references.</p>
+   */
+  public void addPart(ColumnReference[] pPart);
+
+  /** Inserts a "case foo when x then a when y then b else c end"
+   * clause.
+   */
+  public void addPart(Case pCase);
+
+  /** <p>Inserts a subselect.</p>
+   */
+  public void addPart(SelectStatement pPart);
+  
+  /** <p>Inserts a String. The String will be properly escaped.</p>
+   * @throws NullPointerException The paremeter <code>pString</code> is null.
+   */
+  public void addPart(String pString);
+  
+  /** <p>Inserts a NULL value.</p>
+   */
+  public void addPart();
+  
+  /** <p>Inserts a byte value, which will be inserted without quotes.</p>
+   */
+  public void addPart(byte pByte);
+  
+  /** <p>Inserts an int value, which will be inserted without quotes.</p>
+   */
+  public void addPart(int pInt);
+  
+  /** <p>Inserts a long value, which will be inserted without quotes.</p>
+   */
+  public void addPart(long pLong);
+  
+  /** <p>Inserts a short value, which will be inserted without quotes.</p>
+   */
+  public void addPart(short pShort);
+  
+  /** <p>Inserts a float value, which will be inserted without quotes.</p>
+   */
+  public void addPart(float pFloat);
+  
+  /** <p>Inserts a double value, which will be inserted without quotes.</p>
+   */
+  public void addPart(double pDouble);
+  
+  /** <p>Inserts a boolean value, which will be inserted as the word
+   * <code>TRUE</code>, or <code>FALSE</code>, respectively.</p>
+   */
+  public void addPart(boolean pBoolean);
+
+  /** <p>Inserts a function.</p>
+   */
+  public void addPart(Function pFunction);
+
+  /** Inserts an arithmetic expression.
+   */
+  public void addPart(Expression pExpression);
+
+  /** <p>Inserts raw SQL code.</p>
+   */ 
+  public void addRawSQLPart(String pRawSQL);
+  
+  /** <p>Inserts a placeholder.</p>
+   */
+  public void addPlaceholder();
+  
+  /** <p>Returns the number of parts.</p>
+   */
+  public int getNumParts();
+
+  /** Returns the minimum number of parts.
+   */
+  public int getMinimumParts();
+
+  /** Returns the maximum number of parts. Zero indicates unlimited.
+   */
+  public int getMaximumParts();
+
+  /** <p>Returns an Iterator to the parts that have been added.</p>
+   */
+  public Iterator getParts();
+
+  	/** Creates an arithmetic sum.
+	 */
+	public Expression createSUM();
+
+	/** Creates an arithmetic product.
+	 */
+	public Expression createPRODUCT();
+
+	/** Creates an arithmetic difference.
+	 */
+	public Expression createDIFFERENCE();
+
+	/** Creates an arithmetic quotient.
+	 */
+	public Expression createQUOTIENT();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/RawSQLCode.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/RawSQLCode.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/RawSQLCode.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>An instance of {@link RawSQLCode} is used to
+ * insert raw SQL code into the statement.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface RawSQLCode {
+  /** <p>Returns the piece of raw SQL code.</p>
+   */
+  public String getRawSQL();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Iterator;
+
+
+/** <p>A factory for generating SQL statements.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SQLFactory {
+  public interface Ident {
+    /** <p>Returns the SQL identifiers String representation. Typically
+     * same than {@link Object#toString()}.</p>
+     */
+    public String getName();
+  }
+
+  /** <p>Returns the object factory being used.</p>
+   */
+  public ObjectFactory getObjectFactory();
+
+  /** <p>Returns the maximum length of a table name.</p>
+   *
+   * @return The maximum length or null, if checks for valid table name
+   *   length are disabled.
+   */
+  public Integer getMaxTableNameLength();
+
+  /** <p>Returns whether table names are case sensitive or not. Defaults to
+   * false.</p>
+   */
+  public boolean isTableNameCaseSensitive();
+
+  /** <p>Returns the maximum length of a schema name.</p>
+   *
+   * @return The maximum length or null, if checks for valid schema name
+   *   length are disabled.
+   */
+  public Integer getMaxSchemaNameLength();
+
+  /** <p>Returns whether schema names are case sensitive or not. Defaults to
+   * false.</p>
+   */
+  public boolean isSchemaNameCaseSensitive();
+
+  /** <p>Returns the maximum length of a column name.</p>
+   *
+   * @return The maximum length or null, if checks for valid column name
+   *   length are disabled.
+   */
+  public Integer getMaxColumnNameLength();
+
+  /** <p>Returns whether column names are case sensitive or not. Defaults to
+   * false.</p>
+   */
+  public boolean isColumnNameCaseSensitive();
+
+  /** <p>Creates a new SELECT statement.</p>
+   */
+  public SelectStatement newSelectStatement();
+
+  /** <p>Creates a new INSERT statement.</p>
+   */
+  public InsertStatement newInsertStatement();
+
+  /** <p>Creates a new UPDATE statement.</p>
+   */
+  public UpdateStatement newUpdateStatement();
+
+  /** <p>Creates a new DELETE statement.</p>
+   */
+  public DeleteStatement newDeleteStatement();
+
+  /** <p>Creates a new {@link Schema} with the given name.</p>
+   */
+  public Schema newSchema(String pName);
+
+  /** <p>Creates a new {@link Schema} with the given name.</p>
+   */
+  public Schema newSchema(Schema.Name pName);
+
+  /** <p>Returns the {@link Schema Default schema}. The default
+   * schema has the name null.</p>
+   */
+  public Schema getDefaultSchema();
+
+  /** <p>Returns the schema with the given name or null, if no such
+   * schema exists.</p>
+   */
+  public Schema getSchema(Schema.Name pName);
+
+  /** <p>Returns the schema with the given name or null, if no such
+   * schema exists.</p>
+   */
+  public Schema getSchema(String pName);
+
+  /** <p>Returns a list of all schemas. The list includes the default
+   * schema, if {@link #getDefaultSchema()} was called at any time.</p>
+   */
+  public Iterator getSchemas();
+
+  /** <p>Creates a new {@link SQLGenerator}.</p>
+   */
+  public SQLGenerator newSQLGenerator();
+
+  /** <p>Reads the schema named <code>pName</code> from the database.</p>
+   */
+  public Schema getSchema(Connection pConnection, Schema.Name pName) throws SQLException;
+
+  /** <p>Reads the schema named <code>pName</code> from the database.</p>
+   */
+  public Schema getSchema(Connection pConnection, String pName) throws SQLException;
+
+  /** <p>Reads the table named <code>pTable</code> from the schema
+   * named <code>pSchema</code> in the database.</p>
+   */
+  public Table getTable(Connection pConnection, Schema.Name pSchema, Table.Name pTable) throws SQLException;
+
+  /** <p>Reads the table named <code>pTable</code> from the schema
+   * named <code>pSchema</code> in the database.</p>
+   */
+  public Table getTable(Connection pConnection, String pSchema,String pTable) throws SQLException;
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SQLGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Collection;
+
+
+/** <p>An SQL generator.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SQLGenerator {
+  /** <p>Generates a <code>CREATE SCHEMA</code> statement. Doesn't create
+   * <code>CREATE TABLE</code> or similar statements.</p>
+   */
+  public Collection getCreate(Schema pSchema);
+
+  /** <p>Generates <code>CREATE</code> statements for the schema.</p>
+   * @param pAll If this parameter is set to true, then the method is
+   *    equivalent to  {@link #getCreate(Schema)}. Otherwise the returned
+   *    collection will also include <code>CREATE</code> statements for
+   *    all the tables and indexes in the schema. These additional statements
+   *    are created by invoking {@link #getCreate(Table,boolean)} for all the
+   *    tables in the schema.</p>
+   */
+  public Collection getCreate(Schema pSchema, boolean pAll);
+
+  /** <p>Generates a DROP SCHEMA statement. Doesn't create
+   * <code>DROP TABLE</code> or similar statements.</p>
+   */
+  public Collection getDrop(Schema pSchema);
+
+  /** <p>Generates <code>DROP</code> statements for the schema.</p>
+   * @param pAll If this parameter is set to true, then the method is
+   *    equivalent to  {@link #getDrop(Schema)}. Otherwise the returned
+   *    collection will also include <code>DROP</code> statements for
+   *    all the tables and indexes in the schema. These additional statements
+   *    are created by invoking {@link #getDrop(Table,boolean)} for all the
+   *    tables in the schema.</p>
+   */
+  public Collection getDrop(Schema pSchema, boolean pAll);
+
+  /** <p>Generates a CREATE TABLE statement. Doesn't create
+   * <code>CREATE INDEX</code> or similar statements.</p>
+   */
+  public Collection getCreate(Table pTable);
+
+  /** <p>Generates <code>CREATE</code> statements for the table.</p>
+   * @param pAll If this parameter is set to true, then the method is
+   *    equivalent to  {@link #getCreate(Table)}. Otherwise the returned
+   *    collection will also include <code>CREATE</code> statements for
+   *    the indexes, which are defined on the table. These additional
+   *    statements are created by invoking {@link #getCreate(Index)}
+   *    and {@link #getCreate(ForeignKey)} for all the indexes in the
+   *    schema.</p>
+   */
+  public Collection getCreate(Table pTable, boolean pAll);
+
+  /** <p>Generates a DROP TABLE statement. Doesn't create
+   * <code>DROP INDEX</code> or similar statements.</p>
+   */
+  public Collection getDrop(Table pTable);
+
+  /** <p>Generates <code>DROP</code> statements for the table.</p>
+   * @param pAll If this parameter is set to true, then the method is
+   *    equivalent to  {@link #getDrop(Table)}. Otherwise the returned
+   *    collection will also include <code>DROP</code> statements for
+   *    the indexes, which are defined on the table. These additional
+   *    statements are created by invoking {@link #getDrop(Index)}
+   *    and {@link #getDrop(ForeignKey)} for all the indexes in the
+   *    schema.</p>
+   */
+  public Collection getDrop(Table pTable, boolean pAll);
+
+  /** <p>Generates a CREATE INDEX statement.</p>
+   */
+  public Collection getCreate(Index pIndex);
+
+  /** <p>Generates a DROP INDEX statement.</p>
+   */
+  public Collection getDrop(Index pIndex);
+
+  /** <p>Generates a CREATE FOREIGN KEY statement.</p>
+   */
+  public Collection getCreate(ForeignKey pKey);
+
+  /** <p>Generates a DROP FOEIGN KEY statement.</p>
+   */
+  public Collection getDrop(ForeignKey pKey);
+
+  /** <p>Generates an INSERT, UPDATE, DELETE or SELECT statement.</p>
+   */
+  public String getQuery(Statement pStatement);
+
+  /** <p>Generates the WHERE clause of a SELECT, UPDATE, or DELETE statement.</p>
+   */
+  public String getConstraint(Constraint pConstraint);
+
+  /** <p>Returns the <code>WHERE ... ORDER BY ...</code> part
+   * of the SELECT statement.</p>
+   */
+  public String getWhereClause(SelectStatement pQuery);
+
+  /** <p>Sets the statement terminator. A non-null value will be
+   * appended to all generated statements. Defaults to null.</p>
+   */
+  public void setStatementTerminator(String pTerminator);
+
+  /** <p>Returns the statement terminator. A non-null value will be
+   * appended to all generated statements. Defaults to null.</p>
+   */
+  public String getStatementTerminator();
+
+  /** <p>Sets the line terminator. A non-null value indicates that
+   * the generated statements should be made human readable by splitting
+   * them over multiple lines. A null value ensures that a statement
+   * consists of a single line only. Defaults to "\n".</p>
+   */
+  public void setLineTerminator(String pTerminator);
+
+  /** <p>Returns the line terminator. A non-null value indicates that
+   * the generated statements should be made human readable by splitting
+   * them over multiple lines. A null value ensures that a statement
+   * consists of a single line only. Defaults to "\n".</p>
+   */
+  public String getLineTerminator();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Schema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Schema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Schema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Iterator;
+
+
+/** <p>Interface of a database schema.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Schema {
+   public interface Name extends SQLFactory.Ident {
+   }
+
+   /** <p>Returns the {@link org.apache.ws.jaxme.sqls.SQLFactory}
+    * that created this instance of Schema.</p>
+    */
+   public SQLFactory getSQLFactory();
+
+   /** <p>Returns the schema name.</p>
+    */
+   public Name getName();   
+
+   /** <p>Creates a new table with the given name in the schema.</p>
+    */
+   public Table newTable(String pName);
+
+   /** <p>Creates a new table with the given name in the schema.</p>
+    */
+   public Table newTable(Table.Name pName);
+
+   /** <p>Returns the table with the given name or null, if no such table exists
+    * in the schema.</p>
+    */
+   public Table getTable(Table.Name pName);
+
+   /** <p>Returns the table with the given name or null, if no such table exists
+    * in the schema.</p>
+    */
+   public Table getTable(String pName);
+
+   /** <p>Returns an {@link Iterator} to all tables in the schema.</p>
+    */
+   public Iterator getTables();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Iterator;
+
+
+/** <p>Interface of a SELECT statement.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SelectStatement extends ConstrainedStatement {
+	/** Provides a single column for an <code>ORDER BY</code>
+     * clause.
+	 */
+    public interface OrderColumn {
+      /** <p>Returns the ordered column. Typically, this is
+       * a {@link ColumnReference}. However, it may as well
+       * be a {@link Function} or a piece of {@link RawSQLCode}.</p>
+       */
+      public Object getColumn();
+
+      /** <p>Returns whether ascending (false) or descending (true)
+       * sorting is requested.</p>
+       */
+      public boolean isDescending();
+   }
+
+   /** <p>Shortcut for <code>(SelectTableReference) getTable()</code>.</p>
+    */
+   public SelectTableReference getSelectTableReference();
+
+   /** <p>Returns an Iterator over all the table references.</p>
+    */
+   public Iterator getSelectTableReferences();
+
+   /** <p>Adds a column to the ORDER BY clause.</p>
+    */
+   public void addOrderColumn(OrderColumn pColumn);
+
+   /** <p>Adds a column to the ORDER BY clause. The column is sorted in
+    * ascending order.</p>
+    */
+   public void addOrderColumn(Object pColumn);
+
+   /** <p>Adds a column to the ORDER BY clause. The column is sorted in
+    * ascending or descending order, depending on the parameter
+    * <code>pDescending</code>.</p>
+    * @param pDescending True for descending or false for ascending
+    */
+   public void addOrderColumn(Object pColumn, boolean pDescending);
+
+   /** <p>Adds a result column to the statement. By default all columns
+    * are returned.</p>
+    */
+   public void addResultColumn(ColumnReference pColumn);
+
+   /** <p>Returns the list of result columns.</p>
+    */
+   public Iterator getResultColumns();
+
+   /** <p>Returns the list of order columns. The elements
+    * returned by the iterator are instances of
+    * {@link SelectStatement.OrderColumn}.</p>
+    */
+   public Iterator getOrderColumns();
+
+   /** <p>Sets whether the statement should have a DISTINCT clause. By
+    * default no DISTINCT clause is present.</p>
+    */
+   public void setDistinct(boolean pDistinct);
+
+   /** <p>Returns whether the statement should have a DISTINCT clause. By
+    * default no DISTINCT clause is present.</p>
+    */
+   public boolean isDistinct();
+
+   /** <p>Limits the size of the result set to the given number of rows.
+    * Defaults to zero, in which case the size of the result set is
+    * unlimited.</p>
+    */
+   public void setMaxRows(int pMaxRows);
+
+   /** <p>Returns the limit of the number of rows in the result set, or
+    * zero, if the size of the result set is unlimited.</p>
+    */
+   public int getMaxRows();
+
+   /** <p>Indicates that the given number of rows should be skipped at the
+    * result sets beginning. The default is zero, in which case no rows
+    * are skipped.</p>
+    */
+   public void setSkippedRows(int pSkippedRows);
+
+   /** <p>Returns the number of rows to skip at the result sets beginning.
+    * The default is zero, in which case no rows are skipped.</p>
+    */
+   public int getSkippedRows();
+
+   /** <p>Creates a view, which may be used to embed the statement into
+    * a separate query.</p>
+    */
+   public Table createView(Table.Name pName);
+
+
+   /** <p>Creates a view, which may be used to embed the statement into
+    * a separate query.</p>
+    */
+   public Table createView(String pName);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectTableReference.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectTableReference.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SelectTableReference.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>A TableReference being used in a SELECT statement. You
+ * may cast the result of
+ * {@link org.apache.ws.jaxme.sqls.SelectStatement#getTableReference}
+ * to an instance of SelectTableReference.</p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface SelectTableReference extends TableReference {
+   /** <p>Returns the {@link SelectStatement} that created the reference.
+    * Shortcut for <code>(SelectStatement) getStatement()</code>.</p>
+    */
+   public SelectStatement getSelectStatement();
+
+   /** <p>Indicates that the referenced table shall be joined
+    * with the given table <code>pTable</code> and returns a
+    * reference to that table.</p>
+    */
+   public JoinReference join(Table pTable);
+
+   /** <p>Indicates that the referenced table shall be joined
+    * in a left outer join with the given table <code>pTable</code>
+    * and returns a reference to that table.</p>
+    */
+   public JoinReference leftOuterJoin(Table pTable);
+
+   /** <p>Returns the right table of a possible join or null,
+    * if there is no such table.</p>
+    */
+   public JoinReference getRightJoinedTableReference();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SetStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SetStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/SetStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Calendar;
+import java.util.Iterator;
+
+
+/** A common base interface for {@link org.apache.ws.jaxme.sqls.InsertStatement}
+ * and {@link org.apache.ws.jaxme.sqls.UpdateStatement}.
+ */
+public interface SetStatement extends Statement {
+    /** A tupel of column name and value being assigned.
+     */
+    public interface SetValue {
+        /** Returns the column being set.
+         */
+        public ColumnReference getColumnReference();
+        /** Returns the value to which the column is being set.
+         */
+        public Object getValue();
+    }
+
+    /** Returns an {@link Iterator} to all values being set.
+     * Any element in the iterator is an instance of {@link SetValue}.
+     */
+    public Iterator getSetValues();
+
+    /** Adds a SET clause setting the given column to NULL.
+     */
+    public void addSetNull(Column pColumn);
+    /** Adds a SET clause setting the given column to NULL.
+     */
+    public void addSetNull(Column.Name pColumn);
+    /** Adds a SET clause setting the given column to NULL.
+     */
+    public void addSetNull(String pColumn);
+    
+    /** Adds a SET clause setting the given column to a value
+     * given by a placeholder.
+     */
+    public void addSet(Column pColumn);
+    /** Adds a SET clause setting the given column to a value
+     * given by a placeholder.
+     */
+    public void addSet(Column.Name pColumn);
+    /** Adds a SET clause setting the given column to a value
+     * given by a placeholder.
+     */
+    public void addSet(String pColumn);
+    
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, byte pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(Column.Name pColumn, byte pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(String pColumn, byte pValue);
+
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, short pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(Column.Name pColumn, short pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(String pColumn, short pValue);
+    
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, int pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(Column.Name pColumn, int pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(String pColumn, int pValue);
+    
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, long pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(Column.Name pColumn, long pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(String pColumn, long pValue);
+    
+    
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, float pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(Column.Name pColumn, float pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(String pColumn, float pValue);
+    
+    /** Adds a SET clause setting the given column to the value
+     * TRUE or FALSE, depending on <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, boolean pValue);
+    /** Adds a SET clause setting the given column to the value
+     * TRUE or FALSE, depending on <code>pValue<code>.
+     */
+    public void addSet(Column.Name pColumn, boolean pValue);
+    /** Adds a SET clause setting the given column to the value
+     * TRUE or FALSE, depending on <code>pValue<code>.
+     */
+    public void addSet(String pColumn, boolean pValue);
+    
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue<code>.
+     */
+    public void addSet(Column pColumn, String pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(Column.Name pColumn, String pValue);
+    /** Adds a SET clause setting the given column to the value
+     * <code>pValue</code>.
+     */
+    public void addSet(String pColumn, String pValue);
+    
+    /** Adds a SET clause setting the given column to the datetime
+     * value <code>pValue<code>.
+     */
+    public void addSetDateTime(Column pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the datetime
+     * value <code>pValue</code>.
+     */
+    public void addSetDateTime(Column.Name pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the datetime
+     * value <code>pValue</code>.
+     */
+    public void addSetDateTime(String pColumn, Calendar pValue);
+    
+    /** Adds a SET clause setting the given column to the time value
+     * <code>pValue<code>. Shortcut for
+     * <code>addSet(getTable().newColumnReference(pColumn), pValue)</code>.
+     */
+    public void addSetTime(Column pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the time value
+     * <code>pValue</code>. Shortcut for
+     * <code>addSet(getTable().newColumnReference(pColumn), pValue)</code>.
+     */
+    public void addSetTime(Column.Name pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the time value
+     * <code>pValue</code>.
+     */
+    public void addSetTime(String pColumn, Calendar pValue);
+    
+    /** Adds a SET clause setting the given column to the date value
+     * <code>pValue<code>.
+     */
+    public void addSetDate(Column pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the date value
+     * <code>pValue</code>.
+     */
+    public void addSetDate(Column.Name pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the date value
+     * <code>pValue</code>.
+     */
+    public void addSetDate(String pColumn, Calendar pValue);
+    /** Adds a SET clause setting the given column to the given value.
+     * The value may be, for example, a subselect, a function, or a
+     * piece of raw SQL code.
+     */
+    public void addSet(Column pColumn, Object pObject);
+    /** Adds a SET clause setting the given column to the given value.
+     * The value may be, for example, a subselect, a function, or a
+     * piece of raw SQL code.
+     */
+    public void addSet(String pColumn, Object pObject);
+    /** Adds a SET clause setting the given column to the given value.
+     * The value may be, for example, a subselect, a function, or a
+     * piece of raw SQL code.
+     */
+    public void addSet(Column.Name pColumn, Object pObject);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Statement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Statement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Statement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Statement {
+   /** <p>Returns the {@link org.apache.ws.jaxme.sqls.SQLFactory}
+    * that created this Statement.</p>
+    */
+   public SQLFactory getSQLFactory();
+
+   /** <p>Sets the table, for which the statement applies and returns
+    * a reference to the table.</p>
+    */
+   public TableReference setTable(Table pTable);
+
+   /** <p>Returns the table reference, for which the statement applies.</p>
+    */
+   public TableReference getTableReference();
+
+   /** <p>Creates a new function, which may be added to a
+    * {@link org.apache.ws.jaxme.sqls.BooleanConstraint}.</p>
+    */
+   public Function createFunction(String pName);
+
+   /** Creates a new instance of {@link Case}.
+    */
+   public Case newCase(Column.Type pType);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/StringColumn.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/StringColumn.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/StringColumn.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** <p>Interface of a column with datatype {@link Column.Type#CHAR}
+ * or {@link Column.Type#VARCHAR}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface StringColumn extends Column {
+  /** <p>Returns whether the column has fixed or variable length.</p>
+   */
+  public boolean hasFixedLength();
+
+  /** <p>If the column has fixed length: Sets the columns length.
+   * Otherwise sets the columns maximum length.</p>
+   */
+  public void setLength(Long pLength);
+
+  /** <p>Shortcut for <code>setLength(new Integer(pLength))</code>.</p>
+   */
+  public void setLength(long pLength);
+
+  /** <p>If the column has fixed length: Returns the columns length.
+   * Otherwise returns the columns maximum length.</p>
+   */
+  public Long getLength();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Table.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Table.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Table.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+import java.util.Iterator;
+
+
+/** <p>Abstract description of a table.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Table {
+   public interface Name extends SQLFactory.Ident {
+   }
+
+   /** <p>Returns the table name.</p>
+    */
+   public Name getName();
+
+   /** <p>Returns the table schema.</p>
+    */
+   public Schema getSchema();
+
+   /** <p>Returns the table columns.</p>
+    */
+   public Iterator getColumns();
+
+   /** <p>Creates a new column.</p>
+    */
+   public Column newColumn(Column.Name name, Column.Type pType);
+
+   /** <p>Creates a new column.</p>
+    */
+   public Column newColumn(String name, Column.Type pType);
+
+   /** <p>Returns the column with the given name or null,
+    * if no such column exists.</p>
+    */
+   public Column getColumn(Column.Name name);
+
+   /** <p>Returns the column with the given name or null,
+    * if no such column exists.</p>
+    */
+   public Column getColumn(String name);
+
+   /** <p>Creates a new, unique index on the table.</p>
+    */
+   public Index newKey();
+
+   /** <p>Creates a new, non-unique index on the table.</p>
+    */
+   public Index newIndex();
+
+   /** <p>Creates a new primary key on the table.</p>
+    * @throws IllegalStateException A primary key has already been created.
+    */
+   public Index newPrimaryKey();
+
+   /** <p>Creates a new foreign key referencing the given table.</p>
+    */
+   public ForeignKey newForeignKey(Table pReferencedTable);
+
+  /** <p>Returns an INSERT statement for filling all the values. In
+   * other words: If the table FOO has the columns A, B, and C,
+   * then the statement <code>INSERT INTO FOO (A,B,C) VALUES (?, ?, ?)</code>
+   * will be returned.</p>
+   * @see SQLFactory#newInsertStatement()
+   */
+  public InsertStatement getInsertStatement();
+
+  /** <p>Returns a SELECT statement for selecting all the columns. In
+   * other words: If the table FOO has the columns A, B, and C,
+   * then the statement <code>SELECT A, B, C FROM FOO</code> will
+   * be returned.</p>
+   * @see SQLFactory#newSelectStatement()
+   */
+  public SelectStatement getSelectStatement();
+
+  /** <p>Returns an UPDATE statement for updating a column in the table.
+   * In other words: If the table FOO has the columns A, B, C and D
+   * with the primary key columns A and B, then the statement
+   * <code>UPDATE FOO SET C = ?, D = ? WHERE A = ? AND B = ?</code>
+   * will be returned.</p>
+   * @see SQLFactory#newUpdateStatement()
+   * @throws IllegalStateException The table doesn't have a primary key.
+   */
+  public UpdateStatement getUpdateStatement();
+
+  /** <p>Returns an UPDATE statement for updating a column in the table.
+   * In other words: If the table FOO has the primary key columns A and B,
+   * then the statement <code>DELETE FROM FOO WHERE A = ? AND B = ?</code>
+   * will be returned.</p>
+   * @see SQLFactory#newDeleteStatement()
+   * @throws IllegalStateException The table doesn't have a primary key.
+   */
+  public DeleteStatement getDeleteStatement();
+
+  /** <p>Returns the tables qualified name, which is
+   * <code>getSchema().getName() + "." + getName()</code>. If the
+   * schema is the default schema, returns <code>getName()</code>.</p> 
+   */
+  public String getQName();
+
+  /** <p>Returns the tables primary key, if any, or null, if the table
+   * doesn't have a primary key.</p>
+   */
+  public Index getPrimaryKey();
+
+  /** <p>Returns an {@link Iterator} to the indexes defined on the table.
+   * This iterator includes the primary key, if any.</p>
+   */
+  public Iterator getIndexes();
+
+  /** <p>Returns an {@link Iterator} to the foreign keys defined on the
+   * table.</p>
+   */
+  public Iterator getForeignKeys();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/TableReference.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/TableReference.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/TableReference.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>A table reference is used in the {@link Statement}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface TableReference {
+   /** <p>Returns the {@link Statement} that created the reference.</p>
+    */
+   public Statement getStatement();
+
+   /** <p>Returns the referenced {@link Table}.</p>
+    */
+   public Table getTable();
+
+   /** <p>Returns the references alias name. Null indicates that
+    * an arbitrary alias name may be choosen.</p>
+    */
+   public Table.Name getAlias();
+
+   /** <p>Sets the references alias name. Null indicates that
+    * an arbitrary alias name may be choosen.</p>
+    */
+   public void setAlias(Table.Name pName);
+
+   /** <p>Returns the references alias name. Null indicates that
+    * an arbitrary alias name may be choosen.</p>
+    */
+   public void setAlias(String pName);
+
+   /** <p>Returns a reference to the column named <code>pName</code>
+    * in the table.</p>
+    */
+   public ColumnReference newColumnReference(String pName);
+
+   /** <p>Returns a reference to the column named <code>pName</code>
+    * in the table.</p>
+    */
+   public ColumnReference newColumnReference(Column.Name pName);
+
+   /** <p>Returns a reference to the given column in the table.</p>
+    */
+   public ColumnReference newColumnReference(Column pColumn);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/UpdateStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/UpdateStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/UpdateStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+
+/** <p>Interface of an update statement.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface UpdateStatement extends ConstrainedStatement, SetStatement {
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Value.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Value.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/Value.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls;
+
+/** <p>An abstract value.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface Value {
+  public class Type {
+    private String name;
+    protected Type(String pName) {
+      name = pName;
+    }
+    public String toString() { return name; }
+    public String getName() { return name; }
+    public int hashCode() { return name.hashCode(); }
+    public boolean equals(Object o) {
+      return o != null  &&  o instanceof Type  &&
+          ((Type) o).name.equals(name);
+    }
+    public final static Type PLACEHOLDER = new Type("PLACEHOLDER");
+    public final static Type NULL = new Type("NULL");
+    public final static Type BOOLEAN = new Type("BOOLEAN");
+    public final static Type FLOAT = new Type("FLOAT");
+    public final static Type DOUBLE = new Type("DOUBLE");
+    public final static Type BYTE = new Type("BYTE");
+    public final static Type SHORT = new Type("SHORT");
+    public final static Type INT = new Type("INT");
+    public final static Type LONG = new Type("LONG");
+    public final static Type DATETIME = new Type("DATETIME");
+    public final static Type DATE = new Type("DATE");
+    public final static Type TIME = new Type("TIME");
+    public final static Type STRING = new Type("STRING");
+  }
+
+  /** <p>Returns the values type.</p>
+   */
+  public Type getType();
+
+  /** <p>Returns the actual value. This may be null.</p>
+   */
+  public Object getValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/BufferPool.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/BufferPool.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/BufferPool.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+
+/** <p>Interface of a DB2 BufferPool. This object is used to create a
+ * <code>CREATE BUFFERPOOL ...</code> statement.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface BufferPool {
+   public interface Name extends SQLFactory.Ident {
+   }
+
+   /** <p>Returns the BufferPool's name. BufferPool names are unique within the
+    * database.</p>
+    */
+   public Name getName();
+
+   /** <p>Returns the BufferPool's page size. See the secion "CREATE BUFFERPOOL"
+    * in the DB2 reference manual for limitations on the value. Examples: 8192
+    * (bytes) or 8K (Kilobytes).</p>
+    * <p>Default is null, in which case the DB2 default (4K, as of this writing)
+    * applies.</p>
+    */
+   public PageSize getPageSize();
+
+   /** <p>Returns the buffer pools size in number of pages.</p>
+    */
+   public int getNumberOfPages();
+
+   /** <p>Sets whether extended storage may be used. Defaults to null, in which
+    * case the DB2 defaults are choosen.</p>
+    */ 
+   public void setExtendedStorage(Boolean pExtendedStorage);
+
+   /** <p>Returns whether extended storage may be used. Defaults to false.</p>
+    */ 
+   public Boolean getExtendedStorage();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Column.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Column.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Column.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.Column;
+
+
+/** <p>Interface of a column in a DB2 database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface DB2Column extends Column {
+   /** <p>Sets the columns "generated as" clause.</p>
+    */
+   public void setGeneratedAs(String pGeneratedAs);
+
+   /** <p>Returns the columns "generated as" clause.</p>
+    */
+   public String getGeneratedAs();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2ColumnImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2ColumnImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2ColumnImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.ColumnImpl;
+
+
+/** <p>Default implementation of a column in a DB2 database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DB2ColumnImpl extends ColumnImpl implements DB2Column {
+  private String generatedAs;
+
+  protected DB2ColumnImpl(Table pTable, Column.Name pName, Column.Type pType) {
+    super(pTable, pName, pType);
+  }
+
+  public String getGeneratedAs() {
+    return generatedAs;
+  }
+
+  public void setGeneratedAs(String pGeneratedAs) {
+    generatedAs = pGeneratedAs;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import java.util.Iterator;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+
+/** <p>Interface of an SQL factory for DB2 databases.</p>
+*
+* @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+*/
+public interface DB2SQLFactory extends SQLFactory {
+  /** <p>Creates a new {@link TableSpace} with the given name.</p>
+   */
+  public TableSpace newTableSpace(String pName, TableSpace.Type pType);
+
+  /** <p>Creates a new {@link TableSpace} with the given name.</p>
+   */
+  public TableSpace newTableSpace(TableSpace.Name pName, TableSpace.Type pType);
+
+  /** <p>Returns the tablespace with the given name or null, if no such
+   * tablespace exists.</p>
+   */
+  public TableSpace getTableSpace(TableSpace.Name pName);
+
+  /** <p>Returns the tablespace with the given name or null, if no such
+   * tablespace exists.</p>
+   */
+  public TableSpace getTableSpace(String pName);
+
+  /** <p>Returns a list of all tablespaces.
+   * This Iterator does <em>not</em> include the predefined table spaces
+   * <code>SYSCATSPACE</code>, <code>TEMPSPACE1</code>, or
+   * <code>USERSPACE1</code>. These table spaces are accessible via
+   * {@link #getTableSpace(TableSpace.Name)} only.</p>
+   */
+  public Iterator getTableSpaces();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+
+
+/** <p>Default implementation of an SQL factory for DB2 databases.
+ * This factory ensures that the created implementations of
+ * {@link Schema}, {@link Table}, {@link Column}, and {@link SQLGenerator}
+ * may be casted to {@link DB2Schema}, {@link DB2Table}, {@link DB2Column},
+ * {@link DB2SQLGenerator}, respectively.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DB2SQLFactoryImpl extends SQLFactoryImpl
+    implements DB2SQLFactory {
+  /** <p>An immutable, predefined TableSpace.</p>
+   */
+  public class PredefinedTableSpace implements TableSpace {
+    private TableSpace.Name name;
+    private TableSpace.Type type;
+
+    PredefinedTableSpace(String pName, TableSpace.Type pType) {
+      name = new TableSpaceImpl.NameImpl(pName);
+      type = pType;
+    }    
+    public DB2SQLFactory getSQLFactory() { return DB2SQLFactoryImpl.this; }
+    public Name getName() { return name; }
+    public Type getType() { return type; }
+    public PageSize getPageSize() { return null; }
+    public Long getExtentSize() { return null; }
+    public Long getPrefetchSize() { return null; }
+    public Number getOverhead() { return null; }
+    public Number getTransferRate() { return null; }
+    public Boolean hasDroppedTableRecovery() { return null; }
+    public BufferPool getBufferPool() { return null; }
+    public boolean isPredefined() { return true; }
+    public void setPageSize(PageSize pSize) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public void setExtentSize(Long pSize) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public void setPrefetchSize(Long pSize) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public void setOverhead(Number pOverhead) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public void setTransferRate(Number pNumber) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public void setDroppedTableRecovery(Boolean pRecoverable) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public Container newSystemManagedContainer(String pFile) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public Container newDatabaseManagedContainerInFile(String pFile, long pNumPages) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public Container newDatabaseManagedContainerInDevice(String pDevice, long pNumPages) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+    public Iterator getContainers() {
+      return Collections.EMPTY_LIST.iterator();
+    }
+    public void setBufferPool(BufferPool pBufferPool) {
+      throw new IllegalStateException("This tablespace is immutable.");
+    }
+  }
+
+  /** <p>The predefined table space <code>SYSCATSPACE</code>.</p>
+   */
+  public final TableSpace SYSCATSPACE = new PredefinedTableSpace("SYSCATSPACE", TableSpace.Type.REGULAR);
+  /** <p>The predefined table space <code>TEMPSPACE1</code>.</p>
+   */
+  public final TableSpace TEMPSPACE1 = new PredefinedTableSpace("TEMPSPACE1", TableSpace.Type.SYSTEM_TEMPORARY);
+  /** <p>The predefined table space <code>USERSPACE1</code>.</p>
+   */
+  public final TableSpace USERSPACE1 = new PredefinedTableSpace("USERSPACE1", TableSpace.Type.USER_TEMPORARY);
+
+  private List tableSpaces = new ArrayList();
+
+  public DB2SQLFactoryImpl() {}
+
+  public Schema newSchemaImpl(Schema.Name pName) {
+    return new DB2SchemaImpl(this, pName);
+  }
+
+  public Table newTableImpl(Schema pSchema, Table.Name pName) {
+    return new DB2TableImpl(pSchema, pName);
+  }
+
+  public Column newColumn(Table pTable, Column.Name pName, Column.Type pType) {
+    return new DB2ColumnImpl(pTable, pName, pType);
+  }
+
+  public SQLGenerator newSQLGenerator() {
+    return new DB2SQLGeneratorImpl();
+  }
+
+  public TableSpace newTableSpace(String pName, TableSpace.Type pType) {
+    if (pName == null) {
+      throw new NullPointerException("The tablespace name must not be null. Use getDefaultTableSpace() to access the default TableSpace."); 
+    }
+    return newTableSpace(new TableSpaceImpl.NameImpl(pName), pType);
+  }
+
+  public TableSpace newTableSpace(TableSpace.Name pName, TableSpace.Type pType) {
+    if (pName == null) {
+      throw new NullPointerException("The tablespace name must not be null. Use getDefaultTableSpace() to access the default TableSpace."); 
+    }
+    if (getTableSpace(pName) != null) {
+      throw new IllegalStateException("A TableSpace named " + pName + " already exists.");
+    }
+    TableSpace result = newTableSpaceImpl(pName, pType);
+    tableSpaces.add(result);
+    return result;
+  }
+
+  protected TableSpace newTableSpaceImpl(TableSpace.Name pName, TableSpace.Type pType) {
+    return new TableSpaceImpl(this, pName, pType);
+  }
+
+  public TableSpace getTableSpace(TableSpace.Name pName) {
+    for (Iterator iter = tableSpaces.iterator();  iter.hasNext();  ) {
+      TableSpace tableSpace = (TableSpace) iter.next();
+      if (pName.equals(tableSpace.getName())) {
+        return tableSpace;
+      }
+    }
+    if (pName.equals(SYSCATSPACE.getName())) {
+       return SYSCATSPACE;
+    }
+    if (pName.equals(TEMPSPACE1.getName())) {
+       return TEMPSPACE1;
+    }
+    if (pName.equals(USERSPACE1.getName())) {
+       return USERSPACE1;
+    }
+    return null;
+  }
+
+  public TableSpace getTableSpace(String pName) {
+    return getTableSpace(new TableSpaceImpl.NameImpl(pName)); 
+  }
+
+  public Iterator getTableSpaces() {
+    return tableSpaces.iterator();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import java.util.Collection;
+
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+
+
+/** <p>Interface of an SQL generator for DB2 databases.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface DB2SQLGenerator extends SQLGenerator {
+  /** <p>Returns an SQL statement creating the given BufferPool.</p>
+   */
+  public Collection getCreate(BufferPool pBufferPool);
+
+  /** <p>Returns an SQL statement dropping the given BufferPool.</p>
+   */
+  public Collection getDrop(BufferPool pBufferPool);
+
+  /** <p>Returns an SQL statement creating the given TableSpace.</p>
+   */
+  public Collection getCreate(TableSpace pTableSpace);
+
+  /** <p>Returns an SQL statement dropping the given TableSpace.</p>
+   */
+  public Collection getDrop(TableSpace pTableSpace);
+
+  /** <p>Sets whether the generated <code>CREATE TABLE</code> statements
+   * will contain table space references or not. By default they will.</p>
+   */
+  public void setCreatingTableSpaceReferences(boolean pCreatingTableSpaceReferences);
+
+  /** <p>Returns whether the generated <code>CREATE TABLE</code> statements
+   * will contain table space references or not. By default they will.</p>
+   */
+  public boolean isCreatingTableSpaceReferences();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGeneratorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGeneratorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SQLGeneratorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl;
+
+
+/** <p>Default implementation of an SQL generator for DB2 schemas.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DB2SQLGeneratorImpl extends SQLGeneratorImpl implements DB2SQLGenerator {
+  private boolean isCreatingTableSpaceReferences = true;
+
+  protected boolean isPrimaryKeyPartOfCreateTable() { return true; }
+  protected boolean isUniqueIndexPartOfCreateTable() { return true; }
+  protected boolean isForeignKeyPartOfCreateTable() { return true; }
+
+  /** <p>Sets whether <code>CREATE TABLE</code> statements will contain
+   * table space references or not. The default is to create table
+   * space references.</p>
+   */
+  public void setCreatingTableSpaceReferences(boolean pCreatingTableSpaceReferences) {
+     isCreatingTableSpaceReferences = pCreatingTableSpaceReferences;
+  }
+
+  /** <p>Returns whether <code>CREATE TABLE</code> statements will contain
+   * table space references or not. The default is to create table
+   * space references.</p>
+   */
+  public boolean isCreatingTableSpaceReferences() {
+     return isCreatingTableSpaceReferences;
+  }
+  
+  protected String getTypeName(Column.Type pType) {
+    if (pType.equals(Column.Type.BINARY)  ||
+        pType.equals(Column.Type.VARBINARY)) {
+      return "BLOB";
+    } else {
+      return super.getTypeName(pType);
+    }
+  }
+
+  public Collection getCreate(BufferPool pBufferPool) {
+    StringBuffer sb = new StringBuffer();
+    sb.append("CREATE BUFFERPOOL ").append(pBufferPool.getName()).append(" SIZE ");
+    sb.append(pBufferPool.getNumberOfPages());
+    PageSize pageSize = pBufferPool.getPageSize(); 
+    if (pageSize != null) {
+      sb.append(" PAGESIZE ").append(pageSize.getSize());
+    }
+    Boolean extendedStorage = pBufferPool.getExtendedStorage();
+    if (extendedStorage != null) {
+      if (extendedStorage.booleanValue()) {
+        sb.append(" EXTENDED STORAGE");
+      } else {
+        sb.append(" NOT EXTENDED STORAGE");
+      }
+    }
+    List result = new ArrayList();
+    result.add(newStatement(sb.toString()));
+    return result;
+  }
+
+  public Collection getDrop(BufferPool pBufferPool) {
+     List result = new ArrayList();
+     result.add(newStatement("DROP BUFFERPOOL " + pBufferPool.getName()));
+     return result;
+  }
+
+  public Collection getCreate(TableSpace pTableSpace) {
+    if (pTableSpace.isPredefined()) {
+      return Collections.EMPTY_SET;
+    }
+    StringBuffer sb = new StringBuffer();
+    sb.append("CREATE TABLESPACE ");
+    TableSpace.Type type = pTableSpace.getType();
+    if (type != null) {
+      sb.append(type).append(" ");
+    }
+    sb.append(pTableSpace.getName().getName());
+    BufferPool bufferPool = pTableSpace.getBufferPool();
+    PageSize pageSize = (bufferPool == null) ?
+      pTableSpace.getPageSize() : bufferPool.getPageSize();
+    if (pageSize != null) {
+      sb.append(" PAGESIZE ").append(pageSize);
+    }
+    Iterator iter = pTableSpace.getContainers();
+    if (!iter.hasNext()) {
+       throw new IllegalStateException("The TableSpace " + pTableSpace.getName() +
+                                        " doesn't have any containers.");
+    }
+    TableSpace.Container container = (TableSpace.Container) iter.next();
+    String sep = "(";
+    if (container.isSystemManaged()) { 
+       sb.append(" MANAGED BY SYSTEM USING ");
+       while (container != null) {
+         if (!container.isSystemManaged()) {
+           throw new IllegalStateException("A TableSpace must not mix system and database managed containers.");
+         }
+         TableSpace.SystemManagedContainer systemContainer = (TableSpace.SystemManagedContainer) container;
+         sb.append(sep);
+         sep = ", ";
+         sb.append("'").append(systemContainer.getFile()).append("'");
+         container = iter.hasNext() ? (TableSpace.Container) iter.next() : null;
+       }
+    } else {
+       sb.append(" MANAGED BY DATABASE USING (");
+       while (container != null) {
+         if (!container.isDatabaseManaged()) {
+           throw new IllegalStateException("A TableSpace must not mix system and database managed containers.");
+         }
+         TableSpace.DatabaseManagedContainer databaseContainer = (TableSpace.DatabaseManagedContainer) container;
+         sb.append(sep);
+         sep = ", ";
+         if (databaseContainer.getFile() != null) {
+            sb.append("FILE '").append(databaseContainer.getFile()).append("'");
+         } else {
+            sb.append("DEVICE '").append(databaseContainer.getDevice()).append("'");
+         }
+         container = iter.hasNext() ? (TableSpace.Container) iter.next() : null;
+       }
+    }
+    sb.append(")");
+    Long extentSize = pTableSpace.getExtentSize();
+    if (extentSize != null) {
+      sb.append(" EXTENTSIZE ").append(extentSize);
+    }
+    Long prefetchSize = pTableSpace.getPrefetchSize();
+    if (prefetchSize != null) {
+      sb.append(" PREFETCHSIZE ").append(prefetchSize);
+    }
+    if (bufferPool != null) {
+      sb.append(" BUFFERPOOL ").append(bufferPool.getName().getName());
+    }
+    Number overhead = pTableSpace.getOverhead();
+    if (overhead != null) {
+      sb.append(" OVERHEAD ").append(overhead);
+    }
+    Number transferRate = pTableSpace.getTransferRate();
+    if (transferRate != null) {
+      sb.append(" TRANSFERRATE ").append(transferRate);
+    }
+    Boolean hasDroppedTableRecovery = pTableSpace.hasDroppedTableRecovery();
+    if (hasDroppedTableRecovery != null) {
+      sb.append(" DROPPED TABLE RECOVERY ");
+      sb.append(hasDroppedTableRecovery.booleanValue() ? "ON" : "OFF");
+    }
+
+    List result = new ArrayList();
+    result.add(newStatement(sb.toString()));
+    return result;
+  }
+
+  public Collection getDrop(TableSpace pTableSpace) {
+    if (pTableSpace.isPredefined()) {
+      return Collections.EMPTY_SET;
+    }
+    List result = new ArrayList();
+    result.add(newStatement("DROP TABLESPACE " + pTableSpace.getName()));
+    return result;
+  }
+
+  protected String getCreateTableHeader(Table pTable) {
+     String statement = super.getCreateTableHeader(pTable);
+     if (!isCreatingTableSpaceReferences()  ||
+         !(pTable instanceof DB2Table)) {
+        return statement;
+     }
+     StringBuffer sb = new StringBuffer(statement);
+     DB2Table table = (DB2Table) pTable;
+     TableSpace tableSpace = table.getTableSpace();
+     if (tableSpace != null) {
+        sb.append(" IN ").append(tableSpace.getName());
+     }
+     tableSpace = table.getIndexTableSpace();
+     if (tableSpace != null) {
+        sb.append(" INDEX IN ").append(tableSpace.getName());
+     }
+     tableSpace = table.getLongTableSpace();
+     if (tableSpace != null) {
+        sb.append(" LONG IN ").append(tableSpace.getName());
+     }
+     return sb.toString();
+  }
+
+  protected String getCreate(Column pColumn) {
+    String result = super.getCreate(pColumn);
+    if (pColumn instanceof DB2Column) {
+       DB2Column db2Column = (DB2Column) pColumn;
+       if (db2Column.getGeneratedAs() != null) {
+          result += " GENERATED ALWAYS AS (" + db2Column.getGeneratedAs() + ")";
+       }
+    }
+    return result;
+  }
+
+  public Collection getDrop(Schema pSchema) {
+     List result = new ArrayList();
+     for (Iterator iter = super.getDrop(pSchema).iterator();  iter.hasNext();  ) {
+        String s = (String) iter.next();
+        if (s.startsWith("DROP SCHEMA ")) {
+           s += " RESTRICT";
+        }
+        result.add(s);
+     }
+     return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Schema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Schema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Schema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.Schema;
+
+/** <p>Interface of a schema in a DB2 database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface DB2Schema extends Schema {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2SchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.impl.SchemaImpl;
+
+
+/** <p>Default implementation of a schema in a DB2 database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DB2SchemaImpl extends SchemaImpl implements DB2Schema {
+  protected DB2SchemaImpl(SQLFactory pFactory, Schema.Name pName) {
+    super(pFactory, pName);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Table.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Table.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2Table.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>Interface of a table in a DB2 database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface DB2Table extends Table {
+  /** <p>Sets the {@link TableSpace}, in which the table should be
+   * created physically. Null, if the database may choose a
+   * {@link TableSpace}.</p>
+   */
+  public void setTableSpace(TableSpace pTableSpace);
+
+  /** <p>Returns the {@link TableSpace}, in which the table should be
+   * created physically. Null, if the database may choose a
+   * {@link TableSpace}.</p>
+   */
+  public TableSpace getTableSpace();
+
+  /** <p>Sets the {@link TableSpace}, in which the tables indexes
+   * should be created physically. Null, if the tables
+   * main {@link TableSpace} should be choosen.</p>
+   */
+  public void setIndexTableSpace(TableSpace pTableSpace);
+
+  /** <p>Returns the {@link TableSpace}, in which the tables
+   * indexes should be created physically. Null, if the tables
+   * main {@link TableSpace} should be choosen.</p>
+   */
+  public TableSpace getIndexTableSpace();
+
+  /** <p>Sets the {@link TableSpace}, in which the tables indexes
+   * should be created physically. Null, if the tables
+   * main {@link TableSpace} should be choosen.</p>
+   */
+  public void setLongTableSpace(TableSpace pTableSpace);
+
+  /** <p>Returns the {@link TableSpace}, in which the tables
+   * LOB data should be physically stored. Null, if the tables
+   * main {@link TableSpace} should be choosen.</p>
+   */
+  public TableSpace getLongTableSpace();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2TableImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2TableImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/DB2TableImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.TableImpl;
+
+
+/** <p>Default implementation of a table in a DB2 database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DB2TableImpl extends TableImpl implements DB2Table {
+  private TableSpace tableSpace, indexTableSpace, longTableSpace;
+
+  public DB2TableImpl(Schema pSchema, Table.Name pName) {
+    super(pSchema, pName);
+  }
+
+  public void setTableSpace(TableSpace pTableSpace) { indexTableSpace = pTableSpace; }
+  public TableSpace getTableSpace() { return tableSpace; }
+  public void setIndexTableSpace(TableSpace pTableSpace) { indexTableSpace = pTableSpace; }
+  public TableSpace getIndexTableSpace() { return indexTableSpace; }
+  public void setLongTableSpace(TableSpace pTableSpace) { indexTableSpace = pTableSpace; }
+  public TableSpace getLongTableSpace() { return longTableSpace; }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/PageSize.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/PageSize.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/PageSize.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+/** <p>A DB2 page size is limited to certain values.</p>
+ */
+public class PageSize {
+   /** The default page size (4096 bytes).
+    */
+   public static final PageSize PAGESIZE_4096 = new PageSize(4096);
+   /** The default page size (8192 bytes).
+    */
+   public static final PageSize PAGESIZE_8192 = new PageSize(8192);
+   /** The default page size (16384 bytes).
+    */
+   public static final PageSize PAGESIZE_16384 = new PageSize(16384);
+   /** The default page size (32768 bytes).
+    */
+   public static final PageSize PAGESIZE_32768 = new PageSize(32768);
+
+   private static final PageSize[] instances = new PageSize[]{
+      PAGESIZE_4096, PAGESIZE_8192, PAGESIZE_16384, PAGESIZE_32768
+   };
+
+   private long size;
+
+   private PageSize(long pSize) {
+      size = pSize;
+   }
+ 
+   /** Returns the size of the pagesize specification.
+    */
+   public long getSize() { return size; }
+   public String toString() { return "PAGESIZE_" + size; }
+   public boolean equals(Object pOther) {
+      return pOther != null  &&  pOther instanceof PageSize  &&
+         size == ((PageSize) pOther).size;
+   }
+
+   /** Returns the possible pagesize specifications.
+    */
+   public static PageSize[] getInstances() { return instances; }
+
+   /** Converts the given string into a pagesize specification.
+    */
+   public static PageSize valueOf(String pSize) {
+      long l;
+      try {
+         l = Long.parseLong(pSize);
+      } catch (Exception e) {
+         throw new IllegalArgumentException("PageSize is no long value: " + pSize);
+      }
+      return valueOf(l);
+   }
+
+   /** Converts the given long value into a pagesize specification.
+    */
+   public static PageSize valueOf(long pSize) {
+      for (int i = 0;  i < instances.length;  i++) {
+         if (instances[i].size == pSize) {
+            return instances[i];
+         }
+      }
+      throw new IllegalArgumentException("Invalid page size: " + pSize);
+   }
+
+   public int hashCode() {
+      return (int) size / 4096;
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpace.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpace.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpace.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import java.util.Iterator;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+
+/** <p>Interface of a DB2 TableSpace. An object of this kind is used to
+ * create a <code>CREATE TABLESPACE ...</code> statement.</p>
+ * <p>A TableSpace can be associated to a {@link BufferPool}. If it
+ * is, it inherits certain settings from the {@link BufferPool},
+ * in particular the {@link #getPageSize() pageSize}.</p>
+ * <p>A tablespace needs to know where data is stored physically. DB2
+ * distinguishes between two possible data locations: System managed
+ * (Files handled by the operating system) and Database managed (Files
+ * handled by the database or Devices). In the latter case the database
+ * will preallocate space for the files or devices, giving a slightly
+ * faster operation. On the other hand, database managed files cannot grow
+ * automatically.</p>
+ * <p>A tablespaces data location is called container. Any tablespace must
+ * have at least one container. Note, that one tablespace cannot have
+ * both system managed containers and database managed containers. If the
+ * first container is system managed, then all containers are, and vice
+ * versa.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface TableSpace {
+  public interface Name extends SQLFactory.Ident {
+  }
+
+  /** <p>Interface of a TableSpace Container.</p>
+   */
+  public interface Container {
+    /** <p>Returns whether the container is system managed
+     * (aka an operating system file). If this is the case,
+     * the container may be casted to a
+     * {@link org.apache.ws.jaxme.sqls.db2.TableSpace.SystemManagedContainer}.</p> 
+     */
+    public boolean isSystemManaged();
+    /** <p>Returns whether the container is database managed
+     * If this is the case, the container may be casted to a
+     * {@link org.apache.ws.jaxme.sqls.db2.TableSpace.DatabaseManagedContainer}.</p> 
+     */
+    public boolean isDatabaseManaged();
+  }
+
+  /** <p>Interface of a system managed container, aka operating
+   * system file. A container may be casted to a SystemManagedContainer,
+   * if and only if <code>isSystemManaged() == true</code>.</p>
+   */
+  public interface SystemManagedContainer extends Container {
+    /** <p>Returns the containers file name.</p>
+     */
+    public String getFile();
+  }
+
+  /** <p>Interface of a database managed container. The container
+   * may be located in an operating system file with preallocated
+   * size or in a raw operating system device. A container may be
+   * casted to a DatabaseManagedContainer, if and only if
+   * <code>isDatabaseManaged() == true</code>.</p>
+   */
+  public interface DatabaseManagedContainer extends Container {
+    /** <p>Returns the containers file name or null, if the
+     * container is located in a raw device. In the latter case
+     * it is guaranteed, that {@link #getDevice()} returns a
+     * non-null value.</p>
+     */
+    public String getFile();
+    /** <p>Returns the containers device name or null, if the
+     * container is located in an operating system file. In the
+     * latter case it is guaranteed, that {@link #getDevice()}
+     * returns a non-null value.</p>
+     */
+    public String getDevice();
+    /** <p>Returns the containers size in pages.</p>
+     */
+    public long getNumOfPages();
+  }
+
+  /** <p>A DB2 TableSpace type. Valid types are either of
+   * {@link #REGULAR}, {@link #LONG}, {@link #SYSTEM_TEMPORARY}, or
+   * {@link #USER_TEMPORARY}. See the DB2 SQL reference in the section
+   * <code>CREATE TABLESPACE</code> for details on types.</p>
+   */
+  public class Type {
+     /** <p>REGULAR: Stores all data except for temporary tables.</p>
+      */
+    public static final Type REGULAR = new Type("REGULAR");
+    /** <p>LONG: Stores long or LOB table columns. It may also store
+     * structured type columns. The tablespace must be a DMS tablespace.</p>
+     */
+    public static final Type LONG = new Type("LONG");
+    /** <p>SYSTEM TEMPORARY: Stores temporary tables (work areas used
+     * by the database manager to perform operations such as sorts or
+     * joins). Note that a database must always have at least one
+     * <code>SYSTEM TEMPORARY</code> tablespace, as temporary tables
+     * can only be stored in such a tablespace. A temporary tablespace
+     * is created automatically when a database is created. See
+     * <code>CREATE DATABASE</code> in the Command Reference for more information.</p>
+     */
+    public static final Type SYSTEM_TEMPORARY = new Type("SYSTEM TEMPORARY");
+    /* <p>USER TEMPORARY: Stores declared global temporary tables.
+     * Note that no user temporary tablespaces exist when a database
+     * is created. At least one user temporary tablespace should be
+     * created with appropriate <code>USE</code> privileges, to allow
+     * definition of declared temporary tables.</p>
+     */
+    public static final Type USER_TEMPORARY = new Type("USER TEMPORARY");
+    private static final Type[] instances =
+      new Type[]{REGULAR, LONG, SYSTEM_TEMPORARY, USER_TEMPORARY};
+    private String name;
+    private Type(String pName) {
+      name = pName;
+    }
+    public String toString() { return name; }
+    public String getName() { return name; }
+    public boolean equals(Object pOther) {
+      return pOther != null && pOther instanceof Type &&
+              name.equals(((Type) pOther).name);
+    }
+    public int hashCode() { return name.hashCode(); }
+    public static Type[] getInstances() { return instances; }
+    public static Type valueOf(String pName) {
+      for (int i = 0;  i < instances.length;  i++) {
+        if (instances[i].name.equalsIgnoreCase(pName)) {
+          return instances[i];
+        }
+      }
+      throw new IllegalArgumentException("Invalid type name: " + pName);
+    }
+  }
+
+  /** <p>Returns the {@link org.apache.ws.jaxme.sqls.SQLFactory} that created this
+   * <code>TableSpace</code> object.</p>
+   */
+  public DB2SQLFactory getSQLFactory();
+
+  /** <p>Returns the tablespace name.
+   * Tablespace names must be unique in the database.</p>
+   */
+  public TableSpace.Name getName();
+
+  /** <p>Returns the tablespace type.</p>
+   */
+  public TableSpace.Type getType();
+
+  /** <p>Returns the tablespaces page size. If the <code>TableSpace</code>
+   * has an associated {@link BufferPool}, returns the BufferPool's page
+   * size. Otherwise returns the page size configured via
+   * {@link #setPageSize(PageSize)}.</p>
+   */
+  public PageSize getPageSize();
+
+  /** <p>Sets the tablespaces page size. This value will be ignored,
+   * if the <code>TableSpace</code> has an associated {@link BufferPool}.</p>
+   */
+  public void setPageSize(PageSize pSize);
+
+  /** <p>Returns the number of {@link #getPageSize() pageSize} pages that will
+   * be written to a container before skipping to the next container. The
+   * database manager cycles repeatedly through the containers as data is
+   * stored. Defaults to null, in which case the DB2 configuration
+   * parameter DFT_EXTENT_SZ applies.</p>
+   * </p>
+   */
+  public Long getExtentSize();
+
+  /** <p>Sets the number of {@link #getPageSize() pageSize} pages that will
+   * be written to a container before skipping to the next container. The
+   * database manager cycles repeatedly through the containers as data is
+   * stored. Defaults to null, in which case the DB2 configuration
+   * parameter DFT_EXTENT_SZ applies.</p>
+   * </p>
+   */
+  public void setExtentSize(Long pSize);
+
+  /** <p>Returns the number of {@link #getPageSize() pageSize} pages that will
+   * be read from the tablespace when data prefetching is being performed.
+   * Prefetching reads in data needed by a query prior to it being referenced
+   * by the query, so that the query need not wait for I/O to be performed.
+   * Defaults to null, in which case the DB2 configuration parameter
+   * DFT_PREFETCH_SZ applies.</p>
+   */
+  public Long getPrefetchSize();
+
+  /** <p>Sets the number of {@link #getPageSize() pageSize} pages that will
+   * be read from the tablespace when data prefetching is being performed.
+   * Prefetching reads in data needed by a query prior to it being referenced
+   * by the query, so that the query need not wait for I/O to be performed.
+   * Defaults to null, in which case the DB2 configuration parameter
+   * DFT_PREFETCH_SZ applies.</p>
+   */
+  public void setPrefetchSize(Long pSize);
+
+  /** <p>Returns the I/O controller overhead and disk seek and latency time, in
+   * milliseconds. The number should be an average for all containers that belong
+   * to the tablespace, if not the same for all containers. This value is used to
+   * determine the cost of I/O during query optimization. Defaults to null,
+   * in which case the DB2 default (24.1) applies.</p>
+   * </p>
+   */
+  public Number getOverhead();
+
+  /** <p>Sets the I/O controller overhead and disk seek and latency time, in
+   * milliseconds. The number should be an average for all containers that belong
+   * to the tablespace, if not the same for all containers. This value is used to
+   * determine the cost of I/O during query optimization. Defaults to null,
+   * in which case the DB2 default (24.1) applies.</p>
+   * </p>
+   */
+  public void setOverhead(Number pOverhead);
+
+  /** <p>Returns the transfer rate, which is defined as the time to read one page
+   * into memory, in milliseconds. The number shouldbe an average for all
+   * containers that belong to the tablespace, if not the same for all
+   * containers. This value is used to determine the cost of I/O during query
+   * optimization. Defaults to null, in which case the DB2 default (0.9)
+   * applies.</p>
+   */
+  public Number getTransferRate();
+
+  /** <p>Sets the transfer rate, which is defined as the time to read one page
+   * into memory, in milliseconds. The number shouldbe an average for all
+   * containers that belong to the tablespace, if not the same for all
+   * containers. This value is used to determine the cost of I/O during query
+   * optimization. Defaults to null, in which case the DB2 default (0.9)
+   * applies.</p>
+   */
+  public void setTransferRate(Number pNumber);
+
+  /** <p>Returns whether dropped tables in the specified tablespace may be
+   * recovered using the <code>RECOVER TABLE ON</code> option of the
+   * <code>ROLLFORWARD</code> command. This clause can only be specified
+   * for a {@link Type#REGULAR} tablespace (SQLSTATE 42613). For more
+   * information on recovering dropped tables, refer to the Administration
+   * Guide. Defaults to null, in which case the DB2 default applies.</p>
+   */
+  public Boolean hasDroppedTableRecovery();
+
+  /** <p>Sets whether dropped tables in the specified tablespace may be
+   * recovered using the <code>RECOVER TABLE ON</code> option of the
+   * <code>ROLLFORWARD</code> command. This clause can only be specified
+   * for a {@link Type#REGULAR} tablespace (SQLSTATE 42613). For more
+   * information on recovering dropped tables, refer to the Administration
+   * Guide. Defaults to null, in which case the DB2 default applies.</p>
+   */
+  public void setDroppedTableRecovery(Boolean pRecoverable);
+
+  /** <p>Creates a new system managed container with the given file.</p>
+   */
+  public Container newSystemManagedContainer(String pFile);
+
+  /** <p>Creates a new database managed container with the given file
+   * or device and the given number of pages.</p>
+   */
+  public Container newDatabaseManagedContainerInFile(String pFile, long pNumPages);
+
+  /** <p>Creates a new database managed container with the given raw
+   * operating system device and the given number of pages.</p>
+   */
+  public Container newDatabaseManagedContainerInDevice(String pDevice, long pNumPages);
+
+  /** <p>Returns an {@link Iterator} to the table spaces containers.
+   * Any element in the {@link java.util.Iterator} is an instance of
+   * {@link org.apache.ws.jaxme.sqls.db2.TableSpace.Container}, which
+   * was created using {@link #newSystemManagedContainer(String)},
+   * {@link #newDatabaseManagedContainerInFile(String, long)}, or
+   * {@link #newDatabaseManagedContainerInDevice(String, long)}.</p>
+   */
+  public Iterator getContainers();
+
+  /** <p>Sets the {@link BufferPool} used by this {@link TableSpace}.</p>
+   */
+  public void setBufferPool(BufferPool pBufferPool);
+
+  /** <p>Returns the {@link BufferPool} used by this {@link TableSpace}.</p>
+   */
+  public BufferPool getBufferPool();
+
+  /** <p>Returns whether this TableSpace is predefined by the system.</p>
+   */
+  public boolean isPredefined();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpaceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpaceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/TableSpaceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.db2;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+
+
+/** <p>Default implementation of a DB2 tablespace.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TableSpaceImpl implements TableSpace {
+  public static class NameImpl extends SQLFactoryImpl.IdentImpl
+      implements TableSpace.Name {
+    public NameImpl(String pName) { super(pName); }
+  }
+
+  public static class SystemManagedContainerImpl implements TableSpace.SystemManagedContainer {
+    private String file;
+    public boolean isSystemManaged() { return true; }
+    public boolean isDatabaseManaged() { return false; }
+    public String getFile() { return file; }
+    public void setFile(String pFile) { file = pFile; }
+  }
+
+  public static class DatabaseManagedContainerImpl implements TableSpace.DatabaseManagedContainer {
+    private String file;
+    private String device;
+    private long numPages;
+    public boolean isSystemManaged() { return false; }
+    public boolean isDatabaseManaged() { return true; }
+    public void setFile(String pFile) { file = pFile; }
+    public String getFile() { return file; }
+    public void setDevice(String pDevice) { device = pDevice; }
+    public String getDevice() { return device; }
+    public long getNumOfPages() { return numPages; }
+    public void setNumOfPages(long pNumOfPages) { numPages = pNumOfPages; }
+  }
+
+  private DB2SQLFactory sqlFactory;
+  private BufferPool bufferPool;
+  private TableSpace.Name name;
+  private TableSpace.Type type;
+  private List containers = new ArrayList();
+  private Long extentSize, prefetchSize;
+  private PageSize pageSize;
+  private Number overhead, transferRate;
+  private Boolean droppedTableRecovery;
+
+  protected TableSpaceImpl(DB2SQLFactory pFactory, TableSpace.Name pName,
+                            TableSpace.Type pType) {
+    sqlFactory = pFactory;
+    name = pName;
+    type = pType;
+  }
+
+  public DB2SQLFactory getSQLFactory() { return sqlFactory; }
+  public TableSpace.Name getName() { return name; }
+  public TableSpace.Type getType() { return type; }
+  public PageSize getPageSize() {
+     BufferPool bPool = getBufferPool();
+     return bPool == null ? pageSize : bPool.getPageSize();
+  }
+  public void setPageSize(PageSize pSize) { pageSize = pSize; }
+  public Long getExtentSize() { return extentSize; }
+  public void setExtentSize(Long pSize) { extentSize = pSize; }
+  public Long getPrefetchSize() { return prefetchSize; }
+  public void setPrefetchSize(Long pSize) { prefetchSize = pSize; }
+  public Number getOverhead() { return overhead; }
+  public void setOverhead(Number pOverhead) { overhead = pOverhead; }
+  public Number getTransferRate() { return transferRate; }
+  public void setTransferRate(Number pTransferRate) { transferRate = pTransferRate; }
+  public Boolean hasDroppedTableRecovery() { return droppedTableRecovery; }
+  public void setDroppedTableRecovery(Boolean pRecoverable) { droppedTableRecovery = pRecoverable; }
+  public boolean isPredefined() { return false; }
+
+  public Container newSystemManagedContainer(String pFile) {
+    SystemManagedContainerImpl container = new SystemManagedContainerImpl();
+    container.setFile(pFile);
+    containers.add(container);
+    return container;
+  }
+
+  public Container newDatabaseManagedContainerInFile(String pFile, long pNumPages) {
+    DatabaseManagedContainerImpl container = new DatabaseManagedContainerImpl();
+    container.setFile(pFile);
+    container.setNumOfPages(pNumPages);
+    containers.add(container);
+    return container;
+  }
+
+  public Container newDatabaseManagedContainerInDevice(String pDevice, long pNumPages) {
+    DatabaseManagedContainerImpl container = new DatabaseManagedContainerImpl();
+    container.setDevice(pDevice);
+    container.setNumOfPages(pNumPages);
+    containers.add(container);
+    return container;
+  }
+
+  public Iterator getContainers() {
+    return containers.iterator();
+  }
+
+  public void setBufferPool(BufferPool pBufferPool) {
+    bufferPool = pBufferPool;
+  }
+
+  public BufferPool getBufferPool() {
+    return bufferPool;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/db2/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+<html>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<head><title>DB2 support for the SQL generator</title></head>
+<body>
+<h1>DB2 support for the SQL generator</h1>
+<p>This package contains some classes and interfaces enhancing the
+SQL generator with DB2 specific features. In particular, these classes
+enable you to create buffer pools and table spaces.</p>
+<p>The DB2 support works by instantiating a different
+{@link org.apache.ws.jaxme.sqls.SQLFactory}: By default, you would enable
+{@link org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl}. However, for DB2
+support you would choose {@link org.apache.ws.jaxme.sqls.db2.DB2SQLFactoryImpl},
+which is a subclass of the default factory.</p>
+<p>Likewise, you need to replace the default implementation of the SQL generator,
+{@link org.apache.ws.jaxme.sqls.SQLGenerator} with
+{@link org.apache.ws.jaxme.sqls.db2.DB2SQLGeneratorImpl}
+
+<p>The difference between the factories is as follows: When using the
+DB2 factory, you may cast your instances of
+{@link org.apache.ws.jaxme.sqls.SQLFactory},
+{@link org.apache.ws.jaxme.sqls.Schema},
+{@link org.apache.ws.jaxme.sqls.Table}, and
+{@link org.apache.ws.jaxme.sqls.Column} to
+{@link org.apache.ws.jaxme.sqls.db2.DB2SQLFactory},
+{@link org.apache.ws.jaxme.sqls.db2.DB2Schema},
+{@link org.apache.ws.jaxme.sqls.db2.DB2Table}, and
+{@link org.apache.ws.jaxme.sqls.db2.DB2Column}, respectively, and use the
+additional methods.</p>
+
+</body></html>

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumn.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumn.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumn.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Column;
+
+
+/** <p>Interface of a column in a HsqlDb database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface HsqlDbColumn extends Column {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumnImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumnImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbColumnImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.ColumnImpl;
+
+
+/** <p>Default implementation of a column in a HsqlDb database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class HsqlDbColumnImpl extends ColumnImpl implements HsqlDbColumn {
+  protected HsqlDbColumnImpl(Table pTable, Column.Name pName, Column.Type pType) {
+    super(pTable, pName, pType);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+
+/** <p>Interface of an SQL factory for HsqlDb databases.</p>
+ */
+public interface HsqlDbSQLFactory extends SQLFactory {
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+
+/** <p>Default implementation of an SQL factory for HsqlDb databases.
+ * This factory ensures that the created implementations of
+ * {@link Schema}, {@link Table}, {@link Column}, and {@link SQLGenerator}
+ * may be casted to {@link HsqlDbSchema}, {@link HsqlDbTable}, {@link HsqlDbColumn},
+ * {@link HsqlDbSQLGenerator}, respectively.</p>
+ */
+public class HsqlDbSQLFactoryImpl extends SQLFactoryImpl implements HsqlDbSQLFactory {
+   public Schema newSchemaImpl(Schema.Name pName) {
+     if (pName != null) {
+       throw new IllegalArgumentException("The HsqlDb database is supporting the default schema only.");
+     }
+     return new HsqlDbSchemaImpl(this, pName);
+   }
+
+   public Table newTableImpl(Schema pSchema, Table.Name pName) {
+     return new HsqlDbTableImpl(pSchema, pName);
+   }
+
+   public Column newColumn(Table pTable, Column.Name pName, Column.Type pType) {
+     return new HsqlDbColumnImpl(pTable, pName, pType);
+   }
+
+   public SQLGenerator newSQLGenerator() {
+     return new HsqlDbSQLGeneratorImpl();
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+
+
+/** <p>Interface of an SQL generator for HsqlDb databases.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface HsqlDbSQLGenerator extends SQLGenerator {
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGeneratorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGeneratorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSQLGeneratorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl;
+
+
+/** <p>Default implementation of an SQL generator for HsqlDb schemas.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class HsqlDbSQLGeneratorImpl extends SQLGeneratorImpl implements HsqlDbSQLGenerator {
+   protected boolean isPrimaryKeyUniqueIndex() {
+      return false;
+   }
+
+   protected boolean isPrimaryKeyPartOfCreateTable() {
+      return true;
+   }
+
+   protected boolean isUniqueIndexPartOfCreateTable() {
+      return true;
+   }
+
+   protected boolean isNonUniqueIndexPartOfCreateTable() {
+      return false;
+   }
+
+   protected boolean isForeignKeyPartOfCreateTable() {
+      return true;
+   }
+
+   protected String getCreateTableHeader(Table pTable) {
+      if (pTable instanceof HsqlDbTable) {
+         HsqlDbTable table = (HsqlDbTable) pTable;
+         if (table.isCached()) {
+            return "CREATE CACHED TABLE " + pTable.getQName();
+         }
+      }
+      return super.getCreateTableHeader(pTable);
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Schema;
+
+/** <p>Interface of a schema in a HsqlDb database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface HsqlDbSchema extends Schema {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbSchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.impl.SchemaImpl;
+
+
+/** <p>Default implementation of a schema in a HsqlDb database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class HsqlDbSchemaImpl extends SchemaImpl implements HsqlDbSchema {
+  protected HsqlDbSchemaImpl(SQLFactory pFactory, Schema.Name pName) {
+    super(pFactory, pName);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTable.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTable.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTable.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>Interface of a table in a HsqlDb database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface HsqlDbTable extends Table {
+   /** <p>Sets whether this is a cached table or not. By default
+    * tables are cached.</p>
+    */
+   public void setCached(boolean pCached);
+
+   /** <p>Returns whether this is a cached table or not. By default
+    * tables are cached.</p>
+    */
+   public boolean isCached();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTableImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTableImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/HsqlDbTableImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.hsqldb;
+
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.TableImpl;
+
+
+/** <p>Default implementation of a table in a HsqlDb database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class HsqlDbTableImpl extends TableImpl implements HsqlDbTable {
+   private boolean cached = true;
+
+	protected HsqlDbTableImpl(Schema pSchema, Table.Name pName) {
+		super(pSchema, pName);
+	}
+
+   public void setCached(boolean pCached) {
+      cached = pCached;
+   }
+
+   public boolean isCached() {
+      return cached;
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/hsqldb/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+<html>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<head><title>HsqlDb support for the SQL generator</title></head>
+<body>
+<h1>HsqlDb support for the SQL generator</h1>
+<p>This package contains some classes and interfaces enhancing the
+SQL generator with HsqlDb specific features. HsqlDb is an open source
+database, written in Java. It is particularly well suited for JUnit tests,
+because it can run in embedded into the own JVM. HsqlDb is available
+from <a href="http://hsqldb.sf.net">http://hsqldb.sf.net</a>.</p>
+<p>The HsqlDb support works by instantiating a different
+{@link org.apache.ws.jaxme.sqls.SQLFactory}: By default, you would enable
+{@link org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl}. However, for HsqlDb
+support you would choose {@link org.apache.ws.jaxme.sqls.hsqldb.HsqlDbSQLFactoryImpl},
+which is a subclass of the default factory.</p>
+<p>Likewise, you need to replace the default implementation of the SQL generator,
+{@link org.apache.ws.jaxme.sqls.SQLGenerator} with
+{@link org.apache.ws.jaxme.sqls.hsqldb.HsqlDbSQLGeneratorImpl}
+
+<p>The difference between the factories is as follows: When using the
+HsqlDb factory, you may cast your instances of
+{@link org.apache.ws.jaxme.sqls.SQLFactory},
+{@link org.apache.ws.jaxme.sqls.Schema},
+{@link org.apache.ws.jaxme.sqls.Table}, and
+{@link org.apache.ws.jaxme.sqls.Column} to
+{@link org.apache.ws.jaxme.sqls.hsqldb.HsqlDbSQLFactory},
+{@link org.apache.ws.jaxme.sqls.hsqldb.HsqlDbSchema},
+{@link org.apache.ws.jaxme.sqls.hsqldb.HsqlDbTable}, and
+{@link org.apache.ws.jaxme.sqls.hsqldb.HsqlDbColumn}, respectively, and use the
+additional methods.</p>
+
+</body></html>

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/AbstractColumn.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/AbstractColumn.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/AbstractColumn.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.BinaryColumn;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.StringColumn;
+import org.apache.ws.jaxme.sqls.Table;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractColumn implements Column, StringColumn, BinaryColumn {
+  private final Column.Name name;
+  private final Column.Type type;
+  private boolean nullable;
+  private Long length;
+  private Object customData;
+
+  protected AbstractColumn(Column.Name pName, Column.Type pType) {
+    if (pName == null) {
+      throw new NullPointerException("The column name must not be null.");
+    }
+    if (pType == null) {
+      throw new NullPointerException("The column type must not be null.");
+    }
+    name = pName;
+    type = pType;
+  }
+
+  public Column.Name getName() { return name; }
+  public Column.Type getType() { return type; }
+  public boolean isNullable() { return nullable; }
+  public void setNullable(boolean pNullable) { nullable = pNullable; }
+
+
+  public boolean equals(Object o) {
+    if (o == null  ||  !(o instanceof Column)) {
+      return false;
+    }
+    Column other = (Column) o;
+    Table table = getTable();
+    if (table == null) {
+      if (other.getTable() != null) {
+        return false;
+      }
+    } else {
+      if (!table.equals(other.getTable())) {
+        return false;
+      }
+    }
+    return getName().equals(other.getName());
+  }
+
+  public int hashCode() {
+    return getTable().hashCode() + getName().hashCode();
+  }
+
+  public boolean hasFixedLength() {
+    Column.Type myType = getType();
+    if (Column.Type.CHAR.equals(myType)  ||
+        Column.Type.BINARY.equals(myType)) {
+      return true;
+    } else if (Column.Type.VARCHAR.equals(myType)
+               ||  Column.Type.VARBINARY.equals(myType)
+               ||  Column.Type.BLOB.equals(myType)
+               ||  Column.Type.OTHER.equals(myType)
+               ||  Column.Type.CLOB.equals(myType)) {
+      return false;
+    } else {
+      throw new IllegalStateException("Invalid data type for fixed length.");
+    }
+  }
+
+  public boolean isStringColumn() {
+    Column.Type myType = getType();
+    return Column.Type.CHAR.equals(myType) || Column.Type.VARCHAR.equals(myType) ||
+            Column.Type.CLOB.equals(myType);
+  }
+
+  public boolean isBinaryColumn() {
+    Column.Type myType = getType();
+    return Column.Type.BINARY.equals(myType) || Column.Type.VARBINARY.equals(myType) ||
+            Column.Type.BLOB.equals(myType) || Column.Type.OTHER.equals(myType);
+  }
+
+  public void setLength(Long pLength) {
+    length = pLength;
+  }
+
+  public void setLength(long pLength) {
+    setLength(new Long(pLength));
+  }
+
+  public Long getLength() {
+    return length;
+  }
+
+  public Object getCustomData() {
+    return customData;
+  }
+
+  public void setCustomData(Object pCustomData) {
+    customData = pCustomData;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/BooleanConstraintImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/BooleanConstraintImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/BooleanConstraintImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.ConstrainedStatement;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class BooleanConstraintImpl extends PartsImpl implements BooleanConstraint {
+	/** Default implementation of {@link BooleanConstraint.Type}.
+	 */
+	public static class TypeImpl extends SQLFactoryImpl.IdentImpl implements BooleanConstraint.Type {
+		private static final long serialVersionUID = 3762254145096135991L;
+		/** Creates a new instance with the given name.
+		 */
+		public TypeImpl(String pName) {
+			super(pName);
+		}
+	}
+	
+	private BooleanConstraint.Type type;
+	
+	protected BooleanConstraintImpl(CombinedConstraint pCombinedConstraint,
+			BooleanConstraint.Type pType) {
+		super(pCombinedConstraint.getConstrainedStatement());
+		if (pType == null) {
+			throw new NullPointerException("The type must not be null.");
+		}
+		type = pType;
+	}
+	
+	public BooleanConstraint.Type getType() {
+		return type;
+	}
+	
+	protected void add(Object pPart) {
+		Type type = getType();
+		if (BooleanConstraint.Type.IN.equals(type)) {
+			// Arbitrary number of parts
+		} else if (BooleanConstraint.Type.ISNULL.equals(type)) {
+			// Exactly one part
+			if (getNumParts() == 1) {
+				throw new IllegalStateException("An IS NULL clause cannot have more than one part.");
+			}
+		} else if (BooleanConstraint.Type.BETWEEN.equals(type)) {
+			// Exactly three parts
+			if (getNumParts() == 3) {
+				throw new IllegalStateException("A BETWEEN clause cannot have more than three parts.");
+			}
+		} else {
+			// Exactly two parts
+			if (getNumParts() == 2) {
+				throw new IllegalStateException("An " + getType() + " clause cannot have more than two parts.");
+			}
+		}
+		super.add(pPart);
+	}
+	
+	public ConstrainedStatement getConstrainedStatement() {
+		return (ConstrainedStatement) getStatement();
+	}
+
+	public int getMinimumParts() { return 1; }
+
+	public int getMaximumParts() {
+        if (BooleanConstraint.Type.IN.equals(type)) {
+			return 0;
+		} else if (BooleanConstraint.Type.EXISTS.equals(type)
+				   ||  BooleanConstraint.Type.ISNULL.equals(type)) {
+			return 1;
+		} else if (BooleanConstraint.Type.BETWEEN.equals(type)) {
+			return 3;
+		} else if (BooleanConstraint.Type.EQ.equals(type)
+				   ||  BooleanConstraint.Type.NE.equals(type)
+				   ||  BooleanConstraint.Type.GT.equals(type)
+				   ||  BooleanConstraint.Type.LT.equals(type)
+				   ||  BooleanConstraint.Type.GE.equals(type)
+				   ||  BooleanConstraint.Type.LE.equals(type)
+				   ||  BooleanConstraint.Type.LIKE.equals(type)) {
+			return 2;
+		} else {
+			throw new IllegalStateException("Invalid type: " + type);
+        }
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CaseImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CaseImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CaseImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Case;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Column.Type;
+
+
+/** Implementation of a
+ * {@link org.apache.ws.jaxme.sqls.Case} clause.
+ */
+public class CaseImpl implements Case {
+	/** Implementation of a
+     * {@link org.apache.ws.jaxme.sqls.Case.When} clause.
+	 */
+    public static class WhenImpl implements When {
+        private final Object condition, value;
+        /** Creates a new instance with the given condition
+         * and value.
+         */
+        public WhenImpl(Object pCondition, Object pValue) {
+        	condition = ValueImpl.asValue(pCondition);
+            value = ValueImpl.asValue(pValue);
+        }
+        public Object getCondition() { return condition; }
+        public Object getValue() { return value; }
+    }
+
+    private final Column.Type type;
+    private Object checkedValue, elseValue;
+    private List whens = new ArrayList();
+
+    /** Creates a new instance with the given type.
+	 */
+	protected CaseImpl(Column.Type pType) {
+        type = pType;
+	}
+
+	public void setCheckedValue(Object pValue) {
+        checkedValue = ValueImpl.asValue(pValue);
+    }
+	public Object getCheckedValue() {
+        return checkedValue;
+    }
+	public void addWhen(Object pCondition, Object pValue) {
+        addWhen(new WhenImpl(pCondition, pValue));
+    }
+	public void addWhen(When pWhen) { whens.add(pWhen); }
+	public void setElseValue(Object pValue) {
+        elseValue = ValueImpl.asValue(pValue);
+    }
+	public Object getElseValue() { return elseValue; }
+	public Type getType() { return type; }
+	public When[] getWhens() {
+        return (When[]) whens.toArray(new When[whens.size()]);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.Iterator;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>Implementation of a column.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ColumnImpl extends AbstractColumn {
+  public static class NameImpl extends SQLFactoryImpl.IdentImpl implements Column.Name {
+    public NameImpl(String pName) {
+      super(pName);
+    }
+    public boolean equals(Object o) {
+      return o != null  &&  (o instanceof Column.Name)  &&  super.equals(o);
+    }
+  }
+  public static class TypeImpl extends SQLFactoryImpl.IdentImpl implements Column.Type {
+    private int jdbcType;
+    public TypeImpl(String pName, int pJDBCType) {
+      super(pName);
+      jdbcType = pJDBCType;
+    }
+    public int getJDBCType() {
+      return jdbcType;
+    }
+  }
+
+
+  private Table table;
+
+  protected ColumnImpl(Table pTable, Column.Name pName, Column.Type pType) {
+    super(pName, pType);
+    table = pTable;
+  }
+
+  public Table getTable() { return table; }
+  public String getQName() { return getTable().getQName() + "." + getName(); }
+  public boolean isVirtual() { return false; }
+
+  public boolean isPrimaryKeyPart() {
+    Index index = getTable().getPrimaryKey();
+    if (index == null) {
+      return false;
+    }
+    for (Iterator iter = index.getColumns();  iter.hasNext();  ) {
+      Column column = (Column) iter.next();
+      if (column.equals(this)) {
+        return true;
+      }
+    }
+    return false;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnReferenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnReferenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnReferenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.TableReference;
+
+
+/** <p>Implementation of a {@link ColumnReference}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ColumnReferenceImpl implements ColumnReference {
+    private TableReference tableReference;
+    private Column column;
+    private Column.Name alias;
+
+	protected ColumnReferenceImpl(TableReference pTableReference, Column pColumn) {
+	    if (pTableReference == null) {
+	        throw new NullPointerException("The referenced table must not be null.");
+	    }
+	    if (pColumn == null) {
+	        throw new NullPointerException("The referenced column must not be null.");
+	    }
+	    if (!pTableReference.getTable().equals(pColumn.getTable())) {
+	        throw new IllegalStateException("The columns table is not the referenced table.");
+	    }
+	    tableReference = pTableReference;
+	    column = pColumn;
+	}
+
+	public TableReference getTableReference() {
+      return tableReference;
+	}
+
+	public Column getColumn() {
+      return column;
+	}
+
+	public void setAlias(String pName) {
+      setAlias(new ColumnImpl.NameImpl(pName));
+	}
+
+	public void setAlias(Column.Name pName) {
+      alias = pName;
+	}
+
+	public Column.Name getAlias() {
+      return alias;
+	}
+
+   public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof ColumnReference)) {
+         return false;
+      }
+      ColumnReference ref = (ColumnReference) o;
+	  Column c1 = ref.getColumn();
+	  Column c2 = getColumn();
+	  if (c1 == null  ||  c2 == null) {
+		  return super.equals(o);
+	  }
+	  TableReference t1 = ref.getTableReference();
+	  TableReference t2 = ref.getTableReference();
+	  if (t1 == null  ||  t2 == null) {
+		  return super.equals(o);
+	  }
+      return t1.equals(t2)  &&  c1.equals(c2);
+   }
+
+   public int hashCode() {
+      return getTableReference().hashCode() + getColumn().hashCode();
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnSetImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnSetImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ColumnSetImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>A common base class for {@link org.apache.ws.jaxme.sqls.impl.ForeignKeyImpl} and
+ * {@link org.apache.ws.jaxme.sqls.impl.IndexImpl}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class ColumnSetImpl {
+  private final Table table;
+
+	public ColumnSetImpl(Table pTable) {
+    if (pTable == null) {
+      throw new NullPointerException("The column sets table must not be null.");
+    }
+    table = pTable;
+  }
+
+  public Table getTable() {
+	   return table;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CombinedConstraintImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CombinedConstraintImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/CombinedConstraintImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,316 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.ColumnSet;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.ConstrainedStatement;
+import org.apache.ws.jaxme.sqls.Constraint;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.Value;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class CombinedConstraintImpl extends ConstraintImpl implements CombinedConstraint {
+	/** Default implementation of
+     * {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type}.
+	 */
+    public static class TypeImpl extends SQLFactoryImpl.IdentImpl implements CombinedConstraint.Type {
+    	/** Creates a new instance with the given name.
+    	 */
+        public TypeImpl(String pName) {
+            super(pName);
+        }
+    }
+
+    private boolean not;
+    private List parts = new ArrayList();
+    private CombinedConstraint.Type type;
+    
+    protected CombinedConstraintImpl(ConstrainedStatement pConstrainedStatement,
+            CombinedConstraint.Type pType) {
+        super(pConstrainedStatement);
+        type = pType;
+    }
+    
+    public CombinedConstraint.Type getType() {
+        return type;
+    }
+    
+    public CombinedConstraint createAndConstraint() {
+        ObjectFactory f = getConstrainedStatement().getSQLFactory().getObjectFactory();
+        CombinedConstraint result = f.newCombinedConstraint(getConstrainedStatement(),
+                CombinedConstraint.Type.AND);
+        parts.add(result);
+        return result;
+    }
+    
+    public CombinedConstraint createOrConstraint() {
+        ObjectFactory f = getConstrainedStatement().getSQLFactory().getObjectFactory();
+        CombinedConstraint result = f.newCombinedConstraint(getConstrainedStatement(),
+                CombinedConstraint.Type.OR);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createEQ() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.EQ);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createNE() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.NE);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createLT() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.LT);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createGT() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.GT);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createLE() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.LE);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createGE() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.GE);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createLIKE() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.LIKE);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createISNULL() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.ISNULL);
+        parts.add(result);
+        return result;
+    }
+    
+    public BooleanConstraint createIN() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.IN);
+        parts.add(result);
+        return result;
+    }
+    
+    public void createEXISTS(SelectStatement pStatement) {
+        BooleanConstraint bc = new BooleanConstraintImpl(this, BooleanConstraint.Type.EXISTS);
+        parts.add(bc);
+        bc.addPart(pStatement);
+    }
+
+    public BooleanConstraint createBETWEEN() {
+        BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.BETWEEN);
+        parts.add(result);
+		return result;
+    }
+
+    public void addColumnSetQuery(ColumnSet pSet, TableReference pTableReference) {
+        if (!pTableReference.getTable().equals(pSet.getTable())) {
+            throw new IllegalStateException("The foreign keys referencing table is " +
+                    pSet.getTable().getQName() +
+                    ", but the arguments referencing table is " +
+                    pTableReference.getTable().getQName());
+        }
+        if (!pTableReference.getStatement().equals(getConstrainedStatement())) {
+            throw new IllegalStateException("The statement of the table reference is not the same as this constraints statement.");
+        }
+        for (Iterator iter = pSet.getColumns();  iter.hasNext();  ) {
+            Column column = (Column) iter.next();
+            BooleanConstraint eq = createEQ();
+            eq.addPart(getConstrainedStatement().getSQLFactory().getObjectFactory().newColumnReference(pTableReference, column));
+            eq.addPlaceholder();
+        }
+    }
+    
+    public void addJoin(ForeignKey pKey, TableReference pReferencingTable,
+            TableReference pReferencedTable) {
+        if (!pReferencingTable.getTable().equals(pKey.getTable())) {
+            throw new IllegalStateException("The foreign keys referencing table is " +
+                    pKey.getTable().getQName() +
+                    ", but the arguments referencing table is " +
+                    pReferencingTable.getTable().getQName());
+        }
+        if (!pReferencedTable.getTable().equals(pKey.getReferencedTable())) {
+            throw new IllegalStateException("The foreign keys referenced table is " +
+                    pKey.getReferencedTable().getQName() +
+                    ", but the arguments referenced table is " +
+                    pReferencedTable.getTable().getQName());
+        }
+        if (!pReferencingTable.getStatement().equals(getConstrainedStatement())) {
+            throw new IllegalStateException("The statement of the referencing table is not the same as this constraints statement.");
+        }
+        if (!pReferencedTable.getStatement().equals(getConstrainedStatement())) {
+            throw new IllegalStateException("The statement of the referenced table is not the same as this constraints statement.");
+        }
+        
+        for (Iterator iter = pKey.getColumnLinks();  iter.hasNext();  ) {
+            ForeignKey.ColumnLink columnReference = (ForeignKey.ColumnLink) iter.next();
+            BooleanConstraint eq = createEQ();
+            ObjectFactory of = getConstrainedStatement().getSQLFactory().getObjectFactory();
+            eq.addPart(of.newColumnReference(pReferencingTable, columnReference.getLocalColumn()));
+            eq.addPart(of.newColumnReference(pReferencedTable, columnReference.getReferencedColumn()));
+        }
+    }
+    
+    public void addJoin(TableReference pReferencingTable,
+            ColumnSet pReferencingColumnSet,
+            TableReference pReferencedTable,
+            ColumnSet pReferencedColumnSet) {
+        if (pReferencingTable == null) { throw new NullPointerException("The referencing table must not be null."); }
+        if (pReferencingColumnSet == null) { throw new NullPointerException("The referencing column set must not be null."); }
+        if (pReferencedTable == null) { throw new NullPointerException("The referenced table must not be null."); }
+        if (pReferencedColumnSet == null) { throw new NullPointerException("The referenced column set must not be null."); }
+        if (!pReferencingTable.getTable().equals(pReferencingColumnSet.getTable())) {
+            throw new IllegalStateException("The referencing column sets table " +
+                    pReferencingColumnSet.getTable().getQName() +
+                    " doesn't match the referencing table " +
+                    pReferencingTable.getTable().getQName());
+        }
+        if (!pReferencedTable.getTable().equals(pReferencedColumnSet.getTable())) {
+            throw new IllegalStateException("The referenced column sets table " +
+                    pReferencedColumnSet.getTable().getQName() +
+                    " doesn't match the referenced table " +
+                    pReferencedTable.getTable().getQName());
+        }
+        
+        Iterator referencedIter = pReferencedColumnSet.getColumns();
+        for (Iterator iter = pReferencingColumnSet.getColumns();  iter.hasNext();  ) {
+            Column referencingColumn = (Column) iter.next();
+            if (!referencedIter.hasNext()) {
+                throw new IllegalStateException("The size of the referencing and referenced column sets doesn't match.");
+            }
+            Column referencedColumn = (Column) referencedIter.next();
+            BooleanConstraint eq = createEQ();
+            eq.addPart(pReferencingTable.newColumnReference(referencingColumn));
+            eq.addPart(pReferencedTable.newColumnReference(referencedColumn));
+        }
+    }
+    
+    
+    public int getNumParts() {
+        return parts.size();
+    }
+    
+    public Iterator getParts() {
+        return parts.iterator();
+    }
+    
+    public void addConstraint(Map pMap, Constraint pConstraint) {
+        if (pConstraint instanceof CombinedConstraint) {
+            CombinedConstraint source = (CombinedConstraint) pConstraint;
+            CombinedConstraint target;
+            if (source.getType().equals(getType())) {
+                target = this;
+            } else if (source.getType().equals(CombinedConstraint.Type.AND)) {
+                target = createAndConstraint();
+            } else if (source.getType().equals(CombinedConstraint.Type.OR)) {
+                target = createOrConstraint();
+            } else {
+                throw new IllegalStateException("Unknown combined constraint type: " +
+                        source.getType());
+            }
+            for (Iterator iter = source.getParts();  iter.hasNext();  ) {
+                Object o = iter.next();
+                if (o instanceof CombinedConstraint) {
+                    target.addConstraint(pMap, (CombinedConstraint) o);
+                } else if (o instanceof BooleanConstraint) {
+                    target.addConstraint(pMap, (BooleanConstraint) o);
+                } else {
+                    throw new IllegalArgumentException("Invalid part: " + o.getClass().getName()); 
+                }
+            }
+        } else if (pConstraint instanceof BooleanConstraint) {
+            BooleanConstraint source = (BooleanConstraint) pConstraint;
+            BooleanConstraint target;
+            BooleanConstraint.Type sourceType = source.getType();
+            if (BooleanConstraint.Type.EQ.equals(sourceType)) {
+                target = createEQ();
+            } else if (BooleanConstraint.Type.NE.equals(sourceType)) {
+                target = createNE();
+            } else if (BooleanConstraint.Type.GT.equals(sourceType)) {
+                target = createGT();
+            } else if (BooleanConstraint.Type.LT.equals(sourceType)) {
+                target = createLT();
+            } else if (BooleanConstraint.Type.GE.equals(sourceType)) {
+                target = createGE();
+            } else if (BooleanConstraint.Type.LE.equals(sourceType)) {
+                target = createLE();
+            } else if (BooleanConstraint.Type.LIKE.equals(sourceType)) {
+                target = createLIKE();
+            }  else if (BooleanConstraint.Type.ISNULL.equals(sourceType)) {
+                target = createISNULL();
+            } else if (BooleanConstraint.Type.IN.equals(sourceType)) {
+                target = createIN();
+            } else {
+                throw new IllegalArgumentException("Invalid boolean constraint type: " + sourceType);
+            }
+            for (Iterator iter = source.getParts();  iter.hasNext();  ) {
+                Object o = iter.next();
+                if (o instanceof Value) {
+                    target.addPart((Value) o);
+                } else if (o instanceof ColumnReference) {
+                    ColumnReference colRef = (ColumnReference) o;
+                    TableReference tableRef = (TableReference) pMap.get(colRef.getTableReference());
+                    if (tableRef == null) {
+                        throw new IllegalStateException("Unknown reference to table " + colRef.getTableReference().getTable().getQName());
+                    }
+                    target.addPart(tableRef.newColumnReference(colRef.getColumn()));
+                } else {
+                    throw new IllegalStateException("Unknown part type: " + o.getClass().getName());
+                }
+            }
+        } else {
+            throw new IllegalStateException("Unknown constraint type: " + pConstraint.getClass().getName());
+        }
+    }
+
+    public void setNOT(boolean pNot) {
+        not = pNot;
+    }
+
+    public boolean isNOT() {
+        return not;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstrainedStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstrainedStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstrainedStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.ConstrainedStatement;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class ConstrainedStatementImpl extends StatementImpl implements ConstrainedStatement {
+    private CombinedConstraint where = null;
+
+	protected ConstrainedStatementImpl(SQLFactory pFactory) {
+		super(pFactory);
+	}
+
+	public CombinedConstraint getWhere() {
+      if (where == null) {
+          ObjectFactory f = getSQLFactory().getObjectFactory();
+          where = f.newCombinedConstraint(this, CombinedConstraint.Type.AND);
+      }
+      return where;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstraintImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstraintImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ConstraintImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.ConstrainedStatement;
+import org.apache.ws.jaxme.sqls.Constraint;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class ConstraintImpl implements Constraint {
+   private ConstrainedStatement constrainedStatement;
+
+   /** <p>Creates a new instance of ConstraintImpl.</p>
+    */
+	public ConstraintImpl(ConstrainedStatement pStatement) {
+      constrainedStatement = pStatement;
+	}
+
+   public ConstrainedStatement getConstrainedStatement() {
+      return constrainedStatement;
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/DeleteStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/DeleteStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/DeleteStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DeleteStatementImpl extends ConstrainedStatementImpl implements DeleteStatement {
+   /** <p>Creates a new instance of DeleteStatementImpl.</p>
+    */
+	DeleteStatementImpl(SQLFactory pFactory) {
+		super(pFactory);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ExpressionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ExpressionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ExpressionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Expression;
+import org.apache.ws.jaxme.sqls.Statement;
+
+
+/** Default implementation of {@link org.apache.ws.jaxme.sqls.Expression}.
+ */
+public class ExpressionImpl extends PartsImpl implements Expression {
+	/** Default implementation of {@link Expression.Type}.
+	 */
+	public static class TypeImpl extends SQLFactoryImpl.IdentImpl implements Expression.Type {
+		private static final long serialVersionUID = 3834872498671071537L;
+		/** Creates a new instance with the given name.
+		 */
+		public TypeImpl(String pName) {
+			super(pName);
+		}
+	}
+
+	private final Type type;
+
+	protected ExpressionImpl(Statement pStatement, Expression.Type pType) {
+		super(pStatement);
+		type = pType;
+	}
+
+	public Type getType() { return type; }
+
+	public int getMinimumParts() { return 1; }
+	public int getMaximumParts() {
+		if (Expression.PRODUCT.equals(type)
+		    ||  Expression.SUM.equals(type)) {
+			return 0;
+		} else if (Expression.DIFFERENCE.equals(type)
+				   ||  Expression.QUOTIENT.equals(type)) {
+			return 2;
+		} else {
+			throw new IllegalStateException("Invalid type: " + type);
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ForeignKeyImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ForeignKeyImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ForeignKeyImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnSet;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>Implementation of a foreign key.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ForeignKeyImpl extends ColumnSetImpl implements ForeignKey {
+  public static class ColumnReferenceImpl implements ForeignKey.ColumnLink {
+    private final Column localColumn, referencedColumn; 
+    public ColumnReferenceImpl(Column pLocalColumn, Column pReferencedColumn) {
+      if (pLocalColumn == null) {
+         throw new NullPointerException("The local column must not be null.");
+      }
+      if (pReferencedColumn == null) {
+        throw new NullPointerException("The referenced column must not be null.");
+      }
+      localColumn = pLocalColumn;
+      referencedColumn = pReferencedColumn;
+    }
+    public Column getLocalColumn() {
+      return localColumn;
+    }
+    public Column getReferencedColumn() {
+      return referencedColumn;
+    }
+  }
+
+  private Table referencedTable;
+  private ForeignKey.Mode onDelete, onUpdate;
+  public List references = new ArrayList();
+
+  protected ForeignKeyImpl(Table pTable, Table pReferencedTable) {
+    super(pTable);
+    if (pReferencedTable == null) {
+      throw new NullPointerException("The referenced table must not be null.");
+    }
+    referencedTable = pReferencedTable;
+  }
+
+	public Table getReferencedTable() {
+      return referencedTable;
+	}
+
+	public void setOnDelete(ForeignKey.Mode pMode) {
+      onDelete = pMode;
+	}
+
+	public ForeignKey.Mode getOnDelete() {
+      return onDelete;
+	}
+
+	public void setOnUpdate(ForeignKey.Mode pMode) {
+      onUpdate = pMode;
+	}
+
+	public ForeignKey.Mode getOnUpdate() {
+      return onUpdate;
+	}
+
+	public void addColumnLink(Column pColumn, Column pReferencedColumn) {
+    addColumnReference(new ColumnReferenceImpl(pColumn, pReferencedColumn));
+  }
+
+  public void addColumnReference(ForeignKey.ColumnLink pReference) {
+    Column localColumn = pReference.getLocalColumn();
+    if (!getTable().equals(localColumn.getTable())) {
+      throw new IllegalStateException("The local column " + localColumn.getQName() +
+                                       " is not from the local table " + getTable().getQName());
+    }
+    Column referencedColumn = pReference.getReferencedColumn();
+    if (!getReferencedTable().equals(referencedColumn.getTable())) {
+      throw new IllegalStateException("The referenced column " + referencedColumn.getQName() +
+                                       " is not from the referenced table " + getReferencedTable().getQName());
+    }
+    references.add(pReference);
+	}
+
+	public void addColumnLink(Column.Name pName, Column.Name pReferencedName) {
+      Column localColumn = getTable().getColumn(pName);
+      if (localColumn == null) {
+        throw new NullPointerException("The local table " + getTable().getQName() +
+                                        " doesn't contain a column " + pName);
+      }
+      Column referencedColumn = getReferencedTable().getColumn(pReferencedName);
+      if (referencedColumn == null) {
+         throw new NullPointerException("The referenced table " + getReferencedTable().getName() +
+                                         " doesn't contain a column " + pReferencedName);
+      }
+      addColumnLink(localColumn, referencedColumn);
+	}
+
+	public void addColumnLink(String pName, String pReferencedName) {
+      addColumnLink(new ColumnImpl.NameImpl(pName), new ColumnImpl.NameImpl(pReferencedName));
+	}
+
+   public Iterator getColumnLinks() {
+      return references.iterator();
+   }
+
+	public Iterator getColumns() {
+      return new Iterator(){
+         Iterator inner = getColumnLinks();
+         public boolean hasNext() { return inner.hasNext(); }
+         public void remove() { inner.remove(); }
+         public Object next() {
+            ForeignKey.ColumnLink link = (ForeignKey.ColumnLink) inner.next();
+            return link.getLocalColumn();
+         }
+      };
+	}
+
+   public ColumnSet getReferencedColumns() {
+     return new ColumnSet(){
+       public Table getTable() { return getReferencedTable(); }
+       public Iterator getColumns() {
+         return new Iterator() {
+            private Iterator inner = getColumnLinks();
+            public Object next() {
+              return ((ColumnLink) inner.next()).getReferencedColumn();
+            }
+            public boolean hasNext() { return inner.hasNext(); }
+            public void remove() { inner.remove(); }
+         };
+       }
+     };
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/FunctionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/FunctionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/FunctionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.Statement;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class FunctionImpl extends PartsImpl implements Function {
+	final String name;
+	
+	/** <p>Creates a new instance of FunctionImpl.java.</p>
+	 */
+	protected FunctionImpl(Statement pStatement, String pName) {
+		super(pStatement);
+		name = pName;
+	}
+	
+	public String getName() { return name; }
+	
+	public int getMinimumParts() { return 0; }
+	public int getMaximumParts() { return 0; }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/IndexImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/IndexImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/IndexImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class IndexImpl extends ColumnSetImpl implements Index {
+  public static class NameImpl extends SQLFactoryImpl.IdentImpl implements Index.Name {
+    public NameImpl(String pName) {
+      super(pName);
+    }
+  }
+
+  private final List columns = new ArrayList();
+  private final boolean unique;
+  private final boolean primaryKey;
+  private Index.Name name;
+
+	IndexImpl(Table pTable, boolean pUnique, boolean pPrimaryKey) {
+      super(pTable);
+      unique = pUnique;
+      primaryKey = pPrimaryKey;
+      if (primaryKey && !unique) {
+         throw new IllegalArgumentException("A primary key must be unique.");
+      }
+    setName(pTable.getName() + "_" + "I" + ((TableImpl) pTable).indexNameCounter++);
+  }
+
+  public void setName(Index.Name pName) {
+    if (pName == null) {
+      throw new NullPointerException("An index name must not be null.");
+    }
+    name = pName;
+  }
+
+  public void setName(String pName) {
+    if (pName == null) {
+      throw new NullPointerException("An index name must not be null.");
+    }
+    setName(new IndexImpl.NameImpl(pName));
+  }
+
+  public Index.Name getName() {
+    return name;
+	}
+
+	public void addColumn(Column pColumn) {
+      if (columns.contains(pColumn)) {
+         throw new IllegalStateException("The column " + pColumn.getName() + " was already added to the key.");
+      }
+      columns.add(pColumn);
+	}
+
+   public void addColumn(Column.Name pName) {
+      Column column = getTable().getColumn(pName);
+      if (column == null) {
+         throw new NullPointerException("The table " + getTable().getName() + " doesn't contain a column " + pName);
+      }
+      addColumn(column);
+   }
+
+   public void addColumn(String pName) {
+      addColumn(new ColumnImpl.NameImpl(pName));
+   }
+
+	public boolean isUnique() {
+      return unique;
+	}
+
+	public boolean isPrimaryKey() {
+      return primaryKey;
+	}
+
+   public Iterator getColumns() {
+      return columns.iterator();
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/InsertStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/InsertStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/InsertStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.Column.Name;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class InsertStatementImpl extends SetStatementImpl implements InsertStatement {
+	private SelectStatement st;
+
+    /** <p>Creates a new instance of InsertStatementImpl.</p>
+	 */
+	InsertStatementImpl(SQLFactory pFactory) {
+		super(pFactory);
+	}
+
+	public void setSubSelect(SelectStatement pStatement) {
+        st = pStatement;
+	}
+
+	public SelectStatement getSubSelect() {
+        return st;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/JoinReferenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/JoinReferenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/JoinReferenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JoinReferenceImpl extends SelectTableReferenceImpl implements JoinReference {
+    private boolean outerJoin;
+    private SelectTableReference leftTableReference;
+    private CombinedConstraint onClause;
+    
+    /** <p>Creates a new instance of JoinReferenceImpl.</p>
+     */
+    protected JoinReferenceImpl(SelectTableReference pLeftTableReference, Table pRightTable,
+            boolean pOuterJoin) {
+        super(pLeftTableReference.getSelectStatement(), pRightTable);
+        leftTableReference = pLeftTableReference;
+        outerJoin = pOuterJoin;
+    }
+    
+    public boolean isJoin() {
+        return !outerJoin;
+    }
+    
+    public boolean isLeftOuterJoin() {
+        return outerJoin;
+    }
+    
+    public SelectTableReference getLeftJoinedTableReference() {
+        return leftTableReference;
+    }
+    
+    public CombinedConstraint getOn() {
+        if (onClause == null) {
+            ObjectFactory f = getSelectStatement().getSQLFactory().getObjectFactory();
+            onClause = f.newCombinedConstraint(getSelectStatement(), CombinedConstraint.Type.AND);
+        }
+        return onClause;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ObjectFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ObjectFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ObjectFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Case;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.ConstrainedStatement;
+import org.apache.ws.jaxme.sqls.Expression;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.RawSQLCode;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Statement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.CombinedConstraint.Type;
+
+
+/** <p>Default implementation of the object factory.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ObjectFactoryImpl implements ObjectFactory {
+    protected ObjectFactoryImpl() {
+    }
+    
+    public RawSQLCode newRawSQL(String pRawSQLCode) {
+        return new RawSQLCodeImpl(pRawSQLCode);
+    }
+    
+    public JoinReference newJoinReference(SelectTableReference pSelectTableReference,
+            Table pTable,
+            boolean pIsLeftOuterJoin) {
+        return new JoinReferenceImpl(pSelectTableReference, pTable, pIsLeftOuterJoin);
+    }
+    
+    public Function newFunction(Statement pStatement, String pName) {
+        return new FunctionImpl(pStatement, pName);
+    }
+    public Table newView(SelectStatement pSelectStatement, Table.Name pName) {
+        return new ViewImpl(pSelectStatement, pName);
+    }
+
+    public CombinedConstraint newCombinedConstraint(ConstrainedStatement pStatement, Type pType) {
+        return new CombinedConstraintImpl(pStatement, pType);
+    }
+
+    public Case newCase(Column.Type pType) {
+    	return new CaseImpl(pType);
+    }
+
+    public ColumnReference newColumnReference(TableReference pTableReference, Column pColumn) {
+        return new ColumnReferenceImpl(pTableReference, pColumn);
+    }
+
+	public Expression createExpression(Statement pStatement, org.apache.ws.jaxme.sqls.Expression.Type pType) {
+		return new ExpressionImpl(pStatement, pType);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/PartsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/PartsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/PartsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Case;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.Expression;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.Parts;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.Statement;
+import org.apache.ws.jaxme.sqls.Value;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class PartsImpl implements Parts {
+  private final Statement statement;
+  private final List parts = new ArrayList();
+
+  protected PartsImpl(Statement pStatement) {
+    statement = pStatement;
+  }
+
+  protected void add(Object o) {
+    parts.add(o);
+  }
+
+  /** Returns the statement, to which the part belongs.
+   */
+  public Statement getStatement() {
+    return statement;
+  }
+
+  public void addPart(Value pValue) {
+    if (pValue == null) {
+      throw new NullPointerException("A constant value must not be null.");
+    }
+    parts.add(pValue);
+  }
+
+  public void addPart(ColumnReference pColumn) {
+    if (pColumn == null) {
+      throw new NullPointerException("Referenced column must not be null.");
+    }
+    add(pColumn);
+  }
+
+  public void addPart(ColumnReference[] pColumns) {
+    if (pColumns == null) {
+      throw new NullPointerException("The array of referenced columns must not be null.");
+    }
+    for (int i = 0;  i < pColumns.length;  i++) {
+      if (pColumns[i] == null) {
+        throw new NullPointerException("The referenced column with number " + i + " must not be null.");
+      }
+    }
+    add(pColumns);
+  }
+
+  public void addPart(SelectStatement pStatement) {
+    if (pStatement == null) {
+      throw new NullPointerException("The subselect statement must not be null.");
+    }
+    add(pStatement);
+  }
+
+  public void addPart(String pString) {
+    add(new ValueImpl(Value.Type.STRING, pString));
+  }
+
+  public void addPart() {
+    add(new ValueImpl(Value.Type.NULL, null));
+  }
+
+  public void addPart(byte pByte) {
+    add(new ValueImpl(Value.Type.BYTE, new Byte(pByte)));
+  }
+
+  public void addPart(int pInt) {
+    add(new ValueImpl(Value.Type.INT, new Integer(pInt)));
+  }
+
+  public void addPart(long pLong) {
+    add(new ValueImpl(Value.Type.LONG, new Long(pLong)));
+  }
+
+  public void addPart(short pShort) {
+    add(new ValueImpl(Value.Type.SHORT, new Short(pShort)));
+  }
+
+  public void addPart(float pFloat) {
+    add(new ValueImpl(Value.Type.FLOAT, new Float(pFloat)));
+  }
+
+  public void addPart(double pDouble) {
+    add(new ValueImpl(Value.Type.DOUBLE, new Double(pDouble)));
+  }
+
+  public void addPart(boolean pBoolean) {
+    add(new ValueImpl(Value.Type.BOOLEAN, pBoolean ? Boolean.TRUE : Boolean.FALSE));
+  }
+
+  public void addPart(Function pFunction) {
+    add(pFunction);
+  }
+
+  public void addPart(Expression pExpression) {
+	add(pExpression);
+  }
+
+  public void addPlaceholder() {
+    add(new ValueImpl(Value.Type.PLACEHOLDER, null));
+  }
+
+  /** <p>Inserts raw SQL code.</p>
+   */ 
+  public void addRawSQLPart(String pRawSQL) {
+    add(getStatement().getSQLFactory().getObjectFactory().newRawSQL(pRawSQL));
+  }
+
+  public int getNumParts() {
+    return parts.size();
+  }
+
+  public Iterator getParts() {
+    return parts.iterator();
+  }
+
+    public void addPart(Case pCase) {
+        add(pCase);
+    }
+
+	private Expression newExpression(Expression.Type pType) {
+		Statement st = getStatement();
+		Expression result = st.getSQLFactory().getObjectFactory().createExpression(st, pType);
+		addPart(result);
+		return result;
+	}
+
+	public Expression createSUM() { return newExpression(Expression.SUM); }
+	public Expression createPRODUCT() { return newExpression(Expression.PRODUCT); }
+	public Expression createDIFFERENCE() { return newExpression(Expression.DIFFERENCE); }
+	public Expression createQUOTIENT() { return newExpression(Expression.QUOTIENT); }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/RawSQLCodeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/RawSQLCodeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/RawSQLCodeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.RawSQLCode;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class RawSQLCodeImpl implements RawSQLCode {
+  private final String rawSQLCode;
+
+  protected RawSQLCodeImpl(String pRawSQLCode) {
+    rawSQLCode = pRawSQLCode;
+  }
+
+  public String toString() {
+    return rawSQLCode;
+  }
+
+  public String getRawSQL() {
+    return rawSQLCode;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,611 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.sqls.BinaryColumn;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.StringColumn;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+
+
+/** <p>Default implementation of an SQLFactory.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SQLFactoryImpl implements SQLFactory {
+  private static final Logger logger = LoggerAccess.getLogger(SQLFactoryImpl.class);
+
+  /** Base class for deriving identifiers.
+   */
+  public static class IdentImpl implements SQLFactory.Ident, Serializable {
+    private String name;
+
+    protected IdentImpl(String pName) {
+      if (pName == null) {
+        throw new NullPointerException("An ident's string representation must not be null.");
+      }
+      name = pName;
+    }
+
+    public String getName() {
+      return name;
+    }
+
+    public String toString() {
+      return name;
+    }
+
+    public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof SQLFactory.Ident)) {
+        return false;
+      }
+      return name.equalsIgnoreCase(((SQLFactory.Ident) o).getName());
+    }
+    public int hashCode() {
+      return name.hashCode();
+    }
+  }
+
+  private List schemas = new ArrayList();
+  private Integer maxTableNameLength, maxSchemaNameLength, maxColumnNameLength;
+  private boolean tableNameCaseSensitive, schemaNameCaseSensitive, columnNameCaseSensitive;
+  private Schema defaultSchema;
+  private ObjectFactory objectFactory = newObjectFactory();
+
+  /** <p>Creates a new instance of SQLFactoryImpl.</p>
+   */
+  public SQLFactoryImpl() {
+  }
+
+  protected ObjectFactory newObjectFactory() {
+    return new ObjectFactoryImpl();
+  }
+
+  public ObjectFactory getObjectFactory() {
+    return objectFactory;
+  }
+
+  protected void setObjectFactory(ObjectFactory pFactory) {
+    objectFactory = pFactory;
+  }
+
+  /** <p>Sets the maximum length of a table name.</p>
+   * @param pMaxLength The maximum length or null to disable checks for
+   *   valid table name length.
+   */
+  public void setMaxTableNameLength(Integer pMaxLength) {
+    maxTableNameLength = pMaxLength;
+  }
+
+  public Integer getMaxTableNameLength() {
+    return maxTableNameLength;
+  }
+
+  /** <p>Sets whether table names are case sensitive or not. Defaults
+   * to false.</p>
+   * @see SQLFactory#isTableNameCaseSensitive()
+   */
+  public void setTableNameCaseSensitive(boolean pTableNameCaseSensitive) {
+    tableNameCaseSensitive = pTableNameCaseSensitive;
+  }
+
+  public boolean isTableNameCaseSensitive() {
+    return tableNameCaseSensitive;
+  }
+
+  /** <p>Sets the maximum length of a column name.</p>
+   * @param pMaxLength The maximum length or null to disable checks for
+   *   valid column name length.
+   */
+  public void setMaxColumnNameLength(Integer pMaxLength) {
+    maxColumnNameLength = pMaxLength;
+  }
+
+  public Integer getMaxColumnNameLength() {
+    return maxColumnNameLength;
+  }
+
+  /** <p>Sets whether column names are case sensitive or not. Defaults
+   * to false.</p>
+   * @see SQLFactory#isColumnNameCaseSensitive()
+   */
+  public void setColumnNameCaseSensitive(boolean pColumnNameCaseSensitive) {
+    columnNameCaseSensitive = pColumnNameCaseSensitive;
+  }
+ 
+  public boolean isColumnNameCaseSensitive() {
+    return columnNameCaseSensitive;
+  }
+
+  /** <p>Sets whether schema names are case sensitive or not. Defaults
+   * to false.</p>
+   * @see SQLFactory#isSchemaNameCaseSensitive()
+   */
+  public void setSchemaNameCaseSensitive(boolean pSchemaNameCaseSensitive) {
+    schemaNameCaseSensitive = pSchemaNameCaseSensitive;
+  }
+
+  public boolean isSchemaNameCaseSensitive() {
+    return schemaNameCaseSensitive;
+  }
+
+  /** <p>Sets the maximum length of a schema name.</p>
+   * @param pMaxLength The maximum length or null to disable checks for
+   *   valid schema name length.
+   */
+  public void setMaxSchemaNameLength(Integer pMaxLength) {
+    maxSchemaNameLength = pMaxLength;
+  }
+
+  public Integer getMaxSchemaNameLength() {
+    return maxSchemaNameLength;
+  }
+
+  /** Converths the given string into an SQL identifier.
+   */
+  public SQLFactory.Ident newIdent(String pName) {
+    if (pName == null) {
+      throw new NullPointerException("An SQL identifier must not be null.");
+    }
+    if (pName.length() == 0) {
+      throw new IllegalArgumentException("An SQL identifier must not be empty.");
+    }
+    char c = pName.charAt(0);
+    if ((c < 'A'  ||  c > 'Z')  &&  (c < 'a'  ||  c > 'z')) {
+      throw new IllegalArgumentException("An SQL identifiers first character must be A..Z");
+    }
+    for (int i = 1;  i < pName.length();  i++) {
+      c = pName.charAt(i);
+      if ((c < 'A'  ||  c > 'Z')  &&  (c < 'a'  ||  c > 'z')  &&  (c < '0'  ||  c > '9')) {
+        throw new IllegalArgumentException("An SQL identifier must not contain the character " +
+					  c + ", only A..Z, a..z, or 0..9 are allowed.");
+      }
+    }
+    return new IdentImpl(pName);
+  }
+
+  public Schema newSchema(String pName) {
+    if (pName == null) {
+      throw new NullPointerException("A schema name must not be null.");
+    }
+    return newSchema(new SchemaImpl.NameImpl(pName));
+  }
+
+  public Schema newSchema(Schema.Name pName) {
+    if (pName == null) {
+      throw new NullPointerException("A schema name must not be null.");
+    }
+    Integer maxLength = getMaxSchemaNameLength();
+    if (maxLength != null  &&
+	pName.getName().length() > maxLength.intValue()) {
+      throw new IllegalArgumentException("The length of the schema name " + pName +
+					 " exceeds the valid maximum of " + maxLength);
+    }
+    Schema schema = getSchema(pName);
+    if (schema != null) {
+      throw new IllegalStateException("A schema named " + schema.getName() + " already exists.");  
+    }
+    schema = newSchemaImpl(pName);
+    schemas.add(schema);
+    return schema;
+  }
+
+  public Schema getDefaultSchema() {
+    if (defaultSchema == null) {
+      defaultSchema = newSchemaImpl(null);
+      schemas.add(defaultSchema);
+    }
+    return defaultSchema;
+   }
+
+  public Schema getSchema(String pName) {
+    return getSchema(new SchemaImpl.NameImpl(pName));
+  }
+
+  public Schema getSchema(Schema.Name pName) {
+    if (pName == null) {
+      throw new NullPointerException("A schema name must not be null.");
+    }
+    for (Iterator iter = getSchemas(); iter.hasNext();) {
+      Schema schema = (Schema) iter.next();
+      if (isSchemaNameCaseSensitive()) {
+        if (pName.getName().equalsIgnoreCase(schema.getName().getName())) {
+          return schema;
+        }
+      } else {
+        if (pName.equals(schema.getName())) {
+          return schema;
+        }
+      }
+    }
+    return null;
+  }
+
+  public Iterator getSchemas() {
+    return schemas.iterator();
+  }
+
+  public SelectStatement newSelectStatement() {
+    return new SelectStatementImpl(this);
+  }
+
+  public InsertStatement newInsertStatement() {
+    return new InsertStatementImpl(this);
+  }
+
+  public UpdateStatement newUpdateStatement() {
+    return new UpdateStatementImpl(this);
+  }
+
+  public DeleteStatement newDeleteStatement() {
+    return new DeleteStatementImpl(this);
+  }
+
+  protected Schema newSchemaImpl(Schema.Name pName) {
+    return new SchemaImpl(this, pName);
+  }
+
+  protected Table newTableImpl(Schema pSchema, Table.Name pName) {
+    return new TableImpl(pSchema, pName);
+  }
+
+  protected Column newColumnImpl(Table pTable, Column.Name pName, Column.Type pType) {
+    return new ColumnImpl(pTable, pName, pType);
+  }
+
+  public SQLGenerator newSQLGenerator() {
+    return new SQLGeneratorImpl();
+  }
+
+  public Schema getSchema(Connection pConn, String pName) throws SQLException {
+     return getSchema(pConn, pName == null ? null : new SchemaImpl.NameImpl(pName));
+  }
+
+  private class JDBCTable {
+    private final String catalogName, schemaName, tableName, tableType;
+    private final String toStringValue;
+    private Table table;
+    /** Creates a new instance loading data from the given catalog, schema
+     * and table.
+     */
+    public JDBCTable(String pCatalogName, String pSchemaName, String pTableName,
+                     String pTableType) {
+      catalogName = pCatalogName;
+      schemaName = pSchemaName;
+      tableName = pTableName;
+      tableType = pTableType;
+      String s = tableName;
+      if ((schemaName != null  &&  schemaName.length() > 0)  ||
+          (catalogName != null  &&  catalogName.length() > 0)) {
+        s = catalogName + "." + schemaName + "." + tableName;
+        
+      }
+      toStringValue = s;
+    }
+    /** Returns the catalog name.
+     */
+    public String getCatalogName() { return catalogName; }
+    /** Returns the schema name.
+     */
+    public String getSchemaName() { return schemaName; }
+    /** Returns the table name.
+     */
+    public String getTableName() { return tableName; }
+    /** Returns the table type.
+     */
+    public String getTableType() { return tableType; }
+    public String toString() { return toStringValue; }
+    /** Sets the associated instance of {@link Table}.
+     */
+    public void setTable(Table pTable) { table = pTable; }
+    /** Returns the associated instance of {@link Table}.
+     */
+    public Table getTable() { return table; }
+
+    public int hashCode() {
+      int result = 0;
+      if (catalogName != null) result += catalogName.hashCode();
+      if (schemaName != null) result += schemaName.hashCode();
+      if (tableName != null) result += tableName.hashCode();
+      return result;
+    }
+    public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof JDBCTable)) return false;
+      JDBCTable t = (JDBCTable) o;
+      if (catalogName == null) {
+        if (t.catalogName != null) return false;
+      } else {
+        if (!catalogName.equals(t.catalogName)) return false;
+      }
+      if (schemaName == null) {
+        if (t.schemaName != null) return false;
+      } else {
+        if (!schemaName.equals(t.schemaName)) return false;
+      }
+      if (tableName == null) {
+        return t.tableName == null;
+      } else {
+        return tableName.equals(t.tableName);
+      }
+    }
+  }
+
+  protected Schema makeSchema(Schema.Name pName) {
+    Schema schema;
+    if (pName == null) {
+       schema = getDefaultSchema();
+    } else {
+       schema = getSchema(pName);
+       if (schema == null) {
+          schema = newSchema(pName);
+       }
+    }
+    return schema;
+  }
+
+  protected JDBCTable[] readTables(DatabaseMetaData pData, Schema.Name pSchema, Table.Name pTable) throws SQLException {
+    final String mName = "readTables";
+    List tables = new ArrayList();
+    {
+      ResultSet rs = pData.getTables(null, pSchema == null ? null : pSchema.getName(),
+                                     pTable == null ? null : pTable.getName(), null);
+      boolean isRsClosed = false;
+      try {
+        while (rs.next()) {
+          JDBCTable table = new JDBCTable(rs.getString(1), rs.getString(2),
+                                          rs.getString(3), rs.getString(4));
+          if (!"TABLE".equals(table.getTableType())) {
+            continue;
+          }
+   
+          if (pSchema != null) {
+            if (!table.getSchemaName().equals(pSchema.toString())) {
+              continue;
+            }
+          }
+          logger.finest(mName, "Found table " + table);
+          tables.add(table);
+        }
+        isRsClosed = true;
+        rs.close();
+      } finally {
+        if (!isRsClosed) { try { rs.close(); } catch (Throwable ignore) {} }
+      }
+    }
+    return (JDBCTable[]) tables.toArray(new JDBCTable[tables.size()]);
+  }
+
+  protected Column readColumn(Table pTable, String pColumnName, int pDataType, String pTypeName,
+                               long pColumnSize, int pDecimalDigits, int pNullable) {
+                               Column.Type type;
+    final String mName = "readColumn";
+    switch (pDataType) {
+      case Types.BIGINT:        type = Column.Type.BIGINT;    break;
+      case Types.BINARY:        type = Column.Type.BINARY;    break;
+      case Types.BIT:           type = Column.Type.BIT;       break;
+      case Types.BLOB:          type = Column.Type.BLOB;      break;
+      case 16:  /* Types.BOOLEAN, introduced in Java 1.4 */
+      	                        type = Column.Type.BIT;       break;
+      case Types.CHAR:          type = Column.Type.CHAR;      break;
+      case Types.CLOB:          type = Column.Type.CLOB;      break;
+      case Types.DATE:          type = Column.Type.DATE;      break;
+      case Types.DOUBLE:        type = Column.Type.DOUBLE;    break;
+      case Types.FLOAT:         type = Column.Type.FLOAT;     break;
+      case Types.REAL:          type = Column.Type.DOUBLE;    break;
+      case Types.INTEGER:       type = Column.Type.INTEGER;   break;
+      case Types.LONGVARBINARY: type = Column.Type.VARBINARY; break;
+      case Types.LONGVARCHAR:   type = Column.Type.VARCHAR;   break;
+      case Types.OTHER:         type = Column.Type.OTHER;     break;
+      case Types.SMALLINT:      type = Column.Type.SMALLINT;  break;
+      case Types.TIMESTAMP:     type = Column.Type.TIMESTAMP; break;
+      case Types.TIME:          type = Column.Type.TIME;      break;
+      case Types.TINYINT:       type = Column.Type.TINYINT;   break;
+      case Types.VARBINARY:     type = Column.Type.VARBINARY; break;
+      case Types.VARCHAR:       type = Column.Type.VARCHAR;   break;
+      default: throw new IllegalArgumentException("Column " + pColumnName +
+                                                    " in table " + pTable.getQName() +
+                                                    " has unknown JDBC data type " +
+                                                    pDataType);
+    }
+    Column column = pTable.newColumn(pColumnName, type);
+    logger.finest(mName, "Found column " + pColumnName);
+    if (column instanceof StringColumn) {
+      ((StringColumn) column).setLength(pColumnSize);
+    } else if (column instanceof BinaryColumn) {
+      ((BinaryColumn) column).setLength(pColumnSize);
+    }
+    if (pNullable == DatabaseMetaData.columnNullable) {
+      column.setNullable(true);
+    }
+    return column;
+  }
+
+  protected Table readTable(DatabaseMetaData pData, Schema pSchema, JDBCTable pTable)
+      throws SQLException {
+    final String mName = "readTable";
+    ResultSet rs = pData.getColumns(pTable.getCatalogName(), pTable.getSchemaName(),
+                                    pTable.getTableName(), null);
+    boolean isRsClosed = false;
+    try {
+      Table sqlTable = pSchema.newTable(pTable.getTableName());
+      logger.finest(mName, "Looking for columns of " + pTable + "=" + sqlTable.getQName());
+      while (rs.next()) {
+        String columnName = rs.getString(4);
+        int dataType = rs.getInt(5);
+        String typeName = rs.getString(6);
+        long columnSize = rs.getLong(7);
+        int decimalDigits = rs.getInt(9);
+        int isNullable = rs.getInt(11);
+        readColumn(sqlTable, columnName, dataType, typeName, columnSize, decimalDigits, isNullable);
+      }
+      pTable.setTable(sqlTable);
+
+      isRsClosed = true;
+      rs.close();
+      return sqlTable;
+    } finally {
+      if (!isRsClosed) { try { rs.close(); } catch (Throwable ignore) {} }
+    }
+  }
+
+  protected Index readPrimaryKey(DatabaseMetaData pData, JDBCTable pTable) throws SQLException {
+    final String mName = "readPrimaryKey";
+    logger.finest(mName, "Looking for primary keys of " + pTable + "=" + pTable.getTable().getQName());
+    ResultSet rs = pData.getPrimaryKeys(pTable.getCatalogName(),
+                                        pTable.getSchemaName(),
+                                        pTable.getTableName());
+    Index primaryKey = null;
+    boolean isRsClosed = false;
+    try {
+      while (rs.next()) {
+        if (primaryKey == null) {
+          primaryKey = pTable.getTable().newPrimaryKey();
+        } 
+
+        String columnName = rs.getString(4);
+        logger.finest(mName, "Found column " + columnName);
+        primaryKey.addColumn(columnName);
+      }
+
+      isRsClosed = true;
+      rs.close();
+    } finally {
+      if (!isRsClosed) { try { rs.close(); } catch (Throwable ignore) {} }
+    }
+    return primaryKey;
+  }
+
+  protected ForeignKey[] readForeignKeys(DatabaseMetaData pData, JDBCTable pTable, JDBCTable[] pTables)
+      throws SQLException {
+    final String mName = "readForeignKeys";
+    logger.finest(mName, "Looking for foreign keys of " + pTable + "=" + pTable.getTable().getQName());
+    List result = new ArrayList();
+    ResultSet rs = pData.getImportedKeys(pTable.getCatalogName(),
+                                         pTable.getSchemaName(),
+                                         pTable.getTableName());
+    ForeignKey foreignKey = null;
+    boolean isRsClosed = false;
+    try {
+      while (rs.next()) {
+        JDBCTable referencedTable = new JDBCTable(rs.getString(1), rs.getString(2),
+                                                  rs.getString(3), "TABLE");
+        String referencedColumnName = rs.getString(4);
+        String localColumnName = rs.getString(8);
+        logger.finest(mName, "Found column " + localColumnName + " referencing " +
+                      referencedColumnName + " in " + referencedTable);
+        for (int i = 0;  i < pTables.length;  i++) {
+          JDBCTable refIterTable = pTables[i];
+          if (refIterTable.equals(referencedTable)) {
+            referencedTable.setTable(refIterTable.getTable());
+            break;
+          }
+        }
+        if (referencedTable.getTable() == null) {
+          logger.finest(mName, "Unknown table, ignoring");
+          continue;
+        }
+
+        short seq = rs.getShort(9);
+        if (seq == 1) {
+          foreignKey = pTable.getTable().newForeignKey(referencedTable.getTable());
+          result.add(foreignKey);
+        }
+        foreignKey.addColumnLink(localColumnName, referencedColumnName);
+      }
+
+      isRsClosed = true;
+      rs.close();
+    } finally {
+      if (!isRsClosed) { try { rs.close(); } catch (Throwable ignore) {} }
+    }
+    return (ForeignKey[]) result.toArray(new ForeignKey[result.size()]);
+  }
+
+  public Schema getSchema(Connection pConn, Schema.Name pName) throws SQLException {
+    final String mName = "getSchema(Connection,Schema.Name)";
+    logger.finest(mName, "->", new Object[]{pConn, pName});
+
+    Schema schema = makeSchema(pName);
+    DatabaseMetaData metaData = pConn.getMetaData();
+    JDBCTable[] tables = readTables(metaData, pName, null);
+    for (int i = 0;  i < tables.length;  i++) {
+      readTable(metaData, schema, tables[i]);
+      readPrimaryKey(metaData, tables[i]);
+    }
+
+    for (int i = 0;  i < tables.length;  i++) {
+      readForeignKeys(metaData, tables[i], tables);
+    }
+
+    logger.finest(mName, "<-", schema);
+    return schema;
+  }
+
+  public Table getTable(Connection pConnection, Schema.Name pSchema, Table.Name pTable) throws SQLException {
+    final String mName = "getSchema(Connection,Schema.Name)";
+    logger.finest(mName, "->", new Object[]{pConnection, pSchema, pTable});
+
+    Schema schema = makeSchema(pSchema);
+    DatabaseMetaData metaData = pConnection.getMetaData();
+    JDBCTable[] tables = readTables(metaData, pSchema, pTable);
+    JDBCTable jdbcTable;
+    if (tables.length == 0) {
+      String tableName = pTable.toString();
+      String schemaName = pSchema == null ? null : pSchema.toString();
+      String ucTableName = tableName.toUpperCase();
+      String ucSchemaName = schemaName == null ? null : schemaName.toUpperCase();
+      if (tableName.equals(ucTableName)  &&
+          (schemaName == null  ||  schemaName.equals(ucSchemaName))) {
+        throw new IllegalStateException("No table named " + pTable + " found in schema " + pSchema);
+      }
+      return getTable(pConnection, ucSchemaName, ucTableName);
+    } else if (tables.length == 1) {
+      jdbcTable = tables[0];
+    } else {
+      throw new IllegalStateException("Multiple tables named " + pTable + " found in schema " + pSchema);
+    }
+    Table result = readTable(metaData, schema, jdbcTable);
+    readPrimaryKey(metaData, jdbcTable);
+    return result;
+  }
+
+  public Table getTable(Connection pConnection, String pSchema, String pTable) throws SQLException {
+    return getTable(pConnection, pSchema == null ? null : new SchemaImpl.NameImpl(pSchema), new TableImpl.NameImpl(pTable));
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1173 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.BinaryColumn;
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.Case;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.Constraint;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.Expression;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.RawSQLCode;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.SetStatement;
+import org.apache.ws.jaxme.sqls.Statement;
+import org.apache.ws.jaxme.sqls.StringColumn;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+import org.apache.ws.jaxme.sqls.Value;
+
+
+/** <p>Default implementation of an SQL generator.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SQLGeneratorImpl implements SQLGenerator {
+    private String statementTerminator, lineTerminator;
+    
+    public String getStatementTerminator() {
+        return statementTerminator;
+    }
+    
+    public void setStatementTerminator(String pStatementTerminator) {
+        statementTerminator = pStatementTerminator;
+    }
+    
+    public String getLineTerminator() {
+        return lineTerminator;
+    }
+    
+    public void setLineTerminator(String pLineTerminator) {
+        lineTerminator = pLineTerminator;
+    }
+    
+    protected String newStatement(String pStatement) {
+        String s = getStatementTerminator();
+        return s == null ? pStatement : pStatement + s;
+    }
+    
+    public Collection getCreate(Schema pSchema) {
+        if (pSchema.getName() == null) {
+            // Default schema cannot be created
+            return Collections.EMPTY_LIST;
+        }
+        List result = new ArrayList();
+        result.add(newStatement("CREATE SCHEMA " + pSchema.getName()));
+        return result;
+    }
+    
+    public Collection getDrop(Schema pSchema) {
+        if (pSchema.getName() == null) {
+            // Default schema cannot be dropped
+            return Collections.EMPTY_LIST;
+        }
+        List result = new ArrayList();
+        result.add(newStatement("DROP SCHEMA " + pSchema.getName()));
+        return result;
+    }
+    
+    protected String getIndent() { return "  "; }
+    
+    protected String getTypeName(Column.Type pType) {
+        if (pType.equals(Column.Type.BIGINT)) {
+            return "BIGINT";
+        } else if (pType.equals(Column.Type.BINARY)) {
+            return "BINARY";
+        } else if (pType.equals(Column.Type.BIT)) {
+            return "BIT";
+        } else if (pType.equals(Column.Type.CHAR)) {
+            return "CHAR";
+        } else if (pType.equals(Column.Type.DATE)) {
+            return "DATE";
+        } else if (pType.equals(Column.Type.DOUBLE)) {
+            return "DOUBLE";
+        } else if (pType.equals(Column.Type.FLOAT)) {
+            return "FLOAT";
+        } else if (pType.equals(Column.Type.INTEGER)) {
+            return "INT";
+        } else if (pType.equals(Column.Type.SMALLINT)) {
+            return "SMALLINT";
+        } else if (pType.equals(Column.Type.TIME)) {
+            return "TIME";
+        } else if (pType.equals(Column.Type.TIMESTAMP)) {
+            return "TIMESTAMP";
+        } else if (pType.equals(Column.Type.TINYINT)) {
+            return "TINYINT";
+        } else if (pType.equals(Column.Type.VARBINARY)) {
+            return "VARBINARY";
+        } else if (pType.equals(Column.Type.VARCHAR)) {
+            return "VARCHAR";
+        } else if (pType.equals(Column.Type.CLOB)) {
+            return "CLOB";
+        } else if (pType.equals(Column.Type.BLOB)) {
+            return "BLOB";
+        } else if (pType.equals(Column.Type.OTHER)) {
+            return "BLOB";
+        } else {
+            throw new IllegalStateException("Unknown column type: " + pType);
+        }
+    }
+    
+    protected String getCreate(Column pColumn) {
+        StringBuffer sb = new StringBuffer();
+        sb.append(pColumn.getName()).append(" ");
+        Column.Type type = pColumn.getType();
+        Long length = null;
+        if (type.equals(Column.Type.BINARY)
+                ||  type.equals(Column.Type.VARBINARY)
+                ||  type.equals(Column.Type.BLOB)
+                ||  type.equals(Column.Type.OTHER)) {
+            length = ((BinaryColumn) pColumn).getLength();
+            if (length == null) {
+                throw new IllegalStateException("The length of column " + pColumn.getQName() + " is not set.");
+            }
+        } else if (type.equals(Column.Type.CHAR)
+                ||  type.equals(Column.Type.VARCHAR)
+                ||  type.equals(Column.Type.CLOB)) {
+            length = ((StringColumn) pColumn).getLength();
+            if (length == null) {
+                throw new IllegalStateException("The length of column " + pColumn.getQName() + " is not set."); 
+            }
+        }
+        sb.append(getTypeName(type));
+        if (length != null) {
+            sb.append("(").append(length).append(")");
+        }
+        if (!pColumn.isNullable()) {
+            sb.append(" NOT NULL");
+        }
+        return sb.toString();
+    }
+    
+    /** <p>Returns whether the primary key requires special handling
+     * (in which case {@link #isPrimaryKeyPartOfCreateTable()} and
+     * {@link #createPrimaryKeyAsPartOfCreateTable(Table)} are used)
+     * or nor (in which case {@link #isUniqueIndexPartOfCreateTable()}
+     * and {@link #createIndexAsPartOfCreateTable(Index)} apply).</p>
+     */
+    protected boolean isPrimaryKeyUniqueIndex() { return false; }
+    
+    /** <p>Returns whether a <code>CREATE TABLE</code> statement may contain
+     * a <code>PRIMARY KEY</code> clause.</p>
+     */
+    protected boolean isPrimaryKeyPartOfCreateTable() { return false; }
+    
+    /** <p>Returns whether a <code>CREATE TABLE</code> statement may contain
+     * a <code>UNIQUE</code> clause.</p>
+     */
+    protected boolean isUniqueIndexPartOfCreateTable() { return false; }
+    
+    /** <p>Returns whether a <code>CREATE TABLE</code> statement may contain
+     * an <code>INDEX</code> clause.</p>
+     */
+    protected boolean isNonUniqueIndexPartOfCreateTable() { return false; }
+    
+    /** <p>Returns whether a <code>CREATE TABLE</code> statement may contain
+     * a <code>FOREIGN KEY</code> clause.</p>
+     */
+    protected boolean isForeignKeyPartOfCreateTable() { return false; }
+    
+    protected String createPrimaryKeyAsPartOfCreateTable(Table pTable) {
+        Index index = pTable.getPrimaryKey();
+        if (index == null) {
+            return null;
+        }
+        StringBuffer sb = new StringBuffer();
+        sb.append("PRIMARY KEY").append(" (");
+        boolean first = true;
+        for (Iterator iter = index.getColumns();  iter.hasNext();  ) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(", ");
+            }
+            sb.append(((Column) iter.next()).getName().getName());
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+    
+    protected String createIndexAsPartOfCreateTable(Index pIndex) {
+        StringBuffer sb = new StringBuffer();
+        sb.append(pIndex.isUnique() ? "UNIQUE" : "KEY").append(" (");
+        boolean first = true;
+        for (Iterator iter = pIndex.getColumns();  iter.hasNext();  ) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(", ");
+            }
+            sb.append(((Column) iter.next()).getName().getName());
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+    
+    protected String createForeignKeyAsPartOfCreateTable(ForeignKey pKey) {
+        StringBuffer sb = new StringBuffer();
+        sb.append("FOREIGN KEY (");
+        boolean first = true;
+        Iterator iter = pKey.getColumnLinks();
+        if (!iter.hasNext()) {
+            throw new IllegalStateException("Foreign key on " +
+                    pKey.getTable().getQName() +
+                    " referencing " +
+                    pKey.getReferencedTable().getQName() +
+            " doesn't have any columns.");
+        }
+        while (iter.hasNext()) {
+            ForeignKey.ColumnLink link = (ForeignKey.ColumnLink) iter.next();
+            if (first) {
+                first = false;
+            } else {
+                sb.append(", ");
+            }
+            sb.append(link.getLocalColumn().getName().getName());
+        }
+        sb.append(") REFERENCES ");
+        sb.append(pKey.getReferencedTable().getQName());
+        sb.append(" (");
+        first = true;
+        iter = pKey.getColumnLinks();
+        while (iter.hasNext()) {
+            ForeignKey.ColumnLink link = (ForeignKey.ColumnLink) iter.next();
+            if (first) {
+                first = false;
+            } else {
+                sb.append(", ");
+            }
+            sb.append(link.getReferencedColumn().getName().getName());
+        }
+        sb.append(")");
+        
+        ForeignKey.Mode deleteMode = pKey.getOnDelete();
+        if (deleteMode != null) {
+            if (ForeignKey.Mode.CASCADE.equals(deleteMode)) {
+                sb.append(" ON DELETE CASCADE");
+            } else if (ForeignKey.Mode.REJECT.equals(deleteMode)) {
+                sb.append(" ON DELETE RESTRICT");
+            } else if (ForeignKey.Mode.SETNULL.equals(deleteMode)) {
+                sb.append(" ON DELETE SET NULL");
+            } else {
+                throw new IllegalStateException("Unknown foreign key mode for ON  DELETE: " + deleteMode);
+            }
+        }
+        ForeignKey.Mode updateMode = pKey.getOnUpdate();
+        if (updateMode != null) {
+            if (ForeignKey.Mode.CASCADE.equals(updateMode)) {
+                sb.append(" ON UPDATE CASCADE");
+            } else if (ForeignKey.Mode.REJECT.equals(updateMode)) {
+                sb.append(" ON UPDATE RESTRICT");
+            } else {
+                throw new IllegalStateException("Unknown foreign key mode for ON UPDATE: " + updateMode);
+            }
+        }
+        
+        return sb.toString();
+    }
+    
+    protected String getCreateTableHeader(Table pTable) {
+        return "CREATE TABLE " + pTable.getQName();
+    }
+    
+    public Collection getCreate(Table pTable) {
+        String lf = getLineTerminator() == null ? "" : getLineTerminator();
+        String indent = lf == null ? "" : getIndent();
+        StringBuffer sb = new StringBuffer();
+        sb.append(getCreateTableHeader(pTable)).append(" (");
+        String s = lf + indent;
+        for (Iterator iter = pTable.getColumns();  iter.hasNext();  ) {
+            sb.append(s).append(getCreate((Column) iter.next()));
+            s = "," + lf + indent;
+        }
+        
+        for (Iterator iter = pTable.getIndexes();  iter.hasNext();  ) {
+            Index index = (Index) iter.next();
+            String st;
+            if (index.isPrimaryKey()  &&  !isPrimaryKeyUniqueIndex()) {
+                if (!isPrimaryKeyPartOfCreateTable()) {
+                    continue;
+                }
+                st = createPrimaryKeyAsPartOfCreateTable(pTable);
+            } else if (index.isUnique()) {
+                if (!isUniqueIndexPartOfCreateTable()) {
+                    continue;
+                }
+                st = createIndexAsPartOfCreateTable(index);
+            } else {
+                if (!isNonUniqueIndexPartOfCreateTable()) {
+                    continue;
+                }
+                st = createIndexAsPartOfCreateTable(index);
+            }
+            if (st != null) {
+                sb.append(s).append(st);
+            }
+        }
+        if (isForeignKeyPartOfCreateTable()) {
+            for (Iterator iter = pTable.getForeignKeys();  iter.hasNext();  ) {
+                ForeignKey key = (ForeignKey) iter.next();
+                String st = createForeignKeyAsPartOfCreateTable(key);
+                if (st != null) {
+                    sb.append(s).append(st);
+                }
+            }
+        }
+        sb.append(lf).append(")").append(lf);
+        List result = new ArrayList();
+        result.add(newStatement(sb.toString()));
+        return result;
+    }
+    
+    public Collection getDrop(Table pTable) {
+        List result = new ArrayList();
+        result.add(newStatement("DROP TABLE " + pTable.getQName()));
+        return result;
+    }
+
+    private ColumnReference[] getSetStatementsColumns(SetStatement pStatement) {
+        List result = new ArrayList();
+        for (Iterator iter = pStatement.getSetValues();  iter.hasNext();  ) {
+            SetStatement.SetValue setValue = (SetStatement.SetValue) iter.next();
+            result.add(setValue.getColumnReference());
+        }
+        return (ColumnReference[]) result.toArray(new ColumnReference[result.size()]);
+    }
+
+    private ColumnReference[] getInsertStatementsColumns(InsertStatement pStatement) {
+        SelectStatement subSelect = pStatement.getSubSelect();
+        if (subSelect == null) {
+            return getSetStatementsColumns(pStatement);
+        } else {
+        	List result = new ArrayList();
+            for (Iterator iter = subSelect.getResultColumns();  iter.hasNext();  ) {
+        		ColumnReference cRef = (ColumnReference) iter.next();
+        		Column.Name name;
+        		if (cRef.getAlias() == null) {
+                    name = cRef.getColumn().getName();
+        		} else {
+                    name = cRef.getAlias();
+        		}
+        		Column col = pStatement.getTableReference().getTable().getColumn(name);
+        		if (col == null) {
+        			throw new IllegalStateException("A result column " + name
+        					+ " is used in the subselect, which is not present in the insert statements table.");
+        		}
+        		result.add(pStatement.getTableReference().newColumnReference(col));
+        	}
+            return (ColumnReference[]) result.toArray(new ColumnReference[result.size()]);
+        }
+    }
+
+    private void addSetValuesToInsertStatement(StringBuffer pBuffer,
+                                               StatementMetaData pData,
+                                               InsertStatement pQuery) {
+        pBuffer.append(" VALUES (");
+        boolean first = true;
+        for (Iterator iter = pQuery.getSetValues();  iter.hasNext();  ) {
+        	if (first) {
+        		first = false;
+        	} else {
+        		pBuffer.append(", ");
+        	}
+        	SetStatement.SetValue setValue = (SetStatement.SetValue) iter.next();
+            Object o = setValue.getValue();
+            String s = getBooleanConstraintPart(pData, o);
+        	pBuffer.append(s);
+        }
+        pBuffer.append(")");
+    }
+
+    private void addSubSelectToInsertStatement(StringBuffer pBuffer, StatementMetaData pData,
+                                               InsertStatement pStatement) {
+        pBuffer.append(" (");
+        pBuffer.append(getSelectQuery(pStatement.getSubSelect(), pData));
+        pBuffer.append(")");
+    }
+
+    public String getInsertQuery(InsertStatement pQuery) {
+        ColumnReference[] columns = getInsertStatementsColumns(pQuery);
+        StatementMetaData smd = newStatementMetaData(pQuery, columns);
+        
+        StringBuffer result = new StringBuffer();
+        result.append("INSERT INTO ");
+        result.append(getTableAlias(smd, pQuery.getTableReference()));
+        if (columns.length > 0) {
+            result.append(" (");
+            for (int i = 0;  i < columns.length;  i++) {
+            	if (i > 0) {
+            		result.append(", ");
+                }
+                result.append(getColumnAlias(smd, columns[i]));
+            }
+            result.append(")");
+        }
+        boolean hasSetValues = pQuery.getSetValues().hasNext();
+        boolean hasSubselect = pQuery.getSubSelect() != null;
+        if (hasSetValues) {
+            if (hasSubselect) {
+            	throw new IllegalStateException("Using values (InsertStatement.addFoo(..)) and subselects (InsertStatement.setSubSelect(...)) is mutually exclusive.");
+            } else {
+                addSetValuesToInsertStatement(result, smd, pQuery);
+            }
+        } else {
+            if (hasSubselect) {
+                addSubSelectToInsertStatement(result, smd, pQuery);
+            } else {
+            	throw new IllegalStateException("Neither values (InsertStatement.addFoo(..)) nor a subselect (InsertStatement.setSubSelect(...)) are set.");
+            }
+        }
+        return newStatement(result.toString());
+    }
+    
+    protected String getValue(Value pValue) {
+        Value.Type type = pValue.getType();
+        Object o = pValue.getValue();
+        if (Value.Type.BOOLEAN.equals(type)) {
+            return o == null ? "null" : (((Boolean) o).booleanValue() ? "TRUE" : "FALSE");
+        } else if (Value.Type.BYTE.equals(type)   ||
+                Value.Type.SHORT.equals(type)  ||
+                Value.Type.INT.equals(type)    ||
+                Value.Type.LONG.equals(type)   ||
+                Value.Type.FLOAT.equals(type)  ||
+                Value.Type.DOUBLE.equals(type)) {
+            return o == null ? "null" : o.toString();
+        } else if (Value.Type.DATE.equals(type)  ||
+                Value.Type.DATETIME.equals(type)  ||
+                Value.Type.TIME.equals(type)) {
+            throw new IllegalStateException("Date/time handling not yet implemented.");
+        } else if (Value.Type.DATE.equals(type)) {
+            throw new IllegalStateException("Date handling not yet implemented.");
+        } else if (Value.Type.PLACEHOLDER.equals(type)) {
+            return "?";
+        } else if (Value.Type.STRING.equals(type)) {
+            return o == null ? "null" : getEscapedString(o.toString());
+        } else if (Value.Type.NULL.equals(type)) {
+            return "null";
+        } else {
+            throw new IllegalStateException("Unknown value type: " + type);      
+        }
+    }
+    
+    protected String getUpdateQuery(UpdateStatement pQuery) {
+        ColumnReference[] columns = getSetStatementsColumns(pQuery);
+        StatementMetaData smd = newStatementMetaData(pQuery, columns);
+
+        StringBuffer sb = new StringBuffer();
+        sb.append("UPDATE ");
+        sb.append(getTableAlias(smd, pQuery.getTableReference()));
+        sb.append(" SET ");
+        boolean first = true;
+        for (Iterator iter = pQuery.getSetValues();  iter.hasNext();  ) {
+            UpdateStatement.SetValue setValue = (UpdateStatement.SetValue) iter.next();
+            if (first) {
+                first = false;
+            } else {
+                sb.append(", ");
+            }
+            sb.append(getColumnAlias(smd, setValue.getColumnReference()));
+            sb.append("=");
+            sb.append(getBooleanConstraintPart(smd, setValue.getValue()));
+        }
+        String s = getWhereClause(smd, pQuery.getWhere());
+        if (s != null) {
+            sb.append(" WHERE ").append(s);
+        }
+        return newStatement(sb.toString());
+    }
+    
+    protected String getDeleteQuery(DeleteStatement pQuery) {
+        StatementMetaData smd = newStatementMetaData(pQuery);
+        
+        StringBuffer result = new StringBuffer("DELETE FROM ");
+        result.append(getTableAlias(smd, pQuery.getTableReference()));
+        String s = getWhereClause(smd, pQuery.getWhere());
+        if (s != null) {
+            result.append(" WHERE ");
+            result.append(s);
+        }
+        return result.toString();
+    }
+    
+    protected boolean isQualifiedColumn(StatementMetaData pData, ColumnReference pColumn) {
+        if (pData == null) {
+            return false;
+        }
+        Integer num = (Integer) pData.getColumnNames().get(pColumn.getColumn().getName().toString().toUpperCase());
+        if (num == null) {
+            throw new IllegalStateException("Column not in map of column counts: "
+                    + pColumn.getColumn().getName());
+        }
+        return num.intValue() > 1;
+    }
+    
+    protected String getFunction(StatementMetaData pData, Function f) {
+        return f.getName() + '(' + getParts(pData, f.getParts()) + ')';
+    }
+    
+    protected String getColumnAlias(StatementMetaData pData, ColumnReference pColumn) {
+        Column col = pColumn.getColumn();
+        String s = col.getName().toString();
+        if (col.isVirtual()) {
+            VirtualColumn virtCol = (VirtualColumn) col;
+            Object o = virtCol.getValue();
+            if (o instanceof SelectStatement) {
+                return "(" + getSelectQuery((SelectStatement) o, pData) + ") AS " + s;
+            } else if (o instanceof Function) {
+                return getFunction(pData, (Function) o) + " AS " + s;
+            } else if (o instanceof String) {
+                return ((String) o) + " AS " + s;
+            } else {
+                throw new IllegalStateException("Invalid type of VirtualColumn: " + o);
+            }
+        } else {
+            if (isQualifiedColumn(pData, pColumn)) {
+                TableReference tableReference = pColumn.getTableReference();
+                if (tableReference.getAlias() != null) {
+                    s = tableReference.getAlias().getName() + "." + s;
+                } else {
+                    s = tableReference.getTable().getName() + "." + s;
+                }
+            }
+            
+            if (pColumn.getAlias() != null) {
+                s = s + " AS " + pColumn.getAlias().getName();
+            }
+        }
+        return s;
+    }
+    
+    protected String getColumnAlias(StatementMetaData pData, ColumnReference[] pColumn) {
+        StringBuffer sb = new StringBuffer("(");
+        for (int i = 0;  i < pColumn.length;  i++) {
+            if (i > 0) sb.append(", ");
+            sb.append(getColumnAlias(pData, pColumn[i]));
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+    
+    protected boolean isTableAliasUsingAs() { return true; }
+    
+    protected String getTableAlias(StatementMetaData pData, TableReference pTable) {
+        Table t = pTable.getTable();
+        String tableName;
+        Table.Name alias = pTable.getAlias();
+        if (t instanceof ViewImpl) {
+            ViewImpl v = (ViewImpl) t;
+            tableName = "(" + getSelectQuery(v.getViewStatement(), pData) + ")";
+        } else {
+            tableName = pTable.getTable().getQName();
+        }
+        if (alias == null) {
+            return tableName;
+        } else {
+            if (isTableAliasUsingAs()) {
+                return tableName + " AS " + alias.getName();
+            } else {
+                return tableName + " " + alias.getName();
+            }
+        }
+    }
+    
+    protected String getJoinAlias(StatementMetaData pData, JoinReference pJoinReference) {
+        StringBuffer result = new StringBuffer();
+        if (pJoinReference.isLeftOuterJoin()) {
+            result.append(" LEFT OUTER JOIN ");
+        } else if (pJoinReference.isJoin()) {
+            result.append(" JOIN ");
+        } else {
+            throw new IllegalStateException("Unknown join type");
+        }
+        result.append(getTableAlias(pData, pJoinReference));
+        String s = getWhereClause(pData, pJoinReference.getOn());
+        if (s != null) {
+            result.append(" ON ");
+            result.append(s);
+        }
+        return result.toString();
+    }
+    
+    protected String getEscapedString(String s) {
+        if (s.indexOf('\n') > -1  ||  s.indexOf('\r') > -1  ||  s.indexOf('\f') > -1) {
+            throw new IllegalArgumentException("Don't know how to handle line or page terminators.");
+        }
+        if (s.indexOf('\'') > -1) {
+            throw new IllegalArgumentException("Don't know how to handle the char ' in strings.");
+        }
+        return "'" + s + "'";
+    }
+    
+    protected String getParts(StatementMetaData pData, Iterator pParts) {
+        StringBuffer sb = new StringBuffer();
+        while (pParts.hasNext()) {
+            if (sb.length() > 0) {
+                sb.append(", ");
+            }
+            sb.append(getBooleanConstraintPart(pData, pParts.next()));
+        }
+        return sb.toString();
+    }
+
+    protected String getCase(StatementMetaData pData, Case pCase) {
+        StringBuffer sb = new StringBuffer("CASE ");
+        sb.append(getBooleanConstraintPart(pData, pCase.getCheckedValue()));
+        Case.When[] whens = pCase.getWhens();
+        for (int i = 0;  i < whens.length;  i++) {
+        	Case.When when = whens[i];
+            sb.append(" WHEN ");
+            sb.append(getBooleanConstraintPart(pData, when.getCondition()));
+            sb.append(" THEN ");
+            sb.append(getBooleanConstraintPart(pData, when.getValue()));
+        }
+        Object o = pCase.getElseValue();
+        if (o != null) {
+        	sb.append(" ELSE ");
+            sb.append(getBooleanConstraintPart(pData, o));
+        }
+        sb.append(" END");
+        return sb.toString();
+    }
+
+    protected String getBooleanConstraintPart(StatementMetaData pData, Object o) {
+        if (o instanceof Value) {
+            return getValue((Value) o);
+        } else if (o instanceof ColumnReference) {
+            return getColumnAlias(pData, (ColumnReference) o);
+        } else if (o instanceof ColumnReference[]) {
+            return getColumnAlias(pData, (ColumnReference[]) o);
+        } else if (o instanceof SelectStatement) {
+            return '(' + getSelectQuery((SelectStatement) o, pData) + ')';
+        } else if (o instanceof RawSQLCode) {
+            return ((RawSQLCode) o).getRawSQL();
+        } else if (o instanceof Function) {
+            return getFunction(pData, (Function) o);
+        } else if (o instanceof Case) {
+            return getCase(pData, (Case) o);
+        } else if (o instanceof Expression) {
+			return getExpression(pData, (Expression) o);
+        } else {
+            throw new IllegalArgumentException("Invalid part of a boolean constraint: " + o.getClass().getName());
+        }
+    }
+
+	protected String getExpression(StatementMetaData pData, Expression pExpr) {
+		int parts = pExpr.getNumParts();
+		int minParts = pExpr.getMinimumParts();
+		if (parts < minParts) {
+			throw new IllegalStateException("An expression of type " + pExpr.getType()
+											+ " must have at least " + minParts + " parts.");
+		}
+		int maxParts = pExpr.getMaximumParts();
+		if (maxParts > 0  &&  parts > maxParts) {
+			throw new IllegalStateException("An expression of type " + pExpr.getType()
+											+ " must have at least " + maxParts + " parts.");
+		}
+		Iterator iter = pExpr.getParts();
+		if (parts == 1) {
+			return getBooleanConstraintPart(pData, iter.next());
+		} else {
+			String sep;
+			Expression.Type type = pExpr.getType();
+			if (Expression.SUM.equals(type)) {
+				sep = "+";
+			} else if (Expression.PRODUCT.equals(type)) {
+				sep = "*";
+			} else if (Expression.DIFFERENCE.equals(type)) {
+				sep = "-";
+			} else if (Expression.QUOTIENT.equals(type)) {
+				sep = "/";
+			} else {
+				throw new IllegalStateException("Invalid type: " + type);
+			}
+			StringBuffer result = new StringBuffer("(");
+			for (int i = 0;  i < parts;  i++) {
+				if (i > 0) {
+					result.append(sep);
+				}
+				result.append(getBooleanConstraintPart(pData, iter.next()));
+			}
+			result.append(")");
+			return result.toString();
+		}
+	}
+
+    protected String getBooleanConstraintType(BooleanConstraint.Type pType) {
+        if (BooleanConstraint.Type.EQ.equals(pType)) {
+            return "=";
+        } else if (BooleanConstraint.Type.NE.equals(pType)) {
+            return "<>";
+        } else if (BooleanConstraint.Type.GT.equals(pType)) {
+            return ">";
+        } else if (BooleanConstraint.Type.LT.equals(pType)) {
+            return "<";
+        } else if (BooleanConstraint.Type.GE.equals(pType)) {
+            return ">=";
+        } else if (BooleanConstraint.Type.LE.equals(pType)) {
+            return "<=";
+        } else if (BooleanConstraint.Type.LIKE.equals(pType)) {
+            return " LIKE ";
+        } else {
+            throw new IllegalArgumentException("Invalid type: " + pType);
+        }
+    }
+    
+    protected String getBooleanConstraint(StatementMetaData pData,
+                                          BooleanConstraint pConstraint) {
+        BooleanConstraint.Type type = pConstraint.getType();
+        Iterator parts = pConstraint.getParts();
+        if (!parts.hasNext()) {
+            throw new NullPointerException("A boolean constraint must have its parts set.");
+        }
+        if (BooleanConstraint.Type.IN.equals(type)) {
+            Object o = parts.next();
+            return getBooleanConstraintPart(pData, o) + " IN (" + getParts(pData, parts) + ')';
+        }
+        StringBuffer result = new StringBuffer();
+        int expected;
+        if (BooleanConstraint.Type.EXISTS.equals(type)) {
+            SelectStatement selectStatement = (SelectStatement) parts.next();
+            result.append("EXISTS(");
+            result.append(getSelectQuery(selectStatement, pData));
+            result.append(")");
+            expected = 1;
+        } else if (BooleanConstraint.Type.BETWEEN.equals(type)) {
+			expected = 3;
+			if (pConstraint.getNumParts() >= 3) {
+				result.append(getBooleanConstraintPart(pData, parts.next()));
+				result.append(" BETWEEN ");
+				result.append(getBooleanConstraintPart(pData, parts.next()));
+				result.append(" AND ");
+				result.append(getBooleanConstraintPart(pData, parts.next()));
+			}
+        } else {
+            result.append(getBooleanConstraintPart(pData, parts.next()));
+            if (BooleanConstraint.Type.EQ.equals(type)  ||
+                    BooleanConstraint.Type.NE.equals(type)  ||
+                    BooleanConstraint.Type.GT.equals(type)  ||
+                    BooleanConstraint.Type.LT.equals(type)  ||
+                    BooleanConstraint.Type.GE.equals(type)  ||
+                    BooleanConstraint.Type.LE.equals(type)  ||
+                    BooleanConstraint.Type.LIKE.equals(type)) {
+                expected = 2;
+                if (!parts.hasNext()) {
+                    throw new NullPointerException("The boolean constraint " + type +
+                    							   " must have exactly two parts set.");
+                }
+                result.append(getBooleanConstraintType(type));
+                result.append(getBooleanConstraintPart(pData, parts.next()));
+            } else if (BooleanConstraint.Type.ISNULL.equals(type)) {
+                expected = 1;
+                result.append(" IS NULL");
+            } else {
+                throw new IllegalArgumentException("Invalid boolean constraint type: " + type);
+            }
+        }
+        if (expected != 0  &&  parts.hasNext()) {
+            throw new NullPointerException("The boolean constraint " + type +
+                    					   " must have exactly " + expected +
+                    					   " parts set, but has " + pConstraint.getNumParts());
+        }
+        return result.toString();
+    }
+    
+    protected String getCombinedConstraint(StatementMetaData pData,
+            CombinedConstraint pConstraint) {
+        if (pConstraint.getNumParts() == 0) {
+            return null;
+        }
+        
+        List parts = new ArrayList();
+        for (Iterator iter = pConstraint.getParts();  iter.hasNext();  ) {
+            String s;
+            Object o = iter.next();
+            if (o == null) {
+                throw new NullPointerException("A CombinedConstraints part must not be null");
+            }
+            if (o instanceof CombinedConstraint) {
+                s = getCombinedConstraint(pData, (CombinedConstraint) o);
+            } else if (o instanceof BooleanConstraint) {
+                s = getBooleanConstraint(pData, (BooleanConstraint) o);            
+            } else {
+                throw new IllegalArgumentException("Invalid part: " + o.getClass().getName()); 
+            }
+            if (s != null) {
+                parts.add(s);
+            }
+        }
+
+        switch (parts.size()) {
+            case 0: return null;
+            case 1:
+                if (pConstraint.isNOT()) {
+                    return "NOT (" + parts.get(0) + ")";
+                } else {
+                    return (String) parts.get(0);
+                }
+            default:
+                StringBuffer sb = new StringBuffer();
+            	if (pConstraint.isNOT()) {
+            	    sb.append("(NOT ");
+            	}
+            	for (int i = 0;  i < parts.size();  i++) {
+            	    if (i == 0) {
+            	        sb.append("(");
+            	    } else {
+            	        sb.append(" ");
+            	        sb.append(pConstraint.getType());
+            	        sb.append(" ");
+            	    }
+            	    sb.append(parts.get(i));
+            	}
+            	sb.append(")");
+            	if (pConstraint.isNOT()) {
+            	    sb.append(")");
+            	}
+            	return sb.toString();
+        }
+    }
+    
+    public String getConstraint(StatementMetaData pData, Constraint pConstraint) {
+        if (pConstraint instanceof CombinedConstraint) {
+            return getWhereClause(pData, (CombinedConstraint) pConstraint);
+        } else if (pConstraint instanceof BooleanConstraint) {
+            return getBooleanConstraint(pData, (BooleanConstraint) pConstraint);
+        } else {
+            throw new IllegalArgumentException("Unknown constraint type: " +
+                    pConstraint.getClass().getName());
+        }
+    }
+    
+    protected String getWhereClause(StatementMetaData pData,
+            CombinedConstraint pWhereClause) {
+        return getCombinedConstraint(pData, pWhereClause);
+    }
+    
+    protected String getSelectQuery(SelectStatement pQuery) {
+        StatementMetaData selectStatementMetaData = newStatementMetaData(pQuery);
+        return getSelectQuery(pQuery, selectStatementMetaData);
+    }
+    
+
+    protected String getSelectQueryResultColumns(SelectStatement pQuery, StatementMetaData pData) {
+        StringBuffer sb = new StringBuffer();
+        if (pQuery.isDistinct()) {
+            sb.append(" DISTINCT");
+        }
+        Iterator columnIter = pQuery.getResultColumns();
+        if (!columnIter.hasNext()) {
+            sb.append(" *");
+        } else {
+            boolean first = true;
+            do {
+                ColumnReference column = (ColumnReference) columnIter.next();
+                if (first) {
+                    sb.append(" ");
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                sb.append(getColumnAlias(pData, column));
+            } while (columnIter.hasNext());
+        }
+        return sb.toString();
+    }
+
+    protected String getSelectQueryFromClause(SelectStatement pQuery, StatementMetaData pData) {
+        SelectTableReference selectTableReference = pQuery.getSelectTableReference();
+        if (selectTableReference == null) {
+            return null;
+        }
+        StringBuffer sb = new StringBuffer();
+        sb.append(" FROM ");
+        sb.append(getTableAlias(pData, selectTableReference));
+        for (JoinReference joinReference = selectTableReference.getRightJoinedTableReference();
+        joinReference != null;
+        joinReference = joinReference.getRightJoinedTableReference()) {
+            sb.append(getJoinAlias(pData, joinReference));               
+        }
+        return sb.toString();
+    }
+
+    protected String getSelectQueryConstraints(SelectStatement pQuery, StatementMetaData pData,
+                                               StatementMetaData.LocalData pLocalData) {
+        String s = getWhereClause(pData, pQuery.getWhere());
+        if (pLocalData != null  &&  s != null  &&  s.length() > 0) {
+        	pLocalData.setWhereClause(true);
+        }
+        return s;
+    }
+
+    protected String getSelectQuery(SelectStatement pQuery, StatementMetaData pData) {
+        StringBuffer sb = new StringBuffer("SELECT");
+        String s = getSelectQueryResultColumns(pQuery, pData);
+        if (s != null) {
+            sb.append(s);
+        }
+
+        s = getSelectQueryFromClause(pQuery, pData);
+        if (s != null) {
+            sb.append(s);
+        }
+
+        StatementMetaData.LocalData localData = new StatementMetaData.LocalData();
+        s = getSelectQueryConstraints(pQuery, pData, localData);
+        if (s != null  &&  s.length() > 0) {
+            if (localData.hasWhereClause()) {
+                sb.append(" WHERE ");
+            }
+            sb.append(s);
+        }
+        
+        s = getSelectQueryOrderClause(pData, pQuery);
+        if (s != null) {
+            sb.append(s);
+        }
+        return sb.toString();
+    }
+
+    protected String getOrderColumn(StatementMetaData pData, SelectStatement.OrderColumn pColumn) {
+        String s = getBooleanConstraintPart(pData, pColumn.getColumn());
+        if (pColumn.isDescending()) {
+            s += " DESC";
+        }
+        return s;
+    }
+
+    protected String getSelectQueryOrderClause(StatementMetaData pData, SelectStatement pQuery) {
+        StringBuffer sb = new StringBuffer();
+        for (Iterator iter = pQuery.getOrderColumns();  iter.hasNext();  ) {
+            SelectStatement.OrderColumn col = (SelectStatement.OrderColumn) iter.next();
+            if (sb.length() == 0) {
+                sb.append(" ORDER BY ");
+            } else {
+                sb.append(", ");
+            }
+            sb.append(getOrderColumn(pData, col));
+        }
+        return sb.toString();
+    }
+    
+    public String getQuery(Statement pStatement) {
+        String s;
+        if (pStatement instanceof InsertStatement) {
+            s = getInsertQuery((InsertStatement) pStatement);
+        } else if (pStatement instanceof UpdateStatement) {
+            s = getUpdateQuery((UpdateStatement) pStatement); 
+        } else if (pStatement instanceof DeleteStatement) {
+            s =  getDeleteQuery((DeleteStatement) pStatement);
+        } else if (pStatement instanceof SelectStatement) {
+            s = getSelectQuery((SelectStatement) pStatement);
+        } else {
+            throw new IllegalArgumentException("The Statement is neither an INSERT, UPDATE, DELETE nor a SELECT statement.");
+        }
+        return newStatement(s);
+    }
+    
+    public Collection getCreate(Schema pSchema, boolean pAll) {
+        if (!pAll) { return getCreate(pSchema); }
+        List result = new ArrayList();
+        result.addAll(getCreate(pSchema));
+        for (Iterator iter = pSchema.getTables();  iter.hasNext();  ) {
+            Table table = (Table) iter.next();
+            result.addAll(getCreate(table, true));
+        }
+        return result;
+    }
+    
+    public Collection getDrop(Schema pSchema, boolean pAll) {
+        if (!pAll) { return getDrop(pSchema); }
+        List result = new ArrayList();
+        List tables = new ArrayList();
+        for (Iterator iter = pSchema.getTables();  iter.hasNext();  ) {
+            tables.add(iter.next());
+        }
+        Collections.reverse(tables);
+        for (Iterator iter = tables.iterator();  iter.hasNext();  ) {
+            Table table = (Table) iter.next();
+            result.addAll(getDrop(table, true));
+        }
+        result.addAll(getDrop(pSchema));
+        return result;
+    }
+    
+    public Collection getCreate(Table pTable, boolean pAll) {
+        if (!pAll) { return getCreate(pTable); }
+        List result = new ArrayList();
+        result.addAll(getCreate(pTable));
+        for (Iterator iter = pTable.getIndexes();  iter.hasNext();  ) {
+            Index index = (Index) iter.next();
+            if (index.isPrimaryKey() && !isPrimaryKeyUniqueIndex()) {
+                if (isPrimaryKeyPartOfCreateTable()) {
+                    continue;
+                }
+            } else if (index.isUnique()) {
+                if (isUniqueIndexPartOfCreateTable()) {
+                    continue;
+                }
+            } else {
+                if (isNonUniqueIndexPartOfCreateTable()) {
+                    continue;
+                }
+            }
+            result.addAll(getCreate(index));
+        }
+        if (!isForeignKeyPartOfCreateTable()) {
+            for (Iterator iter = pTable.getForeignKeys();  iter.hasNext();  ) {
+                ForeignKey key = (ForeignKey) iter.next();
+                result.addAll(getCreate(key));
+            }
+        }
+        return result;
+    }
+    
+    public Collection getDrop(Table pTable, boolean pAll) {
+        if (!pAll) { return getDrop(pTable); }
+        List result = new ArrayList();
+        for (Iterator iter = pTable.getIndexes();  iter.hasNext();  ) {
+            Index index = (Index) iter.next();
+            result.addAll(getDrop(index));
+        }
+        for (Iterator iter = pTable.getForeignKeys();  iter.hasNext();  ) {
+            ForeignKey key = (ForeignKey) iter.next();
+            result.addAll(getDrop(key));
+        }
+        result.addAll(getDrop(pTable));
+        return result;
+    }
+    
+    public Collection getCreate(Index pIndex) {
+        List result = new ArrayList();
+        String s = createIndexAsPartOfCreateTable(pIndex);
+        if (s != null) {
+            StringBuffer sb = new StringBuffer();
+            sb.append("CREATE");
+            if (pIndex.isUnique()) {
+                sb.append(" UNIQUE");
+            }
+            sb.append(" INDEX");
+            sb.append(" ");
+            sb.append(pIndex.getName());
+            sb.append(" ON ").append(pIndex.getTable().getQName()).append(" (");
+            boolean first = true;
+            for (Iterator iter = pIndex.getColumns();  iter.hasNext();  ) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                sb.append(((Column) iter.next()).getName().getName());
+            }
+            sb.append(")");
+            result.add(newStatement(sb.toString()));
+        }
+        return result;
+    }
+    
+    public Collection getDrop(Index pIndex) {
+        return Collections.EMPTY_SET;
+    }
+    
+    public Collection getCreate(ForeignKey pKey) {
+        List result = new ArrayList();
+        String s = createForeignKeyAsPartOfCreateTable(pKey);
+        if (s != null) {
+            result.add(newStatement("CREATE " + s));
+        }
+        return result;
+    }
+    
+    public Collection getDrop(ForeignKey pKey) {
+        return Collections.EMPTY_SET;
+    }
+    
+    protected StatementMetaData newStatementMetaData(SelectStatement pQuery) {
+        return new StatementMetaData(pQuery);
+    }
+
+    protected StatementMetaData newStatementMetaData(DeleteStatement pQuery) {
+        return new StatementMetaData(pQuery);
+    }
+
+    protected StatementMetaData newStatementMetaData(UpdateStatement pQuery, ColumnReference[] pColumns) {
+        return new StatementMetaData(pQuery, pColumns);
+    }
+
+    protected StatementMetaData newStatementMetaData(InsertStatement pQuery, ColumnReference[] pColumns) {
+        return new StatementMetaData(pQuery, pColumns);
+    }
+
+    public String getWhereClause(SelectStatement pQuery) {
+        StatementMetaData metaData = newStatementMetaData(pQuery);
+        StringBuffer sb = new StringBuffer();
+
+        StatementMetaData.LocalData localData = new StatementMetaData.LocalData();
+        String s = getSelectQueryConstraints(pQuery, metaData, localData);
+        if (s != null) {
+            sb.append(s);
+        }
+        
+        s = getSelectQueryOrderClause(metaData, pQuery);
+        if (s != null) {
+            sb.append(s);
+        }
+
+        return sb.toString();
+    }
+
+    public String getConstraint(Constraint pConstraint) {
+        if (pConstraint instanceof CombinedConstraint) {
+            CombinedConstraint cc = (CombinedConstraint) pConstraint;
+            Statement st = cc.getConstrainedStatement();
+            if (st instanceof SelectStatement) {
+                StatementMetaData selectStatementMetaData = newStatementMetaData((SelectStatement) st);
+                return getCombinedConstraint(selectStatementMetaData, cc);
+            } else {
+                return getCombinedConstraint(null, cc);
+            }
+        } else if (pConstraint instanceof BooleanConstraint) {
+            BooleanConstraint bc = (BooleanConstraint) pConstraint;
+            Statement st = bc.getConstrainedStatement();
+            if (st instanceof SelectStatement) {
+                StatementMetaData selectStatementMetaData = newStatementMetaData((SelectStatement) st);
+                return getBooleanConstraint(selectStatementMetaData, bc);
+            } else {
+                return getBooleanConstraint(null, bc);
+            }
+        } else {
+            throw new IllegalStateException("Invalid type of Constraint: " + pConstraint);
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.Table;
+
+
+/** <p>Implementation of a schema.</p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SchemaImpl implements Schema {
+   public static class NameImpl extends SQLFactoryImpl.IdentImpl implements Schema.Name {
+      NameImpl(String pName) {
+         super(pName);
+      }
+      public boolean equals(Object o) {
+         if (o == null  ||  !(o instanceof Schema.Name)) {
+            return false;
+         }
+         return super.equals(o);
+      }
+   }
+
+   private SQLFactory sqlFactory;
+   private Schema.Name name;
+   private List tables = new ArrayList();
+
+   /** <p>Creates a new instance of SchemaImpl.</p>
+    * @param pFactory The {@link org.apache.ws.jaxme.sqls.SQLFactory}
+    *   creating this instance.
+    * @param pName The schema name.
+    */
+	protected SchemaImpl(SQLFactory pFactory, Schema.Name pName) {
+      sqlFactory = pFactory;
+      name = pName;      
+	}
+
+   public SQLFactory getSQLFactory() {
+      return sqlFactory;
+   }
+
+   public Schema.Name getName() {
+      return name;
+   }
+
+   public Table newTable(String pName) {
+      return newTable(new TableImpl.NameImpl(pName));
+   }
+
+	public Table newTable(Table.Name pName) {
+      if (pName == null) {
+         throw new NullPointerException("A table name must not be null.");
+      }
+      Integer maxLength = getSQLFactory().getMaxTableNameLength();
+      if (maxLength != null  &&  pName.getName().length() > maxLength.intValue()) {
+         throw new IllegalArgumentException("The length of the table name " + pName +
+                                             " exceeds the maximum length of " + maxLength);
+      }
+      Table table = getTable(pName);
+      if (table != null) {
+         throw new IllegalStateException("A table named " + table.getName() +
+                                          " already exists in the schema " + getName());
+      }
+      table = ((SQLFactoryImpl) getSQLFactory()).newTableImpl(this, pName);
+      tables.add(table);
+      return table;
+   }
+
+	public Table getTable(Table.Name pName) {
+      if (pName == null) {
+         throw new NullPointerException("A table name must not be null.");
+      }
+      for (Iterator iter = getTables();  iter.hasNext();  ) {
+         Table table = (Table) iter.next();
+         if (getSQLFactory().isTableNameCaseSensitive()) {
+            if (pName.getName().equalsIgnoreCase(table.getName().getName())) {
+               return table;
+            }
+         } else {
+            if (pName.equals(table.getName())) {
+               return table; 
+            }
+         }
+      }
+      return null;
+	}
+
+   public Table getTable(String pName) {
+      return getTable(new TableImpl.NameImpl(pName));
+   }
+
+	public Iterator getTables() {
+      return tables.iterator();
+	}
+
+   public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof Schema)) {
+         return false;
+      }
+      Schema other = (Schema) o;
+      if (getName() == null) {
+         return other.getName() == null;
+      } else {
+         return getName().equals(other.getName());
+      }
+   }
+
+   public int hashCode() {
+      return getName() == null ? 0 : getName().hashCode();
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SelectStatementImpl extends ConstrainedStatementImpl implements SelectStatement {
+   public static class OrderColumnImpl implements SelectStatement.OrderColumn {
+      private final Object columnReference;
+      private final boolean descending;
+      public OrderColumnImpl(Object pColumnReference, boolean pDescending) {
+         columnReference = pColumnReference;
+         descending = pDescending;
+      }
+      public Object getColumn() {
+         return columnReference;
+      }
+      public boolean isDescending() {
+         return descending;
+      }
+   }
+
+   private List orderColumns = new ArrayList();
+   private List resultColumns = new ArrayList();
+   private boolean distinct;
+   private int maxRows, skippedRows;
+
+	/** <p>Creates a new SelectStatement and sets the creating
+   * {@link org.apache.ws.jaxme.sqls.SQLFactory}.</p>
+	 */
+	public SelectStatementImpl(SQLFactory pFactory) {
+		super(pFactory);
+	}
+
+	public void addOrderColumn(Object pColumn) {
+      addOrderColumn(pColumn, false);
+	}
+
+	public void addOrderColumn(Object pColumn, boolean pDescending) {
+      addOrderColumn(new OrderColumnImpl(pColumn, pDescending));
+	}
+
+	public void addOrderColumn(SelectStatement.OrderColumn pColumn) {
+	    Object o = pColumn.getColumn();
+	    if (o instanceof ColumnReference) {
+		    for (Iterator iter = orderColumns.iterator();  iter.hasNext();  ) {
+		        SelectStatement.OrderColumn column = (SelectStatement.OrderColumn) iter.next();
+		        Object p = column.getColumn();
+		        if (p instanceof ColumnReference) {
+		            if (o.equals(p)) {
+		                throw new NullPointerException("The column "
+		                        					   + ((ColumnReference) o).getColumn().getName()
+		                        					   + " is  already used for sorting.");
+		            }
+		        }
+		    }
+	    }
+	    orderColumns.add(pColumn);
+	}
+
+	public Iterator getOrderColumns() {
+	    return orderColumns.iterator();
+	}
+
+	public void addResultColumn(ColumnReference pColumn) {
+      resultColumns.add(pColumn);
+	}
+
+   public Iterator getResultColumns() {
+      return resultColumns.iterator();
+   }
+
+	public void setDistinct(boolean pDistinct) {
+      distinct = pDistinct;
+	}
+
+	public boolean isDistinct() {
+      return distinct;
+	}
+
+	public void setMaxRows(int pMaxRows) {
+      maxRows = pMaxRows;
+	}
+
+	public int getMaxRows() {
+      return maxRows;
+	}
+
+	public void setSkippedRows(int pSkippedRows) {
+      skippedRows = pSkippedRows;
+	}
+
+	public int getSkippedRows() {
+      return skippedRows;
+	}
+
+   protected TableReference newTableReference(Table pTable) {
+      return new SelectTableReferenceImpl(this, pTable);
+   }
+
+   public SelectTableReference getSelectTableReference() {
+      return (SelectTableReference) getTableReference();
+   }
+
+   public Iterator getSelectTableReferences() {
+      return new Iterator() {
+         SelectTableReference reference = getSelectTableReference();
+         public boolean hasNext() { return reference != null; }
+         public Object next() {
+            SelectTableReference result = reference;
+            reference = result.getRightJoinedTableReference();
+            return result;
+         }
+         public void remove() {
+            throw new UnsupportedOperationException();
+         }
+      };
+   }
+
+	public Table createView(Table.Name pName) {
+	    return getSQLFactory().getObjectFactory().newView(this, pName);
+	}
+
+	public Table createView(String pName) {
+	    return createView(pName == null ? null : new TableImpl.NameImpl(pName));
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectTableReferenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectTableReferenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SelectTableReferenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SelectTableReferenceImpl extends TableReferenceImpl implements SelectTableReference {
+   private JoinReference joinReference;
+
+	/** <p>Creates a new instance of SelectTableReferenceImpl referencing
+    * the given {@link SelectStatement}.</p>
+	 */
+	public SelectTableReferenceImpl(SelectStatement pStatement, Table pTable) {
+		super(pStatement, pTable);
+	}
+
+	public JoinReference join(Table pTable) {
+	  if (joinReference != null) {
+	    throw new IllegalStateException("The table is already involved in a left join.");
+	  }
+	  joinReference = getStatement().getSQLFactory().getObjectFactory().newJoinReference(this, pTable, false);
+	  return joinReference;
+	}
+	
+	public JoinReference leftOuterJoin(Table pTable) {
+	  if (joinReference != null) {
+	    throw new IllegalStateException("The table is already involved in a left join.");
+	  }
+	  joinReference = getStatement().getSQLFactory().getObjectFactory().newJoinReference(this, pTable, true);
+	  return joinReference;
+	}
+	
+	public SelectStatement getSelectStatement() {
+	  return (SelectStatement) getStatement();
+	}
+	
+	public JoinReference getRightJoinedTableReference() {
+	  return joinReference;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SetStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SetStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/SetStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SetStatement;
+import org.apache.ws.jaxme.sqls.Value;
+import org.apache.ws.jaxme.sqls.Column.Name;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class SetStatementImpl extends StatementImpl implements SetStatement {
+  public static class SetValueImpl implements SetStatement.SetValue {
+    private final ColumnReference columnReference;
+    private final Object value;
+    public SetValueImpl(ColumnReference pColumn, Object pValue) {
+      if (pColumn == null) {
+        throw new NullPointerException("Column reference must not be null.");
+      }
+      if (pValue == null) {
+        throw new NullPointerException("Value must not be null.");
+      }
+      columnReference = pColumn;
+      value = pValue;
+    }
+
+    public ColumnReference getColumnReference() { return columnReference; }
+    public Object getValue() { return value; }
+  }
+
+  private List setValues = new ArrayList();
+
+  protected SetStatementImpl(SQLFactory pFactory) {
+    super(pFactory);
+  }
+
+  public Iterator getSetValues() { return setValues.iterator(); }
+
+  public void addSet(ColumnReference pColumn, Value pValue) {
+    addSet(pColumn, pValue);
+  }
+  protected void addSet(ColumnReference pRef, Object pValue) {
+    if (!pRef.getTableReference().equals(getTableReference())) {
+      throw new IllegalArgumentException("The column has an invalid table reference.");
+    }
+    setValues.add(new SetValueImpl(pRef, pValue));
+  }
+  public void addSet(Column pColumn, Object pValue) {
+    addSet(getTableReference().newColumnReference(pColumn), pValue);
+  }
+  public void addSet(String pColumn, Object pValue) {
+    addSet(getTableReference().newColumnReference(pColumn), pValue);
+  }
+  public void addSet(Column.Name pColumn, Object pValue) {
+    addSet(getTableReference().newColumnReference(pColumn), pValue);
+  }
+  public void addSet(Column pColumn, Value pValue) {
+    addSet(pColumn, (Object) pValue);
+  }
+  public void addSet(Column.Name pColumn, Value pValue) {
+    addSet(getTableReference().newColumnReference(pColumn), (Object) pValue);
+  }
+  public void addSet(String pColumn, Value pValue) {
+    addSet(getTableReference().newColumnReference(pColumn), (Object) pValue);
+  }
+
+  public void addSetNull(Column pColumn) {
+    addSet(pColumn, new ValueImpl(Value.Type.NULL, null));
+  }
+  public void addSetNull(Column.Name pColumn) {
+    addSet(pColumn, new ValueImpl(Value.Type.NULL, null));
+  }
+  public void addSetNull(String pColumn) {
+    addSet(pColumn, new ValueImpl(Value.Type.NULL, null));
+  }
+
+  public void addSet(Column pColumn) {
+    if (pColumn == null) {
+      throw new NullPointerException("The column being set must not be null.");
+    }
+    addSet(pColumn, new ValueImpl(Value.Type.PLACEHOLDER, null));
+  }
+  public void addSet(Column.Name pColumn) {
+    addSet(pColumn, new ValueImpl(Value.Type.PLACEHOLDER, null));
+  }
+  public void addSet(String pColumn) {
+    addSet(pColumn, new ValueImpl(Value.Type.PLACEHOLDER, null));
+  }
+
+  public void addSet(Column pColumn, byte pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.BYTE, new Byte(pValue)));
+  }
+  public void addSet(Column.Name pColumn, byte pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.BYTE, new Byte(pValue)));
+  }
+  public void addSet(String pColumn, byte pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.BYTE, new Byte(pValue)));
+  }
+
+  public void addSet(Column pColumn, short pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.SHORT, new Short(pValue)));
+  }
+  public void addSet(Column.Name pColumn, short pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.SHORT, new Short(pValue)));
+  }
+  public void addSet(String pColumn, short pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.SHORT, new Short(pValue)));
+  }
+
+  public void addSet(Column pColumn, int pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.INT, new Integer(pValue)));
+  }
+  public void addSet(Column.Name pColumn, int pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.INT, new Integer(pValue)));
+  }
+  public void addSet(String pColumn, int pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.INT, new Integer(pValue)));
+  }
+
+  public void addSet(Column pColumn, long pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.LONG, new Long(pValue)));
+  }
+  public void addSet(Column.Name pColumn, long pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.LONG, new Long(pValue)));
+  }
+  public void addSet(String pColumn, long pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.LONG, new Long(pValue)));
+  }
+
+  public void addSet(Column pColumn, float pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.FLOAT, new Float(pValue)));
+  }
+  public void addSet(Column.Name pColumn, float pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.FLOAT, new Float(pValue)));
+  }
+  public void addSet(String pColumn, float pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.FLOAT, new Float(pValue)));
+  }
+
+  public void addSet(Column pColumn, boolean pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.BOOLEAN, pValue ? Boolean.TRUE : Boolean.FALSE));
+  }
+  public void addSet(Column.Name pColumn, boolean pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.BOOLEAN, pValue ? Boolean.TRUE : Boolean.FALSE));
+  }
+  public void addSet(String pColumn, boolean pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.BOOLEAN, pValue ? Boolean.TRUE : Boolean.FALSE));
+  }
+
+  public void addSet(Column pColumn, String pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.STRING, pValue));
+  }
+  public void addSet(Column.Name pColumn, String pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.STRING, pValue));
+  }
+  public void addSet(String pColumn, String pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.STRING, pValue));
+  }
+
+  public void addSetDateTime(Column pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.DATETIME, pValue));
+  }
+  public void addSetDateTime(Column.Name pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.DATETIME, pValue));
+  }
+  public void addSetDateTime(String pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.DATETIME, pValue));
+  }
+
+  public void addSetTime(Column pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.TIME, pValue));
+  }
+  public void addSetTime(Column.Name pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.TIME, pValue));
+  }
+  public void addSetTime(String pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.TIME, pValue));
+  }
+
+  public void addSetDate(Column pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.DATE, pValue));
+  }
+  public void addSetDate(Column.Name pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.DATE, pValue));
+  }
+  public void addSetDate(String pColumn, Calendar pValue) {
+    addSet(pColumn, new ValueImpl(Value.Type.DATE, pValue));
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Case;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Statement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+
+
+/** <p>A common base class for {@link org.apache.ws.jaxme.sqls.SelectStatement},
+ * {@link org.apache.ws.jaxme.sqls.InsertStatement},
+ * {@link org.apache.ws.jaxme.sqls.UpdateStatement}, and
+ * {@link org.apache.ws.jaxme.sqls.DeleteStatement}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class StatementImpl implements Statement {
+  private SQLFactory factory;
+  private TableReference tableReference;
+  
+  protected StatementImpl(SQLFactory pFactory) {
+    factory = pFactory;
+  }
+  
+  public SQLFactory getSQLFactory() {
+    return factory;
+  }
+  
+  protected TableReference newTableReference(Table pTable) {
+    return new TableReferenceImpl(this, pTable);
+  }
+  
+  public TableReference setTable(Table pTable) {
+    if (pTable == null) {
+      throw new NullPointerException("The table on which the statement operates must not be null.");
+    }
+    if (tableReference != null) {
+      throw new IllegalStateException("The table on which the statement operates was already set.");
+    }
+    tableReference = newTableReference(pTable);
+    return tableReference;
+  }
+  
+  public TableReference getTableReference() {
+    return tableReference;
+  }
+  
+  public Function createFunction(String pName) {
+    return getSQLFactory().getObjectFactory().newFunction(this, pName);
+  }
+
+    public Case newCase(Column.Type pType) {
+    	return getSQLFactory().getObjectFactory().newCase(pType);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementMetaData.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementMetaData.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/StatementMetaData.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,302 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.Case;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.Expression;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.Parts;
+import org.apache.ws.jaxme.sqls.RawSQLCode;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SetStatement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+import org.apache.ws.jaxme.sqls.Value;
+
+
+public class StatementMetaData {
+    public static class LocalData {
+        private boolean hasWhereClause;
+        
+        public boolean hasWhereClause() {
+            return hasWhereClause;
+        }
+
+        public void setWhereClause(boolean pHasWhereClause) {
+            hasWhereClause = pHasWhereClause;
+        }
+    }
+
+    private final Map aliases = new HashMap();
+    private final Map columnNames = new HashMap();
+
+    private final List tables = new ArrayList();
+
+    public StatementMetaData(DeleteStatement pQuery) {
+        addTable(pQuery.getTableReference());
+        addCombinedConstraint(pQuery.getWhere());
+        createTableAliases();
+        createColumnNames();
+    }
+
+    public StatementMetaData(UpdateStatement pQuery, ColumnReference[] pColumns) {
+        addSetStatement(pQuery, pColumns);
+        addCombinedConstraint(pQuery.getWhere());
+        createTableAliases();
+        createColumnNames();
+    }
+
+    public StatementMetaData(InsertStatement pQuery, ColumnReference[] pColumns) {
+    	addSetStatement(pQuery, pColumns);
+        SelectStatement subSelect = pQuery.getSubSelect();
+        if (subSelect != null) {
+        	addSelectStatement(subSelect);
+        }
+        createTableAliases();
+        createColumnNames();
+    }
+
+    public StatementMetaData(SelectStatement pQuery) {
+      addSelectStatement(pQuery);
+      createTableAliases();
+      createColumnNames();
+    }
+
+    protected void addSetStatement(SetStatement pQuery, ColumnReference[] pColumns) {
+        addTable(pQuery.getTableReference());
+        for (int i = 0;  i < pColumns.length;  i++) {
+            addColumn(pColumns[i]);
+        }
+        for (Iterator iter = pQuery.getSetValues();  iter.hasNext();  ) {
+            SetStatement.SetValue setValue = (SetStatement.SetValue) iter.next();
+            addPart(setValue.getValue());
+            addPart(setValue.getColumnReference());
+        }
+    }
+
+    protected void addTable(TableReference pTableReference) {
+        Table t = pTableReference.getTable();
+        Table.Name alias = pTableReference.getAlias();
+        if (alias != null) {
+            if (aliases.containsKey(alias.getName())) {
+                throw new IllegalStateException("The alias " + alias +
+                        " is used twice ");
+            }
+            aliases.put(alias.getName(), pTableReference);
+        }
+        tables.add(pTableReference);
+        if (t instanceof ViewImpl) {
+            ViewImpl v = (ViewImpl) t;
+            addSelectStatement(v.getViewStatement());
+        }
+            
+        if (pTableReference instanceof JoinReference) {
+            addCombinedConstraint(((JoinReference) pTableReference).getOn());
+        }
+    }
+
+    protected void addSelectStatement(SelectStatement pQuery) {
+        for (Iterator tableIter = pQuery.getSelectTableReferences();  tableIter.hasNext();  ) {
+            TableReference ref = (TableReference) tableIter.next();
+            addTable(ref);
+        }
+        addCombinedConstraint(pQuery.getWhere());
+        for (Iterator iter = pQuery.getResultColumns();  iter.hasNext();  ) {
+            addPart(iter.next());
+        }
+        for (Iterator iter = pQuery.getOrderColumns();  iter.hasNext();  ) {
+        	SelectStatement.OrderColumn orderColumn = (SelectStatement.OrderColumn) iter.next();
+            addPart(orderColumn.getColumn());
+        }
+    }
+
+    protected void addColumn(ColumnReference pColumn) {
+        if (pColumn instanceof VirtualColumn) {
+            VirtualColumn vc = (VirtualColumn) pColumn;
+            Object o = vc.getValue();
+            if (o instanceof SelectStatement) {
+                addSelectStatement((SelectStatement) o);
+            } else if (o instanceof Function) {
+                addParts((Function) o);
+            } else if (o instanceof String) {
+                // Do nothing
+            } else {
+                throw new IllegalStateException("Invalid type of VirtualColumn: " + o);
+            }
+            addColumnName(vc.getName());
+        }
+    }
+
+    private void addColumnName(Column.Name pName) {
+        String key = pName.toString().toUpperCase();
+        Integer num = (Integer) columnNames.get(key);
+        if (num == null) {
+            num = new Integer(1);
+        } else {
+            num = new Integer(num.intValue() + 1);
+        }
+        columnNames.put(key, num);
+    }
+
+    protected void addCombinedConstraint(CombinedConstraint pConstraint) {
+      for (Iterator iter = pConstraint.getParts();  iter.hasNext();  ) {
+        Object o = iter.next();
+        if (o instanceof CombinedConstraint) {
+          addCombinedConstraint((CombinedConstraint) o);
+        } else if (o instanceof BooleanConstraint) {
+          addBooleanConstraint((BooleanConstraint) o);
+        } else {
+          throw new IllegalStateException("Invalid part type in CombinedConstraint: " + o);
+        }
+      }
+    }
+
+    protected void addPart(Object pPart) {
+        if (pPart instanceof SelectStatement) {
+            addSelectStatement((SelectStatement) pPart);
+        } else if (pPart instanceof CombinedConstraint) {
+            addCombinedConstraint((CombinedConstraint) pPart);
+        } else if (pPart instanceof Function) {
+            addParts((Function) pPart);
+        } else if (pPart instanceof Expression) {
+			addParts((Expression) pPart);
+        } else if (pPart instanceof ColumnReference
+                ||  pPart instanceof Value
+                ||  pPart instanceof RawSQLCode) {
+            // Ignore me
+        } else if (pPart instanceof Case) {
+            Case casePart = (Case) pPart;
+            addPart(casePart.getCheckedValue());
+            Object o = casePart.getElseValue();
+            if (o != null) {
+            	addPart(o);
+            }
+            Case.When[] whens = casePart.getWhens();
+            for (int i = 0;  i < whens.length;  i++) {
+            	Case.When when = whens[i];
+            	addPart(when.getCondition());
+                addPart(when.getValue());
+            }
+        } else if (pPart.getClass().isArray()) {
+            Object[] o = (Object[]) pPart;
+            for (int i = 0;  i < o.length;  i++) {
+            	addPart(o[i]);
+            }
+        } else {
+            throw new IllegalStateException("Invalid part type: " + pPart);
+        }
+    }
+
+    protected void addParts(Parts pParts) {
+        for (Iterator iter = pParts.getParts();  iter.hasNext();  ) {
+            addPart(iter.next());
+        }
+    }
+
+    protected void addBooleanConstraint(BooleanConstraint pConstraint) {
+      BooleanConstraint.Type type = pConstraint.getType();
+      if (BooleanConstraint.Type.EQ.equals(type)
+          ||  BooleanConstraint.Type.EXISTS.equals(type)
+          ||  BooleanConstraint.Type.GE.equals(type)
+          ||  BooleanConstraint.Type.GT.equals(type)
+          ||  BooleanConstraint.Type.IN.equals(type)
+          ||  BooleanConstraint.Type.ISNULL.equals(type)
+          ||  BooleanConstraint.Type.LE.equals(type)
+          ||  BooleanConstraint.Type.LIKE.equals(type)
+          ||  BooleanConstraint.Type.LT.equals(type)
+          ||  BooleanConstraint.Type.NE.equals(type)
+          ||  BooleanConstraint.Type.BETWEEN.equals(type)) {
+        addParts(pConstraint);
+      } else {
+        throw new IllegalStateException("Invalid part type in BooleanConstraint: " + type);
+      }
+    }
+
+    protected String getUniqueAlias(String pSuggestion, Map pAliases) {
+        String prefix;
+        if (pSuggestion == null) {
+            prefix = "";
+        } else {
+            prefix = pSuggestion;
+        }
+        if (!pAliases.containsKey(prefix)) {
+            return prefix;
+        }
+        for (char c = '0';  c <= '9';  c++) {
+            String s = prefix + c;
+            if (!pAliases.containsKey(s)) {
+                return s;
+            }
+        }
+        for (char c = 'A';  c <= 'Z';  c++) {
+            String s = prefix + c;
+            if (!pAliases.containsKey(s)) {
+                return s;
+            }
+        }
+        return getUniqueAlias(prefix + '0', pAliases);
+    }
+
+    protected void createTableAliases() {
+        if (tables.size() > 1) {
+            // Make sure that all tables have an alias
+            for (Iterator iter = tables.iterator();  iter.hasNext();  ) {
+                TableReference tableReference = (TableReference) iter.next();
+                if (tableReference.getAlias() == null) {
+                    String alias = getUniqueAlias(tableReference.getTable().getName().getName(), aliases);
+                    aliases.put(alias, tableReference);
+                    if (!alias.equals(tableReference.getTable().getName().getName())) {
+                        tableReference.setAlias(alias);
+                    }
+                }
+            }
+        }
+    }
+
+    protected void createColumnNames() {
+      // Create a Map of all column names, that may be referenced.
+      // maps key is the column name, and the maps value is the
+      // number of possible references. In other words: If an entry
+      // in the map has a value > 1, then its column name must be
+      // qualified, because it is used in multiple tables.
+      for (int i = 0;  i < tables.size();  i++) {
+        TableReference table = (TableReference) tables.get(i);
+        for (Iterator iter = table.getTable().getColumns();  iter.hasNext();  ) {
+          Column col = (Column) iter.next();
+          addColumnName(col.getName());
+        }
+      }
+    }
+
+    public Map getColumnNames() {
+      return columnNames;
+    }
+  }
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnSet;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TableImpl implements Table {
+   public static class NameImpl extends SQLFactoryImpl.IdentImpl implements Table.Name {
+      public NameImpl(String pName) {
+         super(pName);
+      }
+   }
+
+   private Schema schema;
+   private Table.Name name;
+   private List columns = new ArrayList();
+   private List indexes = new ArrayList();
+   private List foreignKeys = new ArrayList();
+
+   int indexNameCounter;
+
+   protected TableImpl(Schema pSchema, Table.Name pName) {
+      schema = pSchema;
+      name = pName;
+   }
+
+	public Schema getSchema() {
+      return schema;
+	}
+
+	public Table.Name getName() {
+      return name;
+	}
+
+   public String getQName() {
+      Schema mySchema = getSchema();
+      if (mySchema.getName() == null) {
+         return getName().getName();
+      } else {
+         return mySchema.getName().getName() + "." + getName().getName();
+      }
+   }
+
+	public Iterator getColumns() {
+      return columns.iterator();
+	}
+
+   public Column newColumn(String pName, Column.Type pType) {
+      return newColumn(new ColumnImpl.NameImpl(pName), pType);
+   }
+
+   public Column newColumn(Column.Name pName, Column.Type pType) {
+      if (pName == null) {
+         throw new NullPointerException("The column name must not be null.");
+      }
+      Integer maxLength = getSchema().getSQLFactory().getMaxColumnNameLength();
+      if (maxLength != null  &&  pName.getName().length() > maxLength.intValue()) {
+         throw new IllegalArgumentException("The column name " + pName +
+                                             " exceeds the maximum column length of " + maxLength);
+      }
+
+      if (pType == null) {
+         throw new NullPointerException("The column type must not be null.");
+      }
+      Column column = getColumn(pName);
+      if (column != null) {
+         throw new IllegalStateException("A column named " + column.getName() +
+                                          " already exists in the table " + getQName());
+      }
+      column = ((SQLFactoryImpl) getSchema().getSQLFactory()).newColumnImpl(this, pName, pType);
+      columns.add(column);
+      return column;
+   }
+
+   public Column getColumn(Column.Name pName) {
+      if (pName == null) {
+         throw new NullPointerException("Column names must not be null.");
+      }
+      for (Iterator iter = getColumns();  iter.hasNext();  ) {
+         Column column = (Column) iter.next();
+         if (getSchema().getSQLFactory().isColumnNameCaseSensitive()) {
+            if (pName.getName().equalsIgnoreCase(column.getName().getName())) {
+               return column;
+            }
+         } else {
+            if (pName.equals(column.getName())) {
+               return column;
+            }
+         }
+      }
+      return null;
+   }
+
+   public Column getColumn(String pName) {
+      return getColumn(new ColumnImpl.NameImpl(pName));
+   }
+
+	public Index newKey() {
+      Index result = new IndexImpl(this, true, false);
+      indexes.add(result);
+      return result;
+	}
+
+	public Index newIndex() {
+      Index result = new IndexImpl(this, false, false);
+      indexes.add(result);
+      return result;
+	}
+
+   public Index getPrimaryKey() {
+      for (Iterator iter = getIndexes();  iter.hasNext();  ) {
+         Index index = (Index) iter.next();
+         if (index.isPrimaryKey()) {
+            return index;
+         }
+      }
+      return null;
+   }
+
+   public Iterator getIndexes() {
+      return indexes.iterator();
+   }
+
+	public Index newPrimaryKey() {
+      Index pk = getPrimaryKey();
+      if (pk != null) {
+         throw new IllegalStateException("A primary key is already defined on table " + getName());
+      }
+      Index result = new IndexImpl(this, true, true);
+      indexes.add(result);
+      return result;
+	}
+
+   public Iterator getForeignKeys() {
+      return foreignKeys.iterator();
+   }
+
+   public ForeignKey newForeignKey(Table pTable) {
+      ForeignKey foreignKey = new ForeignKeyImpl(this, pTable);
+      foreignKeys.add(foreignKey);
+      return foreignKey;
+   }
+
+   public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof Table)) {
+         return false;
+      }
+      Table other = (Table) o;
+      if (!getSchema().equals(other.getSchema())) {
+         return false;
+      }
+      return getName().equals(other.getName());
+   }
+
+   public int hashCode() {
+      return getSchema().hashCode() + getName().hashCode();
+   }
+
+   public InsertStatement getInsertStatement() {
+      InsertStatement result = getSchema().getSQLFactory().newInsertStatement();
+      result.setTable(this);
+      for (Iterator iter = getColumns();  iter.hasNext();  ) {
+         result.addSet((Column) iter.next());
+      }
+      return result;
+   }
+
+   public SelectStatement getSelectStatement() {
+       SQLFactory factory = getSchema().getSQLFactory();
+       SelectStatement result = factory.newSelectStatement();
+      result.setTable(this);
+      TableReference ref = result.getTableReference();
+      for (Iterator iter = getColumns();  iter.hasNext();  ) {
+         Column column = (Column) iter.next();
+         result.addResultColumn(factory.getObjectFactory().newColumnReference(ref, column));
+      }
+      return result;
+   }
+
+  public UpdateStatement getUpdateStatement() {
+    UpdateStatement result = getSchema().getSQLFactory().newUpdateStatement();
+    result.setTable(this);
+    TableReference ref = result.getTableReference();
+    boolean hasPrimaryKey = false;
+    for (Iterator iter = getColumns();  iter.hasNext();  ) {
+      Column column = (Column) iter.next();
+      if (column.isPrimaryKeyPart()) {
+        hasPrimaryKey = true;
+      } else {
+        result.addSet(column);
+      }
+    }
+    if (hasPrimaryKey) {
+      result.getWhere().addColumnSetQuery(getPrimaryKey(), ref);
+    } else {
+      throw new IllegalStateException("Cannot create a default update statement without a primary key.");
+    }
+    return result;
+  }
+
+  public DeleteStatement getDeleteStatement() {
+    DeleteStatement result = getSchema().getSQLFactory().newDeleteStatement();
+    result.setTable(this);
+    ColumnSet primaryKey = getPrimaryKey();
+    if (primaryKey == null) {
+      throw new IllegalStateException("Cannot create a default delete statement without a primary key.");
+    }
+    result.getWhere().addColumnSetQuery(primaryKey, result.getTableReference());
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableReferenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableReferenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/TableReferenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.Statement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+
+
+/** <p>Implementation of a {@link org.apache.ws.jaxme.sqls.TableReference}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TableReferenceImpl implements TableReference {
+   private Statement statement;
+   private Table table;
+   private Table.Name alias;
+   private List columnReferences = new ArrayList();
+
+	/** <p>Creates a new instance of TableReference.</p>
+	 */
+	TableReferenceImpl(Statement pStatement, Table pTable) {
+      statement = pStatement;
+      table = pTable;
+	}
+
+	public Statement getStatement() {
+      return statement;
+	}
+
+	public Table getTable() {
+      return table;
+	}
+
+	public Table.Name getAlias() {
+      return alias;
+	}
+
+	public void setAlias(Table.Name pName) {
+      alias = pName;
+	}
+
+	public void setAlias(String pName) {
+      setAlias(new TableImpl.NameImpl(pName));
+	}
+
+	public ColumnReference newColumnReference(String pName) {
+      return newColumnReference(new ColumnImpl.NameImpl(pName));
+	}
+
+	public ColumnReference newColumnReference(Column.Name pName) {
+      Column column = getTable().getColumn(pName);
+      if (column == null) {
+         throw new NullPointerException("Unknown column name in table " + getTable().getName() +
+                                         ": " + pName);
+      }
+      return newColumnReference(column);
+	}
+
+	public ColumnReference newColumnReference(Column pColumn) {
+      ColumnReference columnReference = getStatement().getSQLFactory().getObjectFactory().newColumnReference(this, pColumn);
+      columnReferences.add(columnReference);
+      return columnReference;
+	}
+
+   public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof TableReference)) {
+         return false;
+      }
+      TableReference ref = (TableReference) o;
+      return ref.getStatement().equals(getStatement())  &&
+             ref.getTable().equals(getTable());
+   }
+
+   public int hashCode() {
+      return getStatement().hashCode() + getTable().hashCode();
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/UpdateStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/UpdateStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/UpdateStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class UpdateStatementImpl extends SetStatementImpl implements UpdateStatement {
+  private CombinedConstraint where = null;
+
+  public UpdateStatementImpl(SQLFactory pFactory) {
+    super(pFactory);
+  }
+
+  public CombinedConstraint getWhere() {
+      if (where == null) {
+          ObjectFactory f = getSQLFactory().getObjectFactory();
+          where = f.newCombinedConstraint(this, CombinedConstraint.Type.AND);
+      }
+      return where;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ValueImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ValueImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ValueImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Value;
+
+/** <p>Implementation of a value.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ValueImpl implements Value {
+  private final Value.Type type;
+  private final Object value;
+
+  public ValueImpl(Value pValue) {
+    this(pValue.getType(), pValue.getValue());
+  }
+  public ValueImpl(Value.Type pType, Object pValue) {
+    if (pType == null) {
+      throw new NullPointerException("The value type must not be null.");
+    }
+    if ((pType.equals(Type.PLACEHOLDER)  ||  pType.equals(Type.NULL))  &&
+	pValue != null) {
+      throw new IllegalArgumentException("The value argument must be null for the type " +
+                                          pType + ".");
+    }
+    type = pType;
+    value = pValue;
+  }
+
+  public Value.Type getType() { return type; }
+  public Object getValue() { return value; }
+  public int hashCode() {
+    int result = type.hashCode();
+    if (value != null) {
+      result = value.hashCode();
+    }
+    return result;
+  }
+  public boolean equals(Object o) {
+    if (o == null  ||  !(o instanceof Value)) {
+      return false;
+    }
+    Value v = (Value) o;
+    if (!type.equals(v.getType())) { return false; }
+    if (value == null) {
+      return v.getValue() == null;
+    } else {
+      return value.equals(v.getValue());
+    }
+  }
+
+    public static Object asValue(Object pValue) {
+    	if (pValue == null) {
+    		return new ValueImpl(Value.Type.NULL, pValue);
+        } else if (pValue instanceof String) {
+        	return new ValueImpl(Value.Type.STRING, pValue);
+        } else if (pValue instanceof Boolean) {
+        	return new ValueImpl(Value.Type.BOOLEAN, pValue);
+        } else if (pValue instanceof Byte) {
+            return new ValueImpl(Value.Type.BYTE, pValue);
+        } else if (pValue instanceof Short) {
+            return new ValueImpl(Value.Type.SHORT, pValue);
+        } else if (pValue instanceof Integer) {
+            return new ValueImpl(Value.Type.INT, pValue);
+        } else if (pValue instanceof Long) {
+            return new ValueImpl(Value.Type.LONG, pValue);
+        } else if (pValue instanceof Float) {
+            return new ValueImpl(Value.Type.FLOAT, pValue);
+        } else if (pValue instanceof Double) {
+            return new ValueImpl(Value.Type.DOUBLE, pValue);
+        } else {
+        	return pValue;
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ViewImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ViewImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/ViewImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+import org.apache.ws.jaxme.sqls.Column.Type;
+
+
+public class ViewImpl extends TableImpl {
+    private class ViewColumnImpl implements Column {
+        private final Column.Name colName;
+        private final Column col;
+        private Object data;
+        private ViewColumnImpl(ColumnReference pColumn) {
+            col = pColumn.getColumn();
+            Column.Name alias = pColumn.getAlias();
+            colName = alias == null ? col.getName() : alias;
+        }
+        public Table getTable() { return ViewImpl.this; }
+        public Name getName() { return colName; }
+        public String getQName() { return getTable() + "." + getName(); }
+        public Type getType() { return col.getType(); }
+        public boolean isPrimaryKeyPart() { return false; }
+        public void setNullable(boolean pNullable) {
+            throw new IllegalStateException("Unable to set a view columns 'Nullable' property.");
+        }
+        public boolean isNullable() { return col.isNullable(); }
+        public boolean isStringColumn() { return col.isStringColumn(); }
+        public boolean isBinaryColumn() { return col.isBinaryColumn(); }
+        public void setCustomData(Object pData) { data = pData; }
+        public Object getCustomData() { return data; }
+        public boolean isVirtual() { return false; }
+    }
+
+    private final SelectStatement stmt;
+
+	protected ViewImpl(SelectStatement pSelectStatement, Table.Name pName) {
+        super(pSelectStatement.getSelectTableReference().getTable().getSchema(),
+              pName == null ? pSelectStatement.getTableReference().getTable().getName() : pName);
+        stmt = pSelectStatement;
+    }
+
+    public Iterator getColumns() {
+        List result = new ArrayList();
+        for (Iterator iter = stmt.getResultColumns();  iter.hasNext();  ) {
+            ColumnReference col = (ColumnReference) iter.next();
+            result.add(new ViewColumnImpl(col));
+        }
+        return result.iterator();
+    }
+
+    public Column newColumn(Column.Name pName, Type pType) {
+        throw new IllegalStateException("A views columns cannot be changed.");
+    }
+
+    public Column newColumn(String pName, Type pType) {
+        throw new IllegalStateException("A views columns cannot be changed.");
+    }
+
+    public Column getColumn(Column.Name pName) {
+        if (pName == null) {
+            throw new NullPointerException("Column names must not be null.");
+         }
+        for (Iterator iter = stmt.getResultColumns();  iter.hasNext();  ) {
+            ColumnReference col = (ColumnReference) iter.next();
+            Column.Name alias = col.getAlias();
+            if (alias == null) {
+            	alias = col.getColumn().getName();
+            }
+            if (alias.equals(pName)) {
+                return new ViewColumnImpl(col);
+            }
+        }
+        return null;
+    }
+
+    public Index newKey() {
+        throw new IllegalStateException("A view cannot have keys.");
+    }
+    public Index newIndex() {
+        throw new IllegalStateException("A view cannot have indexes.");
+    }
+    public Index newPrimaryKey() {
+        throw new IllegalStateException("A view cannot have a primary key.");
+    }
+    public ForeignKey newForeignKey(Table pReferencedTable) {
+        throw new IllegalStateException("A view cannot have foreign keys.");
+    }
+    public InsertStatement getInsertStatement() {
+        throw new IllegalStateException("A view is not updateable.");
+    }
+    public UpdateStatement getUpdateStatement() {
+        throw new IllegalStateException("A view is not updateable.");
+    }
+    public DeleteStatement getDeleteStatement() {
+        throw new IllegalStateException("A view is not updateable.");
+    }
+    public Index getPrimaryKey() {
+        throw new IllegalStateException("A view cannot have a primary key.");
+    }
+    public Iterator getIndexes() {
+        throw new IllegalStateException("A view cannot have indexes.");
+    }
+    public Iterator getForeignKeys() {
+        throw new IllegalStateException("A view cannot have foreign keys.");
+    }
+
+    public SelectStatement getViewStatement() {
+        return stmt;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/VirtualColumn.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/VirtualColumn.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/VirtualColumn.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.impl;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+
+
+/** <p>A virtual column is a named item that can be added
+ * to the result set. For example:</p>
+ * <pre>
+ *   SELECT name, vorname, MAX(a) AS max FROM ...
+ * </pre>
+ * <p>The example uses a virtual column max. The value of
+ * max is calculated from other values.</p>
+ *
+ * @author <a href="mailto:jwi at softwareag.com">Jochen Wiedmann</a>
+ */
+public class VirtualColumn extends AbstractColumn implements ColumnReference {
+    private Column.Name alias;
+    private Object value;
+    
+    public VirtualColumn(Column.Name pName, Column.Type pType) {
+        super(pName, pType);
+    }
+    
+    public VirtualColumn(String pName, Column.Type pType) {
+        super(new ColumnImpl.NameImpl(pName), pType);
+    }
+    
+    public Table getTable() { return null; }
+    public String getQName() { return getName().toString(); }
+    public boolean isPrimaryKeyPart() { return false; }
+    public TableReference getTableReference() { return null; }
+    public Column getColumn() { return this; }
+    public boolean isVirtual() { return true; }
+    
+    public void setAlias(String pName) {
+        setAlias(new ColumnImpl.NameImpl(pName));
+    }
+    
+    public void setAlias(Name pName) {
+        alias = pName;
+    }
+    
+    public Name getAlias() {
+        return alias;
+    }
+    
+    public void setValue(String pValue) {
+        value = pValue;
+    }
+    
+    public void setValue(SelectStatement pValue) {
+        value = pValue;
+    }
+    
+    public void setValue(Function pValue) {
+        value = pValue;
+    }
+    
+    public Object getValue() {
+        return value;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.sqls.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains the basic implementation of the generic framework for SQL generators.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/CreateTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/CreateTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/CreateTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,456 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.junit;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.Expression;
+import org.apache.ws.jaxme.sqls.ForeignKey;
+import org.apache.ws.jaxme.sqls.Index;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.StringColumn;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+import org.apache.ws.jaxme.sqls.impl.VirtualColumn;
+
+
+public class CreateTest extends TestCase {
+    private SQLFactory sqlFactory;
+    private SQLGenerator sqlGenerator;
+    private Schema schema;
+    
+    protected SQLFactory newSQLFactory() {
+        return new SQLFactoryImpl();
+    }
+    
+    protected SQLGenerator newSQLGenerator() {
+        return sqlFactory.newSQLGenerator();
+    }
+    
+    protected SQLFactory getSQLFactory() {
+        return sqlFactory;
+    }
+    
+    protected SQLGenerator getSQLGenerator() {
+        return sqlGenerator;
+    }
+    
+    public void setUp() {
+        sqlFactory = newSQLFactory();
+        sqlGenerator = newSQLGenerator();
+        schema = sqlFactory.newSchema("MySchema");
+    }
+    
+    /** <p>Creates a new instance of CreateTest.java.</p>
+     */
+    public CreateTest(String pName) { super(pName); }
+    
+    /** <p>Creates a basic table</p>
+     */
+    protected Table getBasicTable() {
+        Table table = schema.newTable("MyTable");
+        Column myIndex = table.newColumn("MyIndex", Column.Type.INTEGER);
+        assertTrue(!myIndex.isStringColumn());
+        assertTrue(!myIndex.isBinaryColumn());
+        Column myName = table.newColumn("MyName", Column.Type.VARCHAR);
+        assertTrue(myName.isStringColumn()); // myName may be casted to a StringColumn
+        assertTrue(!myName.isBinaryColumn());
+        ((StringColumn) myName).setLength(60);
+        Column myDate = table.newColumn("MyDate", Column.Type.DATE);
+        assertTrue(!myDate.isStringColumn());
+        assertTrue(!myDate.isBinaryColumn());
+        myDate.setNullable(true);
+        return table;
+    }
+    
+    /** <p>Creates a table with primary key</p>
+     */
+    protected Table getPrimaryKeyTable() {
+        Table table = getBasicTable();
+        Index index = table.newPrimaryKey();
+        index.addColumn("MyIndex");
+        return table;
+    }
+    
+    protected Table getForeignKeyTable(Table pTable) {
+        Table otherTable = pTable.getSchema().newTable("OtherTable");
+        Column otherIndex = otherTable.newColumn("MyIndex", Column.Type.INTEGER);
+        Column referenceColumn = otherTable.newColumn("RefIndex", Column.Type.INTEGER);
+        Column companyColumn = otherTable.newColumn("Company", Column.Type.VARCHAR);
+        ((StringColumn) companyColumn).setLength(60);
+        otherTable.newPrimaryKey().addColumn(otherIndex);
+        
+        ForeignKey reference = otherTable.newForeignKey(pTable);
+        reference.addColumnLink(referenceColumn, pTable.getColumn("MyIndex"));
+        return otherTable;
+    }
+    
+    /** <p>Basic test for creating a <code>CREATE TABLE</code>
+     * statement.</p>
+     */
+    public void testBasicCreate() {
+        Table table = getBasicTable();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        Collection statements = generator.getCreate(table.getSchema(), true);
+        Iterator iter = statements.iterator();
+        assertTrue(iter.hasNext());
+        assertEquals("CREATE SCHEMA MySchema", iter.next());
+        assertTrue(iter.hasNext());
+        assertEquals("CREATE TABLE MySchema.MyTable (\n" +
+                "  MyIndex INT NOT NULL,\n" +
+                "  MyName VARCHAR(60) NOT NULL,\n" +
+                "  MyDate DATE\n" +
+                ")\n", iter.next());
+        assertTrue(!iter.hasNext());
+    }
+    
+    /** <p>Basic test for creating an <code>INSERT</code> statement.</p>
+     */
+    public void testBasicInsert() {
+        Table table = getBasicTable();
+        InsertStatement insertStatement = table.getInsertStatement();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String s = generator.getQuery(insertStatement);
+        assertEquals("INSERT INTO MySchema.MyTable (MyIndex, MyName, MyDate) VALUES (?, ?, ?)", s);
+    }
+
+    protected String getBulkInsertResult() {
+        return "INSERT INTO MySchema.MyTable (MyTable.MyIndex, MyTable.MyName, MyTable.MyDate) (SELECT MyTable0.MyIndex, MyTable0.MyName, MyTable0.MyDate FROM MySchema.MyTable AS MyTable0)";
+    }
+
+    public void testBulkInsert() {
+        Table table = getBasicTable();
+        InsertStatement insertStatement = getSQLFactory().newInsertStatement();
+        insertStatement.setTable(table);
+        SelectStatement st = table.getSelectStatement();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        insertStatement.setSubSelect(st);
+        String got = generator.getQuery(insertStatement);
+        String expect = getBulkInsertResult();
+        assertEquals(expect, got);
+    }
+
+    /** <p>Basic test for creating a <code>SELECT</code> statement.</p>
+     */
+    public void testBasicSelect() {
+        Table table = getBasicTable();
+        SelectStatement selectStatement = table.getSelectStatement();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String s = generator.getQuery(selectStatement);
+        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable", s);
+    }
+    
+    /** <p>Basic test for creating an <code>UPDATE</code> statement.</p>
+     */
+    public void testBasicUpdate() {
+        Table table = getPrimaryKeyTable();
+        UpdateStatement updateStatement = table.getUpdateStatement();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String s = generator.getQuery(updateStatement);
+        assertEquals("UPDATE MySchema.MyTable SET MyName=?, MyDate=? WHERE MyIndex=?", s);
+    }
+    
+    /** <p>Basic test for creating an <code>DELETE</code> statement.</p>
+     */
+    public void testBasicDelete() {
+        Table table = getPrimaryKeyTable();
+        DeleteStatement deleteStatement = table.getDeleteStatement();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String s = generator.getQuery(deleteStatement);
+        assertEquals("DELETE FROM MySchema.MyTable WHERE MyIndex=?", s);
+    }
+    
+    protected String getCreateForeignKeyResult() {
+        return "CREATE TABLE MySchema.OtherTable (  MyIndex INT NOT NULL,  RefIndex INT NOT NULL,  Company VARCHAR(60) NOT NULL)";
+    }
+    
+    /** <p>Test for a FOREIGN KEY definition.</p>
+     */
+    public void testCreateForeignKey() {
+        Table table = getPrimaryKeyTable();
+        Table otherTable = getForeignKeyTable(table);
+        SQLGenerator generator = getSQLGenerator();
+        Collection c = generator.getCreate(otherTable);
+        assertEquals(1, c.size());
+        String expect = getCreateForeignKeyResult();
+        String got = (String) c.iterator().next();
+        assertEquals(expect, got);
+    }
+    
+    protected String getTestJoinResult() {
+        return "SELECT OtherTable.MyIndex, RefIndex, Company FROM MySchema.OtherTable JOIN MySchema.MyTable ON RefIndex=MyTable.MyIndex WHERE OtherTable.MyIndex=?";
+    }
+
+    protected SelectStatement getJoinStatement() {
+        Table table = getPrimaryKeyTable();
+        Table otherTable = getForeignKeyTable(table);
+        SelectStatement statement = otherTable.getSelectStatement();
+        SelectTableReference tableReference = statement.getSelectTableReference();
+        JoinReference joinReference = tableReference.join(table);
+        
+        TableReference refLocal = tableReference;
+        TableReference refRef = tableReference.getRightJoinedTableReference();
+        
+        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
+                refLocal, refRef);
+        CombinedConstraint cc = statement.getWhere();
+        BooleanConstraint bc = cc.createEQ();
+        bc.addPart(tableReference.newColumnReference("MyIndex"));
+        bc.addPlaceholder();
+        return statement;
+    }
+
+    /** <p>Test for a JOIN statement.</p>
+     */
+    public void testJoin() {
+        SelectStatement statement = getJoinStatement();
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String got = generator.getQuery(statement);
+        String expect = getTestJoinResult();
+        assertEquals(expect, got);
+    }
+    
+    protected String getTestLeftOuterJoinResult() {
+        return "SELECT OtherTable.MyIndex, RefIndex, Company FROM MySchema.OtherTable LEFT OUTER JOIN MySchema.MyTable ON RefIndex=MyTable.MyIndex WHERE OtherTable.MyIndex=?";
+    }
+    
+    /** <p>Test for a LEFT OUTER JOIN statement.</p>
+     */
+    public void testLeftOuterJoin() {
+        Table table = getPrimaryKeyTable();
+        Table otherTable = getForeignKeyTable(table);
+        SelectStatement statement = otherTable.getSelectStatement();
+        SelectTableReference tableReference = statement.getSelectTableReference();
+        JoinReference joinReference = tableReference.leftOuterJoin(table);
+        
+        TableReference refLocal = tableReference;
+        TableReference refRef = tableReference.getRightJoinedTableReference();
+        
+        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
+                refLocal, refRef);
+        CombinedConstraint cc = statement.getWhere();
+        BooleanConstraint bc = cc.createEQ();
+        bc.addPart(tableReference.newColumnReference("MyIndex"));
+        bc.addPlaceholder();
+        
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String got = generator.getQuery(statement);
+        String expect = getTestLeftOuterJoinResult();
+        assertEquals(expect, got);
+    }
+    
+    /** <p>Test for an EXISTS clause.</p>
+     */
+    public void testExists() {
+        Table table = getPrimaryKeyTable();
+        Table otherTable = getForeignKeyTable(table);
+        SelectStatement statement = table.getSelectStatement();
+        SelectTableReference tableReference = statement.getSelectTableReference();
+        SelectStatement existsStatement = otherTable.getSelectStatement();
+        SelectTableReference existsTableReference = existsStatement.getSelectTableReference();
+        BooleanConstraint bc = existsStatement.getWhere().createEQ();
+        bc.addPart(existsTableReference.newColumnReference("RefIndex"));
+        bc.addPart(tableReference.newColumnReference("MyIndex"));
+        statement.getWhere().createEXISTS(existsStatement);
+        
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String got = generator.getQuery(statement);
+        String expect = "SELECT MyTable.MyIndex, MyName, MyDate FROM MySchema.MyTable" +
+        " WHERE EXISTS(SELECT OtherTable.MyIndex, RefIndex, Company" +
+        " FROM MySchema.OtherTable WHERE RefIndex=MyTable.MyIndex)";
+        assertEquals(expect, got);
+    }
+
+    /** <p>Test for a BETWEEN clause.</p>
+     */
+    public void testBetween() {
+        Table table = getBasicTable();
+        SelectStatement statement = table.getSelectStatement();
+		BooleanConstraint between = statement.getWhere().createBETWEEN();
+		between.addPart(statement.getTableReference().newColumnReference("MyIndex"));
+		between.addPart(3);
+		between.addPart(5);
+
+		SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String got = generator.getQuery(statement);
+        String expect = "SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE MyIndex BETWEEN 3 AND 5";
+        assertEquals(expect, got);
+    }
+
+    /** <p>Creates a table with a composed primary key.</p>
+     */
+    protected Table getComposedKeyTable() {
+        Table table = getPrimaryKeyTable();
+        Column verNumColumn = table.newColumn("VerNum", Column.Type.INTEGER);
+        assertTrue(!verNumColumn.isStringColumn());
+        assertTrue(!verNumColumn.isBinaryColumn());
+        Index index = table.getPrimaryKey();
+        index.addColumn("VerNum");
+        return table;
+    }
+    
+    /** <p>Test for composed primary keys.</p>
+     */
+    public void testComposedPrimaryKey() {
+        Table table = getComposedKeyTable();
+        
+        SelectStatement statement = table.getSelectStatement();
+        statement.getWhere().addColumnSetQuery(table.getPrimaryKey(), statement.getTableReference());
+        SQLGenerator generator = getSQLGenerator();
+        generator.setLineTerminator("\n");
+        String s = generator.getQuery(statement);
+        assertEquals("SELECT MyIndex, MyName, MyDate, VerNum FROM MySchema.MyTable WHERE (MyIndex=? AND VerNum=?)", s);
+    }
+    
+    /** <p>Test for index names.</p>
+     */
+    public void testIndexNames() {
+        SQLGenerator gen = getSQLGenerator();
+        Table table = getBasicTable();
+        for (int i = 0;  i < 10;  i++) {
+            Index index = table.newIndex();
+            index.addColumn("MyName");
+            String s = (String) gen.getCreate(index).iterator().next();
+            assertEquals("CREATE INDEX MyTable_I" + i + " ON MySchema.MyTable (MyName)", s);
+        }
+        
+        Collection coll = gen.getCreate(schema, true);
+        String[] cmds = (String[]) coll.toArray(new String[coll.size()]);
+        assertEquals(12, cmds.length);
+        assertEquals("CREATE SCHEMA MySchema", cmds[0]);
+        assertEquals("CREATE TABLE MySchema.MyTable (  MyIndex INT NOT NULL,  MyName VARCHAR(60) NOT NULL,  MyDate DATE)", cmds[1]);
+        for (int i = 0;  i < 10;  i++) {
+            assertEquals("CREATE INDEX MyTable_I" + i + " ON MySchema.MyTable (MyName)", cmds[i+2]);
+        }
+    }
+    
+    /** <p>Test for subselects.</p>
+     */
+    public void testSubSelect() {
+        SQLGenerator gen = getSQLGenerator();
+        Table table = getComposedKeyTable();
+        
+        Table otherTable = table.getSchema().newTable("OtherTable");
+        Column otherIndex = otherTable.newColumn("MyIndex", Column.Type.INTEGER);
+        otherTable.newPrimaryKey().addColumn(otherIndex);
+        ForeignKey foreignKey = otherTable.newForeignKey(table);
+        SelectStatement selectStatement = sqlFactory.newSelectStatement();
+        selectStatement.setTable(otherTable);
+        DeleteStatement deleteStatement = sqlFactory.newDeleteStatement();
+        deleteStatement.setTable(table);
+        List columns = new ArrayList();
+        for (Iterator iter = table.getColumns();  iter.hasNext();  ) {
+            Column column = (Column) iter.next();
+            Column refColumn = otherTable.newColumn("Ref" + column.getName(), column.getType());
+            foreignKey.addColumnLink(refColumn, column);
+            if (column.isPrimaryKeyPart()) {
+                selectStatement.addResultColumn(selectStatement.getTableReference().newColumnReference(refColumn));
+                columns.add(deleteStatement.getTableReference().newColumnReference(column));
+            }
+        }
+        BooleanConstraint eq = selectStatement.getWhere().createEQ();
+        eq.addPart(selectStatement.getTableReference().newColumnReference("RefMyName"));
+        eq.addPlaceholder();
+        
+        BooleanConstraint bc = deleteStatement.getWhere().createIN();
+        bc.addPart((ColumnReference[]) columns.toArray(new ColumnReference[columns.size()]));
+        bc.addPart(selectStatement);
+        String expect = "DELETE FROM MySchema.MyTable WHERE (MyTable.MyIndex, VerNum) IN ((SELECT RefMyIndex, RefVerNum FROM MySchema.OtherTable WHERE RefMyName=?))";
+        String got = gen.getQuery(deleteStatement);
+        assertEquals(expect, got);
+    }
+    
+    public void testVirtualColumn() {
+        Table table = getBasicTable();
+        SelectStatement selectStatement = table.getSelectStatement();
+        VirtualColumn col = new VirtualColumn("virtCol", Column.Type.VARCHAR);
+        selectStatement.addResultColumn(col);
+        col.setValue("null");
+        SQLGenerator gen = getSQLGenerator();
+        String query = gen.getQuery(selectStatement);
+        assertEquals("SELECT MyIndex, MyName, MyDate, null AS virtCol FROM MySchema.MyTable", query);
+    }
+
+    public void testNOT() {
+        Table table = getBasicTable();
+        SelectStatement selectStatement = table.getSelectStatement();
+        SelectTableReference ref = selectStatement.getSelectTableReference();
+        CombinedConstraint and = selectStatement.getWhere();
+        BooleanConstraint bc = and.createLIKE();
+        bc.addPart(ref.newColumnReference("MyName"));
+        bc.addPart("%a%");
+        CombinedConstraint or = and.createOrConstraint();
+        or.setNOT(true);
+        bc = or.createEQ();
+        bc.addPart(ref.newColumnReference("MyIndex"));
+        bc.addPart(1);
+        SQLGenerator gen = getSQLGenerator();
+        String query = gen.getQuery(selectStatement);
+        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyName LIKE '%a%' AND NOT (MyIndex=1))", query);
+
+        bc = or.createEQ();
+        bc.addPart(ref.newColumnReference("MyIndex"));
+        bc.addPart(2);
+        query = gen.getQuery(selectStatement);
+        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyName LIKE '%a%' AND (NOT (MyIndex=1 OR MyIndex=2)))", query);
+    }
+
+	/** Test for expressions.
+	 */
+	public void testExpressions() {
+		Table t = getBasicTable();
+		SelectStatement st = t.getSelectStatement();
+		SelectTableReference ref = st.getSelectTableReference();
+		BooleanConstraint bc = st.getWhere().createGT();
+		Expression e1 = bc.createSUM();
+		e1.addPart(ref.newColumnReference("MyIndex"));
+		e1.addPart(3);
+		Expression e2 = bc.createSUM();
+		e2.addPart(5);
+        SQLGenerator gen = getSQLGenerator();
+        String got = gen.getQuery(st);
+		String expect = "SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyIndex+3)>5";
+		assertEquals(expect, got);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/DB2Test.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/DB2Test.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/DB2Test.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.junit;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.db2.DB2SQLFactoryImpl;
+
+
+/**
+ * @author <a href="mailto:jwi at softwareag.com">Jochen Wiedmann</a>
+ */
+public class DB2Test extends CreateTest {
+   public DB2Test(String pName) { super(pName); }
+
+   protected SQLFactory newSQLFactory() {
+      return new DB2SQLFactoryImpl();
+   }
+
+   protected String getCreateForeignKeyResult() {
+      return "CREATE TABLE MySchema.OtherTable (" +
+        "  MyIndex INT NOT NULL," +
+        "  RefIndex INT NOT NULL," +
+        "  Company VARCHAR(60) NOT NULL,"+
+        "  PRIMARY KEY (MyIndex)," +
+        "  FOREIGN KEY (RefIndex) REFERENCES MySchema.MyTable (MyIndex))";
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/JoinTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/JoinTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/JoinTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,442 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.sqls.junit;
+
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.Function;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.Schema;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.impl.VirtualColumn;
+import org.apache.ws.jaxme.sqls.oracle.OraColumnReference;
+import org.apache.ws.jaxme.sqls.oracle.OraSQLFactory;
+import org.apache.ws.jaxme.sqls.oracle.OraSQLFactoryImpl;
+import org.apache.ws.jaxme.sqls.oracle.OraSQLGenerator;
+import org.apache.ws.jaxme.sqls.oracle.OraSelectStatement;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JoinTest extends TestCase {
+    private OraSQLFactory sqlFactory;
+    private OraSQLGenerator sqlGenerator;
+    private Schema schema;
+    private Table dbAkte, dbBeteiligte, dbAktenzeichen;
+    private Table kettenElement, vertreterKette;
+
+    /** <p>Creates a new instance with the given name.</p>
+     */
+    public JoinTest(String pName) {
+        super(pName);
+    }
+
+    public void setUp() {
+        sqlFactory = new OraSQLFactoryImpl();
+        sqlGenerator = (OraSQLGenerator) sqlFactory.newSQLGenerator();
+        sqlGenerator.setOracle8Compatibility(true);
+        schema = sqlFactory.getDefaultSchema();
+        dbAkte = schema.newTable("DBAkte");
+        dbAkte.newColumn("aId", Column.Type.BIGINT);
+        dbBeteiligte = schema.newTable("DBBeteiligte");
+        dbBeteiligte.newColumn("aAktenId", Column.Type.BIGINT);
+        dbBeteiligte.newColumn("aFilter", Column.Type.BIGINT);
+        dbBeteiligte.newColumn("aName", Column.Type.VARCHAR);
+        dbBeteiligte.newColumn("aVorname", Column.Type.VARCHAR);
+        dbBeteiligte.newColumn("aId", Column.Type.BIGINT);
+        dbAktenzeichen = schema.newTable("DBAktenzeichen");
+        dbAktenzeichen.newColumn("aAktenId", Column.Type.BIGINT);
+        dbAktenzeichen.newColumn("aFilter", Column.Type.VARCHAR);
+        dbAktenzeichen.newColumn("aId", Column.Type.BIGINT);
+
+        kettenElement = schema.newTable("KettenElement");
+        kettenElement.newColumn("aId", Column.Type.BIGINT);
+        kettenElement.newColumn("aVertreterId", Column.Type.BIGINT);
+        kettenElement.newColumn("organisationsId", Column.Type.BIGINT);
+
+        vertreterKette = schema.newTable("VertreterKette");
+        vertreterKette.newColumn("wurzelElement", Column.Type.BIGINT);
+    }
+
+    /** <p>Creates the WHERE clause
+     * <pre>
+     *   a.aID = DBBeteiligte.aAktenId
+     * </pre></p>
+     */
+    private void addAktenId(CombinedConstraint pWhere,
+							TableReference pAkteReference, TableReference pBeteiligteReference) {
+        BooleanConstraint bc = pWhere.createEQ();
+        bc.addPart(pBeteiligteReference.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
+        bc.addPart(pAkteReference.newColumnReference(dbAkte.getColumn("aId")));
+    }
+
+	private void addEQ(TableReference pTableReference, CombinedConstraint pWhere,
+					   Column pColumn, String pValue) {
+        BooleanConstraint bc = pWhere.createEQ();
+        bc.addPart(pTableReference.newColumnReference(pColumn));
+        bc.addPart(pValue);
+	}
+
+    /** <p>Creates the count statement
+     * <pre>
+     * 	 (SELECT COUNT(*) AS pColumnName FROM DBBeteiligte WHERE aAktenId=a.aId AND aFilter=pFilter) AS pColumnName
+     * </pre></p>
+     */
+    private ColumnReference getCountStatement(String pColumnName, String pFilter,
+											  TableReference pAkteReference, String pTableAlias) {
+        // SELECT COUNT(*) FROM DBBeteiligte klc WHERE klc.aFilter='Klaeger' AND klc.aAktenId=a.aID
+        SelectStatement st = sqlFactory.newSelectStatement();
+        st.setTable(dbBeteiligte);
+        SelectTableReference tRef = st.getSelectTableReference();
+        tRef.setAlias(pTableAlias);
+        addEQ(tRef, st.getWhere(), dbBeteiligte.getColumn("aFilter"), pFilter);
+        addAktenId(st.getWhere(), pAkteReference, tRef);
+        VirtualColumn vc = new VirtualColumn(pColumnName, Column.Type.INTEGER);
+        vc.setValue("COUNT(*)");
+        st.addResultColumn(vc);
+
+        VirtualColumn result = new VirtualColumn(pColumnName, Column.Type.INTEGER);
+        result.setValue(st);
+        return result;
+    }
+
+
+    /** <p>Creates a statement fetching the first row matching the
+     * search criteria:
+     * <pre>
+     *   LEFT OUTER JOIN
+     *     (SELECT NUM, aName, aVorname, aAktenId FROM
+     *         (SELECT COUNT(*) OVER (PARTITION BY aAktenId) NUM,
+     *                 MIN(UPPER(aName)) OVER (PARTITION BY aAktenId) MINANAME,
+     *                 MIN(UPPER(NVL(aVorname, ' '))) OVER (PARTITION BY aAktenId, UPPER(aName)) MINAVORNAME,
+     *                 aName, aVorname, aAktenId
+     *          FROM DBBeteiligte WHERE aFilter=pFilter
+     *         )
+     *      WHERE UPPER(aName)=MAXANAME AND UPPER(NVL(aVorname, ' '))=MAXAVORNAME
+     *     ) pTableAlias ON a.aId = pTableAlias.aAktenId
+     * </pre>
+     */
+	private JoinReference getFirstRowStatement2(String pFilter, TableReference pAkteReference,
+	        									SelectTableReference pJoinReference,
+	        									String pTableAlias) {
+	    Column aName = dbBeteiligte.getColumn("aName");
+        Column aVorname = dbBeteiligte.getColumn("aVorname");
+        Column aAktenId = dbBeteiligte.getColumn("aAktenId");
+        Column aFilter = dbBeteiligte.getColumn("aFilter");
+
+        SelectStatement st = sqlFactory.newSelectStatement();
+        st.setTable(dbBeteiligte);
+        SelectTableReference ref = st.getSelectTableReference();
+        VirtualColumn num = new VirtualColumn("NUM", Column.Type.INTEGER);
+        num.setValue("COUNT(*) OVER (PARTITION BY " + aAktenId.getName() + ")");
+        st.addResultColumn(num);
+        VirtualColumn minAName = new VirtualColumn("MINANAME", Column.Type.VARCHAR);
+        minAName.setValue("MIN(UPPER(" + aName.getName() + ")) OVER (PARTITION BY " +
+                		  aAktenId.getName() + ")");
+        st.addResultColumn(minAName);
+        VirtualColumn minAVorname = new VirtualColumn("MINAVORNAME", Column.Type.VARCHAR);
+        minAVorname.setValue("MIN(UPPER(NVL(" + aVorname.getName() +
+                			 ", ' '))) OVER (PARTITION BY " +
+                	 		 aAktenId.getName() + ", UPPER(" + aName.getName() +
+                	 		 "))");
+        st.addResultColumn(minAVorname);
+        st.addResultColumn(ref.newColumnReference(aName));
+        st.addResultColumn(ref.newColumnReference(aVorname));
+        st.addResultColumn(ref.newColumnReference(aAktenId));
+        BooleanConstraint bc = st.getWhere().createEQ();
+        bc.addPart(st.getTableReference().newColumnReference(aFilter));
+        bc.addPart(pFilter);
+        Table t = st.createView((Table.Name) null);
+
+        SelectStatement st2 = sqlFactory.newSelectStatement();
+        st2.setTable(t);
+        SelectTableReference ref2 = st2.getSelectTableReference();
+        st2.addResultColumn(ref2.newColumnReference(t.getColumn("NUM")));
+        Column aName2 = t.getColumn(aName.getName());
+        st2.addResultColumn(ref2.newColumnReference(aName2));
+        Column aVorname2 = t.getColumn(aVorname.getName());
+        st2.addResultColumn(ref2.newColumnReference(aVorname2));
+        st2.addResultColumn(ref2.newColumnReference(t.getColumn(aAktenId.getName())));
+
+        bc = st2.getWhere().createEQ();
+        bc.addPart(ref2.newColumnReference(t.getColumn("MINAVORNAME")));
+        Function f = st2.createFunction("MIN");
+        Function f2 = st.createFunction("UPPER");
+        Function f3 = st.createFunction("NVL");
+        f3.addPart(ref2.newColumnReference(aVorname2));
+        f3.addPart(" ");
+        f2.addPart(f3);
+        bc.addPart(f);
+
+        bc = st2.getWhere().createEQ();
+        bc.addPart(ref2.newColumnReference(t.getColumn("MINANAME")));
+        f = st2.createFunction("MIN");
+        f2 = st.createFunction("UPPER");
+        f2.addPart(ref2.newColumnReference(aName2));
+        f.addPart(f2);
+        bc.addPart(f);
+        Table t2 = st2.createView(pTableAlias);
+
+        JoinReference result = pJoinReference.leftOuterJoin(t2);
+        bc = result.getOn().createEQ();
+        bc.addPart(pAkteReference.newColumnReference(dbAkte.getColumn("aId")));
+        bc.addPart(result.newColumnReference(t2.getColumn(aAktenId.getName())));
+        return result;
+	}
+
+    /** <p>Creates a statement fetching the first row matching the search criteria:
+     * <pre>
+     *   LEFT OUTER JOIN DBBeteiligte pTableAlias
+     *   ON a.aId=pTableAlias.aAktenId AND pTableAlias.aFilter=pFilter AND
+     *     UPPER(pTableAlias.aName)=
+     *      (SELECT MIN(UPPER(aName)) FROM DBBeteiligte min WHERE
+     *         pTableAlias.aAktenId=min.aAktenId AND min.aAktenId=pFilter)
+     * </pre></p>
+     */
+    private JoinReference getFirstRowStatement(String pFilter, TableReference pAkteReference,
+											   SelectTableReference pJoinReference,
+											   String pTableAlias) {
+        JoinReference result = pJoinReference.leftOuterJoin(dbBeteiligte);
+        result.setAlias(pTableAlias);
+        addAktenId(result.getOn(), pAkteReference, result);
+        addEQ(result, result.getOn(), dbBeteiligte.getColumn("aFilter"), pFilter);
+        BooleanConstraint bc = result.getOn().createEQ();
+        
+        Function f = pAkteReference.getStatement().createFunction("UPPER");
+        f.addPart(result.newColumnReference(dbBeteiligte.getColumn("aName")));
+        bc.addPart(f);
+        
+        SelectStatement minStatement = sqlFactory.newSelectStatement();
+        minStatement.setTable(dbBeteiligte);
+        SelectTableReference minTableRef = minStatement.getSelectTableReference();
+        minTableRef.setAlias(pTableAlias + "min");
+        BooleanConstraint bc2 = minStatement.getWhere().createEQ();
+        bc2.addPart(result.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
+        bc2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
+        
+        bc2 = minStatement.getWhere().createEQ();
+        bc2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aFilter")));
+        bc2.addPart(pFilter);
+
+        f = pAkteReference.getStatement().createFunction("MIN");
+        Function f2 = pAkteReference.getStatement().createFunction("UPPER");
+        f.addPart(f2);
+        f2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aName")));
+        VirtualColumn vc = new VirtualColumn("MIN", Column.Type.VARCHAR);
+        vc.setValue(f);
+        minStatement.addResultColumn(vc);
+
+        bc.addPart(minStatement);
+        return result;
+    }
+
+    private SelectStatement newStatement(boolean pUseView) {
+        SelectStatement st = sqlFactory.newSelectStatement();
+        st.setTable(dbAkte);
+        SelectTableReference akte = st.getSelectTableReference();
+        akte.setAlias("a");
+
+        //aktenzeichen joinen
+        JoinReference az = akte.join(dbAktenzeichen);
+        az.setAlias("az");
+        CombinedConstraint onClause = az.getOn();
+        BooleanConstraint bc = onClause.createEQ();
+        bc.addPart(akte.newColumnReference(dbAkte.getColumn("aId")));
+        bc.addPart(az.newColumnReference(dbAktenzeichen.getColumn("aAktenId")));
+        bc = onClause.createEQ();
+        bc.addPart(az.newColumnReference(dbAktenzeichen.getColumn("aFilter")));
+        bc.addPart("Hauptverfahren");
+
+        //beteiligte joinen
+        JoinReference kl, be;
+        if (pUseView) {
+            kl = getFirstRowStatement2("Klaeger", akte, az, "kl");
+            be = getFirstRowStatement2("Beklagter", akte, kl, "be");
+        } else {
+            kl = getFirstRowStatement("Klaeger", akte, az, "kl");
+            be = getFirstRowStatement("Beklagter", akte, kl, "be");
+            st.addResultColumn(getCountStatement("anzahlKlaeger", "Klaeger", akte, "klc"));
+            st.addResultColumn(getCountStatement("anzahlBeklagte", "Beklagter", akte, "bec"));
+        }
+        JoinReference ber = be.leftOuterJoin(dbBeteiligte);
+        ber.setAlias("ber");
+        addAktenId(ber.getOn(), akte, ber);
+        addEQ(ber, ber.getOn(), dbBeteiligte.getColumn("aFilter"), "Beklagter");
+
+        return st;
+    }
+
+    /** <p>Creates a complex SELECT statement and runs the generator on it.</p>
+     */
+    public void testCreate1() {
+        SelectStatement st = newStatement(false);
+        String got = sqlGenerator.getQuery(st);
+        String expect = "SELECT (SELECT COUNT(*) AS anzahlKlaeger FROM DBBeteiligte klc WHERE"
+            + " (klc.aFilter='Klaeger' AND klc.aAktenId=a.aId)) AS anzahlKlaeger,"
+            + " (SELECT COUNT(*) AS anzahlBeklagte FROM DBBeteiligte bec WHERE"
+            + " (bec.aFilter='Beklagter' AND bec.aAktenId=a.aId)) AS anzahlBeklagte"
+            + " FROM DBAkte a, DBAktenzeichen az, DBBeteiligte kl, DBBeteiligte be,"
+            + " DBBeteiligte ber WHERE (a.aId=az.aAktenId AND az.aFilter='Hauptverfahren')"
+            + " AND (kl.aAktenId(+)=a.aId AND kl.aFilter(+)='Klaeger' AND"
+            + " UPPER(kl.aName(+))=(SELECT MIN(UPPER(klmin.aName)) AS MIN FROM"
+            + " DBBeteiligte klmin WHERE (kl.aAktenId(+)=klmin.aAktenId AND"
+            + " klmin.aFilter='Klaeger'))) AND (be.aAktenId(+)=a.aId AND"
+            + " be.aFilter(+)='Beklagter' AND UPPER(be.aName(+))=(SELECT"
+            + " MIN(UPPER(bemin.aName)) AS MIN FROM DBBeteiligte bemin WHERE"
+            + " (be.aAktenId(+)=bemin.aAktenId AND bemin.aFilter='Beklagter'))) AND"
+            + " (ber.aAktenId(+)=a.aId AND ber.aFilter(+)='Beklagter')";
+        assertEquals(expect, got);
+    }
+
+    /** <p>Creates another complex SELECT statement and runs the generator on it.</p>
+     */
+    public void testCreate2() {
+        SelectStatement st = newStatement(true);
+        String got = sqlGenerator.getQuery(st);
+        String expect = "SELECT * FROM DBAkte a, DBAktenzeichen az,"
+            + " (SELECT DBBeteiligte.NUM, DBBeteiligte.aName, DBBeteiligte.aVorname,"
+            + " DBBeteiligte.aAktenId FROM (SELECT COUNT(*) OVER (PARTITION BY aAktenId) AS NUM,"
+            + " MIN(UPPER(aName)) OVER (PARTITION BY aAktenId) AS MINANAME,"
+            + " MIN(UPPER(NVL(aVorname, ' '))) OVER (PARTITION BY aAktenId, UPPER(aName)) AS MINAVORNAME,"
+            + " DBBeteiligte0.aName, DBBeteiligte0.aVorname, DBBeteiligte0.aAktenId FROM"
+            + " DBBeteiligte DBBeteiligte0 WHERE DBBeteiligte0.aFilter='Klaeger') WHERE"
+            + " (DBBeteiligte.MINAVORNAME=MIN() AND"
+            + " DBBeteiligte.MINANAME=MIN(UPPER(DBBeteiligte.aName)))),"
+            + " (SELECT DBBeteiligte1.NUM, DBBeteiligte1.aName, DBBeteiligte1.aVorname,"
+            + " DBBeteiligte1.aAktenId FROM (SELECT COUNT(*) OVER (PARTITION BY aAktenId)"
+            + " AS NUM, MIN(UPPER(aName)) OVER (PARTITION BY aAktenId) AS MINANAME,"
+            + " MIN(UPPER(NVL(aVorname, ' '))) OVER (PARTITION BY aAktenId, UPPER(aName)) AS MINAVORNAME,"
+            + " DBBeteiligte2.aName, DBBeteiligte2.aVorname, DBBeteiligte2.aAktenId"
+            + " FROM DBBeteiligte DBBeteiligte2 WHERE DBBeteiligte2.aFilter='Beklagter')"
+            + " DBBeteiligte1 WHERE (DBBeteiligte1.MINAVORNAME=MIN() AND"
+            + " DBBeteiligte1.MINANAME=MIN(UPPER(DBBeteiligte1.aName)))),"
+            + " DBBeteiligte ber WHERE (a.aId=az.aAktenId AND az.aFilter='Hauptverfahren')"
+            + " AND a.aId=kl.aAktenId(+) AND a.aId=be.aAktenId(+) AND"
+            + " (ber.aAktenId(+)=a.aId AND ber.aFilter(+)='Beklagter')";
+        assertEquals(expect, got);
+    }
+
+    private void addEQ(TableReference pRef1, TableReference pRef2,
+                       CombinedConstraint pConstraint,
+                       Column pCol1, Column pCol2) {
+        BooleanConstraint bc = pConstraint.createEQ();
+        bc.addPart(pRef1.newColumnReference(pCol1));
+        bc.addPart(pRef2.newColumnReference(pCol2));
+    }
+
+    private void addEQ(TableReference pRef1, CombinedConstraint pConstraint,
+                       Column pCol1) {
+    	BooleanConstraint bc = pConstraint.createEQ();
+    	bc.addPart(pRef1.newColumnReference(pCol1));
+    	bc.addPlaceholder();
+    }
+
+    /**
+     * Returns the Statment
+     * <pre> 
+     *   SELECT KE.AID FROM KETTENELEMENT KE JOIN VERTRETREKETTE VK
+     *     ON KE.AID = VK.WURZELELEMENT
+     *     WHERE KE.ORGANISATIONSID = ? 
+     * </pre>
+     */
+    private SelectStatement getSelectAidByOrganisationsId() {
+        SelectStatement stmt = sqlFactory.newSelectStatement();
+        stmt.setTable(kettenElement);
+        SelectTableReference kettenElementRef = stmt.getSelectTableReference();
+        JoinReference vertreterKetteRef = kettenElementRef.join(vertreterKette);
+        addEQ(kettenElementRef, vertreterKetteRef, vertreterKetteRef.getOn(),
+              kettenElement.getColumn("aId"),
+              vertreterKette.getColumn("wurzelElement"));
+        addEQ(kettenElementRef, stmt.getWhere(), kettenElement.getColumn("organisationsId"));
+        stmt.addResultColumn(kettenElementRef.newColumnReference(kettenElement.getColumn("aId")));
+        return stmt;
+    }
+
+    /**
+     *  <p>Creates the statement
+     * <pre>
+     *    SELECT AID FROM KETTENELEMENT 
+     *    START WITH KE.AID IN
+     *    ( SELECT KE.AID FROM KETTENELEMENT KE JOIN VERTRETREKETTE VK
+     *      ON KE.AID = VK.WURZELELEMENT
+     *      WHERE KE.ORGANISATIONSID = ?
+     *    )
+     *    CONNECT BY PRIOR KE.AID=KE.AVERTRETERID 
+     * </pre></p>
+     */
+    private SelectStatement getSelectAllChildsByOrganisationsId() {
+        OraSelectStatement stmt = (OraSelectStatement) sqlFactory.newSelectStatement();
+        stmt.setTable(kettenElement);
+        TableReference tRef  = stmt.getTableReference();
+
+        BooleanConstraint in = stmt.getStartWith().createIN();
+        in.addPart(tRef.newColumnReference(kettenElement.getColumn("aId")));
+        in.addPart(getSelectAidByOrganisationsId());
+        
+        BooleanConstraint bc = stmt.getConnectBy().createEQ();
+        OraColumnReference ref1 = (OraColumnReference) tRef.newColumnReference(kettenElement.getColumn("aId"));
+        ref1.setPrior(true);
+        bc.addPart(ref1);
+        bc.addPart(tRef.newColumnReference(kettenElement.getColumn("aVertreterId")));
+
+        return stmt;
+    }
+
+    /** <p>Creates the statement
+     * <pre>
+     *    DELETE FROM KETTENELEMENT KE WHERE AID IN
+     *   ( SELECT AID FROM KETTENELEMENT 
+     *     START WITH KE.AID IN
+     *     ( SELECT KE.AID FROM KETTENELEMENT KE JOIN VERTRETREKETTE VK
+     *        ON KE.AID = VK.WURZELELEMENT
+     *        WHERE KE.ORGANISATIONSID = ?
+     *     )
+     *     CONNECT BY PRIOR KE.AID=KE.AVERTRETERID
+     *   )
+     * </pre></p>
+     */
+    private DeleteStatement getDeleteAllChildsByOrganisationsId() {
+        DeleteStatement dstmt = sqlFactory.newDeleteStatement();
+        dstmt.setTable(kettenElement);
+        TableReference tRef  = dstmt.getTableReference();
+        CombinedConstraint whereClause = dstmt.getWhere();
+        BooleanConstraint bc = whereClause.createIN();
+        bc.addPart(tRef.newColumnReference(kettenElement.getColumn("aId")));
+        bc.addPart(getSelectAllChildsByOrganisationsId());
+        return dstmt;
+    }
+
+    /** <p>Creates the query
+     * <pre>
+     * </pre>
+     * and verifies the generator results.</p>
+     */
+    public void testDelete1() {
+    	DeleteStatement ds = getDeleteAllChildsByOrganisationsId();
+        String expect = "DELETE FROM KettenElement WHERE KettenElement.aId IN" +
+                        " ((SELECT * FROM KettenElement KettenElement0 START WITH KettenElement0.aId IN ((SELECT KettenElement1.aId FROM KettenElement KettenElement1, VertreterKette WHERE KettenElement1.aId=wurzelElement AND KettenElement1.organisationsId=?)) CONNECT BY PRIOR KettenElement0.aId=KettenElement0.aVertreterId))";
+        String got = sqlGenerator.getQuery(ds);
+        assertEquals(expect, got);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/Oracle8Test.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/Oracle8Test.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/junit/Oracle8Test.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.junit;
+
+import org.apache.ws.jaxme.sqls.BooleanConstraint;
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.oracle.OraColumnReference;
+import org.apache.ws.jaxme.sqls.oracle.OraSQLFactoryImpl;
+import org.apache.ws.jaxme.sqls.oracle.OraSQLGenerator;
+import org.apache.ws.jaxme.sqls.oracle.OraSQLGeneratorImpl;
+import org.apache.ws.jaxme.sqls.oracle.OraSelectStatement;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class Oracle8Test extends CreateTest {
+    /** <p>Creates a new instance of Oracle8Test.</p>
+     */
+    public Oracle8Test(String pName) {
+        super(pName);
+    }
+    
+    protected SQLFactory newSQLFactory() {
+        return new OraSQLFactoryImpl();
+    }
+    
+    protected SQLGenerator newSQLGenerator() {
+        OraSQLGenerator gen = new OraSQLGeneratorImpl();
+        gen.setOracle8Compatibility(true);
+        return gen;
+    }
+    
+    protected String getTestJoinResult() {
+        return "SELECT OtherTable.MyIndex, RefIndex, Company FROM MySchema.OtherTable, MySchema.MyTable WHERE RefIndex=MyTable.MyIndex AND OtherTable.MyIndex=?";
+    }
+    
+    protected String getTestLeftOuterJoinResult() {
+        return "SELECT OtherTable.MyIndex, RefIndex, Company FROM MySchema.OtherTable, MySchema.MyTable WHERE RefIndex=MyTable.MyIndex(+) AND OtherTable.MyIndex=?";
+    }
+
+    public void testConnectByPrior() {
+        Table table = getBasicTable();
+        OraSelectStatement selectStatement = (OraSelectStatement) table.getSelectStatement();
+        SelectTableReference ref = selectStatement.getSelectTableReference();
+        CombinedConstraint startWith = selectStatement.getStartWith();
+        BooleanConstraint bc = startWith.createEQ();
+        bc.addPart(ref.newColumnReference("MyIndex"));
+        bc.addPart(1);
+        CombinedConstraint connectByPrior = selectStatement.getConnectBy();
+        bc = connectByPrior.createEQ();
+        OraColumnReference oraRef = (OraColumnReference) ref.newColumnReference("MyIndex");
+        oraRef.setPrior(true);
+        bc.addPart(oraRef);
+        bc.addPart(ref.newColumnReference("MyName"));
+        SQLGenerator gen = getSQLGenerator();
+        String query = gen.getQuery(selectStatement);
+        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable START WITH MyIndex=1 CONNECT BY PRIOR MyIndex=MyName", query);
+    }
+
+    protected String getBulkInsertResult() {
+    	return "INSERT INTO MySchema.MyTable (MyTable.MyIndex, MyTable.MyName, MyTable.MyDate) (SELECT MyTable0.MyIndex, MyTable0.MyName, MyTable0.MyDate FROM MySchema.MyTable MyTable0)";
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReference.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReference.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReference.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.ColumnReference;
+
+
+/** An extension of {@link org.apache.ws.jaxme.sqls.ColumnReference}
+ * supporting the {@link #isPrior()} clause.
+ */
+public interface OraColumnReference extends ColumnReference {
+    /** Returns, whether the column reference has the
+     * PRIOR attribute set. This attribute is required for
+     * the CONNECT BY clause.
+     * @see org.apache.ws.jaxme.sqls.oracle.OraSelectStatement#getConnectBy()
+     * @see #setPrior(boolean)
+     */
+    public boolean isPrior();
+    /** Sets, whether the column reference has the
+     * PRIOR attribute set. This attribute is required for
+     * the CONNECT BY clause.
+     * @see org.apache.ws.jaxme.sqls.oracle.OraSelectStatement#getConnectBy()
+     * @see #isPrior()
+     */
+    public void setPrior(boolean pPrior);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReferenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReferenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraColumnReferenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.impl.ColumnReferenceImpl;
+
+
+/** Default implementation of {@link org.apache.ws.jaxme.sqls.oracle.OraColumnReference}.
+ */
+public class OraColumnReferenceImpl extends ColumnReferenceImpl
+        implements OraColumnReference {
+    private boolean prior;
+
+    OraColumnReferenceImpl(TableReference pTableReference, Column pColumn) {
+        super(pTableReference, pColumn);
+    }
+
+    public boolean isPrior() {
+        return prior;
+    }
+
+    public void setPrior(boolean pPrior) {
+        prior = pPrior;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraJoinReferenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraJoinReferenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraJoinReferenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.JoinReferenceImpl;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class OraJoinReferenceImpl extends JoinReferenceImpl {
+  private boolean isOracle8LeftOuterJoin;
+
+  protected OraJoinReferenceImpl(SelectTableReference pLeftTableReference, Table pRightTable, boolean pOuterJoin) {
+    super(pLeftTableReference, pRightTable, pOuterJoin);
+  }
+
+  public void setIsOracle8LeftOuterJoin(boolean pOracle8LeftOuterJoin) {
+    isOracle8LeftOuterJoin = pOracle8LeftOuterJoin;
+  }
+
+  public boolean isOracle8LeftOuterJoin() {
+    return isOracle8LeftOuterJoin;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraObjectFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraObjectFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraObjectFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.TableReference;
+import org.apache.ws.jaxme.sqls.impl.ObjectFactoryImpl;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class OraObjectFactoryImpl extends ObjectFactoryImpl {
+    public JoinReference newJoinReference(SelectTableReference pSelectTableReference,
+                                         Table pTable,
+                                         boolean pIsLeftOuterJoin) {
+    if (pIsLeftOuterJoin) {
+      return new OraJoinReferenceImpl(pSelectTableReference, pTable, pIsLeftOuterJoin);
+    } else {
+      return super.newJoinReference(pSelectTableReference, pTable, pIsLeftOuterJoin);
+    }
+  }
+    public ColumnReference newColumnReference(TableReference pTableReference, Column pColumn) {
+        return new OraColumnReferenceImpl(pTableReference, pColumn);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.SQLFactory;
+
+public interface OraSQLFactory extends SQLFactory {
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import java.sql.DatabaseMetaData;
+import java.sql.Types;
+
+import org.apache.ws.jaxme.sqls.BinaryColumn;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.StringColumn;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class OraSQLFactoryImpl extends SQLFactoryImpl implements OraSQLFactory {
+    public SQLGenerator newSQLGenerator() {
+        return new OraSQLGeneratorImpl();
+    }
+    
+    protected Column readColumn(Table pTable, String pColumnName, int pDataType, String pTypeName,
+            long pColumnSize, int pDecimalDigits, int pNullable) {
+        Column.Type type;
+        if ("NUMBER".equalsIgnoreCase(pTypeName)) {
+            pDataType = Types.NUMERIC;
+        }
+        switch (pDataType) {
+            case Types.BIGINT:        type = Column.Type.BIGINT;    break;
+            case Types.BINARY:        type = Column.Type.BINARY;    break;
+            case Types.BIT:           type = Column.Type.BIT;       break;
+            case Types.BLOB:          type = Column.Type.VARBINARY; break;
+            case 16: /* Types.BOOLEAN, introduced in Java 1.4 */
+                                      type = Column.Type.BIT;       break;
+            case Types.CHAR:          type = Column.Type.CHAR;      break;
+            case Types.CLOB:          type = Column.Type.VARCHAR;   break;
+            case Types.DATE:          type = Column.Type.DATE;      break;
+            case Types.DOUBLE:        type = Column.Type.DOUBLE;    break;
+            case Types.FLOAT:         type = Column.Type.FLOAT;     break;
+            case Types.INTEGER:       type = Column.Type.INTEGER;   break;
+            case Types.LONGVARBINARY: type = Column.Type.VARBINARY; break;
+            case Types.LONGVARCHAR:   type = Column.Type.VARCHAR;   break;
+            case Types.NUMERIC:
+                if (pDecimalDigits == 0) {
+                    if (pColumnSize == 0) {
+                        type = Column.Type.FLOAT;
+                    } else if (pColumnSize <= 2) {
+                        type = Column.Type.TINYINT;
+                    } else if (pColumnSize <= 4) {
+                        type = Column.Type.SMALLINT;
+                    } else if (pColumnSize <= 9) {
+                        type = Column.Type.INTEGER;
+                    } else {
+                        type = Column.Type.BIGINT;
+                    }
+                } else if (pDecimalDigits == -127) {
+                    // Uses binary precision - See page 4-37 of the OCI book
+                    if (pColumnSize < 24) {
+                        type = Column.Type.FLOAT;  // 53 is double cutoff
+                    } else {
+                        type = Column.Type.DOUBLE;
+                    }
+                } else {
+                    // Uses decimal precision - See page 4-37 of the OCI book
+                    if (pColumnSize < 8) {
+                        type = Column.Type.FLOAT;   // 15 is double cutoff
+                    } else {
+                        type = Column.Type.DOUBLE;
+                    }
+                }
+            break;
+            case Types.OTHER:
+                if ("CLOB".equalsIgnoreCase(pTypeName)) {
+                    type = Column.Type.CLOB;
+                } else {
+                    type = Column.Type.BLOB;
+                }
+            break;        
+            case Types.SMALLINT:      type = Column.Type.SMALLINT;  break;
+            case Types.TIMESTAMP:     type = Column.Type.TIMESTAMP; break;
+            case Types.TIME:          type = Column.Type.TIME;      break;
+            case Types.TINYINT:       type = Column.Type.TINYINT;   break;
+            case Types.VARBINARY:     type = Column.Type.VARBINARY; break;
+            case Types.VARCHAR:       type = Column.Type.VARCHAR;   break;
+            default: throw new IllegalArgumentException("Column " + pColumnName +
+                    " in table " + pTable.getQName() +
+                    " has unknown JDBC data type " +
+                    pDataType);
+        }
+        Column column = pTable.newColumn(pColumnName, type);
+        if (column instanceof StringColumn) {
+            ((StringColumn) column).setLength(pColumnSize);
+        } else if (column instanceof BinaryColumn) {
+            ((BinaryColumn) column).setLength(pColumnSize);
+        }
+        if (pNullable == DatabaseMetaData.columnNullable) {
+            column.setNullable(true);
+        }
+        return column;
+    }
+    
+    protected ObjectFactory newObjectFactory() {
+        return new OraObjectFactoryImpl();
+    }
+    
+    public SelectStatement newSelectStatement() {
+        return new OraSelectStatementImpl(this);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGenerator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGenerator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGenerator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.SQLGenerator;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface OraSQLGenerator extends SQLGenerator {
+  /** <p>Enables compatibility mode for Oracle 8.</p>
+   */
+  public void setOracle8Compatibility(boolean pOracle8Compatibility);
+
+  /** <p>Returns whether compatibility mode for Oracle 8 is enabled.</p>
+   */
+  public boolean isOracle8Compatibility();
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGeneratorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGeneratorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSQLGeneratorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.JoinReference;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.SelectTableReference;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+import org.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl;
+import org.apache.ws.jaxme.sqls.impl.StatementMetaData;
+
+
+/** Oracle specific extension of
+ * {@link org.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl}.
+ */
+public class OraSQLGeneratorImpl extends SQLGeneratorImpl implements OraSQLGenerator {
+    private boolean isOracle8Compatibility;
+    
+    protected boolean isTableAliasUsingAs() { return false; }
+    
+    /** <p>Enables compatibility mode for Oracle 8.</p>
+     */
+    public void setOracle8Compatibility(boolean pOracle8Compatibility) {
+        isOracle8Compatibility = pOracle8Compatibility;
+    }
+    
+    /** <p>Returns whether compatibility mode for Oracle 8 is enabled.</p>
+     */
+    public boolean isOracle8Compatibility() {
+        return isOracle8Compatibility;
+    }
+    
+    protected StatementMetaData newStatementMetaData(SelectStatement pQuery) {
+        return new OraStatementMetaData(pQuery);
+    }
+
+    protected StatementMetaData newStatementMetaData(DeleteStatement pQuery) {
+        return new OraStatementMetaData(pQuery);
+    }
+
+    protected StatementMetaData newStatementMetaData(UpdateStatement pQuery, ColumnReference[] pColumns) {
+        return new OraStatementMetaData(pQuery, pColumns);
+    }
+
+    protected StatementMetaData newStatementMetaData(InsertStatement pQuery, ColumnReference[] pColumns) {
+        return new OraStatementMetaData(pQuery, pColumns);
+    }
+
+    protected String getSelectQueryFromClause(SelectStatement pQuery, StatementMetaData pData) {
+        if (isOracle8Compatibility()) {
+            SelectTableReference tableReference = pQuery.getSelectTableReference();
+            if (tableReference == null) {
+                return super.getSelectQueryFromClause(pQuery, pData);
+            }
+            StringBuffer sb = new StringBuffer(" FROM ");
+            sb.append(getTableAlias(pData, tableReference));
+            for (JoinReference joinReference = tableReference.getRightJoinedTableReference();
+            	 joinReference != null;
+            	 joinReference = joinReference.getRightJoinedTableReference()) {
+                sb.append(", ");
+                sb.append(getTableAlias(pData, joinReference));
+            }
+            return sb.toString();
+        } else {
+            return super.getSelectQueryFromClause(pQuery, pData);
+        }
+    }
+
+    protected String getSelectQueryConstraints(SelectStatement pQuery, StatementMetaData pData,
+                                               StatementMetaData.LocalData pLocalData) {
+        String result;
+        if (isOracle8Compatibility()) {
+            SelectTableReference tableReference = pQuery.getSelectTableReference();
+            if (tableReference == null) {
+                result = super.getSelectQuery(pQuery, pData);
+            } else {
+	            StringBuffer sb = new StringBuffer();
+                for (JoinReference joinReference = tableReference.getRightJoinedTableReference();
+           	 		 joinReference != null;
+           	 		 joinReference = joinReference.getRightJoinedTableReference()) {
+	                OraJoinReferenceImpl oraJoin = null;
+	                if (joinReference instanceof OraJoinReferenceImpl) {
+	                    oraJoin = (OraJoinReferenceImpl) joinReference;
+	                }
+	                String onClause;
+	                if (oraJoin == null) {
+	                    onClause = getWhereClause(pData, joinReference.getOn());
+	                } else {
+	                    oraJoin.setIsOracle8LeftOuterJoin(true);
+	                    onClause = getWhereClause(pData, joinReference.getOn());
+	                    oraJoin.setIsOracle8LeftOuterJoin(false);
+	                }
+	                if (onClause != null  &&  onClause.length() > 0) {
+                        if (pLocalData.hasWhereClause()) {
+                            sb.append(" AND ");
+                        } else {
+                        	pLocalData.setWhereClause(true);
+                        }
+		                sb.append(onClause);
+	                }
+	            }
+	            String whereClause = getWhereClause(pData, pQuery.getWhere());
+	            if (whereClause != null  &&  whereClause.length() > 0) {
+                    if (pLocalData.hasWhereClause()) {
+                        sb.append(" AND ");
+                    } else {
+                        pLocalData.setWhereClause(true);
+                    }
+	                sb.append(whereClause);
+	            }
+	            result = sb.toString();
+            }
+        } else {
+            result = super.getSelectQueryConstraints(pQuery, pData, pLocalData);
+        }
+
+        if (pQuery instanceof OraSelectStatement) {
+            OraSelectStatement oraStatement = (OraSelectStatement) pQuery;
+            String s = getWhereClause(pData, oraStatement.getStartWith());
+            if (s != null  &&  s.length() > 0) {
+                result += " START WITH " + s;
+            }
+            s = getWhereClause(pData, oraStatement.getConnectBy());
+            if (s != null  &&  s.length() > 0) {
+                result += " CONNECT BY " + s;
+            }
+        }
+
+        return result;
+    }
+
+    protected String getColumnAlias(StatementMetaData pData, ColumnReference pColumn) {
+        String s = super.getColumnAlias(pData, pColumn);
+        if (pColumn.getTableReference() instanceof OraJoinReferenceImpl) {
+            OraJoinReferenceImpl oraJoin = (OraJoinReferenceImpl) pColumn.getTableReference();
+            if (oraJoin.isOracle8LeftOuterJoin()) {
+                s = s + "(+)";
+            }
+        }
+        if (pColumn instanceof OraColumnReference) {
+            OraColumnReference oraRef = (OraColumnReference) pColumn;
+            if (oraRef.isPrior()) {
+                s = "PRIOR " + s;
+            }
+        }
+        return s;
+    }
+
+    protected String getOrderColumn(StatementMetaData pData, SelectStatement.OrderColumn pColumn) {
+        String s = super.getOrderColumn(pData, pColumn);
+        if (pColumn instanceof OraSelectStatement.OraOrderColumn) {
+            OraSelectStatement.OraOrderColumn ooc = (OraSelectStatement.OraOrderColumn) pColumn;
+            if (ooc.isNullsFirst()) {
+                s += " NULLS FIRST";
+            }
+        }
+        return s;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+
+
+/** Oracle specific interface of {@link org.apache.ws.jaxme.sqls.SelectStatement}.
+ */
+public interface OraSelectStatement extends SelectStatement {
+    /** An extension of {@link SelectStatement} with the
+     * ability to specify, whether NULL comes first or last.
+     */
+    public interface OraOrderColumn extends OrderColumn {
+        /** Returns, whether nulls should appear first or last.
+         */
+        public boolean isNullsFirst();
+    }
+    /** Implements the <code>START WITH</code> part of a
+     * <code>START WITH ... CONNECT BY PRIOR ...</code> clause.
+     * @see #getConnectBy()
+     */
+    public CombinedConstraint getStartWith();
+
+    /** Implements the <code>CONNECT BY PRIOR</code> part of a
+     * <code>START WITH ... CONNECT BY PRIOR ...</code> clause.
+     * @see #getStartWith()
+     */
+    public CombinedConstraint getConnectBy();
+
+    /** Adds the given order column with the given values for
+     * {@link org.apache.ws.jaxme.sqls.SelectStatement.OrderColumn#isDescending()}
+     * and
+     * {@link OraSelectStatement.OraOrderColumn#isNullsFirst()}.
+     */
+    public void addOrderColumn(Object pObject, boolean pDescending, boolean pNullsFirst);
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraSelectStatementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.CombinedConstraint;
+import org.apache.ws.jaxme.sqls.ObjectFactory;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.impl.SelectStatementImpl;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class OraSelectStatementImpl extends SelectStatementImpl
+        implements OraSelectStatement {
+    /** Default implementation of
+     * {@link OraSelectStatement.OraOrderColumn}.
+     */
+    public static class OraOrderColumnImpl extends OrderColumnImpl
+            implements OraOrderColumn {
+        private final boolean nullsFirst;
+        /** Creates a new instance with the given values for
+         * {@link org.apache.ws.jaxme.sqls.SelectStatement.OrderColumn#getColumn()},
+         * {@link org.apache.ws.jaxme.sqls.SelectStatement.OrderColumn#isDescending()},
+         * and
+         * {@link OraSelectStatement.OraOrderColumn#isNullsFirst()}.
+         */
+        public OraOrderColumnImpl(Object pObject, boolean pDescending,
+                                  boolean pNullsFirst) {
+            super(pObject, pDescending);
+            nullsFirst = pNullsFirst;
+        }
+        public boolean isNullsFirst() { return nullsFirst; }
+    }
+    private CombinedConstraint startWith, connectByPrior;
+    
+    /** Creates a new instance with the given object factory.
+     */
+    public OraSelectStatementImpl(SQLFactory pFactory) {
+        super(pFactory);
+    }
+
+	public CombinedConstraint getStartWith() {
+	    if (startWith == null) {
+	        ObjectFactory f = getSQLFactory().getObjectFactory();
+	        startWith = f.newCombinedConstraint(this, CombinedConstraint.Type.AND);
+	    }
+	    return startWith;
+	}
+
+	public CombinedConstraint getConnectBy() {
+	    if (connectByPrior == null) {
+	        ObjectFactory f = getSQLFactory().getObjectFactory();
+	        connectByPrior = f.newCombinedConstraint(this, CombinedConstraint.Type.AND);
+	    }
+	    return connectByPrior;
+	}
+
+    /* (non-Javadoc)
+     * @see org.apache.ws.jaxme.sqls.oracle.OraSelectStatement#addOrderColumn(java.lang.Object, boolean, boolean)
+     */
+    public void addOrderColumn(Object pObject, boolean pDescending, boolean pNullsFirst) {
+        OraOrderColumn ooc = new OraOrderColumnImpl(pObject, pDescending, pNullsFirst);
+        super.addOrderColumn(ooc);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraStatementMetaData.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraStatementMetaData.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/OraStatementMetaData.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.sqls.oracle;
+
+import org.apache.ws.jaxme.sqls.ColumnReference;
+import org.apache.ws.jaxme.sqls.DeleteStatement;
+import org.apache.ws.jaxme.sqls.InsertStatement;
+import org.apache.ws.jaxme.sqls.SelectStatement;
+import org.apache.ws.jaxme.sqls.UpdateStatement;
+import org.apache.ws.jaxme.sqls.impl.StatementMetaData;
+
+
+/** <p>Oracle specific version of {@link StatementMetaData}.</p>
+ */
+public class OraStatementMetaData extends StatementMetaData {
+	/** <p>Creates new meta data for the given
+     * {@link org.apache.ws.jaxme.sqls.SelectStatement}.</p>
+     */
+    public OraStatementMetaData(SelectStatement pQuery) {
+        super(pQuery);
+    }
+
+    /** <p>Creates new meta data for the given
+     * {@link org.apache.ws.jaxme.sqls.DeleteStatement}.</p>
+     */
+    public OraStatementMetaData(DeleteStatement pQuery) {
+        super(pQuery);
+    }
+
+    /** <p>Creates new meta data for the given
+     * {@link org.apache.ws.jaxme.sqls.InsertStatement}.</p>
+     */
+    public OraStatementMetaData(InsertStatement pQuery, ColumnReference[] pColumns) {
+        super(pQuery, pColumns);
+    }
+
+    /** <p>Creates new meta data for the given
+     * {@link org.apache.ws.jaxme.sqls.UpdateStatement}.</p>
+     */
+    public OraStatementMetaData(UpdateStatement pQuery, ColumnReference[] pColumns) {
+        super(pQuery, pColumns);
+    }
+
+    protected void addSelectStatement(SelectStatement pQuery) {
+        super.addSelectStatement(pQuery);
+        if (pQuery instanceof OraSelectStatement) {
+            OraSelectStatement oQuery = (OraSelectStatement) pQuery;
+            addCombinedConstraint(oQuery.getStartWith());
+            addCombinedConstraint(oQuery.getConnectBy());
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/oracle/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+<html>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<head><title>DB2 support for the SQL generator</title></head>
+<body>
+<h1>Oracle support for the SQL generator</h1>
+<p>This package contains some classes and interfaces enhancing the
+SQL generator with Oracle specific features. In particular, these classes
+are able to work with Oracle's strange metadata.</p>
+<p>The DB2 support works by instantiating a different
+{@link org.apache.ws.jaxme.sqls.SQLFactory}: By default, you would enable
+{@link org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl}. However, for Oracle
+support you would choose {@link org.apache.ws.jaxme.sqls.oracle.OraSQLFactoryImpl},
+which is a subclass of the default factory.</p>
+<p>Likewise, you need to replace the default implementation of the SQL generator,
+{@link org.apache.ws.jaxme.sqls.SQLGenerator} with
+{@link org.apache.ws.jaxme.sqls.oracle.OraSQLGeneratorImpl}
+
+<p>The difference between the factories is as follows: When using the
+DB2 factory, you may cast your instances of
+{@link org.apache.ws.jaxme.sqls.SQLFactory},
+{@link org.apache.ws.jaxme.sqls.Schema},
+{@link org.apache.ws.jaxme.sqls.Table}, and
+{@link org.apache.ws.jaxme.sqls.Column} to
+{@link org.apache.ws.jaxme.sqls.db2.DB2SQLFactory},
+{@link org.apache.ws.jaxme.sqls.db2.DB2Schema},
+{@link org.apache.ws.jaxme.sqls.db2.DB2Table}, and
+{@link org.apache.ws.jaxme.sqls.db2.DB2Column}, respectively, and use the
+additional methods.</p>
+
+</body></html>

Added: branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/js/org/apache/ws/jaxme/sqls/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.sqls Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains the generic framework for SQL generators.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/overview.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/overview.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/overview.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+<head>
+<title>Overview Documentation for JaxMe</title>
+</head>
+<body bgcolor="white">
+    <p> 
+JaxMe 2 is an open source implementation of
+<link href="site:jaxb"><code>JAXB</code></link>, the specification for
+Java/XML binding.
+</p>
+    <p>
+JaxMe contains the following components:
+</p>
+    <ul>
+        <li>
+<a href='http://ws.apache.org/jaxme/api/index.html'>JaxMeAPI</a>
+is a clean room implementation of the JAXB API
+    </li>
+        <li>
+<a href='http://ws.apache.org/jaxme/js/index.html'>JaxMeJS</a>
+is the JaxMe java source generation framework
+    </li>
+        <li>
+<a href='http://ws.apache.org/jaxme/xs/index.html'>JaxMeXS</a>
+is the JaxMe parser for XML schema.
+    </li>
+        <li>
+<a href='http://ws.apache.org/jaxme/pm/index.html'>JaxMePM</a>
+is the JaxMe persistence management framework
+    </li>        
+</ul>
+
+
+    <p>
+See the
+<a href="http://ws.apache.org/jaxme/index.html">JaxMe home page</a> for more details
+</p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,333 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+ 
+package org.apache.ws.jaxme.generator.ino.api4j;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.ws.jaxme.JMElement;
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.AttributeSGChain;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSGChain;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.SchemaSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.AttributeSGImpl;
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.ObjectSGChainImpl;
+import org.apache.ws.jaxme.generator.sg.impl.SGFactoryChainImpl;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.pm.ino.InoObject;
+import org.apache.ws.jaxme.pm.ino.InoResponseHandler;
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBAttribute;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBType;
+import org.apache.ws.jaxme.xs.parser.XsObjectCreator;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TaminoAPI4JSG extends SGFactoryChainImpl {
+    public static final String TAMINOAPI4J_SCHEMA_URI = "http://ws.apache.org/jaxme/namespaces/jaxme2/TaminoAPI4J";
+    private static final JavaQName INO_OBJECT_TYPE = JavaQNameImpl.getInstance(InoObject.class);
+    private static final JavaQName JMELEMENT_TYPE = JavaQNameImpl.getInstance(JMElement.class);
+
+    public abstract class InoDetails extends XsObjectImpl {
+        private String collection;
+        InoDetails(XsObject pParent) {
+            super(pParent);
+        }
+        public void setCollection(String pCollection) {
+            collection = pCollection;
+        }
+        public String getCollection() {
+            String p = "taminoapi4j.collection";
+            return sgFactory.getGenerator().getProperty(p, collection);
+        }
+    }
+
+    public class DbDetails extends InoDetails {
+    	private String url, user, password;
+    	DbDetails(XsObject pParent) {
+    		super(pParent);
+    	}
+        public void setUrl(String pUrl) {
+            url = pUrl;
+        }
+        public String getUrl() {
+            String p = "taminoapi4j.url";
+            return sgFactory.getGenerator().getProperty(p, url);
+        }
+        public void setUser(String pUser) {
+            user = pUser;
+        }
+        public String getUser() {
+            String p = "taminoapi4j.user";
+            return sgFactory.getGenerator().getProperty(p, user);
+        }
+        public void setPassword(String pPassword) {
+            password = pPassword;
+        }
+        public String getPassword() {
+            String p = "taminoapi4j.password";
+            return sgFactory.getGenerator().getProperty(p, password);
+        }
+    }
+
+    public class RaDetails extends InoDetails {
+        private String jndiReference;
+        RaDetails(XsObject pParent) {
+            super(pParent);
+        }
+        public void setJndiReference(String pReference) {
+            jndiReference = pReference;
+        }
+        public String getJndiReference() {
+            String p = "taminoapi4j.jndiReference";
+            return sgFactory.getGenerator().getProperty(p, jndiReference);
+        }
+    }
+
+    private RaDetails raDetails;
+    private DbDetails dbDetails;
+    private SGFactory sgFactory;
+
+    public TaminoAPI4JSG(SGFactoryChain o) {
+        super(o);
+    }
+
+    public void setRaDetails(RaDetails pDetails) throws SAXException {
+        raDetails = pDetails;
+    }
+    public RaDetails getRaDetails() {
+        return raDetails;
+    }
+
+    public void setDbDetails(DbDetails pDetails) {
+        dbDetails = pDetails;
+    }
+    public DbDetails getDbDetails() {
+        return dbDetails;
+    }
+
+    public void init(SGFactory pFactory) {
+        super.init(pFactory);
+        sgFactory = pFactory;
+        SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
+        if (schemaReader instanceof JaxMeSchemaReader) {
+            JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
+            jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
+                public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
+                	if (pParent instanceof JAXBGlobalBindings) {
+                        if (TAMINOAPI4J_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
+                            if ("raDetails".equals(pQName.getLocalName())) {
+                                if (getRaDetails() != null) {
+                                    throw new LocSAXException("An element named " + pQName + " has already been specified.",
+                                            				  pLocator);
+                                }
+                                if (getDbDetails() != null) {
+                                    throw new LocSAXException("The elements dbDetails and raDetails are mutually exclusive.",
+                                            				  pLocator);
+                                }
+                                RaDetails details = new RaDetails(pParent);
+                                setRaDetails(details);
+                                return details;
+                            } else if ("dbDetails".equals(pQName.getLocalName())) {
+                            	if (getDbDetails() != null) {
+                            		throw new LocSAXException("An element named " + pQName + " has already been specified.",
+                            				pLocator);
+                            	}
+                            	if (getRaDetails() != null) {
+                                    throw new LocSAXException("The elements dbDetails and raDetails are mutually exclusive.",
+                                            				  pLocator);
+                                }
+                            	DbDetails details = new DbDetails(pParent);
+                            	setDbDetails(details);
+                            	return details;
+                            } else {
+                                throw new LocSAXException("Invalid element name: " + pQName, pLocator);
+                            }
+                        }
+                    }
+                    return null;
+                }
+            });
+        } else {
+            throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
+                    " is not an instance of " + JaxMeSchemaReader.class.getName());
+        }
+    }
+
+    public Object newSchemaSG(SGFactory pController, XSSchema pSchema) throws SAXException {
+        SchemaSGChain chain = (SchemaSGChain) super.newSchemaSG(pController, pSchema);
+        chain = new TaminoAPI4JSchemaSG(chain, this);
+        return chain;
+    }
+
+    private class InoJAXBProperty implements JAXBProperty {
+        private final String name;
+        public InoJAXBProperty(String pName) {
+            name = pName;
+        }
+        public String getName() { return name; }
+        public String getCollectionType() { return null; }
+        public Boolean isFixedAttributeAsConstantProperty() { return null; }
+        public Boolean isGenerateIsSetMethod() { return null; }
+        public Boolean isEnableFailFastCheck() { return null; }
+        public JAXBJavadoc getJavadoc() { return null; }
+        public BaseType getBaseType() { return null; }
+        public XsESchema getXsESchema() { return null; }
+        public boolean isTopLevelObject() { return false; }
+        public XsObject getParentObject() { return null; }
+        public XsObjectFactory getObjectFactory() { return null; }
+        public Locator getLocator() { return null; }
+        public void validate() throws SAXException {
+        }
+    }
+
+    private class InoAttribute implements JAXBAttribute {
+        private final XsQName qName;
+        private final XSType type;
+        private final XSType parent;
+        private final JAXBProperty jaxbProperty;
+
+        public InoAttribute(XSType pParent, XsQName pName, XSType pType, String pPropertyName) {
+            qName = pName;
+            type = pType;
+            parent = pParent;
+            jaxbProperty = new InoJAXBProperty(pPropertyName);
+        }
+        public boolean isGlobal() { return true; }
+        public XsQName getName() { return qName; }
+        public XSType getType() { return type; }
+        public boolean isOptional() { return true; }
+        public XSAnnotation[] getAnnotations() { return new XSAnnotation[0]; }
+        public String getDefault() { return null; }
+        public String getFixed() { return null; }
+        public Attributes getOpenAttributes() { return new AttributesImpl(); }
+        public XSSchema getXSSchema() { return parent.getXSSchema(); }
+        public boolean isTopLevelObject() { return true; }
+        public XSObject getParentObject() { return null; }
+        public Locator getLocator() { return parent.getLocator(); }
+        public void validate() throws SAXException {
+        }
+        public JAXBSchemaBindings getJAXBSchemaBindings() {
+            return ((JAXBType) parent).getJAXBSchemaBindings();
+        }
+        public JAXBProperty getJAXBProperty() {
+            return jaxbProperty;
+        }
+    }
+
+    protected void addAttribute(TypeSG pComplexTypeSG, XSType pParent,
+								XsQName pName, XSType pType, String pPropertyName)
+    		throws SAXException {
+        AttributeSG[] attrs = pComplexTypeSG.getComplexTypeSG().getAttributes();
+        for (int i = 0;  i < attrs.length;  i++) {
+            AttributeSG attr = attrs[i];
+            if (attr.isWildcard()) {
+                continue;
+            }
+			XsQName qName = attr.getName();
+			if (qName.equals(pName)) {
+			    return;
+            }
+        }
+
+        XSAttribute attribute = new InoAttribute(pParent, pName, pType, pPropertyName);
+        AttributeSGChain chain = (AttributeSGChain) pComplexTypeSG.getComplexTypeSG().newAttributeSG(attribute);
+        AttributeSG attributeSG = new AttributeSGImpl(chain);
+        pComplexTypeSG.getComplexTypeSG().addAttributeSG(attributeSG);
+    }
+
+    public Object newObjectSG(SGFactory pFactory, XSElement pElement) throws SAXException {
+        ObjectSGChain chain = (ObjectSGChain) super.newObjectSG(pFactory, pElement);
+        chain = new ObjectSGChainImpl(chain){
+            public JavaSource getXMLImplementation(ObjectSG pController) throws SAXException {
+                JavaSource result = super.getXMLImplementation(pController);
+                if (result == null) {
+                	return null;
+                }
+                JavaQName[] interfaces = result.getImplements();
+                boolean done = false;
+                result.clearImplements();
+                for (int i = 0;  i < interfaces.length;  i++) {
+                    JavaQName interfaceName = interfaces[i];
+                    if (interfaceName.equals(JMELEMENT_TYPE)  ||
+                        interfaceName.equals(INO_OBJECT_TYPE)) {
+                        if (!done) {
+                            result.addImplements(INO_OBJECT_TYPE);
+                            done = true;
+                        } 
+                    } else {
+                        result.addImplements(interfaceName);
+                    }
+                }
+                if (!done) {
+                    result.addImplements(INO_OBJECT_TYPE);
+                } 
+                return result;
+            }
+        };
+        return chain;
+    }
+
+    private Set elementNames = new HashSet();
+    public ObjectSG getObjectSG(SGFactory pFactory, XSElement pElement) throws SAXException {
+        ObjectSG result = super.getObjectSG(pFactory, pElement);
+        if (result.getTypeSG().isComplex()) {
+	        XsQName elementName = pElement.getName();
+	        if (!elementNames.contains(elementName)) {
+	            elementNames.add(elementName);
+		        // Does the element have an ino:id attribute? If not, create it
+		        XsQName qName = new XsQName(InoResponseHandler.INO_RESPONSE2_URI, "id", "ino");
+		        XSType stringType = XSString.getInstance();
+		        addAttribute(result.getTypeSG(), pElement.getType(), qName, stringType, "inoId");
+		        // Does the element have an ino:docname attribute? If not, create it
+		        qName = new XsQName(InoResponseHandler.INO_RESPONSE2_URI, "docname", "ino");
+		        addAttribute(result.getTypeSG(), pElement.getType(), qName, stringType, "inoDocname");
+	        }
+        }
+        return result;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/TaminoAPI4JSchemaSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.jaxme.generator.ino.api4j;
+
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.SchemaSGChainImpl;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JDbPm;
+import org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JRaPm;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TaminoAPI4JSchemaSG extends SchemaSGChainImpl {
+    private final TaminoAPI4JSG baseSG;
+
+    /** Creates a new instance with the given backing chains.
+     */
+    public TaminoAPI4JSchemaSG(SchemaSGChain pChain, TaminoAPI4JSG pBaseSG) {
+        super(pChain);
+        baseSG = pBaseSG;
+    }
+
+    protected TaminoAPI4JSG getBaseSG() {
+        return baseSG;
+    }
+
+    private Element createProperty(Element pParent, String pName, String pValue) {
+        Element element = pParent.getOwnerDocument().createElementNS(JAXBContextImpl.CONFIGURATION_URI, "Property");
+        pParent.appendChild(element);
+        element.setAttributeNS(null, "name", pName);
+        element.setAttributeNS(null, "value", pValue);
+        return element;
+    }
+
+    public Document getConfigFile(SchemaSG pController, String pPackageName,
+								  List pContextList) throws SAXException {
+        final String uri = JAXBContextImpl.CONFIGURATION_URI;
+        final Document doc = super.getConfigFile(pController, pPackageName, pContextList);
+        final Element root = doc.getDocumentElement();
+        final Iterator iter = pContextList.iterator();
+        TaminoAPI4JSG.RaDetails raDetails = baseSG.getRaDetails();
+        TaminoAPI4JSG.DbDetails dbDetails = baseSG.getDbDetails();
+        for (Node node = root.getFirstChild();  node != null;  node = node.getNextSibling()) {
+            if (node.getNodeType() == Node.ELEMENT_NODE
+                    &&  JAXBContextImpl.CONFIGURATION_URI.equals(node.getNamespaceURI())
+                    &&  "Manager".equals(node.getLocalName())) {
+                Element manager = (Element) node;
+                final ObjectSG objectSG = (ObjectSG) iter.next();
+                final TypeSG typeSG = objectSG.getTypeSG();
+                if (!typeSG.isComplex()) {
+                	continue;
+                }
+
+                final Class managerClass;
+                if (raDetails != null) {
+                    String collection = raDetails.getCollection();
+                    if (collection != null  &&  collection.length() > 0) {
+                        createProperty(manager, "collection", collection);
+                    }
+                    String jndiRef = raDetails.getJndiReference();
+                    if (jndiRef != null  &&  jndiRef.length() > 0) {
+                        createProperty(manager, "jndiReference", jndiRef);
+                    }
+                    managerClass = TaminoAPI4JRaPm.class;
+                } else if (dbDetails != null) {
+                	String collection = dbDetails.getCollection();
+                    if (collection != null  &&  collection.length() > 0) {
+                        createProperty(manager, "collection", collection);
+                    }
+                    String url = dbDetails.getUrl();
+                    if (url != null  &&  url.length() > 0) {
+                        createProperty(manager, "url", url);
+                    }
+                    String user = dbDetails.getUser();
+                    if (user != null  &&  user.length() > 0) {
+                        createProperty(manager, "user", user);
+                    }
+                    String password = dbDetails.getPassword();
+                    if (password != null  &&  password.length() > 0) {
+                        createProperty(manager, "password", password);
+                    }
+                    managerClass = TaminoAPI4JDbPm.class;
+                } else {
+                	managerClass = null;
+                }
+                if (managerClass != null) {
+                    manager.setAttributeNS(uri, "pmClass", managerClass.getName());
+                }
+            }
+        }
+        if (iter.hasNext()) {
+            throw new IllegalStateException("More managers expected than found");
+        }
+        return doc;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/generator/ino/api4j/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.generator.ino.api4j Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Generates JAXB source persisted by Tamino.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/ConnectionDetails.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/ConnectionDetails.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/ConnectionDetails.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG.Mode;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ConnectionDetails extends XsObjectImpl {
+  private final JaxMeJdbcSG jdbcSG;
+  protected ConnectionDetails(JaxMeJdbcSG pJdbcSG, XsObject pParent) {
+    super(pParent);
+    this.jdbcSG = pJdbcSG;
+  }
+
+  private Mode mode;
+  private String driver, url, user, password, datasource;
+  private Boolean usingDatasource;
+  /** Sets the JDBC driver.
+   */
+  public void setDriver(String pDriver) { driver = pDriver; }
+  /** Returns the JDBC driver.
+   */
+  public String getDriver() {
+    return this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.driver", driver);
+  }
+  /** Sets the JDBC URL.
+   */
+  public void setUrl(String pUrl) { url = pUrl; }
+  /** Returns the JDBC URL.
+   */
+  public String getUrl() {
+    return this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.url", url);
+  }
+  /** Sets the JDBC user.
+   */
+  public void setUser(String pUser) { user = pUser; }
+  /** Returns the JDBC user.
+   */
+  public String getUser() {
+    return this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.user", user);
+  }
+  /** Sets the JDBC password.
+   */
+  public void setPassword(String pPassword) { password = pPassword; }
+  /** Returns the JDBC password.
+   */
+  public String getPassword() {
+    return this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.password", password);
+  }
+  /** Sets the JDBC datasource.
+   * @see #setUsingDatasource(Boolean)
+   */
+  public void setDatasource(String pDatasource) { datasource = pDatasource; }
+  /** Returns the JDBC datasource.
+   * @see #isUsingDatasource()
+   */
+  public String getDatasource() {
+    return this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.datasource", datasource);
+  }
+  /** Sets, whether a JDBC datasource is being used. By default
+   * the JDBC driver and URL are used.
+   */
+  public void setUsingDatasource(Boolean pUsingDatasource) {
+    usingDatasource = pUsingDatasource;
+  }
+  /** Returns, whether a JDBC datasource is being used. By default
+   * the JDBC driver and URL are used.
+   */
+  public Boolean isUsingDatasource() {
+    String s = this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.usingDatasource");
+    return s == null ? usingDatasource : Boolean.valueOf(s);
+  }
+  /** Sets the database mode. Must be either of
+   * {@link org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG.Mode#GENERIC}
+   * (default), or
+   * {@link org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG.Mode#ORACLE}.
+   */
+  public void setDbMode(String pMode) {
+    mode = Mode.valueOf(pMode);
+  }
+  /** Returns the database mode. Either of
+   * {@link org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG.Mode#GENERIC}
+   * (default), or
+   * {@link org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG.Mode#ORACLE}.
+   */
+  public Mode getDbMode() {
+    String s = this.jdbcSG.getSGFactory().getGenerator().getProperty("jdbc.dbMode");
+    return s == null ? mode : Mode.valueOf(s);
+  }
+  /** Copies the given details into the current.
+   */
+  public void cloneFrom(ConnectionDetails pFrom) {
+    mode = pFrom.mode;
+    driver = pFrom.driver;
+    url = pFrom.url;
+    user = pFrom.user;
+    password = pFrom.password;
+    datasource = pFrom.datasource;
+    usingDatasource = pFrom.usingDatasource;
+  }
+
+  public void validate() throws SAXException {
+    boolean driverIsSet = driver != null  &&  driver.length() > 0;
+    boolean datasourceIsSet = datasource != null  &&  datasource.length() > 0;
+    if (driverIsSet) {
+      if (!datasourceIsSet) {
+        throw new LocSAXException("Either of the 'driver' or 'datasource' attributes must be set.", getLocator());
+      }
+      if (url == null  &&  url.length() == 0) {
+        throw new LocSAXException("Missing attribute: 'url'", getLocator());
+      }
+    } else {
+    }
+    if (driverIsSet  &&  datasourceIsSet) {
+      throw new LocSAXException("The 'driver' and 'datasource' attributes are mutually exclusive.", getLocator());
+    }
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomColumnData.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomColumnData.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomColumnData.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class CustomColumnData {
+  private final String name;
+  private final Object sg;
+  /** Creates a new instance with the given name, which is
+   * attached to the given <code>pSG</code>.
+   */
+  public CustomColumnData(String pName, Object pSG) {
+    name = pName;
+    sg = pSG;
+  }
+  /** Returns the custom column datas name.
+   */
+  public String getName() { return name; }
+  /** Returns the custom column datas attached object.
+   */
+  public Object getSG() { return sg; }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomTableData.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomTableData.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/CustomTableData.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.sqls.Table;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class CustomTableData {
+  private final Table table;
+  private final TableDetails tableDetails;
+  private final ComplexTypeSG typeSG;
+  /** Creates a new instance-
+   * @param pJdbcSG The source generator creating this instance.
+   * @param pTable The table, which is currently read by the source generator.
+   * @param pTypeSG The complex type being generated.
+   * @param pTableDetails The connection details.
+   */
+  public CustomTableData(JaxMeJdbcSG pJdbcSG, Table pTable, ComplexTypeSG pTypeSG, TableDetails pTableDetails) {
+    table = pTable;
+    typeSG = pTypeSG;
+    tableDetails = pTableDetails;
+  }
+  /** Returns the table, which is currently being read.
+   */
+  public Table getTable() { return table; }
+  /** Returns the type, which is being generated.
+   */
+  public ComplexTypeSG getTypeSG() { return typeSG; }
+  /** Returns the connection details.
+   */
+  public TableDetails getTableDetails() { return tableDetails; }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JaxMeJdbcSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JaxMeJdbcSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JaxMeJdbcSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,564 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.NamingException;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.AttributeSGChain;
+import org.apache.ws.jaxme.generator.sg.ComplexContentSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.GroupSG;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.SGFactory;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.SchemaSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSGChain;
+import org.apache.ws.jaxme.generator.sg.impl.AttributeSGImpl;
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.SGFactoryChainImpl;
+import org.apache.ws.jaxme.logging.Logger;
+import org.apache.ws.jaxme.logging.LoggerAccess;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.SQLFactory;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl;
+import org.apache.ws.jaxme.util.ClassLoader;
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.XsObjectCreator;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.types.XSBase64Binary;
+import org.apache.ws.jaxme.xs.types.XSBoolean;
+import org.apache.ws.jaxme.xs.types.XSByte;
+import org.apache.ws.jaxme.xs.types.XSDate;
+import org.apache.ws.jaxme.xs.types.XSDateTime;
+import org.apache.ws.jaxme.xs.types.XSDouble;
+import org.apache.ws.jaxme.xs.types.XSFloat;
+import org.apache.ws.jaxme.xs.types.XSInt;
+import org.apache.ws.jaxme.xs.types.XSShort;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.types.XSTime;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>A schema writer for creation of an object relational
+ * mapping.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JaxMeJdbcSG extends SGFactoryChainImpl {
+  Logger log = LoggerAccess.getLogger(JaxMeJdbcSG.class);
+
+  /** A database mode specifies, how JDBC metadata is
+   * being interpreted. The main use is for Oracle, which
+   * has a rather peculiar understanding of JDBC metadata.
+   */
+  public static class Mode {
+    private String name;
+    private Mode(String pName) { name = pName; }
+    public String toString() { return name; }
+    /** Returns the modes name.
+     */
+    public String getName() { return name; }
+    public int hashCode() { return name.hashCode(); }
+    public boolean equals(Object o) {
+      if (o == null  ||  !(o instanceof Mode)) {
+        return false;
+      } else {
+        return name.equals(((Mode) o).name);
+      }
+    }
+    /** Returns an instance of <code>Mode</code> with
+     * the given name.
+     * @throws IllegalArgumentException The mode name is invalid.
+     */
+    public static Mode valueOf(String pMode) {
+      if ("GENERIC".equalsIgnoreCase(pMode)) {
+        return GENERIC;
+      } else if ("ORACLE".equalsIgnoreCase(pMode)) {
+        return ORACLE;
+      } else {
+        throw new IllegalArgumentException("Valid database modes are either of 'generic' or 'oracle', not " + pMode);
+      }
+    }
+
+    /** <p>Default database mode; types are taken as reported by the JDBC
+     * driver.</p>
+     */
+    public static final Mode GENERIC = new Mode("Generic");
+    /** <p>Oracle database mode; the type NUMERIC is interpreted as FLOAT,
+     * TINYINT, SMALLINT, INTEGER, BIGINT, or DOUBLE, depending on scale
+     * and precision. This mode is turned on by setting the option
+     * <code>jdbc.dbmode</code> or if the method
+     * {@link java.sql.DatabaseMetaData#getDatabaseProductName()}
+     * returns the value "Oracle".</p>
+     */
+    public static final Mode ORACLE = new Mode("Oracle");
+  }
+
+  private class JdbcAttribute implements XSAttribute {
+    private final Locator locator;
+    private final XsQName name;
+    private final XSType type;
+    private final boolean isOptional;
+    private final XSObject parent;
+
+    /** An attribute, which matches a database column.
+     */
+    public JdbcAttribute(XSObject pParent, Locator pLocator, XsQName pName, XSType pType, boolean pOptional) {
+      parent = pParent;
+      locator = pLocator;
+      name = pName;
+      type = pType;
+      isOptional = pOptional;
+    }
+
+    public boolean isGlobal() { return false; }
+    /** For compatibility only: The value true is unsupported.
+     * @throws IllegalStateException An attempt was made, to make the
+     * attribute public.
+     */
+    public void setGlobal(boolean pGlobal) {
+      if (!pGlobal) {
+        throw new IllegalStateException("This attribute cannot be made global");
+      }
+    }
+    public XsQName getName() { return name; }
+    public XSType getType() { return type; }
+    public boolean isOptional() { return isOptional; }
+    public XSAnnotation[] getAnnotations() { return new XSAnnotation[0]; }
+    public Locator getLocator() { return locator; }
+    public void validate() throws SAXException {}
+    public boolean isTopLevelObject() { return false; }
+    public XSObject getParentObject() { return parent; }
+    public XSSchema getXSSchema() { return parent.getXSSchema(); }
+
+    public String getDefault() { return null; }
+    public String getFixed() { return null; }
+    public Attributes getOpenAttributes() { return null; }
+  }
+
+  /** <p>Namespace URI of the JDBC schema writer.</p>
+   */
+  public static final String JAXME_JDBC_SCHEMA_URI = "http://ws.apache.org/jaxme/namespaces/jaxme2/jdbc-mapping";
+
+  private SGFactory sgFactory;
+  private SQLFactory sqlFactory;
+  private String key;
+
+  /** Creates a new instance.
+   */
+  public JaxMeJdbcSG(SGFactoryChain o) {
+    super(o);
+  }
+
+  /** Returns the key, under which the {@link JaxMeJdbcSG} is
+   * registered in the factory.
+   */
+  public String getKey() {
+    return key;
+  }
+
+  public void init(SGFactory pFactory) {
+    super.init(pFactory);
+    sgFactory = pFactory;
+    SchemaReader schemaReader = pFactory.getGenerator().getSchemaReader();
+    if (schemaReader instanceof JaxMeSchemaReader) {
+      JaxMeSchemaReader jaxmeSchemaReader = (JaxMeSchemaReader) schemaReader;
+      jaxmeSchemaReader.addXsObjectCreator(new XsObjectCreator(){
+        public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
+            if (pParent instanceof XsEAppinfo) {
+	          if (JAXME_JDBC_SCHEMA_URI.equals(pQName.getNamespaceURI())) {
+	            if ("table".equals(pQName.getLocalName())) {
+	              return new TableDetails(JaxMeJdbcSG.this, pParent);
+	            } else if ("connection".equals(pQName.getLocalName())) {
+	              return new ConnectionDetails(JaxMeJdbcSG.this, pParent);
+	            } else {
+	              throw new LocSAXException("Invalid element name: " + pQName, pLocator);
+	            }
+	          }
+            }
+            return null;
+          }
+      });
+    } else {
+      throw new IllegalStateException("The schema reader " + schemaReader.getClass().getName() +
+                                       " is not an instance of " + JaxMeSchemaReader.class.getName());
+    }
+
+    String s = schemaReader.getGenerator().getProperty("jdbc.sqlFactory");
+    if (s == null) {
+      sqlFactory = new SQLFactoryImpl();
+    } else {
+      Class c;
+      try {
+        c = ClassLoader.getClass(s, SQLFactory.class);
+      } catch (ClassNotFoundException e) {
+        throw new IllegalStateException("SQLFactory class " + s + ", specified by property jdbc.sqlFactory, not found.");
+      }
+      try {
+        sqlFactory = (SQLFactory) c.newInstance();
+      } catch (InstantiationException e) {
+        throw new IllegalStateException("Unable to instantiate SQLFactory class " + c.getName());
+      } catch (IllegalAccessException e) {
+        throw new IllegalStateException("Illegal access to the default constructor of SQLFactory class " + c.getName());
+      }
+    }
+
+    key = pFactory.getGenerator().getKey();
+  }
+
+  protected SGFactory getSGFactory() {
+    return sgFactory;
+  }
+
+  public Generator getGenerator(SGFactory pFactory) {
+    return super.getGenerator(pFactory);
+  }
+
+  protected Mode getDatabaseMode(ConnectionDetails pDetails,
+                                  Connection pConn) throws SQLException {
+    if (pDetails == null) {
+      String v = pConn.getMetaData().getDatabaseProductName();
+      try {
+        return Mode.valueOf(v);
+      } catch (Exception e) {
+        return Mode.GENERIC;
+      }
+    } else {
+      return pDetails.getDbMode();
+    }
+  }
+
+  /** <p>Guess an SQL type, based on reported type, scale and
+   * precision.</p>
+   */
+  protected int getDbType(Mode pDbMode, int pDbType, long pScale,
+                            long pPrecision, String pDbTypeName) {
+    if (Mode.GENERIC.equals(pDbMode)) {
+      return pDbType;
+    } else if (pDbType == Types.OTHER) {
+      if ("CLOB".equalsIgnoreCase(pDbTypeName)) {
+        return Types.CLOB;
+      } else if ("BLOB".equalsIgnoreCase(pDbTypeName)) {
+        return Types.BLOB;
+      } else {
+        return Types.OTHER;
+      }
+    } else if (pDbType == Types.NUMERIC  ||  "NUMBER".equalsIgnoreCase(pDbTypeName)) {
+      if (pScale == 0) {
+        if (pPrecision == 0) { return Types.FLOAT; }
+        if (pPrecision <= 2) { return Types.TINYINT; }
+        if (pPrecision <= 4) { return Types.SMALLINT; }
+        if (pPrecision <= 9) { return Types.INTEGER; }
+        return Types.BIGINT;
+      } else if (pScale == -127) {
+        // Uses binary precision - See page 4-37 of the OCI book
+        if (pPrecision < 24) {
+          return Types.FLOAT;  // 53 is double cutoff
+        }
+      } else {
+        // Uses decimal precision - See page 4-37 of the OCI book
+        if (pPrecision < 8) {
+          return Types.FLOAT;   // 15 is double cutoff
+        }
+      }
+    } else if (pDbType != Types.NUMERIC) {
+      return pDbType;
+    }
+    return Types.DOUBLE;
+  }
+
+  /** <p>Creates a new attribute or chooses an existing atomic
+   * child element. Returns the {@link AttributeSG} or
+   * {@link ParticleSG}.</p>
+   */
+  protected Object addColumn(ComplexTypeSG pTypeSG, XSType pType, Column pColumn) throws SAXException {
+    final String mName = "addColumn";
+    log.entering(mName, pColumn.getQName());
+    /*  May be there already is an attribute or child element
+     * with default settings?
+     */
+    List allChilds = new ArrayList();
+    AttributeSG[] attributes = pTypeSG.getAttributes();
+    if (attributes != null) {
+      allChilds.addAll(Arrays.asList(attributes));
+    }
+    if (!pTypeSG.hasSimpleContent()) {
+      ComplexContentSG cct = pTypeSG.getComplexContentSG();
+      GroupSG groupSG = cct.getRootParticle().getGroupSG();
+      ParticleSG[] childs = groupSG.getParticles();
+      if (childs != null) {
+        for (int i = 0;  i < childs.length;  i++) {
+          ParticleSG child = childs[i];
+          // Accept only simple elements
+          if (child.isElement()) {
+            ObjectSG objectSG = child.getObjectSG();
+            if (!objectSG.getTypeSG().isComplex()) {
+              allChilds.add(child);
+            }
+          }
+        }
+      }
+    }
+
+    Object theChild = null;
+    for (Iterator iter = allChilds.iterator();  iter.hasNext();  ) {
+      Object currentChild = iter.next();
+      String localName;
+      if (currentChild instanceof AttributeSG) {
+        localName = ((AttributeSG) currentChild).getName().getLocalName();
+      } else if (currentChild instanceof ParticleSG) {
+        localName = ((ParticleSG) currentChild).getObjectSG().getName().getLocalName();
+      } else {
+        throw new IllegalStateException("Expected either attribute or element.");
+      }
+      if (localName != null  &&  localName.equalsIgnoreCase(pColumn.getName().getName())) {
+        if (theChild == null) {
+          theChild = currentChild;
+        } else {
+          log.warn(mName, "Multiple matching attributes or child elements found for column " +
+                   pColumn.getQName());
+        }
+      }
+    }
+
+    if (theChild == null) {
+      // We have to create a new attribute matching the column
+      XSType xsType;
+      if (pColumn.isBinaryColumn()) {
+        xsType = XSBase64Binary.getInstance();
+      } else if (pColumn.isStringColumn()) {
+        xsType = XSString.getInstance();
+      } else {
+        Column.Type myType = pColumn.getType();
+        if (Column.Type.BIT.equals(myType)) {
+          xsType = XSBoolean.getInstance();
+        } else if (Column.Type.DATE.equals(myType)) {
+          xsType = XSDate.getInstance();
+        } else if (Column.Type.DOUBLE.equals(myType)) {
+          xsType = XSDouble.getInstance();
+        } else if (Column.Type.FLOAT.equals(myType)) {
+          xsType = XSFloat.getInstance();
+        } else if (Column.Type.SMALLINT.equals(myType)) {
+          xsType = XSShort.getInstance();
+        } else if (Column.Type.TIME.equals(myType)) {
+          xsType = XSTime.getInstance();
+        } else if (Column.Type.TIMESTAMP.equals(myType)) {
+          xsType = XSDateTime.getInstance();
+        } else if (Column.Type.TINYINT.equals(myType)) {
+          xsType = XSByte.getInstance();
+        } else if (Column.Type.INTEGER.equals(myType)) {
+          xsType = XSInt.getInstance();
+        } else {
+          throw new IllegalStateException("Unknown column type: " + myType);
+        }
+      }
+
+      XSAttribute attr = new JdbcAttribute(pType, pType.getLocator(),
+                                           new XsQName((String) null, pColumn.getName().getName()), xsType,
+                                           pColumn.isNullable());
+      AttributeSGChain chain = (AttributeSGChain) pTypeSG.newAttributeSG(attr);
+      AttributeSG attributeSG = new AttributeSGImpl(chain);
+      pTypeSG.addAttributeSG(attributeSG);
+      theChild = attributeSG;
+    }
+
+    return theChild;
+  }
+
+  /** <p>We use the interface Connector in order to allow people use of this
+   * class, even if they don't have the javax.sql package around.</p>
+   */
+  private interface Connector {
+  	/** Returns a new database connection.
+  	 */
+    public Connection getConnection(TableDetails pDetails) throws SAXException;
+  }
+
+  private class DriverManagerConnector implements Connector {
+    public Connection getConnection(TableDetails pTableDetails) throws SAXException {
+      final String mName = "DriverManagerConnector.getConnection";
+      Class c = null;
+      Exception ex = null;
+      log.fine(mName, "Loading driver " + pTableDetails.getDriver());
+      try {
+        Class.forName(pTableDetails.getDriver());
+      } catch (Exception e) {
+      }
+      if (c == null) {
+        try {
+          java.lang.ClassLoader cl = Thread.currentThread().getContextClassLoader();
+          if (cl == null) {
+            cl = getClass().getClassLoader(); 
+          }
+          c = cl.loadClass(pTableDetails.getDriver());
+        } catch (Exception e) {
+          if (ex == null) { ex = e; }
+        }
+      }
+      if (c == null) {
+        if (ex == null) { ex = new ClassNotFoundException(); }
+        throw new LocSAXException("Unable to load driver class " + pTableDetails.getDriver()
+                                   + ": " + ex.getClass().getName() + ", " + ex.getMessage(),
+                                   pTableDetails.getLocator());
+      }
+      log.fine(mName, "Connecting to database " + pTableDetails.getUrl() + " as " + pTableDetails.getUser());
+      try {
+        Connection conn = DriverManager.getConnection(pTableDetails.getUrl(), pTableDetails.getUser(),
+                                                      pTableDetails.getPassword());
+        if (conn == null) {
+          throw new LocSAXException("Unable to connect to " + pTableDetails.getUrl()
+                                     + " as user " + pTableDetails.getUser()
+                                     + ": DriverManager returned a null connection",
+                                     pTableDetails.getLocator());
+        }
+        return conn;
+      } catch (SQLException e) {
+        throw new LocSAXException("Unable to connect to " + pTableDetails.getUrl()
+                                   + " as user " + pTableDetails.getUser()
+                                   + ": SQL State = " + e.getSQLState() + ", error code = "
+                                   + e.getErrorCode() + ", " + e.getMessage(),
+                                   pTableDetails.getLocator(), e);
+      }
+    }
+  }
+
+  private class DatasourceConnector implements Connector {
+    public Connection getConnection(TableDetails pTableDetails) throws SAXException {
+      javax.naming.InitialContext ic;
+      try {
+        ic = new javax.naming.InitialContext();
+      } catch (NamingException e) {
+        throw new LocSAXException("Failed to create initial JNDI context: "
+                                   + e.getClass().getName() + ", " + e.getMessage(),
+                                   pTableDetails.getLocator(), e);
+      }
+      javax.sql.DataSource ds;
+      try {
+        ds = (javax.sql.DataSource) ic.lookup(pTableDetails.getDatasource());
+      } catch (NamingException e) {
+        throw new LocSAXException("Failed to lookup datasource " + pTableDetails.getDatasource()
+                                   + ": " + e.getClass().getName() + ", " + e.getMessage(),
+                                   pTableDetails.getLocator(), e);
+      }
+      try {
+        Connection conn = ds.getConnection(pTableDetails.getUser(), pTableDetails.getPassword());
+        if (conn == null) {
+          throw new LocSAXException("Unable to connect to " + pTableDetails.getUrl()
+                                     + " as user " + pTableDetails.getUser()
+                                     + ": Datasource returned a null connection",
+                                     pTableDetails.getLocator());
+        }
+        return conn;
+      } catch (SQLException e) {
+        throw new LocSAXException("Unable to connect to datasource " + pTableDetails.getUrl()
+                                   + " as user " + pTableDetails.getUser()
+                                   + ": SQL State = " + e.getSQLState() + ", error code = "
+                                   + e.getErrorCode() + ", " + e.getMessage(),
+                                   pTableDetails.getLocator(), e);
+      }
+    }
+  }
+
+  protected CustomTableData addTableData(ComplexTypeSG pTypeSG, XSType pType,
+                                          TableDetails pTableDetails) throws SAXException {
+    final String mName = "addTableData";
+    log.entering(mName, new Object[]{pTypeSG, pTableDetails});
+    String tableName = pTableDetails.getName();
+
+    Connection conn;
+    if (pTableDetails.getDriver() == null) {
+      conn = new DatasourceConnector().getConnection(pTableDetails);
+    } else {
+      conn = new DriverManagerConnector().getConnection(pTableDetails);
+    }
+
+    try {
+      int offset = tableName.indexOf('.');
+      String schemaName;
+      if (offset > 0) {
+        schemaName = tableName.substring(0, offset);
+        tableName = tableName.substring(offset+1);
+      } else {
+        schemaName = null;
+      }
+      Table table;
+      try {
+        table = sqlFactory.getTable(conn, schemaName, tableName);
+        conn.close();
+        conn = null;
+      } catch (SQLException e) {
+        throw new SAXException("Failed to read table " + pTableDetails.getName() + ": " + e.getMessage(), e);
+      }
+      if (table.getPrimaryKey() == null) {
+        throw new IllegalStateException("The table " + table.getQName() + " does not have a primary key.");
+      }
+      CustomTableData customTableData = new CustomTableData(this, table, pTypeSG, pTableDetails);
+      for (Iterator iter = table.getColumns();  iter.hasNext();  ) {
+        Column col = (Column) iter.next();
+        Object sg = addColumn(pTypeSG, pType, col);
+        CustomColumnData colData = new CustomColumnData(col.getName().getName(), sg);
+        col.setCustomData(colData);
+      }
+
+      return customTableData;
+    } finally {
+      if (conn != null) { try { conn.close(); } catch (Throwable ignore) {} }
+    }
+  }
+
+  public Object newTypeSG(SGFactory pController, XSType pType) throws SAXException {
+    return new JdbcTypeSG(this, (TypeSGChain) super.newTypeSG(pController, pType), pType);
+  }
+
+  public Object newTypeSG(SGFactory pController, XSType pType, XsQName pName) throws SAXException {
+    return new JdbcTypeSG(this, (TypeSGChain) super.newTypeSG(pController, pType, pName), pType);
+  }
+
+  public Object newTypeSG(SGFactory pController, XSType pType, Context pClassContext, XsQName pName) throws SAXException {
+    return new JdbcTypeSG(this, (TypeSGChain) super.newTypeSG(pController, pType, pClassContext, pName), pType);
+  }
+
+  public Object newSchemaSG(SGFactory pController, XSSchema pSchema) throws SAXException {
+    SchemaSGChain chain = (SchemaSGChain) super.newSchemaSG(pController, pSchema);
+    chain = new JdbcSchemaSG(this, chain);
+    return chain;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcComplexTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcComplexTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcComplexTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.impl.ComplexTypeSGChainImpl;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JdbcComplexTypeSG extends ComplexTypeSGChainImpl {
+  private final JaxMeJdbcSG jdbcSG;
+  private XSType xsType;
+
+  protected JdbcComplexTypeSG(JaxMeJdbcSG pJdbcSG, ComplexTypeSGChain o, XSType pType) {
+    super(o);
+    jdbcSG = pJdbcSG;
+    if (pType == null) {
+      throw new NullPointerException("The XSType argument must not be null.");
+    }
+    xsType = pType;
+  }
+
+  public void init(ComplexTypeSG pTypeSG) throws SAXException {
+    super.init(pTypeSG);
+    TableDetails tableDetails = (TableDetails)
+      XSUtil.getSingleAppinfo(xsType.getAnnotations(), TableDetails.class);
+    if (tableDetails != null) {
+      CustomTableData data = jdbcSG.addTableData(pTypeSG, xsType, tableDetails);
+      pTypeSG.getTypeSG().setProperty(jdbcSG.getKey(), data);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcSchemaSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcSchemaSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcSchemaSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.generator.sg.Context;
+import org.apache.ws.jaxme.generator.sg.ObjectSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSG;
+import org.apache.ws.jaxme.generator.sg.SchemaSGChain;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.impl.SchemaSGChainImpl;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JdbcSchemaSG extends SchemaSGChainImpl {
+  final JaxMeJdbcSG jdbcSG;
+
+  /** <p>Creates a new instance of JdbcSchemaSG.</p>
+   */
+  protected JdbcSchemaSG(JaxMeJdbcSG pJdbcSG, SchemaSGChain pBackingObject) {
+    super(pBackingObject);
+    jdbcSG = pJdbcSG;
+  }
+
+  private Element createProperty(Element pParent, String pName, String pValue) {
+    Element element = pParent.getOwnerDocument().createElementNS(JAXBContextImpl.CONFIGURATION_URI, "Property");
+    pParent.appendChild(element);
+    element.setAttributeNS(null, "name", pName);
+    element.setAttributeNS(null, "value", pValue);
+    return element;
+  }
+
+  public Document getConfigFile(SchemaSG pController, String pPackageName, List pContextList)
+      throws SAXException {
+    final String uri = JAXBContextImpl.CONFIGURATION_URI;
+    final Document doc = super.getConfigFile(pController, pPackageName, pContextList);
+    final Element root = doc.getDocumentElement();
+    final Iterator iter = pContextList.iterator();
+    for (Node node = root.getFirstChild();  node != null;  node = node.getNextSibling()) {
+      if (node.getNodeType() == Node.ELEMENT_NODE
+          &&  JAXBContextImpl.CONFIGURATION_URI.equals(node.getNamespaceURI())
+          &&  "Manager".equals(node.getLocalName())) {
+        final ObjectSG objectSG = (ObjectSG) iter.next();
+        final TypeSG typeSG = objectSG.getTypeSG();
+        if (typeSG.isComplex()) {
+          final CustomTableData customTableData = (CustomTableData) typeSG.getProperty(jdbcSG.getKey());
+          if (customTableData != null) {
+            Element manager = (Element) node;
+            final Context ctx = typeSG.getComplexTypeSG().getClassContext();
+            manager.setAttributeNS(uri, "pmClass", ctx.getPMName().toString());
+
+            final TableDetails tableDetails = customTableData.getTableDetails();
+            final String driver = tableDetails.getDriver();
+            if (driver != null) {
+              createProperty(manager, "jdbc.driver", driver);
+            }
+            final String url = tableDetails.getUrl();
+            if (url != null) {
+              createProperty(manager, "jdbc.url", url);
+            }
+            final String user = tableDetails.getUser();
+            if (user != null) {
+              createProperty(manager, "jdbc.user", user);
+            }
+            final String password = tableDetails.getPassword();
+            if (password != null) {
+              createProperty(manager, "jdbc.password", password);
+            }
+          }
+        }
+      }
+    }
+    if (iter.hasNext()) {
+      throw new IllegalStateException("More managers expected than found");
+    }
+    return doc;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcTypeSG.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcTypeSG.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/JdbcTypeSG.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,531 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.Observer;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.PMParams;
+import org.apache.ws.jaxme.generator.sg.AttributeSG;
+import org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain;
+import org.apache.ws.jaxme.generator.sg.ParticleSG;
+import org.apache.ws.jaxme.generator.sg.PropertySG;
+import org.apache.ws.jaxme.generator.sg.TypeSG;
+import org.apache.ws.jaxme.generator.sg.TypeSGChain;
+import org.apache.ws.jaxme.generator.sg.impl.TypeSGChainImpl;
+import org.apache.ws.jaxme.js.DirectAccessible;
+import org.apache.ws.jaxme.js.JavaInnerClass;
+import org.apache.ws.jaxme.js.JavaMethod;
+import org.apache.ws.jaxme.js.JavaQName;
+import org.apache.ws.jaxme.js.JavaQNameImpl;
+import org.apache.ws.jaxme.js.JavaSource;
+import org.apache.ws.jaxme.js.LocalJavaField;
+import org.apache.ws.jaxme.js.Parameter;
+import org.apache.ws.jaxme.pm.jdbc.*;
+import org.apache.ws.jaxme.sqls.Column;
+import org.apache.ws.jaxme.sqls.Table;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JdbcTypeSG extends TypeSGChainImpl {
+  private final JaxMeJdbcSG jdbcSG;
+  private XSType xsType;
+
+  protected JdbcTypeSG(JaxMeJdbcSG pJdbcSG, TypeSGChain o, XSType pType) {
+    super(o);
+    this.jdbcSG = pJdbcSG;
+    if (pType == null) {
+      throw new NullPointerException("The XSType argument must not be null.");
+    }
+    xsType = pType;
+  }
+
+  public Object newComplexTypeSG(TypeSG pController) throws SAXException {
+    if (xsType == null) {
+      throw new IllegalStateException("An instance of ComplexTypeSGChain has already been created.");
+    }
+    ComplexTypeSGChain chain = (ComplexTypeSGChain) super.newComplexTypeSG(pController);
+    chain = new JdbcComplexTypeSG(jdbcSG, chain, xsType);
+    xsType = null; // Make this available for garbage collection
+    return chain;
+  }
+
+  public void generate(TypeSG pController) throws SAXException {
+    super.generate(pController);
+    if (!pController.isComplex()) {
+      return;
+    }
+    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
+    if (customTableData != null) {
+      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
+      JavaSource js = pController.getSchema().getJavaSourceFactory().newJavaSource(qName, JavaSource.PUBLIC);
+      getPMClass(pController, js, customTableData);
+    }
+  }
+
+  public void generate(TypeSG pController, JavaSource pSource) throws SAXException {
+    super.generate(pController, pSource);
+    if (!pController.isComplex()) {
+      return;
+    }
+    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
+    if (customTableData != null) {
+      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
+      JavaInnerClass jic = pSource.newJavaInnerClass(qName.getClassName());
+      getPMClass(pController, jic, customTableData);
+    }
+  }
+
+  /** <p>Generates code for setting a PreparedStatement's parameter.</p>
+   */
+  protected void setPreparedStatementValue(JavaMethod pMethod, Column pColumn,
+                                             Object pStmt, Object pParamNum,
+                                             Object pValue, TypeSG pTypeSG)
+      throws SAXException {
+    boolean isPrimitive = pTypeSG.getSimpleTypeSG().getRuntimeType().isPrimitive();
+    Column.Type type = pColumn.getType();
+    if (isPrimitive) {
+      if (Column.Type.BIGINT.equals(type)) {
+        pMethod.addLine(pStmt, ".setLong(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.BIT.equals(type)) {
+        pMethod.addLine(pStmt, ".setBoolean(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.DOUBLE.equals(type)) {
+        pMethod.addLine(pStmt, ".setDouble(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.FLOAT.equals(type)) {
+        pMethod.addLine(pStmt, ".setFloat(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.INTEGER.equals(type)) {
+        pMethod.addLine(pStmt, ".setInt(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.SMALLINT.equals(type)) {
+        pMethod.addLine(pStmt, ".setShort(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.TINYINT.equals(type)) {
+        pMethod.addLine(pStmt, ".setByte(", pParamNum, ", ", pValue, ");");
+      }
+    } else {
+      if (!(pValue instanceof DirectAccessible)) {
+         LocalJavaField v = pMethod.newJavaField(pTypeSG.getRuntimeType());
+         v.addLine(pValue);
+         pValue = v;
+      }
+      pMethod.addIf(pValue, " == null");
+      pMethod.addLine(pStmt, ".setNull(", pParamNum, ", ", Types.class, ".", type, ");");
+      pMethod.addElse();
+      if (Column.Type.BIGINT.equals(type)) {
+        pMethod.addLine(pStmt, ".setLong(", pParamNum, ", ", pValue, ".longValue());");
+      } else if (pColumn.isBinaryColumn()) {
+        pMethod.addLine(pStmt, ".setBytes(", pParamNum, ", ", pValue, ");");
+      } else if (pColumn.isStringColumn()) {
+        pMethod.addLine(pStmt, ".setString(", pParamNum, ", ", pValue, ");");
+      } else if (Column.Type.DATE.equals(type)) {
+        pMethod.addLine(pStmt, ".setDate(", pParamNum, ", new ", java.sql.Date.class,
+                        "(", pValue, ".getTime().getTime()));");
+      } else if (Column.Type.DOUBLE.equals(type)) {
+        pMethod.addLine(pStmt, ".setDouble(", pParamNum, ", ", pValue, ".doubleValue());");
+      } else if (Column.Type.FLOAT.equals(type)) {
+        pMethod.addLine(pStmt, ".setFloat(", pParamNum, ", ", pValue, ".floatValue());");
+      } else if (Column.Type.INTEGER.equals(type)) {
+        pMethod.addLine(pStmt, ".setInt(", pParamNum, ", ", pValue, ".intValue());");
+      } else if (Column.Type.SMALLINT.equals(type)) {
+        pMethod.addLine(pStmt, ".setShort(", pParamNum, ", ", pValue, ".shortValue());");
+      } else if (Column.Type.TIME.equals(type)) {
+        pMethod.addLine(pStmt, ".setTime(", pParamNum, ", new ", java.sql.Date.class,
+                        "(", pValue, ".getTime().getTime()));");
+      } else if (Column.Type.TIMESTAMP.equals(type)) {
+        pMethod.addLine(pStmt, ".setTimestamp(", pParamNum, ", new ", Timestamp.class,
+                        "(", pValue, ".getTime().getTime()));");
+      } else if (Column.Type.TINYINT.equals(type)) {
+        pMethod.addLine(pStmt, ".setByte(", pParamNum, ", ", pValue, ".byteValue());");
+      } else {
+        throw new IllegalStateException("Unknown column type: " + type);
+      }
+      pMethod.addEndIf();
+    }
+  }
+
+  /** <p>Generates code for fetching a value from a {@link ResultSet}.</p>
+   */
+  protected Object getResultSetValue(JavaMethod pMethod, Column pColumn,
+                                      Object pRs, Object pParamNum,
+                                      TypeSG pTypeSG)
+      throws SAXException {
+    boolean isPrimitive = pTypeSG.getSimpleTypeSG().getRuntimeType().isPrimitive();
+    Column.Type type = pColumn.getType();
+    if (isPrimitive) {
+      if (Column.Type.BIGINT.equals(type)) {
+        return new Object[]{pRs, ".getLong(", pParamNum, ")"};
+      } else if (Column.Type.BIT.equals(type)) {
+        return new Object[]{pRs, ".getBoolean(", pParamNum, ")"};
+      } else if (Column.Type.DOUBLE.equals(type)) {
+        return new Object[]{pRs, ".getDouble(", pParamNum, ")"};
+      } else if (Column.Type.FLOAT.equals(type)) {
+        return new Object[]{pRs, ".getFloat(", pParamNum, ")"};
+      } else if (Column.Type.INTEGER.equals(type)) {
+        return new Object[]{pRs, ".getInt(", pParamNum, ")"};
+      } else if (Column.Type.SMALLINT.equals(type)) {
+        return new Object[]{pRs, ".getShort(", pParamNum, ")"};
+      } else if (Column.Type.TINYINT.equals(type)) {
+        return new Object[]{pRs, ".getByte(", pParamNum, ")"};
+      } else {
+        throw new IllegalStateException("Unknown primitive type: " + type);
+      }
+    } else {
+      if (pColumn.isStringColumn()) {
+        return new Object[]{pRs, ".getString(", pParamNum, ")"};
+      } else if (pColumn.isBinaryColumn()) {
+        return new Object[]{pRs, ".getBytes(", pParamNum, ")"};
+      } else if (Column.Type.DATE.equals(type)) {
+        LocalJavaField cal = pMethod.newJavaField(Calendar.class);
+        LocalJavaField date = pMethod.newJavaField(Date.class);
+        date.addLine(pRs, ".getDate(", pParamNum, ")");
+        pMethod.addIf(date, " == null");
+        pMethod.addLine(cal, " = null;");
+        pMethod.addElse();
+        pMethod.addLine(cal, " = ", Calendar.class, ".getInstance();");
+        pMethod.addLine(cal, ".setTime(", date, ");");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".HOUR, 0);");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".MINUTE, 0);");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".SECOND, 0);");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".MILLISECOND, 0);");
+        pMethod.addEndIf();
+        return cal;
+      } else if (Column.Type.TIME.equals(type)) {
+        LocalJavaField cal = pMethod.newJavaField(Calendar.class);
+        LocalJavaField date = pMethod.newJavaField(Time.class);
+        date.addLine(pRs, ".getTime(", pParamNum, ")");
+        pMethod.addIf(date, " == null");
+        pMethod.addLine(cal, " = null;");
+        pMethod.addElse();
+        pMethod.addLine(cal, " = ", Calendar.class, ".getInstance();");
+        pMethod.addLine(cal, ".setTime(", date, ");");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".YEAR, 0);");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".MONTH, 0);");
+        pMethod.addLine(cal, ".set(", Calendar.class, ".DAY_OF_MONTH, 0);");
+        pMethod.addEndIf();
+        return cal;
+      } else if (Column.Type.TIMESTAMP.equals(type)) {
+        LocalJavaField cal = pMethod.newJavaField(Calendar.class);
+        LocalJavaField date = pMethod.newJavaField(Timestamp.class);
+        date.addLine(pRs, ".getTimestamp(", pParamNum, ")");
+        pMethod.addIf(date, " == null");
+        pMethod.addLine(cal, " = null;");
+        pMethod.addElse();
+        pMethod.addLine(cal, " = ", Calendar.class, ".getInstance();");
+        pMethod.addLine(cal, ".setTime(", date, ");");
+        pMethod.addEndIf();
+        return cal;
+      } else if (Column.Type.BIT.equals(type)) {
+        LocalJavaField b = pMethod.newJavaField(boolean.class);
+        b.addLine(pRs, ".getBoolean(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : ",
+                               b, " ? ", Boolean.class, ".TRUE : ", Boolean.class, ".FALSE)"};
+      } else if (Column.Type.BIGINT.equals(type)) {
+        LocalJavaField l = pMethod.newJavaField(long.class);
+        l.addLine(pRs, ".getLong(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : new Long(", l, ")"};
+      } else if (Column.Type.DOUBLE.equals(type)) {
+        LocalJavaField d = pMethod.newJavaField(double.class);
+        d.addLine(pRs, ".getDouble(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : new Double(", d, ")"};
+      } else if (Column.Type.FLOAT.equals(type)) {
+        LocalJavaField f = pMethod.newJavaField(float.class);
+        f.addLine(pRs, ".getFloat(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : new Float(", f, ")"};
+      } else if (Column.Type.INTEGER.equals(type)) {
+        LocalJavaField i = pMethod.newJavaField(int.class);
+        i.addLine(pRs, ".getInt(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : new Integer(", i, ")"};
+      } else if (Column.Type.SMALLINT.equals(type)) {
+        LocalJavaField s = pMethod.newJavaField(short.class);
+        s.addLine(pRs, ".getShort(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : new Short(", s, ")"};
+      } else if (Column.Type.TINYINT.equals(type)) {
+        LocalJavaField b = pMethod.newJavaField(byte.class);
+        b.addLine(pRs, ".getByte(", pParamNum, ")");
+        return new Object[]{"(", pRs, ".wasNull() ? null : new Byte(", b, ")"};
+      } else {
+        throw new IllegalStateException("Unknown column type: " + type);
+      }
+    }
+  }
+
+  protected void getFinally(JavaMethod pMethod, DirectAccessible pRessource, Object pSqlMsg,
+                              Object pJaxbMsg) {
+    pMethod.addLine(pRessource, ".close();");
+    pMethod.addLine(pRessource, " = null;");
+    if (pSqlMsg != null) {
+      DirectAccessible e = pMethod.addCatch(SQLException.class);
+      pMethod.addThrowNew(PMException.class, pSqlMsg, " + ", JavaSource.getQuoted(": "),
+                          " + ", e, ".getMessage(), ", e);
+    }
+    if (pJaxbMsg != null) {
+      DirectAccessible e = pMethod.addCatch(JAXBException.class);
+      pMethod.addIf(e, " instanceof ", PMException.class);
+      pMethod.addLine("throw (", PMException.class, ") ", e, ";");
+      pMethod.addElse();
+      pMethod.addThrowNew(PMException.class, pSqlMsg, " + ", JavaSource.getQuoted(": "),
+                          " + ", e, ".getMessage(), ", e);
+      pMethod.addEndIf();
+    }
+    pMethod.addFinally();
+    pMethod.addIf(pRessource, " != null");
+    pMethod.addTry();
+    pMethod.addLine(pRessource, ".close();");
+    pMethod.addCatch(Throwable.class);
+    pMethod.addEndTry();
+    pMethod.addEndIf();
+    pMethod.addEndTry();
+  }
+
+  private int getPreparedStatementParameters(JavaMethod pMethod, Object pStmt, DirectAccessible pElement,
+																						 Iterator pColumns, int pParamNum)
+      throws SAXException {
+    for (Iterator iter = pColumns;  iter.hasNext();  ) {
+      Column col = (Column) iter.next();
+      CustomColumnData colData = (CustomColumnData) col.getCustomData();
+      Object sg = colData.getSG();
+      PropertySG propertySG;
+      TypeSG typeSG;
+      if (sg instanceof AttributeSG) {
+        AttributeSG attrSG = (AttributeSG) sg;
+        propertySG = attrSG.getPropertySG();
+        typeSG = attrSG.getTypeSG();
+      } else if (sg instanceof ParticleSG) {
+        ParticleSG particleSG = (ParticleSG) sg;
+        propertySG = particleSG.getPropertySG();
+        typeSG = particleSG.getObjectSG().getTypeSG();
+      } else {
+        throw new IllegalStateException("Invalid SG type for column " + col.getName() + ": " + sg);
+      }
+      Object value = propertySG.getValue(pElement);
+      setPreparedStatementValue(pMethod, col, pStmt, new Integer(++pParamNum), value, typeSG);
+    }
+    return pParamNum;
+  }
+
+  private int getResultSet(JavaMethod pMethod, DirectAccessible pRs, DirectAccessible pElement,
+                            Iterator pColumns, int pParamNum)
+      throws SAXException {
+    for (Iterator iter = pColumns;  iter.hasNext();  ) {
+      Column col = (Column) iter.next();
+      CustomColumnData colData = (CustomColumnData) col.getCustomData();
+      Object sg = colData.getSG();
+      PropertySG propertySG;
+      TypeSG typeSG;
+      if (sg instanceof AttributeSG) {
+        AttributeSG attrSG = (AttributeSG) sg;
+        propertySG = attrSG.getPropertySG();
+        typeSG = attrSG.getTypeSG();
+      } else if (sg instanceof ParticleSG) {
+        ParticleSG particleSG = (ParticleSG) sg;
+        propertySG = particleSG.getPropertySG();
+        typeSG = particleSG.getObjectSG().getTypeSG();
+      } else {
+        throw new IllegalStateException("Invalid SG type for column " + col.getName() + ": " + sg);
+      }
+      Object value = getResultSetValue(pMethod, col, pRs, new Integer(++pParamNum), typeSG);
+      propertySG.setValue(pMethod, pElement, value, null);
+    }
+    return pParamNum;
+  }
+
+  protected JavaMethod getPMClassInsertMethod(TypeSG pController, JavaSource pSource, CustomTableData pData)
+      throws SAXException {
+    JavaMethod jm = pSource.newJavaMethod("insert", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+    Parameter pElement = jm.addParam(Element.class, "pElement");
+    jm.addThrows(PMException.class);
+    Table table = pData.getTable();
+
+    String q = table.getSchema().getSQLFactory().newSQLGenerator().getQuery(table.getInsertStatement());
+    LocalJavaField query = jm.newJavaField(String.class);
+    query.setFinal(true);
+    query.addLine(JavaSource.getQuoted(q));
+
+    JavaQName qName = pController.getComplexTypeSG().getClassContext().getXMLInterfaceName();
+    LocalJavaField elem = jm.newJavaField(qName);
+    elem.addLine("(", qName, ") ", pElement);
+
+    LocalJavaField connection = jm.newJavaField(Connection.class);
+    connection.addLine("null");
+    jm.addTry();
+    jm.addLine(connection, " = getConnection();");
+    LocalJavaField stmt = jm.newJavaField(PreparedStatement.class);
+    stmt.addLine(connection, ".prepareStatement(", query, ")");
+    jm.addTry();
+    getPreparedStatementParameters(jm, stmt, elem, table.getColumns(), 0);
+    jm.addLine(stmt, ".executeUpdate();");
+    getFinally(jm, stmt, null, null);
+    getFinally(jm, connection, new Object[]{JavaSource.getQuoted("Failed to execute query "),
+                                            " + ", query}, null);
+    return jm;
+  }
+
+  protected JavaMethod getPMClassUpdateMethod(TypeSG pController, JavaSource pSource, CustomTableData pData)
+      throws SAXException {
+    JavaMethod jm = pSource.newJavaMethod("update", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+    Parameter pElement = jm.addParam(Element.class, "pElement");
+    jm.addThrows(PMException.class);
+    Table table = pData.getTable();
+
+    String q = table.getSchema().getSQLFactory().newSQLGenerator().getQuery(table.getUpdateStatement());
+    LocalJavaField query = jm.newJavaField(String.class);
+    query.setFinal(true);
+    query.addLine(JavaSource.getQuoted(q));
+
+    JavaQName qName = pController.getComplexTypeSG().getClassContext().getXMLInterfaceName();
+    LocalJavaField elem = jm.newJavaField(qName);
+    elem.addLine("(", qName, ") ", pElement);
+
+    LocalJavaField connection = jm.newJavaField(Connection.class);
+    connection.addLine("null");
+    jm.addTry();
+    jm.addLine(connection, " = getConnection();");
+
+    LocalJavaField stmt = jm.newJavaField(PreparedStatement.class);
+    stmt.addLine(connection, ".prepareStatement(", query, ")");
+    jm.addTry();
+
+    List nonKeyColumns = new ArrayList();
+    for (Iterator iter = table.getColumns();  iter.hasNext();  ) {
+      Column col = (Column) iter.next();
+      if (!col.isPrimaryKeyPart()) {
+        nonKeyColumns.add(col);
+      }
+    }
+    int i = 0;
+    i = getPreparedStatementParameters(jm, stmt, elem, nonKeyColumns.iterator(), i);
+    getPreparedStatementParameters(jm, stmt, elem, table.getPrimaryKey().getColumns(), i);
+    jm.addLine(stmt, ".executeUpdate();");
+
+    getFinally(jm, stmt, null, null);
+    getFinally(jm, connection, new Object[]{JavaSource.getQuoted("Failed to execute query "),
+                                            " + ", query}, null);
+    return jm;
+  }
+
+  protected JavaMethod getPMClassDeleteMethod(TypeSG pController, JavaSource pSource, CustomTableData pData)
+      throws SAXException {
+    JavaMethod jm = pSource.newJavaMethod("delete", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+    Parameter pElement = jm.addParam(Element.class, "pElement");
+    jm.addThrows(PMException.class);
+    Table table = pData.getTable();
+
+    JavaQName qName = pController.getComplexTypeSG().getClassContext().getXMLInterfaceName();
+    LocalJavaField elem = jm.newJavaField(qName);
+    elem.addLine("(", qName, ") ", pElement);
+
+    String q = table.getSchema().getSQLFactory().newSQLGenerator().getQuery(table.getDeleteStatement());    
+    LocalJavaField query = jm.newJavaField(String.class);
+    query.setFinal(true);
+    query.addLine(JavaSource.getQuoted(q));
+
+    LocalJavaField connection = jm.newJavaField(Connection.class);
+    connection.addLine("null");
+    jm.addTry();
+    jm.addLine(connection, " = getConnection();");
+
+    LocalJavaField stmt = jm.newJavaField(PreparedStatement.class);
+    stmt.addLine(connection, ".prepareStatement(", query, ")");
+    jm.addTry();
+    getPreparedStatementParameters(jm, stmt, elem, table.getPrimaryKey().getColumns(), 0);
+    jm.addLine(stmt, ".executeUpdate();");
+
+    getFinally(jm, stmt, null, null);
+    getFinally(jm, connection, new Object[]{JavaSource.getQuoted("Failed to execute query "),
+                                            " + ", query}, null);
+    return jm;
+  }
+
+  protected JavaMethod getPMClassSelectMethod(TypeSG pController, JavaSource pSource, CustomTableData pData)
+      throws SAXException {
+    JavaMethod jm = pSource.newJavaMethod("select", JavaQNameImpl.VOID, JavaSource.PUBLIC);
+    Parameter pObserver = jm.addParam(Observer.class, "pObserver");
+    Parameter pQuery = jm.addParam(String.class, "pQuery");
+    Parameter pParams = jm.addParam(PMParams.class, "pParams");
+    jm.addThrows(PMException.class);
+    Table table = pData.getTable();
+
+    JavaQName qName = pController.getComplexTypeSG().getClassContext().getXMLInterfaceName();
+    StringBuffer sb = new StringBuffer();
+    for (Iterator iter = table.getColumns();  iter.hasNext();  ) {
+      Column col = (Column) iter.next();
+      if (sb.length() > 0) sb.append(", ");
+      sb.append(col.getName().getName());
+    }
+    LocalJavaField query = jm.newJavaField(String.class);
+    jm.addIf(pParams, " != null  &&  pParams.isDistinct()");
+    jm.addLine(query, " = ", JavaSource.getQuoted("SELECT DISTINCT"), ";");
+    jm.addElse();
+    jm.addLine(query, " = ", JavaSource.getQuoted("SELECT"), ";");
+    jm.addEndIf();
+    jm.addLine(query, " += ", JavaSource.getQuoted(" " + sb + " FROM " + table.getQName()), ";");
+    jm.addIf(pQuery, " != null");
+    jm.addLine(query, " += ", JavaSource.getQuoted(" WHERE "), " + ", pQuery, ";");
+    jm.addEndIf();
+
+    LocalJavaField connection = jm.newJavaField(Connection.class);
+    connection.addLine("null");
+    jm.addTry();
+    jm.addLine(connection, " = getConnection();");
+    LocalJavaField stmt = jm.newJavaField(PreparedStatement.class);
+    stmt.addLine(connection, ".prepareStatement(", query, ")");
+    jm.addTry();
+    LocalJavaField rs = jm.newJavaField(ResultSet.class);
+    rs.addLine(stmt, ".executeQuery();");
+    jm.addTry();
+    jm.addWhile(rs, ".next()");
+    LocalJavaField elem = jm.newJavaField(qName);
+    elem.addLine("(", qName, ") create()");
+    getResultSet(jm, rs, elem, table.getColumns(), 0);
+    jm.addLine(pObserver, ".notify(", elem, ");");
+    jm.addEndWhile();
+
+    getFinally(jm, rs, null, null);
+    getFinally(jm, stmt, null, null);
+    Object sqlMsg = new Object[]{JavaSource.getQuoted("Failed to execute query "),
+                                 " + ", query};
+    Object jaxbMsg = new Object[]{JavaSource.getQuoted("Failed to create instance of  "),
+                                 " + ", qName, ".class.getName()"};
+    getFinally(jm, connection, sqlMsg, jaxbMsg);
+    return jm;
+  }
+
+  protected void getPMClass(TypeSG pController, JavaSource pSource, CustomTableData pTableData) throws SAXException {
+    pSource.addExtends(PMJdbcImpl.class);
+    getPMClassInsertMethod(pController, pSource, pTableData);
+    getPMClassUpdateMethod(pController, pSource, pTableData);
+    getPMClassDeleteMethod(pController, pSource, pTableData);
+    getPMClassSelectMethod(pController, pSource, pTableData);
+  } 
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/TableDetails.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/TableDetails.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/TableDetails.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.jaxme.pm.generator.jdbc;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TableDetails extends ConnectionDetails {
+  protected TableDetails(JaxMeJdbcSG pJdbcSG, XsObject pParent) throws SAXException {
+    super(pJdbcSG, pParent);
+
+    XSSchema schema = pParent.getXsESchema().getContext().getXSSchema();
+    if (schema != null) {
+      ConnectionDetails details = (ConnectionDetails)
+        XSUtil.getSingleAppinfo(schema.getAnnotations(), ConnectionDetails.class);
+      if (details != null) {
+        cloneFrom(details);
+      }
+    }
+  }
+
+  private String name;
+  private List keys;
+  /** Sets the tables name.
+   */
+  public void setName(String pName) {
+    name = pName;
+  }
+  /** Returns the tables name.
+   */
+  public String getName() {
+    return name;
+  }
+  /** Sets the names of the primary key columns.
+   */
+  public void setKeys(String pKeys) {
+    if (keys == null) {
+      keys = new ArrayList();
+    }
+    for (StringTokenizer st = new StringTokenizer(pKeys, ", ");  st.hasMoreTokens();  ) {
+      keys.add(st.nextToken());
+    }
+  }
+  /** Returns the names of the primary key columns.
+   */
+  public List getKeys() {
+    return keys;
+  }
+  /** Copies the current details from the given.
+   */
+  public void cloneFrom(TableDetails pFrom) {
+    super.cloneFrom(pFrom);
+    name = pFrom.name;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (name == null  ||  name.length() == 0) {
+      throw new LocSAXException("Missing or empty 'table' attribute.", getLocator());
+    }
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/generator/jdbc/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm.generator.jdbc Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Basic implementation for generation of generic JDBC-backed persistent source.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMIdImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMIdImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMIdImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.PMException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class PMIdImpl extends PMImpl {
+  private static final Class[] ZERO_CLASSES = new Class[0];
+  private static final Object[] ZERO_OBJECTS = new Object[0];
+  private String getIdMethodName;
+
+  public void init(JMManager pManager) throws JAXBException {
+    String methodName = pManager.getProperty("xmldb.getIdMethodName");
+    if (methodName == null  ||  methodName.length() == 0) {
+      throw new JAXBException("Missing property: 'xmldb.getIdMethodName' (method name for reading the object ID)");
+    }
+    setGetIdMethodName(methodName);
+  }
+
+  /** <p>Sets the name of the method fetching the object ID.</p>
+   */
+  public void setGetIdMethodName(String pProperty) {
+    getIdMethodName = pProperty;
+  }
+
+  /** <p>Returns the name of the method fetching the object ID.</p>
+   */
+  public String getGetIdMethodName() {
+    return getIdMethodName;
+  }
+
+  protected String getId(Element pElement)
+      throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
+              PMException {
+    String getMethodName = getGetIdMethodName();
+    Method m = pElement.getClass().getMethod(getMethodName, ZERO_CLASSES);
+    Object o = m.invoke(pElement, ZERO_OBJECTS);
+    if (o == null) {
+      throw new PMException("The method " + getMethodName + " returned null, which is no valid ID.");
+    }
+    return o.toString();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/PMImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.impl;
+
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.DatatypeConverter;
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.Observer;
+import org.apache.ws.jaxme.PM;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.PMParams;
+
+/** <p>Abstract base class for persistence managers.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class PMImpl implements PM {
+  private JMManager manager;
+
+  /** <p>Creates a new instance of PMImpl.java.</p>
+   */
+  public PMImpl() {
+  }
+
+  public void init(JMManager pManager) throws JAXBException {
+    manager = pManager;
+  }
+
+  public JMManager getManager() {
+    return manager;
+  }
+
+  public void select(Observer pObserver, String pQuery) throws JAXBException {
+    select(pObserver, pQuery, null);
+  }
+
+  public Iterator select(String pQuery) throws JAXBException {
+    return select(pQuery, null);
+  }
+
+  /** The <code>ListObserver</code> is a basic
+   * {@link Observer}, which collects result objects
+   * in a {@link List}.
+   */
+  public static class ListObserver implements Observer {
+    private List list;
+    /** Creates a new <code>ListObserver</code>, which writes
+     * the received objects into the {@link List}
+     * <code>pList</code>.
+     */
+    public ListObserver(List pList) {
+      list = pList;
+    }
+    public void notify(Object pObservable) {
+      list.add(pObservable);
+    }
+  }
+
+  public Iterator select(String pQuery, PMParams pPlaceHolderArgs) throws JAXBException {
+    List result = new ArrayList();
+    ListObserver observer = new ListObserver(result);
+    select(observer, pQuery, pPlaceHolderArgs);
+    return result.iterator();
+  }
+
+  public Object create() throws JAXBException {
+    return manager.getElementJ();
+  }
+
+  protected String parseQuery(String pQuery, PMParams pPlaceHolderArgs) throws PMException {
+    if (pPlaceHolderArgs == null) {
+      return pQuery;
+    }
+    Iterator iter = pPlaceHolderArgs.getParams();
+    if (!iter.hasNext()) {
+      return pQuery;
+    }
+    StringBuffer sb = new StringBuffer();
+    boolean inStr = false;
+    char delim = 0;
+    for (int i = 0;   i < pQuery.length();  i++) {
+      char c = pQuery.charAt(i);
+      if (inStr) {
+        if (c == delim) {
+          inStr = false;
+        }
+        sb.append(c);
+      } else {
+        switch (c) {
+          case '\'':
+            inStr = true;
+            delim = c;
+            sb.append(c);
+            break;
+          case '?':
+            if (!iter.hasNext()) {
+              throw new PMException("Number of placeholder marks exceeds number of actual parameters");
+            }
+            PMParams.Param param = (PMParams.Param) iter.next();
+            switch (param.getType()) {
+              case Types.VARCHAR:
+                sb.append('\'');
+                sb.append(param.getValue());
+                sb.append('\'');
+                break;
+              case Types.BIGINT:
+              case Types.INTEGER:
+              case Types.SMALLINT:
+              case Types.TINYINT:
+                sb.append(param.getValue());
+                break;
+              case Types.TIMESTAMP:
+                sb.append('\'');
+                sb.append(DatatypeConverter.printDateTime((Calendar) param.getValue()));
+                sb.append('\'');
+                break;
+              case Types.DATE:
+                sb.append('\'');
+                sb.append(DatatypeConverter.printDate((Calendar) param.getValue()));
+                sb.append('\'');
+                break;
+              case Types.TIME:
+                sb.append('\'');
+                sb.append(DatatypeConverter.printTime((Calendar) param.getValue()));
+                sb.append('\'');
+                break;
+              default:
+                throw new PMException("Invalid parameter type: " + param.getType());
+            }
+            break;
+          default:
+            sb.append(c);
+            break;
+        }
+      }
+    }
+    if (inStr) {
+      throw new PMException("Failed to parse query, expected trailing " + delim + " character: " + pQuery);
+    }
+    if (iter.hasNext()) {
+      throw new PMException("Number of actual parameters exceeds number of placeholder marks.");
+    }
+    return sb.toString();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Basic implementation classes for
+the <code>JaxMe</code> persistence management framework.
+    </p>
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/IURLEncoder.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/IURLEncoder.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/IURLEncoder.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,13 @@
+package org.apache.ws.jaxme.pm.ino;
+
+import java.io.UnsupportedEncodingException;
+
+
+/** This interface allows to choose between JDK 1.3
+ * and JDK 1.4 dependent classes.
+ */
+public interface IURLEncoder {
+    /** Encodes the string <code>pValue</code>.
+     */
+    public String encode(String pValue) throws UnsupportedEncodingException;
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.ino;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>A SAX exception indicating an error in a Tamino response
+ * document.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class InoException extends SAXException {
+  String inoErrorCode;
+  String inoErrorMessage;
+
+  /**
+   * Creates a new instance of <code>InoException</code> with
+   * the given error code and message.
+   */
+  public InoException(String pInoErrorCode, String pInoErrorMessage) {
+    super(pInoErrorCode + ": " + pInoErrorMessage);
+    inoErrorCode = pInoErrorCode;
+    inoErrorMessage = pInoErrorMessage;
+  }
+
+  /** <p>Returns the Tamino error code.</p>
+   */
+  public String getInoErrorCode() {
+    return inoErrorCode;
+  }
+
+  /** <p>Returns the Tamino error message.</p>
+   */
+  public String getInoErrorMessage() {
+    return inoErrorMessage;
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoManager.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoManager.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoManager.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,330 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.pm.ino;
+
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.SAXException;
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.JMUnmarshallerHandler;
+import org.apache.ws.jaxme.Observer;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.PMParams;
+import org.apache.ws.jaxme.pm.impl.PMIdImpl;
+
+
+
+/** <p>An implementation of a JMManager for a Tamino database.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>s
+ */
+public class InoManager extends PMIdImpl {
+  private java.net.URL dbURL;
+  private String user, password;
+  private String idTag, elementTag;
+  private boolean useGet;
+  private static final javax.xml.parsers.SAXParserFactory spf;
+  private static final IURLEncoder encoder;
+
+  static {
+    spf = SAXParserFactory.newInstance();
+    spf.setNamespaceAware(true);
+    spf.setValidating(false);
+    IURLEncoder e;
+    try {
+        String myClassName = InoManager.class.getName();
+        int offset = myClassName.lastIndexOf('.');
+        String packageName = myClassName.substring(0, offset);
+        e = (IURLEncoder) Class.forName(packageName + ".URLEncoder14").newInstance();
+    } catch (Throwable t) {
+    	e = new URLEncoder();
+    }
+    encoder = e;
+  }
+
+  protected String getUser() {
+      return user;
+  }
+
+  protected String getPassword() {
+      return password;
+  }
+
+  /** Returns the qualified element name of the root element.
+   * This is used in delete or select queries for creation
+   * of an XPath query.
+   */
+  public String getElementTag() {
+    return elementTag;
+  }
+
+  /** Sets the qualified element name of the root element.
+   * This is used in delete or select queries for creation
+   * of an XQL statement.
+   */
+  public void setElementTag(String pElementTag) {
+    elementTag = pElementTag;
+  }
+
+  /** Returns the qualified attribute name of the ID attribute.
+   * This is used in delete or update queries for creation
+   * of an XQL statement.
+   */
+  public String getIdTag() {
+    return idTag;
+  }
+
+  /** Returns the qualified attribute name of the ID attribute.
+   * This is used in delete or update queries for creation
+   * of an XQL statement.
+   */
+  public void setIdTag(String pIdTag) {
+    idTag = pIdTag;
+  }
+
+  public void init(JMManager pManager) throws JAXBException {
+    super.init(pManager);
+    idTag = pManager.getProperty("ino.idTag");
+    if (idTag == null  ||  idTag.length() == 0) {
+      throw new JAXBException("Missing property: 'ino.idTag' (Tag name or attribute name of the element ID)");
+    }
+    elementTag = pManager.getProperty("ino.elementTag");
+    if (elementTag == null  ||  elementTag.length() == 0) {
+      throw new JAXBException("Missing property: 'ino.elementTag' (Qualified element name, including namespace prefix)");
+    }
+    String url = pManager.getProperty("ino.url");
+    if (url == null  ||  url.length() == 0) {
+      throw new JAXBException("Missing property: 'ino.url' (Tamino database URL)");
+    }
+    user = pManager.getProperty("ino.user");
+    password = pManager.getProperty("ino.password");
+    useGet = Boolean.valueOf(pManager.getProperty("ino.useGet")).booleanValue();
+  }
+
+  /** <p>Returns a query suited for deleting the element.</p>
+   */
+  protected String getDeleteQuery(Element pElement)
+      throws JAXBException, InvocationTargetException, IllegalAccessException,
+  			 NoSuchMethodException, UnsupportedEncodingException {
+    String id = getId(pElement);
+    if (id == null  ||  id.length() == 0) {
+      throw new JAXBException("The element being deleted doesn't have an ID.");
+    }
+    return "_delete=" +
+      encoder.encode(getElementTag() + '[' + getIdTag() + '=' + id + ']');
+  }
+
+  /** <p>Returns a query suited for updating the element.</p>
+   */
+  protected String getUpdateQuery(Element pElement)
+  		throws JAXBException, UnsupportedEncodingException {
+    StringWriter sw = new StringWriter();
+    Marshaller marshaller = getManager().getFactory().createMarshaller();
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+    marshaller.marshal(pElement, sw);
+    return "_process=" + encoder.encode(sw.toString());
+  }
+
+  /** <p>Returns a query suited for inserting the element.</p>
+   */
+  protected String getInsertQuery(Element pElement)
+  		throws JAXBException, UnsupportedEncodingException {
+    StringWriter sw = new StringWriter();
+    Marshaller marshaller = getManager().getFactory().createMarshaller();
+    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
+    marshaller.marshal(pElement, sw);
+    return "_process=" + encoder.encode(sw.toString());
+  }
+
+  /** <p>Performs a single database query.</p>
+   */
+  protected java.net.HttpURLConnection getResponse(String pQuery) throws SAXException {
+    java.net.URL connectionURL = dbURL;
+    try {
+      if (useGet) {
+        String dburl = connectionURL.toString();
+        String url;
+        if (dburl.indexOf('?') > 0) {
+          url = dburl + "&" + pQuery;
+        } else {
+          url = dburl + "?" + pQuery;
+        }
+        try {
+          connectionURL = new java.net.URL(url);
+          java.net.HttpURLConnection conn =
+            (java.net.HttpURLConnection) connectionURL.openConnection();
+          conn.setDoOutput(false);
+          conn.setDoInput(true);
+          return conn;
+        } catch (java.net.MalformedURLException e) {
+          throw new SAXException("Malformed database URL: " + url);
+        }
+      } else {
+        java.net.HttpURLConnection conn =
+          (java.net.HttpURLConnection) connectionURL.openConnection();
+        conn.setDoOutput(true);
+        conn.setDoInput(true);
+
+        java.io.OutputStream ostream = conn.getOutputStream();
+        java.io.Writer w = new java.io.OutputStreamWriter(ostream);
+        w.write(pQuery);
+        w.close();
+        return conn;
+      }
+    } catch (java.io.IOException e) {
+      throw new SAXException("I/O Error: " + e.getMessage(), e);
+    }
+  }
+
+  /** <p>Performs a single database query.</p>
+   */
+  protected InoResponseHandler performQuery(String pQuery, java.util.List pList)
+      throws SAXException {
+    InoResponseHandler irh = new InoResponseHandler();
+    if (pList != null) {
+      irh.setInoObjectIdList(pList);
+    }
+    performQuery(pQuery, irh);
+    return irh;
+  }
+
+  /** <p>Parses a single INO response document.</p>
+   */
+  protected void performQuery(String pQuery, InoResponseHandler pHandler)
+      throws SAXException {
+    java.net.HttpURLConnection conn = getResponse(pQuery);
+    try {
+      org.xml.sax.InputSource isource = new org.xml.sax.InputSource(conn.getInputStream());
+      isource.setEncoding(conn.getContentEncoding());
+      org.xml.sax.XMLReader xr;
+      javax.xml.parsers.SAXParser sp = spf.newSAXParser();
+      xr = sp.getXMLReader();
+      xr.setContentHandler(pHandler);
+      xr.parse(isource);
+    } catch (javax.xml.parsers.ParserConfigurationException e) {
+      throw new SAXException("ParserConfigurationException: " + e.getMessage(), e);
+    } catch (java.io.IOException e) {
+      throw new SAXException("I/O Exception: " + e.getMessage(), e);
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#select(org.apache.ws.jaxme.Observer, java.lang.String, org.apache.ws.jaxme.PMParams)
+   */
+  public void select(Observer pObserver, String pQuery, PMParams pPlaceHolderArgs) throws JAXBException {
+    pQuery = super.parseQuery(pQuery, pPlaceHolderArgs);
+    String q;
+    int max = pPlaceHolderArgs.getMaxResultDocuments();
+    int skip = pPlaceHolderArgs.getSkippedResultDocuments();
+    if (max != 0  ||  skip != 0) {
+      q = "_xql(" + (skip+1) + "," + max + ")=";
+    } else {
+      q = "_xql=";
+    }
+
+    InoResponseHandler irh = new InoResponseHandler();
+	try {
+		q += encoder.encode(pQuery);
+	} catch (UnsupportedEncodingException e) {
+		throw new PMException(e);
+	}
+	JMUnmarshallerHandler handler = (JMUnmarshallerHandler) getManager().getFactory().createUnmarshaller().getUnmarshallerHandler();
+	handler.setObserver(pObserver);
+	irh.setResultHandler(handler);
+	try {
+		performQuery(q, irh);
+	} catch (SAXException e) {
+		throw new PMException(e);
+	}
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#insert(javax.xml.bind.Element)
+   */
+  public void insert(javax.xml.bind.Element pElement) throws PMException {
+    try {
+      String query = getInsertQuery(pElement);
+      java.util.List idList = new java.util.ArrayList();
+      performQuery(query, idList);
+      if (idList.size() == 0) {
+        throw new PMException("Query did not return an ino:id");
+      }
+    } catch (SAXException e) {
+      throw new PMException(e);
+    } catch (JAXBException e) {
+      if (e instanceof PMException) {
+        throw (PMException) e;
+      } else {
+        throw new PMException(e);
+      }
+    } catch (UnsupportedEncodingException e) {
+        throw new PMException(e);
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#update(javax.xml.bind.Element)
+   */
+  public void update(javax.xml.bind.Element pElement) throws PMException {
+      try {
+          String query = getUpdateQuery(pElement);
+          performQuery(query, (java.util.List) null);
+      } catch (SAXException e) {
+          throw new PMException(e);
+      } catch (UnsupportedEncodingException e) {
+          throw new PMException(e);
+      } catch (JAXBException e) {
+          if (e instanceof PMException) {
+              throw (PMException) e;
+          } else {
+              throw new PMException(e);
+          }
+      }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#delete(javax.xml.bind.Element)
+   */
+  public void delete(javax.xml.bind.Element pElement) throws PMException {
+    try {
+      String query = getDeleteQuery(pElement);
+      performQuery(query, (java.util.List) null);
+    } catch (NoSuchMethodException e) {
+      throw new PMException(e);
+    } catch (IllegalAccessException e) {
+      throw new PMException(e);
+    } catch (InvocationTargetException e) {
+      throw new PMException(e.getTargetException());
+    } catch (SAXException e) {
+      throw new PMException(e);
+    } catch (JAXBException e) {
+      if (e instanceof PMException) {
+        throw (PMException) e;
+      } else {
+        throw new PMException(e);
+      }
+    } catch (UnsupportedEncodingException e) {
+        throw new PMException(e);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoObject.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoObject.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoObject.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.ino;
+
+import org.apache.ws.jaxme.JMElement;
+
+/** <p>Interface of a document stored in Tamino.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface InoObject extends JMElement {
+	/** Sets the objects document name. May be null,
+     * because a document is typically not required.
+	 */
+    public void setInoDocname(String pDocname);
+
+    /** Sets the objects ino:id. May be null,
+     * because an ino:id is no longer required
+     * nowadays.
+     */
+    public void setInoId(String pId);
+
+    /** Returns the objects document name. May be null,
+     * because a document is typically not required.
+     */
+    public String getInoDocname();
+
+    /** Returns the objects ino:id. May be null,
+     * because an ino:id is no longer required
+     * nowadays.
+     */
+    public String getInoId();
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoResponseHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoResponseHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/InoResponseHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.ino;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>This is a SAX content handler for an ino:response document.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class InoResponseHandler implements ContentHandler {
+  /** <p>The namespace of an INO response document:
+   * <samp>http://namespaces.softwareag.com/tamino/response2</samp>.</p>
+   */
+  public static final String INO_RESPONSE2_URI =
+    "http://namespaces.softwareag.com/tamino/response2";
+  /** <p>The namespace of the XQL section in an INO response
+   * document: <samp>http://metalab.unc.edu/xql/</samp>.</p>
+   */
+  public static final String XQL_URI = "http://metalab.unc.edu/xql/";
+
+
+  private boolean inInoMessage = false;
+  private boolean inInoMessageText;
+  private boolean inXqlResult;
+  private int level;
+  private String inoErrorCode;
+  private StringBuffer inoErrorMessage;
+  private Locator locator;
+  private ContentHandler resultHandler;
+
+  /** Creates a new InoResponseHandler */
+  public InoResponseHandler() {}
+
+  public void setDocumentLocator(Locator l) {
+    locator = l;
+  }
+
+  /** Returns the document {@link Locator}, that was
+   * previously set by the XML parser. May be null, if
+   * the parser didn't supply one.
+   */
+  public Locator getDocumentLocator() {
+    return locator;
+  }
+
+  public void startDocument() throws org.xml.sax.SAXException {
+    inInoMessage = false;
+    inInoMessageText = false;
+    inXqlResult = false;
+    level = 0;
+    if (inoObjectIdList != null) {
+      inoObjectIdList.clear();
+    }
+  }
+
+  public void endDocument() throws org.xml.sax.SAXException {
+  }
+  
+  public void startElement(String namespaceUri, String localName,
+                           String qName, Attributes attr) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        if (level == 2) {
+          resultHandler.startDocument();
+        }
+        resultHandler.startElement(namespaceUri, localName, qName, attr);
+      }
+    } else if (inInoMessage) {
+      if (level == 2) {
+        if (INO_RESPONSE2_URI.equals(namespaceUri)  &&
+            "messagetext".equals(localName)) {
+          String c = attr.getValue(INO_RESPONSE2_URI, "code");
+          if (c != null) {
+            inoErrorCode = c;
+          }
+          inInoMessageText = true;
+        }
+      }
+    } else if (level == 1) {
+      if (XQL_URI.equals(namespaceUri)  &&  "result".equals(localName)) {
+        inXqlResult = true;
+      } else if (INO_RESPONSE2_URI.equals(namespaceUri)) {
+        if ("message".equals(localName)) {
+          String retval = attr.getValue(INO_RESPONSE2_URI, "returnvalue");
+          if (retval == null  ||  !retval.equals("0")) {
+            inoErrorCode = retval;
+            inoErrorMessage = new StringBuffer();
+            inInoMessage = true;
+          }
+        } else if (inoObjectIdList != null && "object".equals(localName)) {
+          inoObjectIdList.add(attr.getValue(INO_RESPONSE2_URI, "id"));
+        }
+      }
+    }
+    ++level;
+  }
+
+  public void endElement(String namespaceUri, String localName,
+                         String qName) throws SAXException {
+    level--;
+    if (inXqlResult) {
+      if (level == 1) {
+        inXqlResult = false;
+      } else {
+        if (resultHandler != null) {
+          resultHandler.endElement(namespaceUri, localName, qName);
+          if (level == 2) {
+            resultHandler.endDocument();
+          }
+        }
+      }
+    } else if (inInoMessage) {
+      if (level == 1) {
+        if (inoErrorCode == null) {
+          inoErrorCode = "INOUNKNOWN";
+        }
+        throw new InoException(inoErrorCode, inoErrorMessage.toString());
+      } else if (level == 2) {
+        if (inInoMessageText) {
+          inInoMessageText = false;
+        }
+      }
+    }
+  }
+
+  public void startPrefixMapping(String namespaceUri,
+                                 String prefix) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        resultHandler.startPrefixMapping(namespaceUri, prefix);
+      }
+    }
+  }
+  
+  public void endPrefixMapping(String prefix) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        resultHandler.endPrefixMapping(prefix);
+      }
+    }
+  }
+  
+  public void ignorableWhitespace(char[] ch, int start, int len) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        resultHandler.ignorableWhitespace(ch, start, len);
+      }
+    }
+  }
+  
+  public void skippedEntity(String entity) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        resultHandler.skippedEntity(entity);
+      }
+    }
+  }
+  
+  public void processingInstruction(String target, String data) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        resultHandler.processingInstruction(target, data);
+      }
+    }
+  }
+  
+  public void characters(char[] ch, int start, int len) throws SAXException {
+    if (inXqlResult) {
+      if (resultHandler != null) {
+        resultHandler.characters(ch, start, len);
+      }
+    } else if (inInoMessageText) {
+      inoErrorMessage.append(ch, start, len);
+    }
+  }
+
+  /** <p>Sets the result handler. The result handler is another SAX ContentHandler.
+   * For any result document the InoResponseHandler finds, that is, for any
+   * subelement of xql:result, a stream of SAX events is generated for the
+   * result handler.</p>
+   * <p>If the response document contains more than one result object, then the
+   * result handler must be "restartable". In other words, it must be able to
+   * process multiple startDocument ... endDocument startDocument ...
+   * endDocument sequences.</p>
+   *
+   * @param handler The result handler to use or null to disable SAX events
+   * @see #getResultHandler
+   */
+  public void setResultHandler(ContentHandler handler) {
+    resultHandler = handler;
+  }
+
+  /** <p>Returns a result handler, that was previously set with setResultHandler,
+   * or null.</p>
+   * <p>The result handler is another SAX ContentHandler.
+   * For any result document the InoResponseHandler finds, that is, for any
+   * subelement of xql:result, a stream of SAX events is generated for the
+   * result handler.</p>
+   * <p>If the response document contains more than one result object, then the
+   * result handler must be "restartable". In other words, it must be able to
+   * process multiple startDocument ... endDocument startDocument ...
+   * endDocument sequences.</p>
+   *
+   * @return The result handler or null, if generating SAX events is disabled.
+   */
+  public ContentHandler getResultHandler() {
+    return resultHandler;
+  }
+
+  private java.util.List inoObjectIdList;
+  /** <p>The Tamino response document contains object ID's of inserted
+   * or updated objects. If you use this method, then the ID's are
+   * collected in the given List. A null value disables ID
+   * collection. The list will be cleared within <code>startDocument</code>,
+   * so it's safe to reuse the list over multiple uses of the handler.</p>
+   * <p>More precise, the list will contain all occurences of
+   * ino:response/ino:object/@ino:id.</p>
+   *
+   * @param pList A list where ID's are being collected or null to disable
+   *   ID collection.
+   * @see #getInoObjectIdList
+   */
+  public void setInoObjectIdList(java.util.List pList) {
+    inoObjectIdList = pList;
+  }
+  /** <p>Returns the current list for collection of generated ino:id's.</p>
+   *
+   * @see #setInoObjectIdList
+   */
+  public java.util.List getInoObjectIdList() { return inoObjectIdList; }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.pm.ino;
+
+
+/** Utility class for URL encoding with Java 1.3 and below.
+ */
+public class URLEncoder implements IURLEncoder {
+	/** Encodes the string <code>pValue</code>.
+	 */
+    public String encode(String pValue) {
+    	return java.net.URLEncoder.encode(pValue);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder14.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder14.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/URLEncoder14.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.pm.ino;
+
+import java.io.UnsupportedEncodingException;
+
+
+/** Utility class for URL encoding with Java 1.3 and below.
+ */
+public class URLEncoder14 implements IURLEncoder {
+	/** Encodes the string <code>pValue</code>.
+	 */
+    public String encode(String pValue) throws UnsupportedEncodingException {
+    	return java.net.URLEncoder.encode(pValue, "UTF8");
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/DocumentDefaultHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.ino.api4j;
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
+import org.apache.ws.jaxme.pm.ino.InoObject;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXDocument;
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXDocumentDefaultHandler;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class DocumentDefaultHandler extends TSAXDocumentDefaultHandler {
+    private static final ThreadLocal handler = new ThreadLocal();
+
+    static JMUnmarshallerHandlerImpl getUnmarshallerHandler() {
+        return (JMUnmarshallerHandlerImpl) handler.get();
+    }
+
+    static void setUnmarshallerHandler(JMUnmarshallerHandlerImpl pHandler) {
+        handler.set(pHandler);
+    }
+
+    public void startDocument() throws SAXException {
+        getUnmarshallerHandler().startDocument();
+    }
+
+    public void endDocument() throws SAXException {
+        getUnmarshallerHandler().endDocument();
+    }
+
+    public void startElement(String pNamespaceURI, String pLocalName, String pQName,
+							 Attributes pAttr) throws SAXException {
+        getUnmarshallerHandler().startElement(pNamespaceURI, pLocalName, pQName, pAttr);
+    }
+
+    public void endElement(String pNamespaceURI, String pLocalName, String pQName)
+    		throws SAXException {
+        getUnmarshallerHandler().endElement(pNamespaceURI, pLocalName, pQName);
+    }
+
+    public void characters(char[] pBuffer, int pOffset, int pLen) throws SAXException {
+        getUnmarshallerHandler().characters(pBuffer, pOffset, pLen);
+    }
+
+    public void ignorableWhitespace(char[] pBuffer, int pOffset, int pLen) throws SAXException {
+        getUnmarshallerHandler().ignorableWhitespace(pBuffer, pOffset, pLen);
+    }
+
+    public void processingInstruction(String pTarget, String pData) throws SAXException {
+        getUnmarshallerHandler().processingInstruction(pTarget, pData);
+    }
+
+    public void skippedEntity(String pEntity) throws SAXException {
+        getUnmarshallerHandler().skippedEntity(pEntity);
+    }
+
+    public void endPrefixMapping(String pPrefix) throws SAXException {
+        getUnmarshallerHandler().endPrefixMapping(pPrefix);
+    }
+
+    public void startPrefixMapping(String pPrefix, String pNamespaceURI) throws SAXException {
+        getUnmarshallerHandler().startPrefixMapping(pPrefix, pNamespaceURI);
+    }
+
+    public void setDocumentLocator(Locator pLocator) {
+        getUnmarshallerHandler().setDocumentLocator(pLocator);
+    }
+
+    public TSAXDocument getDocument() {
+        try {
+	        return new TJMElement((InoObject) getUnmarshallerHandler().getResult());
+        } catch (JAXBException e) {
+            throw new UndeclaredThrowableException(e);
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/ElementDefaultHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.ino.api4j;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.pm.ino.InoObject;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXElement;
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXElementDefaultHandler;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ElementDefaultHandler extends TSAXElementDefaultHandler {
+    static class Data {
+        int level = 0;
+        boolean inDocument = false;
+        boolean iHaveCreatedStartDocument = false;
+        final List result = new ArrayList();
+    }
+    static ThreadLocal data = new ThreadLocal();
+    static void initData() {
+        data.set(new Data());
+    }
+    static void resetData() {
+        data.set(null);
+    }
+
+    private Data getData() {
+        return (Data) data.get();
+    }
+
+    public TSAXElement getFirstElement() {
+        List result = getData().result;
+        if (result.size() > 0) {
+            return new TJMElement((InoObject) result.get(0));
+        } else {
+            return null;
+        }
+    }
+
+    public Iterator getElementIterator() {
+        return new Iterator(){
+            Iterator inner = getData().result.iterator();
+            public void remove() {
+                inner.remove();
+            }
+            public boolean hasNext() {
+                return inner.hasNext();
+            }
+            public Object next() {
+                return new TJMElement((InoObject) inner.next());
+            }
+        };
+    }
+
+    public void startDocument() throws SAXException {
+        Data d = getData();
+        d.iHaveCreatedStartDocument = false;
+        d.inDocument = true;
+        DocumentDefaultHandler.getUnmarshallerHandler().startDocument();
+    }
+
+    public void endDocument() throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().endDocument();
+	        try {
+	            d.result.add(DocumentDefaultHandler.getUnmarshallerHandler().getResult());
+	        } catch (JAXBException e) {
+	            throw new SAXException(e);
+	        }
+	        d.inDocument = false;
+	        d.iHaveCreatedStartDocument = false;
+        }
+    }
+
+    public void startElement(String pNamespaceURI, String pLocalName, String pQName,
+							 Attributes pAttr) throws SAXException {
+        Data d = getData();
+        if (d.level++ == 0  &&  !d.inDocument) {
+            startDocument();
+            d.iHaveCreatedStartDocument = true;
+        }
+        DocumentDefaultHandler.getUnmarshallerHandler().startElement(pNamespaceURI, pLocalName, pQName, pAttr);
+    }
+
+    public void endElement(String pNamespaceURI, String pLocalName, String pQName)
+    		throws SAXException {
+        Data d = getData();
+        DocumentDefaultHandler.getUnmarshallerHandler().endElement(pNamespaceURI, pLocalName, pQName);
+        if (--d.level == 0  &&  d.iHaveCreatedStartDocument) {
+            endDocument();
+        }
+    }
+
+    public void characters(char[] pBuffer, int pOffset, int pLen) throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().characters(pBuffer, pOffset, pLen);
+        }
+    }
+
+    public void ignorableWhitespace(char[] pBuffer, int pOffset, int pLen) throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().ignorableWhitespace(pBuffer, pOffset, pLen);
+        }
+    }
+
+    public void processingInstruction(String pTarget, String pData) throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().processingInstruction(pTarget, pData);
+        }
+    }
+
+    public void skippedEntity(String pEntity) throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().skippedEntity(pEntity);
+        }
+    }
+
+    public void endPrefixMapping(String pPrefix) throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().endPrefixMapping(pPrefix);
+        }
+    }
+
+    public void startPrefixMapping(String pPrefix, String pNamespaceURI) throws SAXException {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().startPrefixMapping(pPrefix, pNamespaceURI);
+        }
+    }
+
+    public void setDocumentLocator(Locator pLocator) {
+        Data d = getData();
+        if (d.inDocument) {
+            DocumentDefaultHandler.getUnmarshallerHandler().setDocumentLocator(pLocator);
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TJMElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.ino.api4j;
+
+import java.io.Writer;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.jaxme.pm.ino.InoObject;
+
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXDocument;
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXElement;
+
+
+/** JaxMe specific implementation of
+ * {@link com.softwareag.tamino.db.api.objectModel.sax.TSAXElement},
+ * and {@link com.softwareag.tamino.db.api.objectModel.sax.TSAXDocument}.
+ */
+public class TJMElement implements TSAXDocument, TSAXElement {
+    private final InoObject element;
+
+    /** Creates a new instance, which reads or writes
+     * the given {@link InoObject}.
+     */
+    public TJMElement(InoObject pElement) {
+        element = pElement;
+    }
+
+    /** Returns the {@link InoObject}, which is being
+     * read, or written.
+     */
+    public InoObject getJMElement() {
+        return element;
+    }
+
+    public TSAXElement getRootElement() {
+        return this;
+    }
+
+    public void writeTo(Writer pWriter) {
+        try {
+            TaminoAPI4JRaPm.getJAXBContext().createMarshaller().marshal(getJMElement(), pWriter);
+        } catch (JAXBException e) {
+            throw new UndeclaredThrowableException(e);
+        }
+    }
+
+    public void setDocname(String pDocname) {
+        element.setInoDocname(pDocname);
+    }
+
+    public void setId(String pId) {
+        element.setInoId(pId);
+    }
+
+    public String getDoctype() {
+        QName qName = element.getQName();
+        String prefix = qName.getPrefix();
+        if (prefix == null  ||  prefix.length() == 0) {
+            return qName.getLocalPart();
+        } else {
+            return prefix + ':' + qName.getLocalPart();
+        }
+    }
+
+    public String getDocname() {
+        String result = element.getInoDocname();
+        return result == null ? "" : result;
+    }
+
+    public String getId() {
+        String result = element.getInoId();
+        return result == null ? "" : result;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JDbPm.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JDbPm.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JDbPm.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.pm.ino.api4j;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.PMException;
+
+import com.softwareag.tamino.db.api.connection.TConnection;
+import com.softwareag.tamino.db.api.connection.TConnectionFactory;
+import com.softwareag.tamino.db.api.connection.TServerNotAvailableException;
+
+
+/** {@link org.apache.ws.jaxme.PM} implementation for accessing
+ * a Tamino database via the basic version of the TaminoAPI4J.
+ */
+public class TaminoAPI4JDbPm extends TaminoAPI4JPm {
+	private String url, user, password;
+
+	/** Sets the database URL. This includes the database name,
+	 * but not the database collection.
+	 */
+	public String getUrl() {
+		return url;
+	}
+
+	/** Returns the database URL. This includes the database name,
+	 * but not the database collection.
+	 */
+	public void setUrl(String pUrl) {
+		url = pUrl;
+	}
+
+	/** Returns the database user.
+	 */
+	public String getUser() {
+		return user;
+	}
+
+	/** Sets the database user.
+	 */
+	public void setUser(String pUser) {
+		user = pUser;
+	}
+
+	/** Returns the database users password.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/** Sets the database users password.
+	 */
+	public void setPassword(String pPassword) {
+		password = pPassword;
+	}
+
+    public void init(JMManager pManager) throws JAXBException {
+        super.init(pManager);
+        url = pManager.getProperty("url");
+        user = pManager.getProperty("user");
+        password = pManager.getProperty("password");
+    }
+
+	protected TConnection getTConnection() throws PMException {
+		TConnectionFactory factory = TConnectionFactory.getInstance();
+		try {
+			return factory.newConnection(url, user, password);
+		} catch (TServerNotAvailableException e) {
+			throw new PMException(e);
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JPm.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.pm.ino.api4j;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.Observer;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.PMParams;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl;
+import org.apache.ws.jaxme.pm.impl.PMImpl;
+import org.apache.ws.jaxme.pm.ino.InoObject;
+
+import com.softwareag.tamino.db.api.accessor.TAccessLocation;
+import com.softwareag.tamino.db.api.accessor.TDeleteException;
+import com.softwareag.tamino.db.api.accessor.TInsertException;
+import com.softwareag.tamino.db.api.accessor.TQuery;
+import com.softwareag.tamino.db.api.accessor.TQueryException;
+import com.softwareag.tamino.db.api.accessor.TUpdateException;
+import com.softwareag.tamino.db.api.accessor.TXMLObjectAccessor;
+import com.softwareag.tamino.db.api.connection.TConnection;
+import com.softwareag.tamino.db.api.objectModel.TIteratorException;
+import com.softwareag.tamino.db.api.objectModel.TNoSuchXMLObjectException;
+import com.softwareag.tamino.db.api.objectModel.TXMLObject;
+import com.softwareag.tamino.db.api.objectModel.TXMLObjectIterator;
+import com.softwareag.tamino.db.api.objectModel.TXMLObjectModel;
+import com.softwareag.tamino.db.api.objectModel.sax.TSAXObjectModel;
+import com.softwareag.tamino.db.api.response.TResponse;
+
+
+/** Common base class for
+ * {@link org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JRaPm}, and
+ * {@link org.apache.ws.jaxme.pm.ino.api4j.TaminoAPI4JDbPm}.
+ */
+public abstract class TaminoAPI4JPm extends PMImpl {
+    private static final ThreadLocal context = new ThreadLocal();
+	private String collection;
+    private static boolean isInitialized;
+    private static TSAXObjectModel model;
+
+    static JAXBContextImpl getJAXBContext() {
+        return (JAXBContextImpl) context.get();
+    }
+
+    static void setJAXBContext(JAXBContextImpl pContext) {
+        context.set(pContext);
+    }
+
+    public void init(JMManager pManager) throws JAXBException {
+        super.init(pManager);
+        if (!isInitialized) {
+            synchronized(TaminoAPI4JRaPm.class) {
+                if (!isInitialized) {
+                    TSAXObjectModel m = new TSAXObjectModel(TaminoAPI4JRaPm.class.getName(),
+                            								TJMElement.class, TJMElement.class,
+                            								new DocumentDefaultHandler(),
+															new ElementDefaultHandler());
+                    TXMLObjectModel.register(m);
+                    model = m;
+                    isInitialized = true;
+                }
+            }
+        }
+        collection = pManager.getProperty("collection");
+        if (collection == null  ||  collection.length() == 0) {
+            throw new JAXBException("The property 'collection' must be set.");
+        }
+    }
+
+	/** Returns the Tamino database collection.
+	 */
+	public String getCollection() {
+	    return collection;
+	}
+
+	/** Sets the Tamino database collection.
+	 */
+	public void setCollection(String pCollection) {
+	    collection = pCollection;
+	}
+
+    protected TXMLObject getTXMLObject(InoObject pElement) {
+        return TXMLObject.newInstance(new TJMElement(pElement));
+    }
+
+    protected TSAXObjectModel getTSAXObjectModel() throws JAXBException {
+        return model;
+    }
+
+    protected abstract TConnection getTConnection() throws PMException;
+
+    public void select(Observer pObserver, String pQuery, PMParams pParams) throws PMException {
+        TConnection conn = null;
+        try {
+        	JAXBContextImpl c = getManager().getFactory();
+            setJAXBContext(c);
+            JMUnmarshallerHandlerImpl h = (JMUnmarshallerHandlerImpl) c.createUnmarshaller().getUnmarshallerHandler();
+            DocumentDefaultHandler.setUnmarshallerHandler(h);
+            ElementDefaultHandler.initData();
+            conn = getTConnection();
+            TXMLObjectAccessor accessor = conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
+            TResponse response = accessor.query(TQuery.newInstance(pQuery));
+            for (TXMLObjectIterator iter = response.getXMLObjectIterator();
+                 iter.hasNext();  ) {
+                TXMLObject object = iter.next();
+                pObserver.notify(((TJMElement) object.getElement()).getJMElement());
+            }
+        } catch (TQueryException e) {
+            throw new PMException(e);
+        } catch (TNoSuchXMLObjectException e) {
+            throw new PMException(e);
+        } catch (TIteratorException e) {
+            throw new PMException(e);
+        } catch (JAXBException e) {
+            throw new PMException(e);
+        } finally {
+            if (conn != null) { try { conn.close(); } catch (Throwable ignore) {} }
+            setJAXBContext(null);
+            DocumentDefaultHandler.setUnmarshallerHandler(null);
+            ElementDefaultHandler.initData();
+        }
+    }
+
+    public void insert(Element pElement) throws PMException {
+        TConnection conn = null;
+        try {
+            setJAXBContext(getManager().getFactory());
+            conn = getTConnection();
+            TXMLObjectAccessor accessor = conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
+            accessor.insert(getTXMLObject((InoObject) pElement));
+        } catch (TInsertException e) {
+            throw new PMException(e);
+        } finally {
+            if (conn != null) { try { conn.close(); } catch (Throwable ignore) {} }
+            setJAXBContext(null);
+        }
+    }
+
+    public void update(Element pElement) throws PMException {
+        TConnection conn = null;
+        try {
+            setJAXBContext(getManager().getFactory());
+            conn = getTConnection();
+            TXMLObjectAccessor accessor = conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
+            accessor.update(getTXMLObject((InoObject) pElement));
+        } catch (TUpdateException e) {
+            throw new PMException(e);
+        } finally {
+            if (conn != null) { try { conn.close(); } catch (Throwable ignore) {} }
+            setJAXBContext(null);
+        }
+    }
+
+    public void delete(Element pElement) throws PMException {
+        TConnection conn = null;
+        try {
+            setJAXBContext(getManager().getFactory());
+            conn = getTConnection();
+            TXMLObjectAccessor accessor = conn.newXMLObjectAccessor(TAccessLocation.newInstance(collection), model);
+            accessor.delete(getTXMLObject((InoObject) pElement));
+        } catch (TDeleteException e) {
+            throw new PMException(e);
+        } finally {
+            if (conn != null) { try { conn.close(); } catch (Throwable ignore) {} }
+            setJAXBContext(null);
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/TaminoAPI4JRaPm.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.pm.ino.api4j;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.PMException;
+
+import com.softwareag.tamino.db.api.connection.TConnection;
+import com.softwareag.tamino.db.api.connection.TServerNotAvailableException;
+import com.softwareag.tamino.db.api.connector.TaminoDataSource;
+
+
+/** {@link org.apache.ws.jaxme.PM} implementation for accessing
+ * a Tamino database via the resource adapter version of the
+ * TaminoAPI4J.
+ */
+public class TaminoAPI4JRaPm extends TaminoAPI4JPm {
+    private String jndiReference;
+
+    /** Returns the JNDI reference.
+     */
+    public String getJndiReference() {
+        return jndiReference;
+    }
+
+    /** Sets the JNDI reference.
+     */
+    public void setJndiReference(String pJndiReference) {
+        jndiReference = pJndiReference;
+    }
+
+    protected TConnection getTConnection() throws PMException {
+    	TaminoDataSource tds;
+    	try {
+    		InitialContext ic = new InitialContext();
+    		tds = (TaminoDataSource) ic.lookup(jndiReference);
+    	} catch (NamingException e) {
+    		throw new PMException(e);
+    	}
+    	try {
+			return tds.getConnection();
+		} catch (TServerNotAvailableException e) {
+			throw new PMException(e);
+		}
+    }
+
+    public void init(JMManager pManager) throws JAXBException {
+        super.init(pManager);
+        jndiReference = pManager.getProperty("jndiReference");
+        if (jndiReference == null  ||  jndiReference.length() == 0) {
+            throw new JAXBException("The property 'jndiReference' must be set.");
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/api4j/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm.ino.api4j Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Persistence manager implementation for Tamino datastore.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/ino/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm.ino Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Specialization of the JaxMe persistence framework for the Tamino datastore.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/PMJdbcImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/PMJdbcImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/PMJdbcImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.jaxme.pm.jdbc;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.pm.impl.PMImpl;
+import org.apache.ws.jaxme.util.ClassLoader;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class PMJdbcImpl extends PMImpl {
+  private String driver, url, user, password;
+
+  /** <p>Creates a new instance of PMJdbcImpl.</p>
+   */
+  public PMJdbcImpl() {
+    super();
+  }
+
+  public void init(JMManager pManager) throws JAXBException {
+    super.init(pManager);
+    String myDriver = pManager.getProperty("jdbc.driver");
+    if (myDriver == null  ||  myDriver.length() == 0) {
+      throw new JAXBException("Missing property: 'jdbc.driver' (JDBC driver class)");
+    }
+    driver = myDriver;
+    try {
+      ClassLoader.getClass(myDriver, Driver.class);
+    } catch (ClassNotFoundException e) {
+      throw new JAXBException("Unable to load driver class " + myDriver);
+    }
+    String myUrl = pManager.getProperty("jdbc.url");
+    if (myUrl == null  ||  myUrl.length() == 0) {
+      throw new JAXBException("Missing property: 'jdbc.url' (JDBC database URL)");
+    }
+    url = myUrl;
+
+    user = pManager.getProperty("jdbc.user");
+
+    password = pManager.getProperty("jdbc.password");
+  }
+
+  /** Returns the configured JDBC driver.
+   */
+  public String getJdbcDriver() {
+    return driver;
+  }
+
+  /** Returns the configured JDBC URL.
+   */
+  public String getJdbcUrl() {
+    return url;
+  }
+
+  /** Returns the configured JDBC user.
+   */
+  public String getJdbcUser() {
+    return user;
+  }
+
+  /** Returns the configured JDBC password.
+   */
+  public String getJdbcPassword() {
+    return password;
+  }
+
+  /** Creates a new database connection.
+   */
+  public Connection getConnection() throws SQLException {
+    return DriverManager.getConnection(getJdbcUrl(), getJdbcUser(), getJdbcPassword());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/jdbc/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm.jdbc Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+This implementation for the the <code>JaxMe</code> persistence management framework
+target JDBC compliant datastores.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/junit/SessionTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/junit/SessionTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/junit/SessionTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.pm.junit;
+
+import java.sql.Connection;
+import java.util.Calendar;
+import java.util.Iterator;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import junit.framework.TestCase;
+import org.apache.ws.jaxme.PM;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.impl.JAXBContextImpl;
+import org.apache.ws.jaxme.test.pm.session.Session;
+import org.apache.ws.jaxme.test.pm.session.impl.SessionTypePM;
+
+
+/** Unit test for the JDBC manager.
+ */
+public class SessionTest extends TestCase {
+  private static int num;
+
+  /** Creates a new instance of the test with the given name.
+   */
+  public SessionTest(String pName) {
+    super(pName);
+  }        
+
+  private JAXBContextImpl getFactory() throws JAXBException {
+    String s = Session.class.getName();
+    int offset = s.lastIndexOf('.');
+    s = s.substring(0, offset);
+    return (JAXBContextImpl) JAXBContext.newInstance(s);
+  }
+
+  private PM getPM() throws JAXBException, PMException {
+    return getFactory().getJMPM(Session.class);
+  }
+
+  private Session getSession(PM pm) throws JAXBException {
+    Session session = (Session) pm.create();
+    session.setCookie("abcdefg" + num++);
+    session.setEXPIRETIME((short) 900);
+    session.setIpAddress("192.168.5.1");
+    Calendar now = Calendar.getInstance();
+    session.setLastAction(now);
+    session.setLOGINTIME(now);
+    session.setPRECEDENCE(3.27);
+    session.setRANDOMSEED(0.01);
+    return session;
+  }
+
+  /** Tests, whether the factory can be created.
+   */
+  public void testCreateFactory() throws Exception {
+    getFactory();
+  }
+
+  /** Tests, whether a manager created.
+   */
+  public void testCreateManager() throws Exception {
+    PM pm = getPM();
+    assertTrue(pm instanceof SessionTypePM);
+    SessionTypePM sessionTypePM = (SessionTypePM) pm;
+    Connection conn = sessionTypePM.getConnection();
+    assertNotNull(conn);
+    assertTrue(conn.getAutoCommit());
+  }
+
+  /** Tests, whether all entries can be removed from
+   * the database.
+   */
+  public void testClear() throws Exception {
+    PM pm = getPM();
+    for (Iterator iter = pm.select(null);  iter.hasNext();  ) {
+      pm.delete((Session) iter.next());
+    }
+  }
+
+  /** Tests, whether a new row can be created,
+   * which is not stored into the database.
+   */
+  public void testCreate() throws Exception {
+    PM pm = getPM();
+    getSession(pm);
+  }
+
+  /** Tests, whether a new row can be created
+   * and stored into the database.
+   */
+  public void testInsert() throws Exception {
+    PM pm = getPM();
+    Session session = getSession(pm);
+    session.setID(1);
+    pm.insert(session);
+    session = getSession(pm);
+    session.setID(2);
+    session.setIpAddress("192.168.5.127");
+    pm.insert(session);
+  }
+
+  /** Test, that reads all rows from the database.
+   */
+  public void testSelectAll() throws Exception {
+    PM pm = getPM();
+    Iterator iter = pm.select("1=1 ORDER BY ID");
+    assertTrue(iter.hasNext());
+    Session session = (Session) iter.next();
+    assertEquals(1, session.getID());
+    assertTrue(iter.hasNext());
+    session = (Session) iter.next();
+    assertEquals(2, session.getID());
+    assertTrue(!iter.hasNext());
+  }
+
+  /** Test, that reads a single row from the database.
+   */
+  public void testSelect() throws Exception {
+    PM pm = getPM();
+    Iterator iter = pm.select("IPADDRESS='192.168.5.127'");
+    assertTrue(iter.hasNext());
+    Session session = (Session) iter.next();
+    assertEquals("192.168.5.127", session.getIpAddress());
+    assertEquals(2, session.getID());
+    assertTrue(!iter.hasNext());
+    assertTrue(!pm.select("IPADDRESS='192.168.5.128'").hasNext());
+  }
+
+  /** Test, that updates a row in the database.
+   */
+  public void testUpdate() throws Exception {
+    PM pm = getPM();
+    Iterator iter = pm.select("IPADDRESS='192.168.5.127'");
+    Session session = (Session) iter.next();
+    session.setIpAddress("192.168.5.128");
+    pm.update(session);
+
+    assertTrue(!pm.select("IPADDRESS='192.168.5.127'").hasNext());
+    iter = pm.select("IPADDRESS='192.168.5.128'");
+    assertTrue(iter.hasNext());
+    session = (Session) iter.next();
+    assertEquals("192.168.5.128", session.getIpAddress());
+    assertEquals(2, session.getID());
+    assertTrue(!iter.hasNext());
+
+    iter = pm.select("IPADDRESS='192.168.5.128'");
+    session = (Session) iter.next();
+    session.setIpAddress("192.168.5.127");
+    pm.update(session);
+
+    testSelect();
+  }
+
+  /** Test, that deletes a row in the database.
+   */
+  public void testDelete() throws Exception {
+    testClear();
+    PM pm = getPM();
+    assertTrue(!pm.select(null).hasNext());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+This contains <a href='http://ws.apache.org/jaxme/pm/'>JaxMePM</a>,
+the <code>JaxMe</code> persistence management framework.
+    </p>
+        <p>
+This code deals with database persistence of <code>JaxMe</code> generated objects.
+Here, the term database is used in a broad sense including support for persisting
+to relational and xml databases.
+    </p>
+</body>
+</html>
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/XmlDbPM.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,338 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.pm.xmldb;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.bind.Element;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.apache.ws.jaxme.JMManager;
+import org.apache.ws.jaxme.JMUnmarshallerHandler;
+import org.apache.ws.jaxme.Observer;
+import org.apache.ws.jaxme.PMException;
+import org.apache.ws.jaxme.PMParams;
+import org.apache.ws.jaxme.pm.impl.PMIdImpl;
+import org.xml.sax.ContentHandler;
+import org.xmldb.api.DatabaseManager;
+import org.xmldb.api.base.Collection;
+import org.xmldb.api.base.Database;
+import org.xmldb.api.base.ResourceIterator;
+import org.xmldb.api.base.ResourceSet;
+import org.xmldb.api.base.XMLDBException;
+import org.xmldb.api.modules.XMLResource;
+import org.xmldb.api.modules.XPathQueryService;
+
+
+/** This is a persistence manager for the XML::DB interface. In other
+ * words, using this persistence manager you may read documents from a
+ * database via the XML::DB API or write them into the database using the
+ * same API.<br>
+ * This persistence manager is generic: The same manager works fine for
+ * any JAXB element.
+ */
+public class XmlDbPM extends PMIdImpl {
+  private Class driverClass;
+  private String collection;
+  private String user;
+  private String password;
+  private Map databaseProperties;
+  private String xPathQueryService = "XPathQueryService";
+  private String xPathQueryServiceVersion = "1.0";
+
+  /** Creates a new instance of <code>XmlDbPM</code>.
+   */
+  public XmlDbPM() {
+  }
+
+  public void init(JMManager pManager) throws JAXBException {
+    super.init(pManager);
+
+    String driverClassName = pManager.getProperty("xmldb.driver");
+    if (driverClassName == null  ||  driverClassName.length() == 0) {
+      throw new JAXBException("Missing property: 'xmldb.driver' (driver class name)");
+    }
+
+    String coll = pManager.getProperty("xmldb.collection");
+    if (coll == null  ||  coll.length() == 0) {
+      throw new JAXBException("Missing property: 'xmldb.collection' (collection name)");
+    }
+    setCollection(coll);
+    setUser(pManager.getProperty("xmldb.user"));
+    setPassword(pManager.getProperty("xmldb.password"));
+
+    for (int i = 0;  ;  i++) {
+      String p = "xmldb.property." + i;
+      String v = pManager.getProperty(p);
+      if (v == null) {
+        break;
+      }
+      int offset = v.indexOf('=');
+      if (offset == -1) {
+        throw new JAXBException("Invalid database property value " + p + ": Expected name=value, got " + v);
+      }
+      String name = v.substring(0, offset);
+      String value = v.substring(offset+1);
+      if (databaseProperties != null) {
+        databaseProperties = new HashMap();
+      }
+      databaseProperties.put(name, value);
+    }
+
+    Class c;
+    try {
+      c = Class.forName(driverClassName);
+    } catch (ClassNotFoundException e) {
+      try {
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+          cl = getClass().getClassLoader();   
+        }
+        c = cl.loadClass(driverClassName);
+      } catch (ClassNotFoundException f) {
+        throw new JAXBException("Failed to load driver class " + driverClassName, e);
+      }
+    }
+    setDriverClass(c);
+  }
+
+  /** Returns the collection name.
+   */
+  public String getCollection() {
+    return collection;
+  }
+
+  /** Sets the collection name.
+   */
+  public void setCollection(String pCollection) {
+    collection = pCollection;
+  }
+
+  /** Returns the driver class.
+   */
+  public Class getDriverClass() {
+    return driverClass;
+  }
+
+  /** Sets the driver class.
+   */
+  public void setDriverClass(Class pDriverClass) {
+    driverClass = pDriverClass;
+  }
+
+  /** Returns the password.
+   */
+  public String getPassword() {
+    return password;
+  }
+
+  /** Sets the password.
+   */
+  public void setPassword(String pPassword) {
+    password = pPassword;
+  }
+
+  /** Returns the users name.
+   */
+  public String getUser() {
+    return user;
+  }
+
+  /** Sets the users name.
+   */
+  public void setUser(String pUser) {
+    user = pUser;
+  }
+
+  /** Returns the name of the XPathQueryService. Defaults to
+   * "XPathQueryService".
+   */
+  public String getXPathQueryService() {
+    return xPathQueryService;
+  }
+
+  /** Sets the name of the XPathQueryService. Defaults to
+   * "XPathQueryService".
+   */
+  public void setXPathQueryService(String pXpathQueryService) {
+    xPathQueryService = pXpathQueryService;
+  }
+
+  /** Returns the version of the XPathQueryService. Defaults to
+   * "1.0".
+   */
+  public String getXPathQueryServiceVersion() {
+    return xPathQueryServiceVersion;
+  }
+
+  /** Sets the version of the XPathQueryService. Defaults to
+   * "1.0".
+   */
+  public void setXPathQueryServiceVersion(String pXpathQueryServiceVersion) {
+    xPathQueryServiceVersion = pXpathQueryServiceVersion;
+  }
+
+  /** Returns the database collection by invoking
+   * {@link DatabaseManager#getCollection(String)}.
+   */
+  protected Collection getXmlDbCollection()
+      throws XMLDBException, IllegalAccessException, InstantiationException {
+    Database database = (Database) getDriverClass().newInstance();
+    if (databaseProperties != null) {
+      for (Iterator iter = databaseProperties.entrySet().iterator();  iter.hasNext();  ) {
+        Map.Entry entry = (Map.Entry) iter.next();
+        database.setProperty((String) entry.getKey(), (String) entry.getValue());
+      }
+    }
+    DatabaseManager.registerDatabase(database); 
+    return DatabaseManager.getCollection(getCollection());
+  }
+
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#select(org.apache.ws.jaxme.Observer, java.lang.String, org.apache.ws.jaxme.PMParams)
+   */
+  public void select(Observer pObserver, String pQuery, PMParams pPlaceHolderArgs) throws JAXBException {
+    if (pPlaceHolderArgs != null) {
+      pQuery = super.parseQuery(pQuery, pPlaceHolderArgs);
+    }
+
+    if (pQuery == null) {
+      throw new IllegalArgumentException("A query must be specified");
+    }
+
+	Collection col;
+	try {
+		col = getXmlDbCollection();
+		XPathQueryService service = (XPathQueryService) col.getService(getXPathQueryService(),
+																	   getXPathQueryServiceVersion());
+		ResourceSet result = service.query(pQuery);
+		if (result != null) {
+			ResourceIterator i = result.getIterator();
+			if (i.hasMoreResources()) {
+				JMUnmarshallerHandler handler = (JMUnmarshallerHandler) getManager().getFactory().createUnmarshaller().getUnmarshallerHandler();
+				handler.setObserver(pObserver);
+				while(i.hasMoreResources()) {
+					XMLResource r = (XMLResource) i.nextResource();
+					r.getContentAsSAX(handler);
+				}
+			}
+		}
+	} catch (XMLDBException e) {
+		throw new PMException(e);
+	} catch (IllegalAccessException e) {
+		throw new PMException(e);
+	} catch (InstantiationException e) {
+		throw new PMException(e);
+	}
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#insert(javax.xml.bind.Element)
+   */
+  public void insert(Element pElement) throws PMException {
+    try {
+      Collection col = getXmlDbCollection();
+      String id = getId(pElement);
+      XMLResource resource = (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
+      ContentHandler ch = resource.setContentAsSAX();
+      Marshaller marshaller = getManager().getFactory().createMarshaller();
+      marshaller.marshal(pElement, ch);
+      col.storeResource(resource);
+    } catch (XMLDBException e) {
+      throw new PMException(e);
+    } catch (IllegalAccessException e) {
+      throw new PMException(e);
+    } catch (InstantiationException e) {
+      throw new PMException(e);
+    } catch (NoSuchMethodException e) {
+      throw new PMException(e);
+    } catch (InvocationTargetException e) {
+      throw new PMException(e.getTargetException());
+    } catch (JAXBException e) {
+      if (e instanceof PMException) {
+        throw (PMException) e;
+      } else {
+        throw new PMException(e);
+      }
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#update(javax.xml.bind.Element)
+   */
+  public void update(Element pElement) throws PMException {
+    try {
+      Collection col = getXmlDbCollection();
+      String id = getId(pElement);
+      XMLResource resource = (XMLResource) col.getResource(id);
+      ContentHandler ch = resource.setContentAsSAX();
+      Marshaller marshaller = getManager().getFactory().createMarshaller();
+      marshaller.marshal(pElement, ch);
+      col.storeResource(resource);
+    } catch (XMLDBException e) {
+      throw new PMException(e);
+    } catch (IllegalAccessException e) {
+      throw new PMException(e);
+    } catch (InstantiationException e) {
+      throw new PMException(e);
+    } catch (NoSuchMethodException e) {
+      throw new PMException(e);
+    } catch (InvocationTargetException e) {
+      throw new PMException(e.getTargetException());
+    } catch (JAXBException e) {
+      if (e instanceof PMException) {
+        throw (PMException) e;
+      } else {
+        throw new PMException(e);
+      }
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.apache.ws.jaxme.PM#delete(javax.xml.bind.Element)
+   */
+  public void delete(Element pElement) throws PMException {
+    try {
+     Collection col = getXmlDbCollection();
+     String id = getId(pElement);
+     XMLResource resource = (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
+     col.removeResource(resource);
+   } catch (XMLDBException e) {
+     throw new PMException(e);
+   } catch (IllegalAccessException e) {
+     throw new PMException(e);
+   } catch (InstantiationException e) {
+     throw new PMException(e);
+   } catch (InvocationTargetException e) {
+     throw new PMException(e.getTargetException());
+   } catch (NoSuchMethodException e) {
+     throw new PMException(e);
+    } catch (JAXBException e) {
+      if (e instanceof PMException) {
+        throw (PMException) e;
+      } else {
+        throw new PMException(e);
+      }
+   }
+  }
+
+}

Added: branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/pm/org/apache/ws/jaxme/pm/xmldb/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.pm.xmldb Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains an implementation of
+the <code>JaxMe</code> persistence management framework
+targeting the XML::DB API.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/test/README
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/README	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/README	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,8 @@
+This folder contains various files and example scripts related to testing:
+
+jaxb		The schema files in this folder are compiled twice: Once by
+			JAXB and once by JaxMe. They are used to verify features and
+			behaviour specified by JAXB.
+
+jaxme		The schema files in this folder are using features, which are
+			unknown to JAXB.

Added: branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/junit/PrintParse.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/junit/PrintParse.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/java/org/apache/ws/jaxme/junit/PrintParse.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.junit;
+
+
+public class PrintParse {
+    /** Converts a boolean value into 0 (false) or 1 (true).
+     */
+    public static String printBoolean(boolean pValue) {
+        return pValue ? "1" : "0";
+    }
+
+    /** Converts the values 0 (false) or 1 (true) into a
+     * boolean value.
+     */
+    public static boolean parseBoolean(String pValue) {
+        if ("1".equals(pValue)) {
+            return true;
+        } else if ("0".equals(pValue)) {
+            return false;
+        } else {
+            throw new IllegalArgumentException("Illegal argument: " + pValue);
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!-- A sample document for the Address.xsd schema. This
+     sample document is used in the docs, see
+     docs/GenerateJava.html. -->
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<Address xmlns="http://ws.apache.org/jaxme/test/misc/address">
+  <Name>
+    <First>Jane</First>
+    <Middle>Lee</Middle>
+    <Middle>Chris</Middle>
+    <Last>Doe</Last>
+    <Initials>(JD)</Initials>
+  </Name>
+  <Postal>
+    <Street>34 Main Street</Street>   
+    <ZIP>02215</ZIP>
+    <City>Boston</City>
+    <State>MA</State>   
+  </Postal>
+  <PhoneDetails>
+    <Phone type="Work">
+    <PhoneNumber>555.5789</PhoneNumber>
+    </Phone>
+    <Phone type="Fax">
+    <PhoneNumber>555.1212</PhoneNumber>
+    </Phone>
+  </PhoneDetails>
+  <EmailDetails>
+    <Email type="Private">
+      <EmailAddress>jdoe at yourcompany.com</EmailAddress>
+    </Email>
+    <Email type="Office">
+      <EmailAddress>josephdoe at mycompany.com</EmailAddress>
+    </Email>
+  </EmailDetails>
+</Address>
+

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/Address.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/address"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:annotation>
+    <xs:documentation>
+      A simple JaxMe example: Personal address collection.
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:element name="Address">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Name">
+          <xs:annotation>
+            <xs:documentation>
+              A name consists of two required (first and last name)
+              and two optional parts (middle name and initials).
+            </xs:documentation>
+          </xs:annotation>
+
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="First" type="xs:string">
+                <xs:annotation>
+                  <xs:documentation>
+                    The first name.
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+              <xs:element name="Middle" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                  <xs:documentation>
+                    The middle name, may occur multiple times
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+              <xs:element name="Last" type="xs:string">
+                <xs:annotation>
+                  <xs:documentation>
+                    The surname.
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+              <xs:element name="Initials" minOccurs="0" type="xs:string">
+                <xs:annotation>
+                  <xs:documentation>
+                    For example: JW
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="Postal">
+          <xs:annotation>
+            <xs:documentation>
+              Details of the postal address
+            </xs:documentation>
+          </xs:annotation>
+
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="Street" type="xs:string">
+                <xs:annotation>
+                  <xs:documentation>
+                    The street, including a number, if any. For
+                    example, "Fasanenhofstr. 28", or "Main street, 28".
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+              <xs:element name="ZIP">
+                <xs:annotation>
+                  <xs:documentation>
+                    The ZIP code, for example 70565, as in 70565 Stuttgart.
+                  </xs:documentation>
+                </xs:annotation>
+                <xs:simpleType>
+			      <xs:restriction base="xs:string">
+				  </xs:restriction>
+				</xs:simpleType>
+			  </xs:element>
+              <xs:element name="City" type="xs:string">
+                <xs:annotation>
+                  <xs:documentation>
+                    The city, for example Stuttgart.
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+              <xs:element name="State" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                  <xs:documentation>
+                    For US only: The state.
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+              <xs:element name="Country" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                  <xs:documentation>
+                    For US only: The state.
+                  </xs:documentation>
+                </xs:annotation>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="PhoneDetails" minOccurs="0">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="Phone" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                  <xs:documentation>
+                    Details about a single phone number.
+                  </xs:documentation>
+                </xs:annotation>
+                <xs:complexType>
+                  <xs:sequence>
+                    <xs:element name="PhoneNumber" type="xs:string">
+                      <xs:annotation>
+                        <xs:documentation>
+                          The actual phone number
+                        </xs:documentation>
+                      </xs:annotation>
+                    </xs:element>
+                  </xs:sequence>
+                  <xs:attribute name="type" use="required">
+                    <xs:annotation>
+                      <xs:documentation>
+                        Either of "Fax", "Mobile", "Private" or "Office".
+                      </xs:documentation>
+                    </xs:annotation>
+                  </xs:attribute>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="EmailDetails" minOccurs="0">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="Email" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                  <xs:documentation>
+                    Details about a single email address
+                  </xs:documentation>
+                </xs:annotation>
+                <xs:complexType>
+                  <xs:sequence>
+                    <xs:element name="EmailAddress" type="xs:string">
+                      <xs:annotation>
+                        <xs:documentation>
+                          The actual email address
+                        </xs:documentation>
+                      </xs:annotation>
+                    </xs:element>
+                  </xs:sequence>
+                  <xs:attribute name="type" use="required">
+                    <xs:annotation>
+                      <xs:documentation>
+                        Either of "Private" or "Office".
+                      </xs:documentation>
+                    </xs:annotation>
+                  </xs:attribute>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>  
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute name="id"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
+

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/build.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/build.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/build.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,144 @@
+<!--
+
+	This build script is invoked twice: Once for the JAXB compiler and once
+	for JaxMe.
+
+-->
+<project name="test.jaxb" default="all">
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+  <target name="init" depends="init.clover">
+    <condition property="params.available">
+      <and>
+        <isset property="build"/>
+        <isset property="dist"/>
+        <isset property="preqs"/>
+
+		<!-- Exactly one of the following must be set. -->
+        <or>
+          <isset property="run.jaxme"/>
+          <isset property="run.jaxb"/>
+        </or>
+        <not>
+          <and>
+            <isset property="run.jaxme"/>
+            <isset property="run.jaxb"/>
+          </and>
+        </not>
+      </and>
+    </condition>
+  </target>
+
+  <target name="init.clover" if="build.clover.db">
+    <taskdef resource="clovertasks"/>
+    <clover-setup initString="${build.clover.db}">
+      <files>
+        <exclude name="**/test/**/*.java"/>
+      </files>
+    </clover-setup>
+  </target>
+
+  <target name="check.params" unless="params.available" depends="init">
+    <echo>You must invoke this Ant script from the top level directory</echo>
+    <echo>in order to have the required parameters set.</echo>
+    <fail>Invalid invocation</fail>
+  </target>
+
+  <target name="check.jaxb.home" unless="jaxb.home" depends="init" if="run.jaxb">
+    <echo>The property jaxb.home is not set. This property should contain the</echo>
+    <echo>location of the Java Web Services Developer Pack 1.2, which includes</echo>
+    <echo>JAXB. The JWSDP is required to build the JaxMe 2 distribution. The</echo>
+    <echo>property can be set in ${jaxme.properties.location.1},</echo>
+    <echo>in ${jaxme.properties.location.2},</echo>
+    <echo>or on the command line using -Djaxb.home=&lt;directory&gt;.</echo>
+    <echo>The JWSDP is available from http://java.sun.com/webservices/</echo>
+    <fail>Missing JWSDP, terminating.</fail>
+  </target>
+
+  <target name="taskdef.jaxme" depends="check.params" if="run.jaxme">
+    <path id="xjc.class.path">
+      <pathelement location="${dist}/jaxme2-${version}.jar"/>
+      <pathelement location="${dist}/jaxmejs-${version}.jar"/>
+      <pathelement location="${dist}/jaxmexs-${version}.jar"/>
+      <pathelement location="${dist}/jaxmeapi-${version}.jar"/>
+    </path>
+	<property name="srcdir" location="${build}/test/jaxme/src"/>
+	<property name="classdir" location="${build}/test/jaxme/classes"/>
+	<property name="xjcclass" value="org.apache.ws.jaxme.generator.XJCTask"/>
+  </target>
+
+  <target name="taskdef.jaxb" depends="check.params,check.jaxb.home" if="run.jaxb">
+    <path id="xjc.class.path">
+      <fileset dir="${jaxb.home}/jaxb/lib" includes="*.jar"/>
+      <fileset dir="${jaxb.home}/jwsdp-shared/lib"
+          includes="jax-qname.jar,namespace.jar,relaxngDatatype.jar,xsdlib.jar"/>
+    </path>
+	<property name="srcdir" location="${build}/test/jaxb/src"/>
+	<property name="classdir" location="${build}/test/jaxb/classes"/>
+	<property name="xjcclass" value="com.sun.tools.xjc.XJCTask"/>
+  </target>
+
+  <!-- Runs either of taskdef.jaxme or taskdef.jaxb -->
+  <target name="taskdef" depends="taskdef.jaxme,taskdef.jaxb">
+    <taskdef name="xjc" classname="${xjcclass}" classpathref="xjc.class.path"/>
+    <mkdir dir="${srcdir}"/>
+    <mkdir dir="${classdir}"/>
+  </target>
+
+  <target name="generate" depends="taskdef">
+    <xjc target="${srcdir}">
+      <schema dir="${basedir}">
+        <include name="*.xsd"/>
+        <include name="jira/*.xsd"/>
+        <exclude name="enumeration.xsd"/>
+        <exclude name="wildcards.xsd"/>
+        <exclude name="rss.xsd"/>
+        <exclude name="**/xjc*.xsd"/>
+      </schema>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/address/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/defaults/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/group/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/jaxb/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/rss/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/types/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/recursion/*"/>
+    </xjc>
+    <xjc target="${srcdir}" extension="true">
+      <schema dir="${basedir}">
+        <include name="enumeration.xsd"/>
+        <include name="wildcards.xsd"/>
+		<!--  <include name="rss.xsd"/>  -->
+        <include name="**/xjc*.xsd"/> 
+      </schema>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/enumeration/*"/>
+      <produces dir="${srcdir}" includes="org/apache/ws/jaxme/test/misc/wildcards/*"/>
+    </xjc>
+  </target>
+
+  <target name="compile" depends="generate">
+    <javac classpathref="xjc.class.path"
+                  debug="${debug}"
+               optimize="${optimize}"
+                 source="1.3"
+                 target="1.3"   
+                destdir="${classdir}">
+      <src location="${srcdir}"/>
+      <src location="${testsrc}"/>   
+    </javac>
+  </target>
+
+  <target name="all" depends="compile"/>
+</project>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/defaults.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/defaults.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/defaults.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+ <xs:schema
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/defaults"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:annotation>
+    <xs:documentation>
+      This schema is soley designed to test default values in elements.
+    </xs:documentation> 
+  </xs:annotation>
+  
+  <xs:element name="Persons">
+    <xs:complexType>
+	  <xs:sequence>
+	    <xs:element name="Person" minOccurs="0" maxOccurs="unbounded">
+          <xs:complexType>
+	        <xs:sequence>
+              <xs:element name="Name" minOccurs="0">
+                <xs:complexType>
+	              <xs:sequence>
+   		            <xs:element name="First" type="xs:string" default="Anonymous" minOccurs="0"/>
+		            <xs:element name="Last" type="xs:string"/>
+	              </xs:sequence>
+	            </xs:complexType>
+	          </xs:element>
+   		      <xs:element name="Age" type="xs:int" default="25" minOccurs="0"/>
+	        </xs:sequence>
+	        <xs:attribute name="Alias" type="xs:string" default="Ias"/>
+	      </xs:complexType>
+	    </xs:element>
+	  </xs:sequence>
+	</xs:complexType>
+  </xs:element>
+
+  <xs:element name="defaultValuesElt">
+  	<xs:complexType>
+  		<xs:attribute name="string" type="xs:string" default="string" />
+  		<xs:attribute name="boolean" type="xs:boolean" default="true" />
+  		<xs:attribute name="float" type="xs:float" default="1" />
+  		<xs:attribute name="double" type="xs:double" default="1" />
+  		<xs:attribute name="decimal" type="xs:decimal" default="1" />
+  		<xs:attribute name="duration" type="xs:duration"
+  			default="P1D" />
+  		<xs:attribute name="dateTime" type="xs:dateTime"
+  			default="2001-12-31T12:30:30" />
+  		<xs:attribute name="time" type="xs:time" default="12:00:00" />
+  		<xs:attribute name="date" type="xs:date" default="2002-01-01" />
+  		<xs:attribute name="hexBinary" type="xs:hexBinary"
+  			default="0F00" />
+  		<xs:attribute name="base64Binary" type="xs:base64Binary"
+  			default="B64S" />
+  		<xs:attribute name="anyURI" type="xs:anyURI"
+  			default="http://tempuri.org" />
+  		<xs:attribute name="QName" type="xs:QName" default="QName" />
+  		<xs:attribute name="normalizedString"
+  			type="xs:normalizedString" default="" />
+  		<xs:attribute name="token" type="xs:token" default="token" />
+  		<xs:attribute name="language" type="xs:language" default="EN" />
+		<xs:attribute name="NMTOKEN" type="xs:NMTOKEN"
+			default="NMTOKEN" />
+		<xs:attribute name="NMTOKENS" type="xs:NMTOKENS"
+			default="NMTOKENS,NMTOKENS1"/>  		
+  		<xs:attribute name="Name" type="xs:Name" default="Name" />
+  		<xs:attribute name="NCName" type="xs:NCName" default="NCName" />
+  		<xs:attribute name="IDREF" type="xs:IDREF" default="idvalue0" />
+  		<xs:attribute name="integer" type="xs:integer" default="1" />
+  		<xs:attribute name="nonPositiveInteger"
+  			type="xs:nonPositiveInteger" default="-1" />
+  		<xs:attribute name="negativeInteger" type="xs:negativeInteger"
+  			default="-1" />
+  		<xs:attribute name="long" type="xs:long" default="1" />
+  		<xs:attribute name="int" type="xs:int" default="1" />
+  		<xs:attribute name="short" type="xs:short" default="1" />
+  		<xs:attribute name="byte" type="xs:byte" default="1" />
+  		<xs:attribute name="nonNegativeInteger"
+  			type="xs:nonNegativeInteger" default="1" />
+  		<xs:attribute name="unsignedLong" type="xs:unsignedLong"
+  			default="1" />
+  		<xs:attribute name="unsignedInt" type="xs:unsignedInt"
+  			default="1" />
+  		<xs:attribute name="unsignedShort" type="xs:unsignedShort"
+  			default="1" />
+  		<xs:attribute name="unsignedByte" type="xs:unsignedByte"
+  			default="1" />
+  		<xs:attribute name="positiveInteger" type="xs:positiveInteger"
+  			default="1" />
+  	</xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/enumeration.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/enumeration.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/enumeration.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/enumeration"
+    xmlns:ex="http://ws.apache.org/jaxme/test/misc/enumeration"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+    jaxb:extensionBindingPrefixes="xjc"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    jaxb:version="1.0">
+  <xs:annotation>
+    <xs:documentation>
+      Demonstration of a complex type with all sorts of enumeration values.
+    </xs:documentation>
+    <xs:appinfo>
+      <jaxb:globalBindings
+          typesafeEnumBase="xs:string xs:int xs:long xs:short xs:double xs:float">
+        <xjc:serializable/>
+      </jaxb:globalBindings>
+    </xs:appinfo>
+  </xs:annotation>
+
+  <!-- In this example the typesafeEnumMember instances are part of the
+       typesafeEnumClass. -->
+  <xs:simpleType name="StringType">
+    <xs:annotation>
+      <xs:appinfo>
+        <jaxb:typesafeEnumClass name="MyStringTypeClass">
+          <jaxb:typesafeEnumMember name="FOO" value="FOO"/>
+          <jaxb:typesafeEnumMember name="BAR" value="BAR"/>
+        </jaxb:typesafeEnumClass>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="FOO"/>
+      <xs:enumeration value="BAR"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <!-- Here's another case: The typesafeEnumMember instances are part
+       of their respective values. Choose your own style. -->
+  <xs:simpleType name="IntType">
+    <xs:annotation>
+      <xs:appinfo>
+        <jaxb:typesafeEnumClass name="MyIntTypeClass"/>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:int">
+      <xs:enumeration value="3">
+        <xs:annotation>
+          <xs:appinfo>
+            <jaxb:typesafeEnumMember name="INT3"/>
+          </xs:appinfo>
+        </xs:annotation>
+      </xs:enumeration>
+      <xs:enumeration value="0">
+        <xs:annotation>
+          <xs:appinfo>
+            <jaxb:typesafeEnumMember name="INT0"/>
+          </xs:appinfo>
+        </xs:annotation>
+      </xs:enumeration>
+      <xs:enumeration value="-7">
+        <xs:annotation>
+          <xs:appinfo>
+            <jaxb:typesafeEnumMember name="INT_7"/>
+          </xs:appinfo>
+        </xs:annotation>
+      </xs:enumeration>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <!-- I personally prefer the former style, for shortness. So we
+       revert to this style. -->
+  <xs:simpleType name="LongType">
+    <xs:annotation>
+      <xs:appinfo>
+        <jaxb:typesafeEnumClass name="MyLongTypeClass">
+          <jaxb:typesafeEnumMember name="LONG_POSITIVE" value="987298379879887"/>
+          <jaxb:typesafeEnumMember name="LONG_ZERO" value="0"/>
+          <jaxb:typesafeEnumMember name="LONG_NEGATIVE" value="-23987982739273989"/>
+        </jaxb:typesafeEnumClass>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:long">
+      <xs:enumeration value="987298379879887"/>
+      <xs:enumeration value="0"/>
+      <xs:enumeration value="-23987982739273989"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="ShortType">
+    <xs:annotation>
+      <xs:appinfo>
+        <jaxb:typesafeEnumClass name="MyShortTypeClass">
+          <jaxb:typesafeEnumMember name="SHORT_POSITIVE" value="3468"/>
+          <jaxb:typesafeEnumMember name="SHORT_ZERO" value="0"/>
+          <jaxb:typesafeEnumMember name="SHORT_NEGATIVE" value="-23"/>
+        </jaxb:typesafeEnumClass>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:short">
+      <xs:enumeration value="3468"/>
+      <xs:enumeration value="0"/>
+      <xs:enumeration value="-23"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="DoubleType">
+    <xs:annotation>
+      <xs:appinfo>
+        <jaxb:typesafeEnumClass name="MyDoubleTypeClass">
+          <jaxb:typesafeEnumMember name="DOUBLE_POSITIVE" value="3249239847982.234"/>
+          <jaxb:typesafeEnumMember name="DOUBLE_ZERO" value="0"/>
+          <jaxb:typesafeEnumMember name="DOUBLE_NEGATIVE" value="-324234.234"/>
+        </jaxb:typesafeEnumClass>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:double">
+      <xs:enumeration value="3249239847982.234"/>
+      <xs:enumeration value="0"/>
+      <xs:enumeration value="-324234.234"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="FloatType">
+    <xs:annotation>
+      <xs:appinfo>
+        <jaxb:typesafeEnumClass name="MyFloatTypeClass">
+          <jaxb:typesafeEnumMember name="FLOAT_POSITIVE" value="47982.234"/>
+          <jaxb:typesafeEnumMember name="FLOAT_ZERO" value="0"/>
+          <jaxb:typesafeEnumMember name="FLOAT_NEGATIVE" value="-24234.234"/>
+        </jaxb:typesafeEnumClass>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:restriction base="xs:float">
+      <xs:enumeration value="47982.234"/>
+      <xs:enumeration value="0"/>
+      <xs:enumeration value="-24234.234"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:complexType name="AllSimpleTypes">
+    <xs:sequence>
+      <xs:element name="StringElem" type="ex:StringType"/>
+      <xs:element name="IntElem" type="ex:IntType"/>
+      <xs:element name="LongElem" type="ex:LongType"/>
+      <xs:element name="ShortElem" type="ex:ShortType"/>
+      <xs:element name="DoubleElem" type="ex:DoubleType"/>
+      <xs:element name="FloatElem" type="ex:FloatType"/>
+      <xs:element name="DateTimeElem" minOccurs="0">
+        <xs:simpleType>
+          <xs:restriction base="xs:dateTime">
+            <xs:enumeration value="2002-12-17T12:23:11"/>
+            <xs:enumeration value="2002-12-16T12:00:11"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:element>
+      <xs:element name="DateElem" minOccurs="0">
+        <xs:simpleType>
+          <xs:restriction base="xs:date">
+            <xs:enumeration value="2002-12-17"/>
+            <xs:enumeration value="2002-12-16"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:element>
+      <xs:element name="TimeElem" minOccurs="0">
+        <xs:simpleType>
+          <xs:restriction base="xs:time">
+            <xs:enumeration value="12:23:11"/>
+            <xs:enumeration value="12:00:11"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:element name="AllTypesElement">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element type="ex:AllSimpleTypes" name="AllSimpleTypesElement"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="LocalEnumElement">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="LocalString">
+          <xs:simpleType>
+            <xs:annotation><xs:appinfo>
+              <jaxb:typesafeEnumClass name="LocalStringCl"/>
+            </xs:appinfo></xs:annotation>
+            <xs:restriction base="xs:string">
+              <xs:enumeration value="a"/>
+              <xs:enumeration value="b"/>
+            </xs:restriction>
+          </xs:simpleType>
+        </xs:element>
+        <xs:element name="LocalInt">
+          <xs:simpleType>
+            <xs:restriction base="xs:int">
+              <xs:enumeration value="0"/>
+              <xs:enumeration value="1"/>
+            </xs:restriction>
+          </xs:simpleType>
+        </xs:element>
+        <xs:element name="LocalDouble">
+          <xs:simpleType>
+            <xs:restriction base="xs:double">
+              <xs:enumeration value="0.0"/>
+              <xs:enumeration value="1.0"/>
+            </xs:restriction>
+          </xs:simpleType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="LocalEnumAttribute">
+    <xs:complexType>
+      <xs:attribute name="stringAttr" default="b">
+        <xs:simpleType>
+          <xs:restriction base="xs:string">
+            <xs:enumeration value="a"/>
+            <xs:enumeration value="b"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="intAttr">
+        <xs:simpleType>
+          <xs:restriction base="xs:int">
+            <xs:enumeration value="0"/>
+            <xs:enumeration value="1"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+      <xs:attribute name="doubleAttr">
+        <xs:simpleType>
+          <xs:restriction base="xs:double">
+            <xs:enumeration value="0.0"/>
+            <xs:enumeration value="1.0"/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/group.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/group.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/group.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+ <xs:schema
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/group"
+	xmlns="http://ws.apache.org/jaxme/test/misc/group"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:annotation>
+    <xs:documentation>
+      This schema is soley designed to test default values in elements.
+    </xs:documentation> 
+  </xs:annotation>
+  
+  <xs:group name="NameGroup">
+    <xs:sequence>
+      <xs:element name="FirstName" minOccurs="0" type="xs:string"/>
+      <xs:element name="LastName" minOccurs="0" type="xs:string"/>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:element name="Persons">
+    <xs:complexType>
+	  <xs:sequence>
+	    <xs:element name="Person" minOccurs="0" maxOccurs="unbounded">
+          <xs:complexType>
+	        <xs:sequence>
+	          <xs:group ref="NameGroup"/>
+   		      <xs:element name="Age" minOccurs="0" type="xs:int"/>
+	        </xs:sequence>
+	        <xs:attribute name="Alias" type="xs:string"/>
+	      </xs:complexType>
+	    </xs:element>
+	  </xs:sequence>
+	</xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jaxb.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jaxb.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jaxb.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/jaxb"
+    xmlns:jx="http://ws.apache.org/jaxme/test/misc/jaxb"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    jaxb:version="1.0">
+  <xs:annotation>
+    <xs:documentation>
+      Demonstration of the jaxb:class and jaxb:property elements
+    </xs:documentation>
+    <xs:appinfo>
+      <jaxb:globalBindings
+        typesafeEnumBase="xs:string xs:int xs:long xs:short xs:double xs:float"/>
+    </xs:appinfo>
+  </xs:annotation>
+
+  <xs:element name="MyClass">
+    <xs:annotation>
+      <xs:documentation>This element would by default be called "MyClass".
+        We use an instance of jaxb:class to rename it to "SomeClass".
+        Likewise, the implementation would by default be called
+        "SomeClassImpl". We move it to a subpackage "impl" and call it
+        "SomeClass".
+      </xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:annotation>
+        <xs:appinfo>
+          <jaxb:class name="SomeClass"
+              implClass="org.apache.ws.jaxme.test.misc.jaxb.impl.SomeClass">
+            <jaxb:javadoc>This is the implementation of the XML element "MyClass".</jaxb:javadoc>
+          </jaxb:class>
+        </xs:appinfo>
+      </xs:annotation>
+      <xs:sequence>
+        <xs:element name="x" type="xs:int">
+          <xs:annotation>
+            <xs:documentation>
+              This attribute would by default be called have a getter "getX()" and
+              a setter "setX()". We rename these to "getSomeElement()" and
+              "setSomeElement()".
+            </xs:documentation>
+            <xs:appinfo>
+              <jaxb:property name="SomeElement"/>
+            </xs:appinfo>
+          </xs:annotation>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute name="foo" type="xs:string">
+        <xs:annotation>
+          <xs:documentation>
+            This attribute would by default be called have a getter "getFoo()" and
+            a setter "setFoo()". We rename these to "getSomeAttribute()" and
+            "setSomeAttribute()".
+          </xs:documentation>
+          <xs:appinfo>
+            <jaxb:property name="SomeAttribute"/>
+          </xs:appinfo>
+        </xs:annotation>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-10.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-10.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-10.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://commons.dspc.net/activitymodel"
+    xmlns="http://commons.dspc.net/activitymodel"
+    elementFormDefault="qualified">
+  <xs:element name="TransmissionData">
+    <xs:complexType>
+      <xs:attribute name="created"/>
+      <xs:attribute name="mail-id"/>
+      
+      <xs:sequence>
+	<xs:element name="sender">
+	  <xs:complexType>
+	    <xs:attribute name="name"/>
+	    <xs:attribute name="account-id"/>
+
+	    <xs:sequence>
+	      <xs:element name="e-mail" minOccurs="0" type="xs:string"/>
+	      <xs:element name="phone" minOccurs="0" type="xs:string"/>
+	      <xs:element name="crypt-signature" minOccurs="0" type="xs:string"/>
+	    </xs:sequence>
+	  </xs:complexType>
+	</xs:element>
+	
+	<xs:element name="recipient">
+
+	  <xs:complexType>
+	    <xs:attribute name="name" type="xs:string"/>
+	    <xs:attribute name="account-id" type="xs:string"/>
+	  </xs:complexType>
+	</xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-12.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-12.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-12.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://commons.dspc.net/activitymodel2"
+    xmlns="http://commons.dspc.net/activitymodel2"
+    elementFormDefault="qualified">
+  <xs:element name="Body1">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string">
+          <xs:attribute name="html-template"/>
+          <xs:attribute name="text-template"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+
+
+  <xs:element name="Body2">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:string"/>
+      </xs:simpleContent>
+      <xs:attribute name="html-template"/>
+      <xs:attribute name="text-template"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-17.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-17.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-17.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<schema xmlns = "http://www.w3.org/2001/XMLSchema"
+         targetNamespace = "http://www.verticon.com/jaxb/schema"
+         xmlns:s = "http://www.verticon.com/jaxb/schema"
+         elementFormDefault = "qualified"
+         attributeFormDefault = "unqualified">
+	<element name="TestConfiguration" type="s:TestConfigurationType"/>
+
+	<complexType name="TestConfigurationType">
+		<choice>
+			<element name="ChildOne" type="s:ChildOneType"/>
+			<element name="ChildTwo" type="s:ChildTwoType"/>
+        </choice>
+    </complexType>
+
+    <complexType name="ChildTwoType">
+		<choice>
+        	<element name="Resource" type="s:ResourceType"/>
+        	<element name="Commands" type="string"/>
+        </choice>
+       <attribute name="name" use="required" type="string"/>
+       <attribute name="type" use="required" type="s:ChildTwoTypeType"/>
+    </complexType>
+
+    <complexType name="ChildOneType">
+        <attribute name="location" use="required" type="anyURI"/>
+        <attribute name="name" use="required" type="string"/>
+    </complexType>
+
+    <complexType name="ResourceType">
+        <attribute name="location" use="required" type="anyURI"/>
+    </complexType>
+
+   <simpleType name='ChildTwoTypeType'>
+      <annotation>
+          <documentation>supported child two types</documentation>
+      </annotation>
+      <restriction base='string'>
+        <enumeration value='groovy'>
+          <annotation>
+              <documentation>Groovy scripting language.</documentation>
+          </annotation>
+        </enumeration>
+        <enumeration value='jython'>
+          <annotation>
+              <documentation>Jython scripting language.</documentation>
+          </annotation>
+        </enumeration>
+      </restriction>
+  </simpleType>
+</schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-20.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-20.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-20.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,20 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<schema xmlns = "http://www.w3.org/2001/XMLSchema"
+         targetNamespace = "http://asi.sbc.com/cpsosasos/trouble/data"
+         xmlns:s = "http://asi.sbc.com/cpsosasos/trouble/data"
+         elementFormDefault = "qualified"
+         attributeFormDefault = "unqualified">
+  <element name="foo">
+    <complexType>
+      <attribute name="bar" type="s:ServiceIDType"/>
+    </complexType>
+  </element>
+
+  <simpleType name="ServiceIDType">
+    <restriction base="s:NameTypeType"/>
+  </simpleType>
+
+  <simpleType name="NameTypeType">
+    <union memberTypes="integer string"/>
+  </simpleType>
+</schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-21.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-21.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-21.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<schema
+    xmlns="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://msqr.us/xsd/ieat"
+    jaxb:version="1.0"
+    xmlns:eat="http://msqr.us/xsd/ieat"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+    
+     <annotation>
+    	<appinfo>
+    		<jaxb:globalBindings>
+				<jaxb:javaType name="java.lang.Integer"  xmlType="xs:int"/>
+    		</jaxb:globalBindings>
+			<jaxb:schemaBindings>
+    			<jaxb:package name="magoffin.matt.ieat.domain"/>
+    		</jaxb:schemaBindings>
+    	</appinfo>
+    </annotation>
+	
+	<complexType name="base">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="baseId" type="int" use="optional"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="course">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="courseId" type="int"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="difficulty">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="difficultyId" type="int"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="ethnicity">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="ethnicityId" type="int"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="ingredient">
+		<sequence>
+			<element name="name" type="string" />
+			<element name="description" type="string" />
+		</sequence>
+		<attribute name="ingredientId" type="int">
+			<annotation><appinfo>
+				<jaxb:property generateIsSetMethod="true"/>
+			</appinfo></annotation>
+		</attribute>
+	</complexType>
+
+	<complexType name="prep-time">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="prepTimeId" type="int"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="recipe">
+		<sequence>
+			<element name="name" type="string" />
+			<element name="excerpt" type="string" 
+				minOccurs="0"/>
+			<element name="source" type="string"
+				minOccurs="0"/>
+			<element name="directions" type="string"/>
+			<element name="base" type="eat:base"
+				minOccurs="0"/>
+			<element name="ethnicity" type="eat:ethnicity"
+				minOccurs="0"/>
+			<element name="difficulty" type="eat:difficulty"
+				minOccurs="0"/>
+			<element name="system" type="eat:system"/>
+			<element name="ingredient" type="eat:recipe-ingredient" 
+				minOccurs="0" maxOccurs="unbounded"/>
+			<!--
+			<element name="related-recipe" type="eat:related-recipe"
+				minOccurs="0" maxOccurs="unbounded"/>-->
+		</sequence>
+		<attribute name="recipeId" type="int">
+			<annotation><appinfo>
+				<jaxb:property generateIsSetMethod="true"/>
+			</appinfo></annotation>
+		</attribute>
+		<attribute name="servingSize" type="int"/>
+		<attribute name="createdDate" type="dateTime"/>
+		<attribute name="modifiedDate" type="dateTime"/>
+	</complexType>
+	
+	<complexType name="recipe-ingredient">
+		<sequence>
+			<element name="ingredient" type="eat:ingredient"/>
+			<element name="unit" type="eat:unit"/>
+		</sequence>
+		<attribute name="quantity" type="int"/>
+		<attribute name="qualifier" type="string"/>
+		<attribute name="optional" type="boolean"/>
+		<attribute name="ordering" type="short"/>
+	</complexType>
+
+	<complexType name="related-recipe">
+		<sequence>
+			<element name="kind" type="eat:relation-kind"/>
+			<element name="recipe" type="eat:recipe"/>
+		</sequence>
+		<attribute name="relationKindId" type="int"/>
+	</complexType>
+
+	<complexType name="relation-kind">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="relationKindId" type="int"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="system">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="systemId" type="int"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="unit">
+		<simpleContent>
+			<extension base="string">
+				<attribute name="unitId" type="int"/>
+				<attribute name="abbreviation" type="string"/>
+			</extension>
+		</simpleContent>
+	</complexType>
+
+	<complexType name="user">
+		<sequence>
+			<element name="name" type="string" />
+			<element name="email" type="string" />
+			<element name="password" type="string"/>
+		</sequence>
+		<attribute name="login" type="string"/>
+		<attribute name="accessLevel" type="int"/>
+		<attribute name="userId" type="int">
+			<annotation><appinfo>
+				<jaxb:property generateIsSetMethod="true"/>
+			</appinfo></annotation>
+		</attribute>
+		<attribute name="language" type="string"/>
+		<attribute name="country" type="string"/>
+		<attribute name="createdDate" type="dateTime"/>
+		<attribute name="lastLoginDate" type="dateTime"/>
+	</complexType>
+	
+  <complexType name="VisualType">
+    <all>
+      <element name="periodlist">
+        <complexType>
+          <sequence>
+            <element name="period" type="string" maxOccurs="unbounded">
+              <annotation><appinfo>
+                <jaxb:property generateIsSetMethod="true"/>
+              </appinfo></annotation>
+            </element>
+          </sequence>
+		</complexType>
+	  </element>
+	</all>
+  </complexType>
+</schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-46.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-46.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-46.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,11 @@
+<xs:schema targetNamespace='http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/'
+	    xmlns:eGov_IT='http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/'
+	    xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+  <xs:element name='Riferimento'>
+    <xs:complexType>
+      <xs:sequence/>
+      <xs:attribute ref='eGov_IT:id' use='required'/>
+    </xs:complexType>
+  </xs:element>
+  <xs:attribute name='id' type='xs:ID'/>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-65.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-65.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-65.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,15 @@
+<xs:schema targetNamespace='http://ws.apache.org/jaxme/test/jira/jaxme65'
+	elementFormDefault='qualified'
+	xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+  <xs:element name='jaxme65'>
+    <xs:complexType mixed='true'>
+      <xs:choice minOccurs='0' maxOccurs='1'>
+        <xs:element name='problem' type='xs:string'/>
+        <xs:element name='reason' type='xs:string'/>
+        <xs:element name='solution' type='xs:string'/>
+      </xs:choice>
+      <xs:attribute name='id' type='xs:string'/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
+

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-72.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-72.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jaxme-72.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,8 @@
+<xs:schema targetNamespace='http://apache.org/ws/jaxme/test/jira72'
+	    xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+  <xs:element name='jaxme-72'>
+    <xs:complexType>
+      <xs:attribute name="test" type="xs:QName"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    xmlns:a="http://ws.apache.org/jaxme/test/misc/xsimport/a"
+    xmlns:b="http://ws.apache.org/jaxme/test/misc/xsimport/b"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/xsimport/a"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:import namespace="http://ws.apache.org/jaxme/test/misc/xsimport/b"
+    schemaLocation="jira45.xsi"/>
+
+	<xs:element name="outer">
+	  <xs:complexType>
+	    <xs:sequence>
+		  <xs:element ref="b:inner1"/>
+		  <xs:element ref="b:inner2"/>
+		</xs:sequence>
+	  </xs:complexType>
+	</xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsi
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsi	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/jira45.xsi	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+    xmlns:b="http://ws.apache.org/jaxme/test/misc/xsimport/b"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/xsimport/b"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:element name="inner1" type="xs:string"/>
+  <xs:element name="inner2" type="xs:int"/>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/xjcSerializable.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/xjcSerializable.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/jira/xjcSerializable.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+ <xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+    jaxb:extensionBindingPrefixes="xjc"
+    targetNamespace="http://ws.apache.org/jaxme/tests/printparse"
+    elementFormDefault="qualified">
+  <xs:annotation><xs:appinfo>
+    <jaxb:globalBindings>
+      <xjc:serializable uid="12343"/>
+      <!-- JAXB marshalls boolean types to valid schema values "false" and "true"
+           we override this to use "0" and "1" instead -->
+      <jaxb:javaType name="boolean" xmlType="xs:boolean"
+        printMethod="org.apache.ws.jaxme.junit.PrintParse.printBoolean"
+        parseMethod="org.apache.ws.jaxme.junit.PrintParse.parseBoolean"/>
+    </jaxb:globalBindings>
+  </xs:appinfo></xs:annotation>
+ 
+  <xs:element name="Test">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Bool" type="xs:boolean"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/nestedGroups.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/nestedGroups.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/nestedGroups.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:ng="http://ws.apache.org/jaxme/test/nestedGroups"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/nestedGroups"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    jaxb:version="1.0">
+  <xs:annotation><xs:documentation>
+      This schema is for testing various kinds of nested groups.
+  </xs:documentation></xs:annotation>
+
+  <xs:group name="abGroup">
+    <xs:sequence>
+      <xs:element name="a" type="xs:string"/>
+      <xs:element name="b" type="xs:int"/>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:group name="cdGroup">
+    <xs:sequence>
+      <xs:element name="c" type="xs:string"/>
+      <xs:element name="d" type="xs:int"/>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:element name="SequenceOfSimpleSequences">
+    <xs:annotation><xs:documentation>
+      This is the most basic kind of nested group: A sequence, which is
+      made of two sequences, each of which has a multiplicity &lt;= 1.
+
+	  However, this example isn't as unimportant as it may seem, because
+	  this is in fact, how xs:extension is solved internally.
+    </xs:documentation></xs:annotation>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:group ref="ng:abGroup"/>
+        <xs:group ref="ng:cdGroup"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="MixedElement">
+    <xs:annotation><xs:documentation>
+      This is an extended type of nested groups: The outer element
+      contains child elements with mixed content.
+    </xs:documentation></xs:annotation>
+    <xs:complexType mixed="true">
+      <xs:sequence>
+        <xs:element name="f" type="xs:float">
+          <xs:annotation><xs:appinfo>
+            <jaxb:property name="aFloat"/>
+          </xs:appinfo></xs:annotation>
+        </xs:element>
+        <xs:choice>
+          <xs:element name="g" type="xs:long"/>
+          <xs:element name="h" type="xs:dateTime"/>
+        </xs:choice>
+        <xs:element name="abElement">
+          <xs:complexType>
+            <xs:group ref="ng:abGroup"/>
+          </xs:complexType>
+        </xs:element>
+        <xs:group ref="ng:abGroup"/>
+        <xs:element name="cdElement">
+          <xs:complexType>
+            <xs:group ref="ng:cdGroup"/>
+          </xs:complexType>
+        </xs:element>
+        <xs:group ref="ng:cdGroup"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="ThreeNestedLevelsElement">
+    <xs:annotation><xs:documentation>
+      An element with three levels of nested groups.
+    </xs:documentation></xs:annotation>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:choice>
+          <xs:sequence>
+            <xs:element name="a" type="xs:string"/>
+            <xs:element name="b" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+          <xs:sequence>
+            <xs:element name="c" type="xs:string"/>
+            <xs:element name="d" type="xs:int" minOccurs="0"/>
+          </xs:sequence>
+          <xs:sequence>
+            <xs:element name="e" type="xs:string" minOccurs="0"/>
+            <xs:element name="f" type="xs:int"/>
+          </xs:sequence>
+          <xs:sequence>
+            <xs:element name="g" type="xs:string" minOccurs="0"/>
+          </xs:sequence>
+        </xs:choice>
+        <xs:element name="h" type="xs:long" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+	<xs:group name="MailTemplateGroup">
+		<xs:sequence>
+			<xs:element name="subject" type="xs:string"/>
+			<xs:choice>
+				<xs:sequence>
+					<xs:element name="prepend" type="xs:string"/>
+					<xs:element name="append" type="xs:string"/>
+				</xs:sequence>
+				<xs:element name="body" maxOccurs="unbounded">
+					<xs:complexType>
+						<xs:simpleContent>
+							<xs:extension base="xs:string">
+								<xs:attribute name="delivery" use="required">
+									<xs:simpleType>
+										<xs:restriction base="xs:string">
+											<xs:enumeration value="dailyDigest"/>
+											<xs:enumeration value="immediate"/>
+										</xs:restriction>
+									</xs:simpleType>
+								</xs:attribute>
+							</xs:extension>
+						</xs:simpleContent>
+					</xs:complexType>
+				</xs:element>
+			</xs:choice>
+		</xs:sequence>
+	</xs:group>
+
+	<xs:element name="MailTemplate">
+		<xs:annotation>
+			<xs:documentation>Mail template sample</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:group ref="ng:MailTemplateGroup"/>
+			<xs:attribute name="language" type="xs:string" use="optional" default="EN"/>
+			<xs:attribute name="name" type="xs:string" use="required"/>
+		</xs:complexType>
+	</xs:element>
+
+	<xs:element name="MailTemplateMixed">
+		<xs:annotation>
+			<xs:documentation>Mail template sample with mixed content</xs:documentation>
+		</xs:annotation>
+		<xs:complexType mixed="true">
+			<xs:group ref="ng:MailTemplateGroup"/>
+			<xs:attribute name="language" type="xs:string" use="optional" default="EN"/>
+			<xs:attribute name="name" type="xs:string" use="required"/>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/recursion.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/recursion.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/recursion.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+	xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+	targetNamespace="http://ws.apache.org/jaxme/test/recursion"
+	xmlns:rec="http://ws.apache.org/jaxme/test/recursion"
+	elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+  <complexType name="EmployeeTypeDirect">
+    <sequence>
+      <element name="Employees" type="rec:EmployeeTypeDirect" minOccurs="0"/>
+    </sequence>
+    <attribute name="id" type="string" use="required" />
+    <attribute name="name" type="string" use="required" />
+  </complexType>
+  <element name="DirectEmployee" type="rec:EmployeeTypeDirect" />
+
+  <complexType name="EmployeeTypeIndirect">
+    <sequence>
+      <element name="Manager">
+	    <complexType>
+	      <sequence>
+	        <element name="Employees" type="rec:EmployeeTypeIndirect" minOccurs="0"/>
+	      </sequence>
+	    </complexType>
+      </element>
+    </sequence>
+    <attribute name="id" type="string" use="required" />
+    <attribute name="name" type="string" use="required" />
+  </complexType>
+  <element name="IndirectEmployee" type="rec:EmployeeTypeIndirect"/>
+
+
+  <complexType name="PotManagerType">
+    <annotation><documentation>
+      Schema for testing potential recursion. It is actually not
+      potential recursion. It is potential direct/indirect recursion.
+    </documentation></annotation>
+    <sequence>
+      <element maxOccurs="unbounded" name="Employees"
+        type="rec:PotEmployeeType"/>
+    </sequence>
+  </complexType>
+  <complexType name="PotEmployeeType">
+    <choice>
+      <element name="Manager" type="rec:PotManagerType" minOccurs="0"/>
+      <element name="Employees"	type="rec:PotEmployeeType"/>
+    </choice>
+    <attribute name="id" type="string" use="required" />
+    <attribute name="name" type="string" use="required" />
+  </complexType>
+  <element name="PotEmployee" type="rec:PotEmployeeType" />
+
+  <element name="Attribute">
+	<complexType>
+	  <sequence>
+        <element name="AttributeList">
+          <complexType>
+            <sequence>
+              <element ref="rec:Attribute" minOccurs="0" maxOccurs="unbounded"/>
+            </sequence>
+          </complexType>
+        </element>
+	  </sequence>
+	  <attribute name="id" type="string" use="required"/>
+	  <attribute name="name" type="string" use="required"/>
+	  <attribute name="value" type="string" use="optional"/>
+	</complexType>
+  </element>
+</schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/rss.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/rss.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/rss.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,83 @@
+<?xml version='1.0'?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    xmlns:jm="http://ws.apache.org/jaxme/namespaces/jaxme2"
+    jaxb:version="1.0">
+  <xs:annotation><xs:appinfo>
+    <jaxb:schemaBindings>
+      <jaxb:package name="org.apache.ws.jaxme.test.misc.rss"/>
+    </jaxb:schemaBindings>
+  </xs:appinfo></xs:annotation>
+  <xs:element name="rss">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="channel">
+          <xs:complexType>
+	        <xs:choice minOccurs="0" maxOccurs="unbounded">
+	          <xs:element name="title" type="xs:string"/>
+	          <xs:element name="description" type="xs:string"/>
+	          <xs:element name="link" type="xs:string"/>
+	          <xs:element name="language" type="xs:string"/>
+	          <xs:element name="item" maxOccurs="unbounded">
+	            <xs:complexType>
+		          <xs:choice minOccurs="0" maxOccurs="unbounded">
+		            <xs:element name="title" type="xs:string"/>
+		            <xs:element name="link" type="xs:string"/>
+	                <xs:element name="description" type="xs:string"/>
+		          </xs:choice>
+	            </xs:complexType>
+	          </xs:element>
+	          <xs:element name="rating" minOccurs="0" type="xs:string"/>
+	          <xs:element name="image" minOccurs="0">
+	            <xs:complexType>
+	              <xs:choice minOccurs="0" maxOccurs="unbounded">
+		            <xs:element name="title" type="xs:string"/>
+		            <xs:element name="url" type="xs:string"/>
+		            <xs:element name="link" type="xs:string"/>
+		            <xs:element name="width" type="xs:string"/>
+		            <xs:element name="height" type="xs:string"/>
+		            <xs:element name="description" type="xs:string"/>
+		          </xs:choice>
+		        </xs:complexType>
+	          </xs:element>
+	          <xs:element name="textinput" minOccurs="0">
+	            <xs:complexType>
+	              <xs:choice minOccurs="0" maxOccurs="unbounded">
+		            <xs:element name="title" type="xs:string"/>
+		            <xs:element name="description" type="xs:string"/>
+		            <xs:element name="name" type="xs:string"/>
+		            <xs:element name="link" type="xs:string"/>
+		          </xs:choice>
+		        </xs:complexType>
+	          </xs:element>
+	          <xs:element name="copyright" minOccurs="0" type="xs:string"/>
+	          <xs:element name="pubDate" minOccurs="0" type="xs:string"/>
+	          <xs:element name="lastBuildDate" minOccurs="0" type="xs:string"/>
+	          <xs:element name="docs" minOccurs="0" type="xs:string"/>
+	          <xs:element name="managingEditor" minOccurs="0" type="xs:string"/>
+	          <xs:element name="webMaster" minOccurs="0" type="xs:string"/>
+	          <xs:element name="skipHours" minOccurs="0" type="xs:string"/>
+	          <xs:element name="skipDays" minOccurs="0" type="xs:string"/>
+	        </xs:choice>
+	      </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute name="version" type="xs:string" fixed="0.91"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/simpleTypeRestriction.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/simpleTypeRestriction.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/simpleTypeRestriction.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns="http://teamconnect.com"
+	   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+           targetNamespace="http://teamconnect.com"
+	   jaxb:version="1.0">
+   <xs:simpleType name="ZNSecurityTypeIID">
+       <xs:annotation>
+           <xs:documentation/>
+	   <xs:appinfo>
+             <jaxb:typesafeEnumClass>
+               <jaxb:typesafeEnumMember name="ONE" value="0"/>
+	       <jaxb:typesafeEnumMember name="TWO" value="2"/>
+	     </jaxb:typesafeEnumClass>
+           </xs:appinfo>
+       </xs:annotation>
+       <xs:restriction base="xs:int" >
+           <xs:enumeration value="0" />
+           <xs:enumeration value="2" />
+       </xs:restriction>
+   </xs:simpleType>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/types.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/types.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/types.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/types"
+    xmlns:ex="http://ws.apache.org/jaxme/test/misc/types"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    jaxb:version="1.0"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+
+  <xs:complexType name="AllSimpleTypes">
+    <xs:annotation>
+      <xs:documentation>
+        A complex type which includes the builtin simple types.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="StringElem" type="xs:string"/>
+      <xs:element name="IntElem" type="xs:int"/>
+      <xs:element name="LongElem" type="xs:long"/>
+      <xs:element name="ShortElem" type="xs:short"/>
+      <xs:element name="DoubleElem" type="xs:double"/>
+      <xs:element name="FloatElem" type="xs:float"/>
+      <xs:element name="DateTimeElem" type="xs:dateTime"/>
+      <xs:element name="DateElem" type="xs:date"/>
+      <xs:element name="TimeElem" type="xs:time"/>
+      <xs:element name="DurationElem" type="xs:duration"/>
+      <xs:element name="HexBinaryElem" type="xs:hexBinary"/>
+      <xs:element name="Base64BinaryElem" type="xs:base64Binary"/>
+      <xs:element name="NmTokenElem" type="xs:NMTOKEN"/>
+      <xs:element name="NmTokensElem" type="xs:NMTOKENS"/>
+      <xs:element name="DecimalElem" type="xs:decimal"/>
+      <xs:element name="IntegerElem" type="xs:integer"/>
+      <xs:element name="NonNegativeIntegerElem" type="xs:nonNegativeInteger"/>
+      <xs:element name="PositiveIntegerElem" type="xs:positiveInteger"/>
+      <xs:element name="NonPositiveIntegerElem" type="xs:nonPositiveInteger"/>
+      <xs:element name="NegativeIntegerElem" type="xs:negativeInteger"/>
+      <xs:element name="QNameElem" type="xs:QName"/>
+      <xs:element name="BooleanElem" type="xs:boolean"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:element name="EAllSimpleTypeAttrs" type="ex:AllSimpleTypeAttrs"/>
+
+  <xs:complexType name="AllSimpleTypeAttrs">
+    <xs:annotation><xs:documentation>
+      A complex type which includes the same type as attributes.
+    </xs:documentation></xs:annotation>
+    <xs:attribute name="StringAttr" type="xs:string"/>
+    <xs:attribute name="IntAttr" type="xs:int"/>
+    <xs:attribute name="LongAttr" type="xs:long"/>
+    <xs:attribute name="ShortAttr" type="xs:short"/>
+    <xs:attribute name="DoubleAttr" type="xs:double"/>
+    <xs:attribute name="FloatAttr" type="xs:float"/>
+    <xs:attribute name="DateTimeAttr" type="xs:dateTime"/>
+    <xs:attribute name="DateAttr" type="xs:date"/>
+    <xs:attribute name="TimeAttr" type="xs:time"/>
+    <xs:attribute name="DurationAttr" type="xs:duration"/>
+    <xs:attribute name="HexBinaryAttr" type="xs:hexBinary"/>
+    <xs:attribute name="Base64BinaryAttr" type="xs:base64Binary"/>
+    <xs:attribute name="NmTokenAttr" type="xs:NMTOKEN"/>
+    <xs:attribute name="NmTokensAttr" type="xs:NMTOKENS"/>
+    <xs:attribute name="DecimalAttr" type="xs:decimal"/>
+    <xs:attribute name="IntegerAttr" type="xs:integer"/>
+    <xs:attribute name="NonNegativeIntegerAttr" type="xs:nonNegativeInteger"/>
+    <xs:attribute name="PositiveIntegerAttr" type="xs:positiveInteger"/>
+    <xs:attribute name="NonPositiveIntegerAttr" type="xs:nonPositiveInteger"/>
+    <xs:attribute name="NegativeIntegerAttr" type="xs:negativeInteger"/>
+    <xs:attribute name="QNameAttr" type="xs:QName"/>
+    <xs:attribute name="BooleanAttr" type="xs:boolean"/>
+  </xs:complexType>
+
+  <xs:simpleType name="ListType">
+    <xs:annotation>
+      <xs:documentation>
+        A simple type which is in fact a list of integers.
+        The list is implemented as an instance of java.util.List.
+        The generated clas includes a method
+        addListType(Integer) and a method Integer[] getListType.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:list itemType="xs:integer"/>
+  </xs:simpleType>
+
+  <xs:simpleType name="UnionType">
+    <xs:annotation>
+      <xs:documentation>
+        A simple type which max in fact be either an Integer,
+        an instance of java.util.Calendar, or a String. When
+        reading an XML document with an element of type
+        UnionType, then the implementation will attempt to
+        perform new Integer(String), DateFormat.parse(String)
+        and new String(String), in that order. The first
+        one that can be performed without throwing an
+        exception, wins. Note that the order of the member
+        types matters, as new String(String) will always
+        succeed.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:union memberTypes="xs:int xs:dateTime xs:string"/>
+  </xs:simpleType>
+
+  <xs:element name="AllTypesElement">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element type="ex:AllSimpleTypes" name="AllSimpleTypesElement"/>
+        <xs:element type="ex:ListType" name="ListTypeElement"/>
+        <xs:element type="ex:UnionType" name="UnionTypeElement"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="AllTypesAttrs">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element type="ex:AllSimpleTypeAttrs" name="AllSimpleTypesAttrElement"/>
+      </xs:sequence>
+      <xs:attribute type="ex:ListType" name="ListTypeAttr"/>
+      <xs:attribute type="ex:UnionType" name="UnionTypeAttr"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:complexType name="Rated">
+    <xs:annotation><xs:documentation>
+      Another sample: A complex type with simple Content.
+    </xs:documentation></xs:annotation>
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="rating" type="xs:int"/>
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+  <xs:element name="Author" type="ex:Rated"/>
+
+  <xs:element name="AllSimpleTypesWrapper">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="ex:AllTypesElement" minOccurs="0" maxOccurs="unbounded"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:complexType name="parameter">
+    <xs:attribute name="key" type="xs:string"/>
+    <xs:attribute name="value" type="xs:string"/>
+  </xs:complexType>
+
+  <xs:element name="Array">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ArrayElement" minOccurs="0" maxOccurs="unbounded"
+        	type="xs:int">
+          <xs:annotation><xs:appinfo>
+            <jaxb:property collectionType="indexed"/>
+          </xs:appinfo></xs:annotation>
+        </xs:element>
+        <xs:element name="ListElement" minOccurs="0" maxOccurs="unbounded"
+        	type="xs:int"/>
+        <xs:element name="StringArrayElement" minOccurs="0" maxOccurs="unbounded"
+        	type="xs:string">
+          <xs:annotation><xs:appinfo>
+            <jaxb:property collectionType="indexed"/>
+          </xs:appinfo></xs:annotation>
+        </xs:element>
+        <xs:element name="StringListElement" minOccurs="0" maxOccurs="unbounded"
+            type="xs:string"/>
+        <xs:element name="ComplexArrayElement" minOccurs="0" maxOccurs="unbounded"
+            type="ex:parameter">
+          <xs:annotation><xs:appinfo>
+            <jaxb:property collectionType="indexed"/>
+          </xs:appinfo></xs:annotation>
+        </xs:element>
+        <xs:element name="ComplexListElement" minOccurs="0" maxOccurs="unbounded"
+            type="ex:parameter"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="AllElement">
+    <xs:complexType>
+      <xs:annotation>
+        <xs:documentation>
+          An xs:all element with all the builtin simple types.
+        </xs:documentation>
+      </xs:annotation>
+      <xs:all>
+        <xs:element name="StringElem" type="xs:string"/>
+        <xs:element name="IntElem" type="xs:int"/>
+        <xs:element name="LongElem" type="xs:long"/>
+        <xs:element name="ShortElem" type="xs:short"/>
+        <xs:element name="DoubleElem" type="xs:double"/>
+        <xs:element name="FloatElem" type="xs:float"/>
+        <xs:element name="DateTimeElem" type="xs:dateTime"/>
+        <xs:element name="DateElem" type="xs:date"/>
+        <xs:element name="TimeElem" type="xs:time"/>
+        <xs:element name="DurationElem" type="xs:duration"/>
+        <xs:element name="HexBinaryElem" type="xs:hexBinary"/>
+        <xs:element name="Base64BinaryElem" type="xs:base64Binary"/>
+        <xs:element name="NmTokenElem" type="xs:NMTOKEN"/>
+        <xs:element name="NmTokensElem" type="xs:NMTOKENS"/>
+        <xs:element name="DecimalElem" type="xs:decimal"/>
+        <xs:element name="IntegerElem" type="xs:integer"/>
+        <xs:element name="NonNegativeIntegerElem" type="xs:nonNegativeInteger"/>
+        <xs:element name="PositiveIntegerElem" type="xs:positiveInteger"/>
+        <xs:element name="NonPositiveIntegerElem" type="xs:nonPositiveInteger"/>
+        <xs:element name="NegativeIntegerElem" type="xs:negativeInteger"/>
+        <xs:element name="QNameElem" type="xs:QName"/>
+        <xs:element name="BooleanElem" type="xs:boolean"/>
+      </xs:all>
+    </xs:complexType>
+  </xs:element>
+
+	<xs:element name="row">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="cell" maxOccurs="unbounded">
+					<xs:complexType>
+						<xs:simpleContent>
+							<xs:extension base="xs:string">
+								<xs:attribute name="id" type="xs:string" use="required"/>
+							</xs:extension>
+						</xs:simpleContent>
+					</xs:complexType>
+				</xs:element>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+
+    <xs:element name="date">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="year">
+            <xs:simpleType>
+              <xs:restriction base="xs:positiveInteger">
+                <xs:totalDigits value="4"/>
+              </xs:restriction>
+            </xs:simpleType>
+         </xs:element>
+       </xs:sequence>
+     </xs:complexType>
+   </xs:element>
+
+   <xs:complexType name="FsNode">
+     <xs:sequence>
+       <xs:element ref="ex:acl" minOccurs="0"/>
+     </xs:sequence>
+     <xs:attribute name="id" type="xs:long" use="required"/>
+     <xs:attribute name="name" type="xs:string" use="required"/>
+     <xs:attribute name="parent" type="xs:long" use="required"/>
+   </xs:complexType>
+
+   <xs:element name="FsFile" type="ex:FsNode"/>
+
+   <xs:element name="FsDirectory">
+     <xs:complexType>
+       <xs:complexContent>
+         <xs:extension base="ex:FsNode">
+           <xs:attribute name="hidden" type="xs:boolean" use="optional" default="false"/>
+         </xs:extension>
+       </xs:complexContent>
+     </xs:complexType>
+   </xs:element>
+
+   <xs:element name="acl">
+     <xs:complexType>
+       <xs:sequence>
+         <xs:element name="rule" minOccurs="0" maxOccurs="unbounded">
+           <xs:complexType>
+             <xs:attribute name="principal" type="xs:string" use="required"/>
+             <xs:attribute name="mode">
+               <xs:simpleType>
+                 <xs:restriction base="xs:string">
+                   <xs:enumeration value="allow"/>
+                   <xs:enumeration value="deny"/>
+                 </xs:restriction>
+               </xs:simpleType>
+             </xs:attribute>
+           </xs:complexType>
+         </xs:element>
+       </xs:sequence>
+     </xs:complexType>
+   </xs:element>
+
+    <xs:element name="html">
+      <xs:complexType mixed="true">
+        <xs:sequence>
+          <xs:element name="dummy" type="xs:string"/>
+          <xs:element name="head">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="title" type="xs:string"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+          <xs:element name="body">
+            <xs:complexType>
+              <xs:sequence>
+			    <xs:element name="p" maxOccurs="unbounded">
+                  <xs:complexType/>
+                </xs:element>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+
+   <xs:element name="jira62">
+     <xs:complexType>
+       <xs:attribute name="a" use="optional">
+         <xs:simpleType>
+           <xs:restriction base="xs:string">
+             <xs:maxLength value="4"/>
+           </xs:restriction>
+         </xs:simpleType>
+       </xs:attribute>
+       <xs:attribute name="b" use="optional">
+         <xs:simpleType>
+           <xs:restriction base="xs:string">
+             <xs:minLength value="4"/>
+           </xs:restriction>
+         </xs:simpleType>
+       </xs:attribute>
+       <xs:attribute name="c" use="optional">
+         <xs:simpleType>
+           <xs:restriction base="xs:string">
+             <xs:length value="4"/>
+           </xs:restriction>
+         </xs:simpleType>
+       </xs:attribute>
+     </xs:complexType>
+   </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/jaxb/wildcards.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/jaxb/wildcards.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/jaxb/wildcards.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/misc/wildcards"
+    xmlns:ex="http://ws.apache.org/jaxme/test/misc/wildcards"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+
+  <xs:element name="AnyAttribute">
+    <xs:complexType>
+      <xs:anyAttribute namespace="##any"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="OtherAttribute">
+    <xs:complexType>
+      <xs:anyAttribute namespace="##other"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="ListAttribute">
+    <xs:complexType>
+      <xs:anyAttribute namespace="##targetNamespace http://ws.apache.org/jaxme/test/misc/wildcards/2"/>
+    </xs:complexType>
+  </xs:element>
+
+<!--
+  <xs:element name="AnyElement">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Header" type="xs:string"/>
+        <xs:any namespace="##any"/>
+        <xs:element name="Footer" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="OtherElement">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Header" type="xs:string"/>
+        <xs:any namespace="##other"/>
+        <xs:element name="Footer" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="ListElement">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="Header" type="xs:string"/>
+        <xs:any namespace="##targetNamespace http://ws.apache.org/jaxme/test/misc/wildcards/2"/>
+        <xs:element name="Footer" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+-->
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/test/pm/initdb.sql
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/pm/initdb.sql	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/pm/initdb.sql	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,11 @@
+CREATE CACHED TABLE httpSession (
+  id INT NOT NULL PRIMARY KEY,
+  ipaddress VARCHAR(15) NOT NULL,
+  logintime TIMESTAMP NOT NULL,
+  lastaction TIMESTAMP NOT NULL,
+  expiretime SMALLINT NOT NULL,
+  cookie VARCHAR(25) NOT NULL,
+  randomSeed DOUBLE NOT NULL,
+  precedence REAL,
+  UNIQUE (cookie)
+);

Added: branches/jaxme/upstream/0.5.1/src/test/pm/session.xsd
===================================================================
--- branches/jaxme/upstream/0.5.1/src/test/pm/session.xsd	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/test/pm/session.xsd	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xml:lang="EN"
+    targetNamespace="http://ws.apache.org/jaxme/test/pm/session"
+    xmlns:jm="http://ws.apache.org/jaxme/namespaces/jaxme2/schema"
+    xmlns:jdm="http://ws.apache.org/jaxme/namespaces/jaxme2/jdbc-mapping"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+  <xs:annotation>
+    <xs:documentation>
+      This is an example demonstrating the JDBC mapping.
+      It demonstrates the use of a table httpSession, as
+      specified in the file "init.sql".
+    </xs:documentation>
+    <xs:appinfo>
+    </xs:appinfo>
+  </xs:annotation>
+
+  <xs:element name="Session">
+    <xs:annotation>
+      <xs:documentation>
+        This is an implementation of the SESSION table. The
+        elements are read through JDBC.
+      </xs:documentation>
+      <xs:appinfo>
+      </xs:appinfo>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:annotation><xs:appinfo>
+        <jdm:table name="httpSession"/>
+      </xs:appinfo></xs:annotation>
+      <xs:sequence>
+        <xs:element name="IpAddress" type="xs:string">
+          <xs:annotation>
+            <xs:documentation>
+              A default for the spelling of "IpAddress". Without this default,
+              the spelling would be choosen as provided by JDBC, typically
+              uppercased.
+            </xs:documentation>
+          </xs:annotation>
+        </xs:element>
+        <xs:element name="LastAction" type="xs:dateTime">
+          <xs:annotation>
+            <xs:documentation>
+              The element LastAction is stored in the database as a timestamp.
+              However, we want it to have a certain property: It should be
+              updated automatically with any update or insert to match the
+              current time.
+            </xs:documentation>
+          </xs:annotation>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute name="Cookie">
+        <xs:annotation>
+          <xs:documentation>
+            Just to demonstrate, that a database column can also
+            be mapped to an attribute.
+          </xs:documentation>
+        </xs:annotation>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: branches/jaxme/upstream/0.5.1/src/webapp/build.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/build.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/build.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,110 @@
+<project name="webapp" default="all">
+<!--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+  <!-- Make sure, that *all* targets (except those on which init depends)
+       depend on init. Would be nice, if Ant could do that for us.
+       All the properties below could as well be set in
+       ${user.home}/.jaxme.properties or ${basedir}/jaxme.properties -->
+  <target name="init" depends="init">
+	<property name="jaxme.properties.location.1" location="${user.home}/.jaxme.properties"/>
+	<property name="jaxme.properties.location.2" location="${basedir}/jaxme.properties"/>
+    <available file="${jaxme.properties.location.1}" property="jaxme.properties.location" value="${jaxme.properties.location.1}"/>
+    <property name="jaxme.properties.location" location="${basedir}/jaxme.properties"/>
+    <echo>Loading custom properties from ${jaxme.properties.location}</echo>
+    <property file="${jaxme.properties.location}"/>
+
+    <property name="build" location="${basedir}/../../build/webapp"/>
+    <property name="build.classes" location="${build}/classes"/>
+    <property name="preqs" location="${basedir}/../../prerequisites"/>
+    <property name="dist" location="${basedir}/../../dist"/>
+    <property name="debug" value="true"/>
+    <property name="optimize" value="false"/>
+    <property name="force" value="false"/>
+    <property name="logLevel" value="warn"/>
+    <property name="src" location="${basedir}/java"/>
+
+	<path id="jaxme.webapp.class.path">
+	  <pathelement location="${dist}/jaxmeapi.jar"/>
+	  <pathelement location="${dist}/jaxmexs.jar"/>
+	  <pathelement location="${dist}/jaxmejs.jar"/>
+	  <pathelement location="${dist}/jaxme2.jar"/>
+	  <pathelement location="${preqs}/servlet.jar"/>
+	</path>
+  </target>
+
+  <target name="init.clover" if="build.clover.db">
+    <taskdef resource="clovertasks"/>
+    <clover-setup initString="${build.clover.db}"/>
+  </target>
+
+  <target name="clean" depends="init">
+    <delete dir="${build}"/>
+    <delete dir="${dist}/jaxme.war"/>
+  </target>
+
+  <target name="compile" depends="init">
+    <mkdir dir="${build.classes}"/>
+    <javac destdir="${build.classes}" srcdir="${src}" debug="${debug}"
+           source="1.3" target="1.3"   
+           optimize="${optimize}" classpathref="jaxme.webapp.class.path"/>
+  </target>
+
+  <target name="check.tomcat.home" depends="init" unless="tomcat.home">
+    <echo>You have not set the property tomcat.home in your jaxme.properties.</echo>
+    <echo>The property indicates the directory, where your Tomcat is installed.</echo>
+    <echo>The property may be set in ${jaxme.properties.location.1} or</echo>
+    <echo>${jaxme.properties.location.2}.</echo>
+    <fail>Missing tomcat.home property, terminating</fail>
+  </target>
+
+  <target name="all" depends="compile">
+  </target>
+
+  <target name="fastinstall" depends="all,check.tomcat.home">
+    <mkdir dir="${tomcat.home}/webapps/jaxme/WEB-INF/classes"/>
+    <copy todir="${tomcat.home}/webapps/jaxme/WEB-INF/classes">
+      <fileset dir="${build.classes}"/>
+    </copy>
+    <copy todir="${tomcat.home}/webapps/jaxme">
+      <fileset dir="${basedir}" includes="*.jsp"/>
+    </copy>
+    <copy todir="${tomcat.home}/webapps/jaxme/WEB-INF/lib">
+      <fileset dir="${dist}" includes="jaxme*.jar"/>
+    </copy>
+    <copy file="${basedir}/web.xml" todir="${tomcat.home}/webapps/jaxme/WEB-INF" overwrite="true">
+      <filterset>
+        <filter token="work.dir" value="${tomcat.home}/work"/>
+        <filter token="http.proxyHost" value="${http.proxyHost}"/>
+        <filter token="http.proxyPort" value="${http.proxyPort}"/>
+      </filterset>
+    </copy>
+  </target>
+
+  <target name="war" depends="all">
+    <copy todir="${build}" file="${basedir}/web.xml">
+      <filterset>
+        <filter token="work.dir" value=""/>
+        <filter token="http.proxyHost" value=""/>
+        <filter token="http.proxyPort" value=""/>
+      </filterset>
+    </copy>
+    <war destfile="${dist}/jaxme.war" webxml="${build}/web.xml">
+      <classes dir="${build.classes}"/>
+      <fileset dir="${basedir}" includes="*.jsp"/>
+      <lib dir="${dist}" includes="jaxme*.jar"/>
+    </war>
+  </target>
+</project>

Added: branches/jaxme/upstream/0.5.1/src/webapp/compile.jsp
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/compile.jsp	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/compile.jsp	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,52 @@
+<%--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<%
+	java.util.List errors = new java.util.ArrayList();
+	boolean isValidating = Boolean.valueOf(request.getParameter("isValidating")).booleanValue();
+	String url = request.getParameter("url");
+	if (url == null  ||  url.length() == 0) {
+		errors.add("The schema URL must not be empty.");
+	} else {
+		try {
+			new java.net.URL(url);
+		} catch (java.net.MalformedURLException e) {
+			errors.add("The schema URL " + url + " is invalid.");
+		}
+	}
+	String what = request.getParameter("what");
+	if (!"compile".equals(what)  &&  !"validate".equals(what)) {
+		errors.add("You must choose a proper action: Either 'compile' or 'validate'");
+	}
+		
+
+	if (errors.size() == 0) {
+		request.getRequestDispatcher("jaxme").forward(request, response);
+	} else {
+		%>
+			<html><head><title>JaxMe Online - Error Message</title></head>
+				<body><h1>JaxMe Online - Error Message</h1>
+					<p>Sorry, but we are unable to process your request, due to the
+						following problems:<ul>
+						<% for (java.util.Iterator iter = errors.iterator();  iter.hasNext();  ) { %>
+							<li><%= iter.next() %></li>
+						<% } %></ul>
+					<p>Please return to the <a href="javascript:history.back()">calling page</a>
+						and fix your input.</p>
+				</body>
+			</html>
+		<%
+	}
+%>

Added: branches/jaxme/upstream/0.5.1/src/webapp/index.jsp
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/index.jsp	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/index.jsp	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,68 @@
+<%--
+ Copyright 2003, 2004  The Apache Software Foundation
+  
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<%
+	String url = request.getParameter("url");
+	if (url == null) {
+		url = "";
+	}
+
+	Boolean success = (Boolean) request.getAttribute("success");
+	boolean isValidating = Boolean.valueOf(request.getParameter("isValidating")).booleanValue();
+	ServletException e = (ServletException) request.getAttribute("error");
+
+	String what = request.getParameter("what");
+	boolean compiling = what == null  ||  "compile".equals(what);
+%>
+<html><head><title>JaxMe Online</title></head>
+	<body><h1>JaxMe Online</h1>
+		<p>This small web application allows you to run JaxMe online.
+			By entering a schema URL, the JaxMe compiler is invoked
+			and returns a ZIP file with the generated sources.</p>
+	    <form method="get" action="compile.jsp">
+	    	<table>
+	    		<tr><th align="right">URL:</th>
+	    	        <td><input type="text" name="url" value="<%= url %>"></input></td></tr>
+				<tr><th align="right">Action:</th>
+					<td><select name="what">
+						  <option value="compile">Compile using JaxMe</option>
+						  <option value="validate" <%= compiling ? "" : "\"selected\"" %>>Validate using JaxMeXS</option>
+						</select></td></tr>
+				<tr><th align="right">Validating parser:</th>
+					<td><select name="isValidating">
+						  <option value="false">No</option>
+						  <option value="true" <%= isValidating ? "\"selected\"" : ""%>>Yes</option>
+						</select></td></tr>
+	    	    <tr><td></td>
+	    	    	<td><input type="submit" value="Compile"></input></td></tr>
+	    	</table>
+	    </form>
+<%
+	if (success != null) {
+		if (success.booleanValue()) {
+			%><h3>Schema validation result</h3><p>The schema was validated successful.</p><%
+		} else {
+			%><h3>Schema validation result</h3><p>The schema was found to contain errors.</p><%
+		}
+	}
+	if (e != null) {
+		%><h3>Error Details</h3><pre><%
+		    Throwable t = e.getRootCause() == null ? e : e.getRootCause();
+		    t.printStackTrace(new java.io.PrintWriter(out));
+		%></pre><%
+	}
+%>
+	</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/BaseServlet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/BaseServlet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/BaseServlet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.webapp;
+
+import java.io.File;
+
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServlet;
+
+
+public abstract class BaseServlet extends HttpServlet {
+	private static File workDir;
+	
+	public File getWorkDir() {
+		return workDir;
+	}
+
+	public void cleanDirectory(File pDirectory) throws ServletException {
+		File[] files = pDirectory.listFiles();
+		for (int i = 0;  i < files.length;  i++) {
+			File f = files[i];
+			if (f.isFile()) {
+				if (!f.delete()) {
+					throw new UnavailableException("Unable to delete file " + f.getAbsolutePath());
+				}
+			} else if (f.isDirectory()) {
+				cleanDirectory(f);
+				if (!f.delete()) {
+					throw new UnavailableException("Unable to delete directory " + f.getAbsolutePath());
+				}
+			} else {
+				throw new UnavailableException("Unable to determine how to remove " + f.getAbsolutePath());
+			}
+		}
+	}
+
+	public void createDirectory(File pDirectory) throws ServletException {
+		if (!pDirectory.mkdir()) {
+			throw new UnavailableException("Unable to create working directory " + pDirectory);
+		}
+	}
+
+	public void init() throws ServletException {
+		synchronized (BaseServlet.class) {
+			if (workDir == null) {
+				String p = getServletContext().getInitParameter("http.proxyHost");
+				if (p != null  &&  p.length() > 0) {
+					String v = getServletContext().getInitParameter("http.proxyPort");
+					if (v != null  &&  v.length() > 0) {
+						log("http.proxyHost parameter detected, setting host=" + p + ", port=" + v);
+						System.setProperty("http.proxyHost", p);
+						System.setProperty("http.proxyPort", v);
+					} else {
+						throw new UnavailableException("The http.proxyHost parameter is set, but the http.proxyPort parameter is not set.");
+					}
+				} else {
+					log("http.proxyHost parameter is not set");
+				}
+				String s = getServletContext().getInitParameter("work.dir");
+				File f;
+				if (s == null  ||  s.length() == 0) {
+					s = System.getProperty("java.io.tmpdir");
+					if (s == null  ||  s.length() == 0) {
+						throw new UnavailableException("Neither the servlet context parameter work.dir nor the system property java.io.tmpdir are set.");
+					}
+					f = new File(s);
+					if (!f.isDirectory()) {
+						throw new UnavailableException("The directory " + s + " (specified by the system property java.io.tmpdir) does not exist.");
+					}
+				} else {
+					f = new File(s);
+					if (!f.isDirectory()) {
+						throw new UnavailableException("The directory " + s + " (specified by the servlet context parameter work.dir) does not exist.");
+					}
+				}
+
+				File g = new File(f, "jaxme");
+				if (g.isDirectory()) {
+					cleanDirectory(g);
+				} else {
+					createDirectory(g);
+				}
+				workDir = g;
+			}
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/InitServlet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/InitServlet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/InitServlet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.webapp;
+
+
+/** <p>Initializes the "JaxMe online" application by creating and/or
+ * cleaning the working directory.</p>
+ */
+public class InitServlet extends BaseServlet {
+}

Added: branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/JaxMeServlet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/JaxMeServlet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/java/org/apache/ws/jaxme/webapp/JaxMeServlet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.webapp;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** <p>This class invokes the JaxMe compiler.</p>
+ */
+public class JaxMeServlet extends BaseServlet {
+	private class StoringEntityResolver implements EntityResolver {
+		private final File schemaDir;
+		private final Map urlMap = new HashMap();
+		public StoringEntityResolver(File pSchemaDir) {
+			schemaDir = pSchemaDir;
+		}
+		
+		public InputSource resolveEntity(String pPublicId, String pSystemId) throws SAXException, IOException {
+			try {
+				URL url = new URL(pSystemId);
+				String fileName = (String) urlMap.get(url);
+				if (fileName != null) {
+					FileInputStream istream = new FileInputStream(new File(schemaDir, fileName));
+					InputSource isource = new InputSource(istream);
+					isource.setSystemId(url.toString());
+					return isource;
+				}
+				
+				String file = url.getFile();
+				if (file == null) {
+					file = "";
+				} else {
+					int offset = file.lastIndexOf('/');
+					if (offset >= 0) {
+						file = file.substring(offset+1);
+					}
+				}
+				if ("".equals(file)) {
+					file = "schema.xsd";
+				}
+				int offset = file.lastIndexOf('.');
+				String prefix;
+				String suffix;
+				String numAsStr = "";
+				if (offset > 0  &&  offset < file.length()) {
+					prefix = file.substring(0, offset);
+					suffix = file.substring(offset);
+				} else {
+					prefix = file;
+					suffix = ".xsd";
+				}
+				File f;
+				for (int num = 1;  ;  ++num) {
+					f = new File(schemaDir, prefix + numAsStr + suffix);
+					if (f.exists()) {
+						numAsStr = "_" + num;
+					} else {
+						break;
+					}
+				}
+
+				InputStream istream = url.openStream();
+				schemaDir.mkdirs();
+				FileOutputStream fos = new FileOutputStream(f);
+				try {
+					byte[] buffer = new byte[1024];
+					for (;;) {
+						int res = istream.read(buffer);
+						if (res == -1) {
+							break;
+						} else if (res > 0) {
+							fos.write(buffer, 0, res);
+						}
+					}
+					istream.close();
+					fos.close();
+					fos = null;
+				} finally {
+					if (fos != null) { try { f.delete(); } catch (Throwable ignore) {} }
+				}
+
+				urlMap.put(url, f.getName());
+				InputSource isource = new InputSource(new FileInputStream(f));
+				isource.setSystemId(url.toString());
+				return isource;
+			} catch (Exception e) {
+				JaxMeServlet.this.log("Failed to resolve URL " + pSystemId, e);
+			}
+			return null;
+		}
+	}
+
+	public File createTempDir() throws IOException, ServletException {
+		File f = File.createTempFile("jaxme", ".tmp", getWorkDir());
+		f.delete();
+		if (!f.mkdir()) {
+			throw new ServletException("Unable to create temporary directory " + f.getAbsolutePath());
+		}
+		return f;
+	}
+
+	public void addContents(ZipOutputStream pZipFile, File pDirectory, String pDirName) throws IOException {
+		File[] files = pDirectory.listFiles();
+		for (int i = 0;  i < files.length;  i++) {
+			File f = files[i];
+			String name = pDirName.length() == 0 ? f.getName() : pDirName + "/" + f.getName();
+			if (f.isDirectory()) {
+				addContents(pZipFile, f, name);
+			} else if (f.isFile()) {
+				FileInputStream istream = new FileInputStream(f);
+				try {
+					ZipEntry zipEntry = new ZipEntry(name);
+					pZipFile.putNextEntry(zipEntry);
+					byte[] buffer = new byte[1024];
+					for (;;) {
+						int res = istream.read(buffer);
+						if (res == -1) {
+							break;
+						} else if (res > 0) {
+							pZipFile.write(buffer, 0, res);
+						}
+					}
+					pZipFile.closeEntry();
+					istream.close();
+					istream = null;
+				} finally {
+					if (istream != null) { try { istream.close(); } catch (Throwable ignore) {} }
+				}
+			}
+		}
+	}
+
+	public void removeDirectory(File pDirectory) throws ServletException {
+		cleanDirectory(pDirectory);
+		pDirectory.delete();
+	}
+
+	protected void doCompile(boolean pValidating, File pTempDir, URL pURL, HttpServletResponse pResponse)
+			throws ServletException, IOException {
+		Generator gen = new GeneratorImpl();
+		gen.setTargetDirectory(new File(pTempDir, "src"));
+		gen.setValidating(pValidating);
+		gen.setSchemaReader(new JAXBSchemaReader());
+		gen.setEntityResolver(new StoringEntityResolver(new File(pTempDir, "schema")));
+		try {
+			gen.generate(pURL);
+		} catch (Exception e) {
+			throw new ServletException(e);
+		}
+		
+		pResponse.setContentType("application/zip");
+		pResponse.setHeader("Content-Disposition", "attachment; filename=\"jaxmeGeneratedSrc.zip\"");
+		ZipOutputStream zipOutputStream = new ZipOutputStream(pResponse.getOutputStream());
+		addContents(zipOutputStream, pTempDir, "");
+		zipOutputStream.close();
+		removeDirectory(pTempDir);
+		pTempDir = null;
+	}
+
+	protected void doValidate(boolean pValidating, File pTempDir, URL pURL, HttpServletResponse pResponse)
+			throws ServletException, IOException {
+		XSParser parser = new XSParser();
+		parser.setValidating(pValidating);
+		InputSource isource = new InputSource(pURL.toString());
+		try {
+			parser.parse(isource);
+		} catch (Exception e) {
+			throw new ServletException(e);
+		}
+	}
+
+	public void doGet(HttpServletRequest pRequest, HttpServletResponse pResponse)
+	    	throws ServletException, IOException {
+		String s = pRequest.getParameter("url");
+		if (s == null  ||  s.length() == 0) {
+			throw new ServletException("Missing or empty request parameter: " + s);
+		}
+		URL url;
+		try {
+			url = new URL(s);
+		} catch (MalformedURLException e) {
+			throw new ServletException("Malformed URL: " + s);
+		}
+		
+		boolean isValidating = Boolean.valueOf(pRequest.getParameter("isValidating")).booleanValue();
+		File f = createTempDir();
+
+		String what = pRequest.getParameter("what");
+
+		boolean forward = false;
+		try {
+			if ("compile".equals(what)) {
+				try {
+					doCompile(isValidating, f, url, pResponse);
+				} catch (ServletException e) {
+					pRequest.setAttribute("error", e);
+					forward = true;
+				}
+			} else if ("validate".equals(what)) {
+				doValidate(isValidating, f, url, pResponse);
+				pRequest.setAttribute("success", Boolean.TRUE);
+				forward = true;
+			} else {
+				throw new ServletException("You must choose a proper action: Either 'compile' or 'validate'.");
+			}
+
+			f = null;
+		} finally {
+			if (f != null) { try { removeDirectory(f); } catch (Throwable ignore) {} }
+		}
+
+		if (forward) {
+			pRequest.getRequestDispatcher("index.jsp").forward(pRequest, pResponse);
+		}
+	}
+
+	public void doPost(HttpServletRequest pRequest, HttpServletResponse pResponse)
+			throws ServletException, IOException {
+		// No actual difference between GET and POST ...
+		doGet(pRequest, pResponse);
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/webapp/web.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/src/webapp/web.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/webapp/web.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app 
+    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
+    "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+<!--
+  Copyright 2003, 2004  The Apache Software Foundation
+   
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+	<display-name>JaxMe Online</display-name>
+    <description>
+	  This small web application allows access to run the
+	  JaxMe compiler on a remote schema. It returns a ZIP
+	  file with the generated sources.
+    </description>
+
+    <context-param>
+      <param-name>work.dir</param-name>
+      <param-value>@work.dir@</param-value>
+      <description>
+        This parameter specifies the location of
+    	the "work" directory. If such a location is
+    	not set, the value ${java.io.tmpdir}
+    	will be used.
+
+        In either case, a subdirectory "jaxme" will be
+        created, which is the actual working directory.
+        The directory will be created or cleaned on
+        startup by the InitServlet.
+      </description>
+    </context-param>
+
+	<context-param>
+		<param-name>http.proxyHost</param-name>
+		<param-value>@http.proxyHost@</param-value>
+		<description>
+			This parameter, if present and nonempty, contains the name of a proxy
+			host to use for connecting to remote URL's. If you set this parameter,
+			you must also set the "http.proxyPort" parameter.
+		</description>
+	</context-param>
+
+	<context-param>
+		<param-name>http.proxyPort</param-name>
+		<param-value>@http.proxyPort@</param-value>
+		<description>
+			This parameter, if present and nonempty, contains the name of a proxy
+			host to use for connecting to remote URL's. If you set this parameter,
+			you must also set the "http.proxyPort" parameter.
+		</description>
+	</context-param>
+
+    <servlet>
+      <servlet-name>InitServlet</servlet-name>
+      <description>
+      	Loaded on startup to initialize the application. In particular,
+      	it creates or cleans the working directory.
+      </description>
+      <servlet-class>org.apache.ws.jaxme.webapp.InitServlet</servlet-class>
+      <!-- Load this servlet at server startup time -->
+      <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet>
+      <servlet-name>JaxMeServlet</servlet-name>
+      <description>
+      	Invokes the JaxMe binding compiler.
+      </description>
+      <servlet-class>org.apache.ws.jaxme.webapp.JaxMeServlet</servlet-class>
+    </servlet>
+
+	<servlet-mapping>
+      <servlet-name>JaxMeServlet</servlet-name>
+      <url-pattern>/jaxme</url-pattern>
+    </servlet-mapping>
+</web-app>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/SchemaTransformer.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/SchemaTransformer.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/SchemaTransformer.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+package org.apache.ws.jaxme.xs;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** A schema transformer is able to modify a schema, which
+ * is being read. This is used, for example, to implement
+ * the external JAXB binding files.
+ */
+public interface SchemaTransformer {
+	/** Reads the given input source.
+	 */
+	public void parse(InputSource pSource, XMLReader pReader)
+			throws ParserConfigurationException, SAXException, IOException;
+
+	/** Returns the new input source. Called after
+	 * {@link #parse(InputSource, XMLReader)}.
+	 */
+	public InputSource getTransformedInputSource();
+
+	/** Returns the new XML reader. Called after
+	 * {@link #parse(InputSource, XMLReader)}.
+	 */
+	public XMLReader getTransformedXMLReader();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XPathMatcher.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XPathMatcher.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XPathMatcher.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,944 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEField;
+import org.apache.ws.jaxme.xs.xml.XsESelector;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTKeybase;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/** 
+ * An XPath matcher. Implements the restricted subset of XPath as defined
+ * by the XML Schema.
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public final class XPathMatcher {
+  private static final XSElementOrAttrRef[] NO_MATCHES 
+    = new XSElementOrAttrRef[] {};
+
+  /**
+   * The matching of elements and attributes works by walking a finite
+   * state automata produced by parsing the xpath. There is one more
+   * automata than |'s in the xpath, the first node of each automata is
+   * stored in this array.
+   */
+  private final InternalNode[] _stateMachineRoots;
+  private final Locator _saxLocator;
+
+  private XPathMatcher( Locator locator, InternalNode[] roots ) {
+    _saxLocator = locator;
+    _stateMachineRoots = roots;
+  }
+
+  /**
+   * Matches every element and attribute referenced by the specified
+   * keybase.<p>
+   *
+   * The result is a two dimensional array, the first dimension corresponds to
+   * each xs:field used to declare the constraint. The second dimension is
+   * for each 'or' used within the fields xpath query. <p>
+   *
+   * Only tags and attributes that were matched by the xpath will be in the
+   * result, any xpath that fails to match anything will not be stored
+   * in this array.<p>
+   */
+  public static XSElementOrAttrRef[][] match( 
+    XsTKeybase keybase, 
+    XSElement startingNode 
+  ) 
+    throws SAXException
+  {
+    XsESelector selector = keybase.getSelector();
+    XsEField[]  fields   = keybase.getFields();
+
+    String selectorXPath = selector.getXpath().getToken();
+    XPathMatcher baseMatcher = XPathMatcher.parse(
+      selector.getLocator(),
+      selectorXPath, 
+      true
+    );
+
+    XSElementOrAttrRef[] baseElements = baseMatcher.match( startingNode );
+
+    final int numBaseElements = baseElements.length;
+    final int numFields = fields.length;
+    XSElementOrAttrRef[][] results = new XSElementOrAttrRef[numFields][];
+
+
+    // populate the results, the first dimension is indexed by 'field'
+    for ( int i=0; i<numFields; i++ ) {
+      XsEField field = fields[i];
+      String fieldXPath = field.getXpath().getToken();
+
+      XPathMatcher fieldMatcher = XPathMatcher.parse( 
+        field.getLocator(),
+        fieldXPath, 
+        false 
+      );
+
+      Set matches = new HashSet(3);
+
+      // run the xpath for each of the elements identified by the selector,
+      // referred to as the base elements. The values saved in matches then
+      // form the second dimension of the result.
+      for ( 
+        int baseElementIndex=0; 
+        baseElementIndex<numBaseElements; 
+        baseElementIndex++
+      ) {
+        fieldMatcher.match( 
+          baseElements[baseElementIndex].getElement(), 
+          matches 
+        );
+      }
+
+      int numResults = matches.size();
+      results[i] = (XSElementOrAttrRef[]) matches.toArray( 
+        new XSElementOrAttrRef[numResults] 
+      );
+    }
+
+    return results;
+  }
+
+
+
+
+  /**
+   * Create an XPathMatcher. Parses a string holding a restricted subset
+   * of XPath and returns an object that knows how to walk XSElement
+   * objects based on that XPath. 
+   *
+   * @param elementsOnly True if the xpath is not allowed to match attributes.
+   */
+  public static XPathMatcher parse( 
+    Locator locator, 
+    String xpath, 
+    boolean elementsOnly 
+  ) 
+    throws SAXException 
+  {
+    Tokenizer tokenizer = new Tokenizer( locator, xpath );
+    List automatasList = new ArrayList(3);
+
+    InternalNode automata = createNextAutomata( tokenizer, elementsOnly );
+    while ( automata != null ) {
+      automatasList.add( automata );
+      automata = createNextAutomata( tokenizer, elementsOnly );
+    }
+
+    int numAutomatas = automatasList.size();
+    InternalNode[] automataRoots = new InternalNode[numAutomatas];
+    automataRoots = (InternalNode[]) automatasList.toArray( automataRoots );
+
+    return new XPathMatcher( locator, automataRoots );
+  }
+
+  /**
+   * Return the elements and attributes matched by this xpath when applied
+   * from the specified starting node.
+   */
+  public XSElementOrAttrRef[] match( XSElement startingNode ) 
+    throws SAXException
+  {
+    Set matches = new HashSet(5);
+
+    match( startingNode, matches );
+
+    int numMatches = matches.size();
+    if ( numMatches == 0 ) {
+      return NO_MATCHES;
+    }
+
+    XSElementOrAttrRef[] matchesArray = new XSElementOrAttrRef[numMatches];
+
+    return (XSElementOrAttrRef[]) matches.toArray( matchesArray );
+  }
+
+  /**
+   * Return the elements and attributes matched by this xpath when applied
+   * from the specified starting node.
+   */
+  public void match(XSElement startingNode, Set matches) throws SAXException {
+    InternalNode[] roots = _stateMachineRoots;
+    int numRoots = roots.length;
+
+    for ( int i=0; i<numRoots; i++ ) {
+      roots[i].match( startingNode, matches );
+    }
+  }
+
+
+
+//
+// Below is the parser used to create the finate state automatas.
+//
+
+
+  /**
+   * Called by #parse to create a new automata. If there are n |'s in an
+   * xpath then there will be 1+n automatas generated. An automata is
+   * used to walk over the XSElement objects, with the goal of creating
+   * and XSElementOrAttrRef object for each match defined by the original
+   * xpath.
+   */
+  private static InternalNode createNextAutomata( 
+    Tokenizer tokenizer, 
+    boolean elementsOnly
+  ) 
+    throws SAXException
+  {
+    InternalNode rootNode = createAnEntityNode( tokenizer, elementsOnly );
+
+    if ( rootNode != null ) {
+      appendASeperatorNode( tokenizer, rootNode, elementsOnly );
+    } 
+
+    return rootNode;
+  }
+
+  /**
+   * Called when the next token in the xpath <b>must</b> refer to either
+   * an attribute or an element. Called by #createNextAutomata and
+   * #appendAnEntityNode.
+   */
+  private static InternalNode createAnEntityNode( 
+    Tokenizer tokenizer, 
+    boolean elementsOnly
+  ) throws SAXException {
+    Token token = tokenizer.next();
+  
+    switch ( token.getTokenCode() ) {
+      case Tokenizer.ELEMENT_TOKEN:
+        return new NamedChildElementNode(
+          token.getNameSpace(), 
+          token.getLabel() 
+        );
+      case Tokenizer.ATTR_TOKEN:
+        if ( elementsOnly ) {
+          tokenizer.throwException( 
+            "No references to an attribute are allowed here."
+          );
+        } 
+
+        return new StaticAttributeNode(token.getNameSpace(), token.getLabel());
+      case Tokenizer.THIS_TOKEN:
+        return new ThisNode();
+      case Tokenizer.ALL_CHILDREN_TOKEN:
+        return new AllChildrenNode( token.getNameSpace() );
+      case Tokenizer.END_TOKEN:
+        return null; 
+      default:
+        tokenizer.throwException(
+          "Read '" + token.getImage() + "' when a reference to either an "
+          + "attribute or an element was expected."
+        );
+    }
+
+
+    //assert false : "unreachable code reached"; 
+    //This return is only here to keep the compiler happy..
+    return null;
+  }
+
+  /**
+   * Given the current state of the automata (previousNode), append a 
+   * new node that will match either an attribute or an element.
+   */
+  private static void appendAnEntityNode( 
+    Tokenizer tokenizer, 
+    InternalNode previousNode,
+    boolean elementsOnly
+  ) throws SAXException {
+    InternalNode newNode = createAnEntityNode( tokenizer, elementsOnly );
+
+    // has the end of the xpath been reached?
+    if ( newNode != null ) {
+      previousNode.setNextNode( newNode );
+      appendASeperatorNode( tokenizer, newNode, elementsOnly );
+    }
+  }
+
+  /**
+   * The automata is made up only of nodes that match either 1 attribute
+   * or 1+ elements. However the xpath string separates these references in
+   * a number of ways, this function will part those separators and
+   * choose between ending the automata or parsing the next attribute/element
+   * reference.
+   */
+  private static void appendASeperatorNode( 
+    Tokenizer tokenizer, 
+    InternalNode previousNode,
+    boolean elementsOnly
+  ) throws SAXException {
+    Token token = tokenizer.next();
+
+    switch ( token.getTokenCode() ) {
+      case Tokenizer.SEPARATOR_TOKEN:
+        appendAnEntityNode( tokenizer, previousNode, elementsOnly );
+        return;
+      case Tokenizer.OR_TOKEN:
+        return;    
+      case Tokenizer.END_TOKEN:
+        return;
+      case Tokenizer.ALL_DESCENDANTS_TOKEN:
+        InternalNode newNode = new AllDescendantsNode( token.getNameSpace() );
+        previousNode.setNextNode( newNode );
+        appendAnEntityNode( tokenizer, newNode, elementsOnly );
+        return;
+      default:
+        tokenizer.throwException(
+          "Unexpected string '" + token.getImage() + "' encountered. Expected"
+          + " either | / or nothing."
+        );
+    }
+  }
+
+
+
+
+//
+// Below is the lexical code. Breaks the xpath down into its component parts.
+// Used by #parse to create the matcher (or finate state automata).
+//
+
+
+  /**
+   * Breaks the input xpath down into its basic parts. 
+   */
+  private static final class Tokenizer {
+    public static final int ELEMENT_TOKEN         = 0;
+    public static final int THIS_TOKEN            = 1;
+    public static final int ATTR_TOKEN            = 2;
+    public static final int ALL_CHILDREN_TOKEN    = 3;
+    public static final int ALL_DESCENDANTS_TOKEN = 4;
+    public static final int SEPARATOR_TOKEN       = 5;
+    public static final int OR_TOKEN              = 6;
+    public static final int END_TOKEN             = 7;
+
+    public static final CharHandler STARTING_HANDLER =new InitialCharHandler();
+    public static final CharHandler ATTRIBUTE_HANDLER 
+      = new AttributeCharHandler();
+    public static final CharHandler ELEMENT_HANDLER = new ElementCharHandler();
+
+    private final String _xpath;
+    private final Locator _saxLocator;
+
+    private int _pos;
+
+    public Tokenizer( Locator locator, String xpath ) {
+      _xpath = xpath;
+      _saxLocator = locator;
+    }
+
+    public boolean hasNext() {
+      return _pos < _xpath.length();
+    }
+
+    /**
+     * Fetches the next token from the input xpath.
+     */
+    public Token next() throws SAXException {
+      TokenizerState context = new TokenizerState();
+      while ( context.hasNext() ) {
+        CharHandler ch = context.getCharHandler();
+
+        ch.process( context );
+      }
+
+      _pos = context.getPos();
+
+      return context.createToken();
+    }
+
+    public void throwException( String msg ) throws SAXException {
+      throw new LocSAXException( msg, _saxLocator );
+    }
+
+    private class TokenizerState {
+      private final int    _startPos;
+
+      private int    _pos;
+      private int    _markedPos;
+      private int    _tokenCode = -1;
+      private String _nameSpace;
+      private String _label;
+
+      private CharHandler _charHandler = STARTING_HANDLER;
+
+      public TokenizerState() {
+        _startPos = Tokenizer.this._pos;
+        _pos = Tokenizer.this._pos;
+        _markedPos = Tokenizer.this._pos;
+      }
+
+      public int getPos() {
+        return _pos;
+      }
+
+      public CharHandler getCharHandler() {
+        return _charHandler;
+      }
+
+      public void setCharHandler( CharHandler ch ) {
+        _charHandler = ch;
+      }
+
+      public boolean hasMatch() {
+        return _tokenCode >= 0;
+      }
+
+      public boolean hasNext() {
+        boolean boo = !hasMatch() && this._pos < _xpath.length();
+
+        return boo;
+      }
+
+      public char peekAhead() {
+        return Tokenizer.this._xpath.charAt( _pos );
+      }
+
+      public char scrollAhead() {
+        return Tokenizer.this._xpath.charAt( _pos++ );
+      }
+
+      // TODO skipWhiteSpace and skipOverIdentifier are almost identical,
+      // consider pulling the internals of them out into a reusable utility.
+
+      public void skipWhiteSpace() {
+        final String xpath = Tokenizer.this._xpath;
+        final int maxPos = xpath.length();
+
+        int pos = _pos;
+        while ( pos < maxPos ) {
+          char ch = xpath.charAt( pos );
+
+          if ( Character.isWhitespace(ch) ) {
+            pos++;
+          } else {
+            break;
+          }
+        }
+
+        _pos = pos;
+      }
+
+      public void skipOverIdentifier() {
+        final String xpath = Tokenizer.this._xpath;
+        final int maxPos = xpath.length();
+
+        int pos = _pos;
+        while ( pos < maxPos ) {
+          char ch = xpath.charAt( pos );
+
+          if ( Character.isLetterOrDigit(ch) || ch == '_' || ch == '-' ) {
+            pos++;
+          } else {
+            break;
+          }
+        }
+
+        _pos = pos;
+      }
+
+      public void setTokenCode( int tokenCode ) {
+        _tokenCode = tokenCode;
+      }
+
+      public void markPos() {
+        _markedPos = _pos;
+      }
+
+      public void saveNameSpace() {
+        _nameSpace = Tokenizer.this._xpath.substring( _markedPos, _pos );
+        _markedPos = _pos;
+      }
+
+      public void saveLabel() {
+        _label = Tokenizer.this._xpath.substring( _markedPos, _pos );
+        _markedPos = _pos;
+      }
+
+      public Token createToken() {
+        if ( !hasMatch() && !hasNext() ) {
+          _tokenCode = END_TOKEN;
+        }
+
+        return new Token(
+          _tokenCode,
+          _nameSpace,
+          _label,
+          _xpath.substring( _startPos, _pos )
+        );
+      }
+
+      public void throwException( String msg ) throws SAXException {
+        Tokenizer.this.throwException( msg );
+      }
+    }
+
+    /**
+     * Base class for the 'state' classes that process the xpath. The main
+     * loop in Tokenizer#next keeps asking the current char handler to
+     * process the context (current state of the tokenizer) until either
+     * the char handler decides to hand over to another char handler, the
+     * end of the xpath string is reached or a match is reached inwhich case
+     * a token will be generated by Tokenizer#next.
+     */
+    private static abstract class CharHandler {
+      public abstract void process( TokenizerState context ) 
+        throws SAXException;
+    }
+
+    /**
+     * The first char handler invoked for each new token. Does not know what
+     * token to expect, so does its best to handle the simple one or two char
+     * constant tokens (eg . * / // |) but will delegate to another char 
+     * handler for the more complicated composite tokens such as @ns:foo, 
+     * foo, ns:foo, ns:* etc.
+     */
+    private static final class InitialCharHandler extends CharHandler {
+      public void process( TokenizerState context ) 
+        throws SAXException
+      {
+        // assert context.hasNext();
+        context.skipWhiteSpace();
+
+        if ( !context.hasNext() ) {
+          return;
+        }
+
+        char ch = context.peekAhead();
+        switch ( ch ) {
+          case '*':
+            context.scrollAhead();
+            context.setTokenCode( Tokenizer.ALL_CHILDREN_TOKEN );
+            break;
+          case '.':
+            context.scrollAhead();
+            context.setTokenCode( Tokenizer.THIS_TOKEN );
+            break;
+          case '/':
+            context.scrollAhead();
+            if ( context.peekAhead() == '/' ) {
+              context.scrollAhead();
+              context.setTokenCode( Tokenizer.ALL_DESCENDANTS_TOKEN );
+            } else {
+              context.setTokenCode( Tokenizer.SEPARATOR_TOKEN );
+            }
+
+            break;
+          case '|':
+            context.scrollAhead();
+            context.setTokenCode( Tokenizer.OR_TOKEN );
+            break;
+          case '@':
+            context.scrollAhead();
+            context.markPos();
+            context.setCharHandler( ATTRIBUTE_HANDLER );
+            break;
+          default:
+            context.setCharHandler( ELEMENT_HANDLER );
+        }
+      }
+    }
+
+    /**
+     * Accepts elementName, ns:*, ns:elementName
+     */
+    private static final class ElementCharHandler extends CharHandler {
+      public void process( TokenizerState context ) 
+        throws SAXException
+      {
+        context.skipOverIdentifier();
+
+        if ( context.hasNext() ) {
+          if ( context.peekAhead() == ':' ) {
+            context.saveNameSpace();
+            context.scrollAhead();
+
+            if ( context.hasNext() ) {
+              if ( context.peekAhead() == '*' ) {
+                context.scrollAhead();
+                context.setTokenCode( Tokenizer.ALL_CHILDREN_TOKEN );
+
+                return;
+              }
+            } 
+
+            context.markPos();
+            context.skipOverIdentifier();
+          }
+        } 
+
+        context.saveLabel();
+        context.setTokenCode( Tokenizer.ELEMENT_TOKEN );
+      }
+    }
+
+    /**
+     * Accepts fieldName, or ns:fieldName.
+     */
+    private static final class AttributeCharHandler extends CharHandler {
+      public void process( TokenizerState context ) 
+        throws SAXException
+      {
+        context.skipOverIdentifier();
+
+        if ( context.hasNext() && context.peekAhead() == ':' ) {
+          context.saveNameSpace();
+          context.scrollAhead();
+          context.markPos();
+          context.skipOverIdentifier();
+        } 
+
+        context.saveLabel();
+        context.setTokenCode( Tokenizer.ATTR_TOKEN );
+      }
+    }
+  }
+
+  /**
+   * Represents a basic part of the xpath input. These tokens are
+   * created by the Tokenizer.
+   */
+  private static final class Token {
+    private final int _tokenCode;
+
+    /**
+     * The name of the name space, or null if the match does not belong to
+     * a name space.
+     */
+    private final String _nameSpace;
+
+    /**
+     * The local name of the element/field that was matched.
+     */
+    private final String _label;
+
+    /**
+     * The entire matched string in its raw form.
+     */
+    private final String _image;
+
+    public Token(int tokenCode, String nameSpace, String label, String image) {
+      _tokenCode = tokenCode;
+      _nameSpace = nameSpace;
+      _label = label;
+      _image = image;
+    }
+
+    public int getTokenCode() {
+      return _tokenCode;
+    }
+
+    public String getNameSpace() {
+      return _nameSpace;
+    }
+
+    public String getLabel() {
+      return _label;
+    }
+
+    public String getImage() {
+      return _image;
+    }
+  }
+
+
+
+//
+// Below is the finate state automata used to match the xpath with 
+// XSElements and XSAttributes. Generated by the #parse method and executed
+// by the #match method.
+//
+
+
+  /**
+   * The xpath is converted into a small finite state machine. This interface
+   * is the base type of each node within the generated graph.
+   */
+  private abstract static class InternalNode {
+    private InternalNode _next;
+
+    /**
+     * Applies the action associated with this node to the current element.
+     * If the node decides that the currentElement (or attribute or the
+     * element) is a match then a XSElementOrAttrRef will be added to the
+     * matches list. If the match is incomplete then this node will 
+     * invoke match on other nodes within the automata. If there is no
+     * match at all then this node will exit immediately.
+     *
+     * @param currentElement The element that is the focus of the match.
+     * @param matches The list that collects all of the elements/attributes
+     *   that reach the end of the finite state machine.
+     */
+    public abstract void match( XSElement currentElement, Set matches )
+      throws SAXException;
+
+    /**
+     * Link this node with another node. Due to the restrictions made to
+     * the valid XPath usable within the XML Schema have very simple graphs
+     * where each node links to at most one other node.
+     */
+    public final void setNextNode( InternalNode next ) {
+      _next = next;
+    }
+
+    /**
+     * Carry on to the next node in the graph. If there is no other
+     * node then it means that this element is a match and should be
+     * added to the matches list before returning.
+     */
+    protected final void continueSearchFor( 
+      XSElement currentElement, 
+      Set matches 
+    ) throws SAXException {
+      InternalNode next = _next;
+
+      if ( next == null ) {
+        matches.add( new XSElementOrAttrRef(currentElement) );
+      } else {
+        next.match( currentElement, matches );
+      }
+    }
+
+    /**
+     * A utility method that checks whether the specified namespace/name
+     * matches the XsQName.
+     */
+    protected boolean doesMatch(String nameSpace, String name, XsQName qName) {
+      boolean boo = doesNSMatch(nameSpace, qName) 
+        && name.equals( qName.getLocalName() );
+
+      return boo;
+    }
+
+    /**
+     * A utility method that checks whether the specified namespace/name
+     * matches the XsQName.
+     */
+    protected boolean doesNSMatch(String nameSpace, XsQName qName) {
+      if ( nameSpace == null ) {
+        return qName.getPrefix() == null;
+      } else {
+        return nameSpace.equals( qName.getPrefix() );
+      }
+    }
+
+    // TODO consider moving this functionality into the XSElement object
+    protected Iterator getChildrenIteratorFor( XSElement element ) 
+      throws SAXException
+    {
+      List children = new ArrayList(5);
+
+      XSType type = element.getType();
+
+      if ( !type.isSimple() ) {
+        XSComplexType complexType = type.getComplexType();
+
+        if ( !complexType.isEmpty() ) {
+          XSParticle particle = complexType.getParticle();
+
+          if ( particle.isElement() ) {
+            children.add( particle.getElement() );
+          } else if ( particle.isGroup() ) {
+            XSGroup group = particle.getGroup();
+
+            XSParticle[] particles = group.getParticles();
+            int numParticles = particles.length;
+
+            for ( int i=0; i<numParticles; i++ ) {
+              XSParticle groupedParticle = particles[i];
+
+              if ( groupedParticle.isElement() ) {
+                children.add( groupedParticle.getElement() );
+              }
+            }
+          }
+        }
+      }
+
+      return children.iterator();
+    }
+  }
+
+  /**
+   * This state represents a . within the xpath. 
+   */
+  private static final class ThisNode extends InternalNode {
+    /**
+     * Use this singleton when this node appears as the last of the matching
+     * criteria.
+     */
+    public static final ThisNode LEAF_INSTANCE = new ThisNode();
+
+    public void match( XSElement currentElement, Set matches ) 
+      throws SAXException
+    {
+      continueSearchFor( currentElement, matches );
+    }
+  }
+
+  /**
+   * Represents a constant within the xpath that matches an elements name.
+   */
+  private static final class NamedChildElementNode extends InternalNode {
+    private final String _nameSpace;
+    private final String _name;
+
+    /**
+     * @param nameSpace The XML name space required for the matching element. 
+     *   Null means no name space.
+     * @param name The name of the XSElement that will be matched. The name
+     *   is not nullable.
+     */
+    public NamedChildElementNode( String nameSpace, String name ) {
+      _nameSpace = nameSpace;
+      _name = name;
+    }
+
+    public void match( XSElement currentElement, Set matches ) 
+      throws SAXException
+    {
+      Iterator iterator = getChildrenIteratorFor( currentElement );
+
+      while ( iterator.hasNext() ) {
+        XSElement element = (XSElement) iterator.next();
+
+        if ( doesMatch(_nameSpace, _name, element.getName()) ) {
+          continueSearchFor( element, matches );
+
+          // there can only be one match..
+          break;
+        }
+      }
+    }
+  }
+
+  /**
+   * Represents a constant within the xpath that matches an attributes name.
+   */
+  private static final class StaticAttributeNode extends InternalNode {
+    private final String _nameSpace;
+    private final String _name;
+
+    /**
+     * @param nameSpace The XML name space required for the matching element. 
+     *   Null means no name space.
+     * @param name The name of the XSElement that will be matched. The name
+     *   is not nullable.
+     */
+    public StaticAttributeNode( String nameSpace, String name ) {
+      _nameSpace = nameSpace;
+      _name = name;
+    }
+
+    public void match( XSElement currentElement, Set matches ) 
+      throws SAXException
+    {
+      //assert getNextNode() == null;
+      XSType type = currentElement.getType();
+
+      if ( !type.isSimple() ) {
+        XSComplexType complexType = type.getComplexType();
+        XSAttributable[] attributables = complexType.getAttributes();
+        int numAttribables = attributables.length;
+
+        // TODO consider moving this functionality onto the XSElement object
+        for ( int i=0; i<numAttribables; i++ ) {
+          XSAttributable attributable = attributables[i];
+
+          if ( attributable instanceof XSAttribute ) {
+            XSAttribute attribute = (XSAttribute) attributable;
+
+            if ( doesMatch(_nameSpace, _name, attribute.getName()) ) {
+              matches.add( new XSElementOrAttrRef(attribute) );
+
+              return;
+            }
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * This node matches all elements that are children of the current element.
+   */
+  private static final class AllChildrenNode extends InternalNode {
+    private final String _nameSpace;
+
+    public AllChildrenNode( String nameSpace ) {
+      _nameSpace = nameSpace;
+    }
+
+    public void match( XSElement currentElement, Set matches ) 
+      throws SAXException
+    {
+      String nameSpace = _nameSpace;
+      Iterator iterator = getChildrenIteratorFor( currentElement );
+
+      while ( iterator.hasNext() ) {
+        XSElement element = (XSElement) iterator.next();
+
+        if ( doesNSMatch(nameSpace, element.getName()) ) {
+          continueSearchFor( element, matches );
+        }
+      }
+    }
+  }
+
+  /**
+   * This node matches every element that is below the current element.
+   */
+  private static final class AllDescendantsNode extends InternalNode {
+    private final String _nameSpace;
+
+    public AllDescendantsNode( String nameSpace ) {
+      _nameSpace = nameSpace;
+    }
+
+    public void match( XSElement currentElement, Set matches ) 
+      throws SAXException
+    {
+      String nameSpace = _nameSpace;
+      Iterator iterator = getChildrenIteratorFor( currentElement );
+
+      while ( iterator.hasNext() ) {
+        XSElement element = (XSElement) iterator.next();
+
+        if ( doesNSMatch(nameSpace, element.getName()) ) {
+          continueSearchFor( element, matches );
+
+          // go recursive
+          this.match( element, matches );
+        }
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAnnotation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAnnotation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAnnotation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+
+/** <p>Interface of an annotation.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAnnotation extends XSOpenAttrs {
+  /** <p>Returns the array of documentations.</p>
+   */
+  public XSDocumentation[] getDocumentations();
+
+  /** <p>Returns the array of appinfo elements.</p>
+   */
+  public XSAppinfo[] getAppinfos();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAny.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAny.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAny.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAny extends XSWildcard {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAppinfo.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAppinfo.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAppinfo.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+
+
+/** <p>Interface of an appinfo element.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAppinfo extends XSObject {
+  /** <p>Returns the appinfos source element or null,
+   * if no such attribute is defined.</p>
+   */
+  public XsAnyURI getSource();
+
+  /** <p>Returns the appinfos content. The objects in the
+   * array are either of:
+   * <ul>
+   *   <li>A String, indicating character data, or</li>
+   *   <li>A DOM document containing a single child element.</li>
+   * </ul>
+   * @see #getText()
+   */
+  public Object[] getChilds();
+
+  /** <p>Merges the String elements returned by {@link #getChilds()}
+   * into a single String.</p>
+   * @see #getChilds()
+   */
+  public String getText();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAtomicType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAtomicType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAtomicType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+
+/** <p>Details of an atomic type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAtomicType {
+  /** <p>Returns the value of the "fractionDigits" facet or null, if the facet is not set.</p>
+   */
+  public Long getFractionDigits();
+
+  /** <p>Returns the value of the "length" facet or null, if the facet is not set.</p>
+   */
+  public Long getLength();
+
+  /** <p>Returns the value of the "maxExclusive" facet or null, if the facet is not set.</p>
+   */
+  public String getMaxExclusive();
+
+  /** <p>Returns the value of the "maxInclusive" facet or null, if the facet is not set.</p>
+   */
+  public String getMaxInclusive();
+
+  /** <p>Returns the value of the "maxLength" facet or null, if the facet is not set.</p>
+   */
+  public Long getMaxLength();
+
+  /** <p>Returns the value of the "minExclusive" facet or null, if the facet is not set.</p>
+   */
+  public String getMinExclusive();
+
+  /** <p>Returns the value of the "minInclusive" facet or null, if the facet is not set.</p>
+   */
+  public String getMinInclusive();
+
+  /** <p>Returns the value of the "minLength" facet or null, if the facet is not set.</p>
+   */
+  public Long getMinLength();
+
+  /** <p>Returns the value of the "totalDigits" facet or null, if the facet is not set.</p>
+   */
+  public Long getTotalDigits();
+
+  /** <p>Returns whether the simple type is replacing tabs, carriage returns,
+   * and line feeds with blanks.</p>
+   */
+  public boolean isReplacing();
+
+  /** <p>Returns whether the simple type is collapsing multiple blanks into
+   * one and removing preceding and trailing blanks. Collapsing includes
+   * replacing.</p>
+   */
+  public boolean isCollapsing();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributable.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributable.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributable.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/** <p>A common interface for the objects returned by
+ * {@link org.apache.ws.jaxme.xs.XSComplexType#getAttributes()}:
+ * {@link org.apache.ws.jaxme.xs.XSAttribute} and
+ * {@link org.apache.ws.jaxme.xs.XSWildcard}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAttributable {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttribute.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttribute.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttribute.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>Interface of a schema attribute.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAttribute extends XSOpenAttrs, XSAttributable {
+  /** <p>Returns whether the attribute is global.</p>
+   */
+  public boolean isGlobal();
+
+  /** <p>Returns the attributes name. Note, that an attribute
+   * always has a name, unlike types.</p>
+   */
+  public XsQName getName();
+
+  /** <p>Returns the attributes type.</p>
+   */
+  public XSType getType();
+
+  /** <p>Returns whether the attribute is optional.</p>
+   */
+  public boolean isOptional();
+
+  /** <p>Returns the attributes set of annotations.</p>
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** <p>Returns the attributes "default" value or null, if no such
+   * attribute is set.</p>
+   */
+  public String getDefault();
+
+  /** <p>Returns the attributes "fixed" value or null, if no such
+   * attribute is set.</p>
+   */
+  public String getFixed();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributeGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributeGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSAttributeGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>Interface of an attribute group. Note, that attribute groups
+ * are always global.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAttributeGroup extends XSOpenAttrs {
+  /** <p>Returns the attribute group is global: Returns the attribute
+   * groups name. Otherwise returns null.</p>
+   */
+  public XsQName getName();
+
+  /** <p>Returns the groups attributes.</p>
+   */
+  public XSAttributable[] getAttributes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSComplexType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSComplexType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSComplexType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Details of a complex type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSComplexType {
+  /** <p>Returns whether the complex type has simple content. If so,
+   * you may use the method {@link #getSimpleContent()} to fetch the
+   * simple contents type. If not, you may use
+   * {@link #getComplexContentType()}, {@link #isEmpty()},
+   * {@link #isElementOnly()}, {@link #isMixed()}, and
+   * {@link #getParticle()}. The method {@link #getAttributes()}
+   * is always valid.</p>
+   */
+  public boolean hasSimpleContent();
+
+  /** <p>If the complex type has simple content, returns the contents
+   * type. This is, of course, a simple type.</p>
+   */
+  public XSSimpleContentType getSimpleContent();
+
+  /** <p>If the element hasn't simple content: Returns the element contents
+   * type.</p>
+   * @throws IllegalStateException The element does not have
+   *   complex content
+   * @see XsComplexContentType#EMPTY
+   * @see XsComplexContentType#ELEMENT_ONLY
+   * @see XsComplexContentType#MIXED
+   * @see #isEmpty()
+   * @see #isElementOnly()
+   * @see #isMixed()
+   */
+  public XsComplexContentType getComplexContentType();
+
+  /** <p>If the element hasn't simple content: Returns whether the
+   * elements content is empty. Shortcut for
+   * <code>getComplexContentType().equals(EMPTY)</code>.</p>
+   * @throws IllegalStateException The element does not have
+   *   complex content
+   * @see XsComplexContentType#EMPTY
+   */
+  public boolean isEmpty();
+
+  /** <p>If the element hasn't simple content: Returns whether the
+   * elements content is elementOnly. Shortcut for
+   * <code>getComplexContentType().equals(ELEMENT_ONLY)</code>.</p>
+   * @throws IllegalStateException The element does not have
+   *   complex content
+   * @see XsComplexContentType#ELEMENT_ONLY
+   */
+  public boolean isElementOnly();
+
+  /** <p>If the element hasn't simple content: Returns whether the
+   * elements content is mixed. Shortcut for
+   * <code>getComplexContentType().equals(MIXED)</code>.</p>
+   * @throws IllegalStateException The element does not have
+   *   complex content
+   * @see XsComplexContentType#MIXED
+   */
+  public boolean isMixed();
+
+  /** <p>If the element hasn't simple content: Returns the complex
+   * elements particle.</p>
+   * @throws IllegalStateException The element has simple content
+   */
+  public XSParticle getParticle();
+
+  /** <p>Returns the complex types attributes.</p>
+   */
+  public XSAttributable[] getAttributes();
+
+  /** <p>Returns whether the element is a extension of another element.</p>
+   */
+  public boolean isExtension();
+
+  /** <p>If the element is an extension: Returns the extended type.</p>
+   * @throws IllegalStateException The element is no extension.
+   */
+  public XSType getExtendedType();
+
+  /** <p>Returns whether the element is a restriction of another element.</p>
+   */
+  public boolean isRestriction();
+
+  /** <p>If the element is an restriction: Returns the restricted type.</p>
+   * @throws IllegalStateException The element is no restriction.
+   */
+  public XSType getRestrictedType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSContentHandler.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSContentHandler.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSContentHandler.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.xs;
+
+import org.xml.sax.ContentHandler;
+
+/** <p>A SAX Parser for XML Schema. Use this as a SAX ContentHandler.
+ * The schema may be retrieved using {@link #getXSSchema()} after
+ * invoking {@link org.xml.sax.ContentHandler#endDocument()}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSContentHandler extends ContentHandler {
+  /** <p>Returns the schema, which has previously been parsed.</p>
+   * @throws IllegalStateException The
+   * {@link org.xml.sax.ContentHandler#endDocument()} event
+   * has not yet been seen.
+   */
+  public XSSchema getXSSchema();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSDocumentation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSDocumentation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSDocumentation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XmlLang;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSDocumentation extends XSObject {
+  /** <p>Returns the documentations xml:lang attribute or null,
+   * if no such attribute is defined.</p>
+   */
+  public XmlLang getLanguage();
+
+  /** <p>Returns the documentations source element or null,
+   * if no such attribute is defined.</p>
+   */
+  public XsAnyURI getSource();
+
+  /** <p>Returns the documentations content. The objects in the
+   * array are either of:
+   * <ul>
+   *   <li>A String, indicating character data, or</li>
+   *   <li>A DOM document containing a single child element.</li>
+   * </ul>
+   * @see #getText()
+   */
+  public Object[] getChilds();
+
+  /** <p>Merges the String elements returned by {@link #getChilds()}
+   * into a single String.</p>
+   * @see #getChilds()
+   */
+  public String getText();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>Interface of a schema element</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSElement extends XSOpenAttrs {
+  /** <p>Returns the array of annotations.</p>
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** <p>Returns whether the element is global or not.</p>
+   */
+  public boolean isGlobal();
+  
+  /** <p>Returns whether the element is nillable or not.</p>
+   */  
+  public boolean isNillable();
+
+  /** <p>Returns the elements name. Note that, unlike types,
+   * an element always has a name.</p>
+   */
+  public XsQName getName();
+
+  /** <p>Returns the elements type.</p>
+   */
+  public XSType getType();
+
+  /** <p>Returns the elements "default" value or null, if no such
+   * attribute is set.</p>
+   */
+  public String getDefault();
+
+  /** <p>Returns the elements "fixed" value or null, if no such
+   * attribute is set.</p>
+   */
+  public String getFixed();
+
+  /** <p>Returns the name of an element, which may be substituted
+   * by this element.</p>
+   */
+  public XsQName getSubstitutionGroupName();
+
+  /** <p>Returns whether this element is blocked for substitution.</p>
+   */
+  public boolean isBlockedForSubstitution();
+
+  /** <p>Returns whether the element is abstract or not.</p>
+   */
+  public boolean isAbstract();
+
+  /** <p>If the element may be substituted by other elements (in other
+   * words: if it is the head of a substitution group), sets the choice
+   * group of all the elements that may be used to replace the element.
+   * The element itself is part of the substitution group if, and only
+   * if, the element is not abstract.</p>
+   */
+  public void setSubstitutionGroup(XSGroup pGroup);
+
+  /** <p>If the element may be substituted by other elements (in other
+   * words: if it is the head of a substitution group), returns the choice
+   * group of all the elements that may be used to replace the element.
+   * The element itself is part of the substitution group if, and only
+   * if, the element is not abstract.</p>
+   */
+  public XSGroup getSubstitutionGroup();
+
+  /**
+   * Fetch all of the identity constraints that this element places
+   * upon its child tags. Note that a single xs:unique or xs:key tag
+   * may expand to several elements in this array depending on their
+   * xpath fields.
+   */
+  public XSIdentityConstraint[] getIdentityConstraints();
+
+  /**
+   * Fetch all of the keyref's declared by this element.
+   */
+  public XSKeyRef[] getKeyRefs();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/** 
+ * Specifies an element or attribute relative to the declaring element. The
+ * reference cannot be to an element and a attribute, one of the two getters
+ * must return null.
+ *
+ * @see XSElement
+ * @see XSIdentityConstraint
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public final class XSElementOrAttrRef {
+    private final XSElement _element;
+    private final XSAttribute _attribute;
+    
+    public XSElementOrAttrRef( XSElement element ) {
+        _element = element;
+        _attribute = null;
+    }
+    
+    public XSElementOrAttrRef( XSAttribute attribute ) {
+        _element = null;
+        _attribute = attribute;
+    }
+    
+    /**
+     * Fetches the element that this reference refers to. Returns null when
+     * isAttributeRef is true.
+     */
+    public XSElement getElement() {
+        return _element;
+    }
+    
+    /**
+     * Fetches the attribute that this reference refers to. Returns null when
+     * isAttributeRef is false.
+     */
+    public XSAttribute getAttribute() {
+        return _attribute;
+    }
+    
+    /**
+     * Returns true if this reference points at an attribute. Returns false
+     * when it references an element.
+     */
+    public boolean isAttributeRef() {
+        return _element == null;
+    }
+    
+    public int hashCode() {
+        Object o;
+        
+        if ( _element == null) {
+            o = _attribute;
+        } else {
+            o = _element;
+        }
+        
+        return o.hashCode();
+    }
+    
+    public boolean equals( Object o ) {
+        if ( o == null  || !(o instanceof XSElementOrAttrRef)) {
+            return false;
+        }
+        
+        XSElementOrAttrRef other = (XSElementOrAttrRef) o;
+        if ( this.isAttributeRef() ) {
+            return this._attribute.equals( other._attribute );
+        } else {
+            return this._element.equals( other._element );
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSEnumeration.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSEnumeration.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSEnumeration.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+
+/** <p>Interface of an xs:enumeration facet. This could be a simple string,
+ * but it is not unusual, that they carry important information in their
+ * <code>xs:annotation/xs:appinfo</code> section, thus the inheritance
+ * from {@link XSObject}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSEnumeration extends XSObject {
+  /** <p>Returns the enumeration facets set of annotations.</p>
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** <p>Returns the facets value.</p>
+   */
+  public String getValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>Interface of a group.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSGroup extends XSOpenAttrs, XSModelGroup {
+  /** <p>Returns the array of annotations.</p>
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** <p>Sets whether the group is global or not.</p>
+   */
+  public void setGlobal(boolean pGlobal);
+
+  /** <p>Returns whether the group is global or not.</p>
+   */
+  public boolean isGlobal();
+
+  /** <p>If the group is global: Returns the groups name. Otherwise returns
+   * null.</p>
+   */
+  public XsQName getName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSIdentityConstraint.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSIdentityConstraint.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSIdentityConstraint.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+
+
+/** 
+ * An identity constraint restricts the contents of an elements children.
+ * An XSElement may have one or more constraints associated with it that
+ * restrict the values that can be stored in an XML file that is described
+ * by this schema. For more information read into xs:key, xs:key-ref and
+ * xs:unique.
+ *
+ * @see XSElement
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public interface XSIdentityConstraint extends XSOpenAttrs {
+  /** 
+   * Returns the array of annotations.
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** 
+   * Returns the name of this constraint.
+   */
+  public String getName();
+
+  /**
+   * Return true if every element of the key is required when matching a
+   * node.
+   */
+  public boolean isUnique();
+
+  /**
+   * Returns an array of references to element and attributes. All references
+   * are relative to the element that owns this constraint. <p>
+   *
+   * The result is a two dimensional array, the first dimension corresponds to
+   * each xs:field used to declare the constraint. The second dimension is
+   * for each 'or' used within the fields xpath query. <p>
+   *
+   * Only tags and attributes that were matched by the xpath will be in the
+   * result, any xpath that fails to match anything will not be stored
+   * in this array.<p>
+   */
+  public XSElementOrAttrRef[][] getMatchCriteria();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSKeyRef.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSKeyRef.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSKeyRef.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+
+
+/** 
+ * This reference represents a key used to look up other elements. It does
+ * not infer any extra constraints other than if the match criteria exists
+ * then the values matched must exist within the refered identity constraint.
+ * For more information please refer to the xs:keyref tag.
+ *
+ * @see XSElement
+ * @see XSIdentityConstraint
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public interface XSKeyRef extends XSOpenAttrs {
+  /** 
+   * Returns the array of annotations.
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** 
+   * Returns the name of this constraint.
+   */
+  public String getName();
+
+  /**
+   * Returns the name of the unique or key identity constraint that this
+   * keyref references. The constraint must either be declared on the same
+   * element as this keyref or a descendant.
+   */
+  public XSIdentityConstraint getIdentityConstraint();
+
+  /**
+   * Returns an array of references to element and attributes. All references
+   * are relative to the element that declares this keyref.<p>
+   *
+   * The result is a two dimensional array, the first dimension corresponds to
+   * each xs:field used to declare the constraint. The second dimension is
+   * for each 'or' used within the fields xpath query. <p>
+   *
+   * Only tags and attributes that were matched by the xpath will be in the
+   * result, any xpath that fails to match anything will not be stored
+   * in this array.<p>
+   */
+  public XSElementOrAttrRef[][] getMatchCriteria();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSListType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSListType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSListType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/** <p>Details of a list type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSListType {
+  /** <p>Returns the item type (which is, of course, a simple type).</p>
+   */
+  public XSType getItemType();
+  /** <p>Returns the value of the "length" facet or null, if the facet is not set.</p>
+   */
+  public Long getLength();
+  /** <p>Returns the value of the "maxLength" facet or null, if the facet is not set.</p>
+   */
+  public Long getMinLength();
+  /** <p>Returns the value of the "minLength" facet or null, if the facet is not set.</p>
+   */
+  public Long getMaxLength();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSModelGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSModelGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSModelGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a model group. A model group is, for example,
+ * defined by an <code>xs:group</code> element, or by a complex type
+ * without simpleContent or complexContent.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSModelGroup {
+  public class Compositor {
+    private String name;
+    Compositor(String pName) {
+      name = pName;
+    }
+    public String toString() { return name; }
+    public boolean equals(Object o) {
+      return o != null  &&  o instanceof Compositor  &&  ((Compositor) o).name.equals(name);
+    }
+    public int hashCode() { return name.hashCode(); }
+  }
+
+  /** <p>The sequence compositor.</p>
+   */
+  public static final Compositor SEQUENCE = new Compositor("sequence");
+
+  /** <p>The choice compositor.</p>
+   */
+  public static final Compositor CHOICE = new Compositor("choice");
+
+  /** <p>The all compositor.</p>
+   */
+  public static final Compositor ALL = new Compositor("all");
+
+  /** <p>Returns the model groups compositor.</p>
+   */
+  public Compositor getCompositor();
+
+  /** <p>Shortcut for <code>getCompositor().equals(SEQUENCE)</code>.</p>
+   * @see #getCompositor()
+   * @see #SEQUENCE
+   */
+  public boolean isSequence();
+
+  /** <p>Shortcut for <code>getCompositor().equals(CHOICE)</code>.</p>
+   * @see #getCompositor()
+   * @see #CHOICE
+   */
+  public boolean isChoice();
+
+  /** <p>Shortcut for <code>getCompositor().equals(ALL)</code>.</p>
+   * @see #getCompositor()
+   * @see #ALL
+   */
+  public boolean isAll();
+
+  /** <p>Returns the model groups particles.</p>
+   */
+  public XSParticle[] getParticles();
+
+  /** <p>Returns the model groups locator.</p>
+   */
+  public Locator getLocator();
+
+  /** <p>Validates the particles contents.</p>
+   */
+  public void validate() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSNotation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSNotation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSNotation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/** <p>Interface of a notation.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSNotation extends XSObject {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObject.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObject.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObject.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/** <p>A common base interface for all other schema objects.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSObject {
+  /** <p>Returns the objects schema.</p>
+   */
+  public XSSchema getXSSchema();
+
+  /** <p>Returns whether the object is a top-level object. This is
+   * the case for the XsESchema itself and for all its childs only.</p>
+   */
+  public boolean isTopLevelObject();
+
+  /** <p>Returns either of the following:
+   * <ul>
+   *   <li>If the object is the schema itself, returns null. The
+   *     schema doesn't have a parent object.</p>
+   *   <li>If the object is a top-level object, returns the
+   *     schema.</p>
+   *   <li>Otherwise returns the object in which the given object
+   *     is embedded.</li>
+   * </ul>
+   */
+  public XSObject getParentObject();
+
+  /** <p>Returns the objects location.</p>
+   */
+  public Locator getLocator();
+
+  /** <p>Validates the objects internal state.</p>
+   */
+  public void validate() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObjectFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObjectFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSObjectFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>An object factory for the logical XSParser.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSObjectFactory {
+  /** <p>Returns a new instance of {@link XSLogicalParser}.</p>
+   */
+  public XSLogicalParser newXSLogicalParser();
+  /** <p>Returns a new instance of {@link XSSchema}.</p>
+   */
+  public XSSchema newXSSchema(XSContext pContext, XsESchema pSchema) throws SAXException;
+  /** <p>Returns a new instance of {@link XSAnnotation}.</p>
+   */
+  public XSAnnotation newXSAnnotation(XSObject pParent, XsEAnnotation pAnnotation) throws SAXException;
+  /** <p>Returns a new instances of {@link XSAnnotation}.</p>
+   */
+  public XSAnnotation[] newXSAnnotations(XSObject pParent, XsEAnnotation pAnnotation) throws SAXException;
+  /** <p>Returns a new instance of {@link XSAppinfo}.</p>
+   */
+  public XSAppinfo newXSAppinfo(XSObject pParent, XsEAppinfo pAppinfo);
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSAtomicType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSAtomicType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException;
+  /** <p>Returns a new instance of {@link XSAttribute}.</p>
+   */
+  public XSAttribute newXSAttribute(XSObject pParent, XsTAttribute pAttribute) throws SAXException;
+  /** <p>Returns a new instance of {@link XSAttributeGroup}.</p>
+   */
+  public XSAttributeGroup newXSAttributeGroup(XSObject pParent, XsTAttributeGroup pGroup) throws SAXException;
+  /** <p>Returns a new instance of {@link XSDocumentation}.</p>
+   */
+  public XSDocumentation newXSDocumentation(XSObject pParent, XsEDocumentation pDocumentation) throws SAXException;
+  /** <p>Returns a new instance of {@link XSElement}.</p>
+   */
+  public XSElement newXSElement(XSObject pParent, XsTElement pElement) throws SAXException;
+  /** <p>Returns a new instance of {@link XSEnumeration}.</p>
+   */
+  public XSEnumeration newXSEnumeration(XSObject pParent, XsEEnumeration pEnumeration) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSListType(XSType pParent, XsEList pList) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSListType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSListType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException;
+  /** <p>Returns a new instance of {@link XSGroup}.</p>
+   */
+  public XSGroup newXSGroup(XSObject pParent, XsTNamedGroup pGroup) throws SAXException;
+  /** <p>Returns a new instance of {@link XSGroup}.</p>
+   */
+  public XSGroup newXSGroup(XSObject pParent, XsTAll pAll) throws SAXException;
+  /** <p>Returns a new instance of {@link XSGroup}.</p>
+   */
+  public XSGroup newXSGroup(XSObject pParent, XsTGroupRef pGroup) throws SAXException;
+  /** <p>Returns a new instance of {@link XSGroup}.</p>
+   */
+  public XSGroup newXSGroup(XSObject pParent, XsEChoice pChoice) throws SAXException;
+  /** <p>Returns a new instance of {@link XSGroup}.</p>
+   */
+  public XSGroup newXSGroup(XSObject pParent, XsESequence pSequence) throws SAXException;
+  /** <p>Returns a new instance of {@link XSType}.</p>
+   */
+  public XSType newXSType(XSObject pParent, XsETopLevelSimpleType pType) throws SAXException;
+  /** <p>Returns a new instance of {@link XSType}.</p>
+   */
+  public XSType newXSType(XSObject pParent, XsTComplexType pType) throws SAXException;
+  /** <p>Returns a new instance of {@link XSType}.</p>
+   */
+  public XSType newXSType(XSObject pParent, XsTLocalComplexType pType) throws SAXException;
+  /** <p>Returns a new instance of {@link XSType}.</p>
+   */
+  public XSType newXSType(XSObject pParent, XsTLocalSimpleType pType) throws SAXException;
+  /** <p>Returns a new instance of {@link XSType}.</p>
+   */
+  public XSType newXSType(XSObject pParent, XsTSimpleRestrictionType pType) throws SAXException;
+  /** <p>Returns a new instance of {@link XSNotation}.</p>
+   */
+  public XSNotation newXSNotation(XSObject pParent, XsENotation pType) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleContentType}.</p>
+   */
+  public XSSimpleContentType newXSSimpleContentType(XSType pComplexType, XSType pSimpleType, XsObject pBaseObject) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSUnionType(XSType pParent, XsEUnion pUnion) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSUnionType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException;
+  /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+   */
+  public XSSimpleType newXSUnionType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException;
+  /** <p>Returns a new instance of {@link XSWildcard}.</p>
+   */
+  public XSWildcard newXSWildcard(XSObject pParent, XsTWildcard pWildcard) throws SAXException;
+  /** <p>Returns a new instance of {@link XSAny}.</p>
+   */
+  public XSAny newXSAny(XSObject pParent, XsEAny pAny) throws SAXException;
+  /** <p>Returns a new instance of {@link XSKeyRef}.</p>
+   */
+  public XSKeyRef newXSKeyRef(XSElement pParent, XsEKeyref keyRef) throws SAXException;
+  /** <p>Returns a new instance of {@link XSIdentityConstraint}.</p>
+   */
+  public XSIdentityConstraint newXSIdentityConstraint(XSElement pParent,
+													  XsEUnique unique) throws SAXException;
+  /** <p>Returns a new instance of {@link XSIdentityConstraint}.</p>
+   */
+  public XSIdentityConstraint newXSIdentityConstraint(XSElement pParent,
+													  XsEKey key) throws SAXException;
+  /** Returns the object factories schema transformer.
+   * May be null, in which case no schema transformation
+   * occurs.
+   */
+  public SchemaTransformer getSchemaTransformer();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSOpenAttrs.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSOpenAttrs.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSOpenAttrs.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.xs;
+
+import org.xml.sax.Attributes;
+
+
+/** <p>Interface of an object, which allows for additional
+ * attributes from non-default namespaces.</>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSOpenAttrs extends XSObject {
+  /** <p>Returns the additional attributes, if any, or null.</p>
+   */
+  public Attributes getOpenAttributes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.apache.ws.jaxme.xs.parser.impl.XSContextImpl;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>The XML schema parser.</p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: XSParser.java 232099 2005-04-27 19:42:55Z jochen $
+ */
+public class XSParser {
+  /** <p>The XML Schema URI: <code>http://www.w3.org/2001/XMLSchema</code></p>
+   */
+  public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
+
+  private static final ThreadLocal parser = new ThreadLocal();
+
+  private XSContext data;
+  private boolean notValidating;
+  private List addedImports = new ArrayList();
+
+  /** <p>Creates a new instance of XSParser.</p>
+   */
+  public XSParser() {
+  }
+
+  /** <p>Sets whether the parser is validating.</p>
+   */
+  public void setValidating(boolean pValidating) {
+    notValidating = !pValidating;
+  }
+
+  /** <p>Returns whether the parser is validating.</p>
+   */
+  public boolean isValidating() {
+    return !notValidating;
+  }
+
+  /** <p>Adds a schema being imported by the parser. This feature
+   * is useful, if a schema silently assumes the presence of additional
+   * datatypes. For example, a WSDL definition will contain references
+   * to SOAP datatypes without explicit import.</p>
+   * @param pNamespace Matches the "xs:import" nodes "namespace" attribute.
+   *   In particular it may be null, in which case the imported schema may
+   *   not have a targetNamespace.
+   * @param pSchemaLocation Matches the "xs:import" nodes "schemaLocation"
+   *   attribute. In particular it may be null.
+   * @see #addImport(String, Node)
+   */
+  public void addImport(String pNamespace, String pSchemaLocation) {
+    addedImports.add(new XSLogicalParser.AddedImport(pNamespace, pSchemaLocation));
+  }
+
+  /** <p>Adds a schema being imported by the parser. The schema is
+   * provided as a DOM node. This feature is useful, if a schema
+   * silently assumes the presence of additional datatypes. For
+   * example, a WSDL definition will contain references to SOAP
+   * datatypes without explicit import.</p>
+   * @param pNamespace Matches the "xs:import" nodes "namespace"
+   *   attribute. In particular it may be null, in which case the
+   *   imported schema may not have a targetNamespace.
+   * @param pSchemaLocation The imported schemas system ID, if known,
+   * or null. Knowing the system ID is important only, if you need
+   * to prevent recursive schematas being included more than once.
+   * @param pSchema A DOM node with the schema being imported.
+   * @see #addImport(String, String)
+   */
+  public void addImport(String pNamespace, String pSchemaLocation, Node pSchema) {
+    addedImports.add(new XSLogicalParser.AddedImport(pNamespace, pSchemaLocation, pSchema));
+  }
+
+  /** <p>Provides access to the parsers internal data. Use the
+   * {@link #getRunningInstance()} method to find the parser.</p>
+   */
+  public XSContext getContext() {
+    if (data == null) {
+      setData(new XSContextImpl());
+    }
+    return data;
+  }
+
+  protected void setData(XSContext pData) { data = pData; }
+
+  /** <p>Parses the given XML schema. and returns a syntactical
+   * representation.</p>
+   * @see #parse(InputSource)
+   */
+  public XsESchema parseSyntax(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
+    XSContext context = getContext();
+    parser.set(this);
+    try {
+      XsObjectFactory factory = context.getXsObjectFactory();
+      XsSAXParser xsSAXParser = factory.newXsSAXParser();
+      context.setCurrentContentHandler(xsSAXParser);
+      XMLReader xr = factory.newXMLReader(isValidating());
+      xr.setContentHandler(xsSAXParser);
+      xr.parse(pSource);
+      return (XsESchema) xsSAXParser.getBean();
+    } finally {
+      context.setCurrentContentHandler(null);
+      parser.set(null);
+    }
+  }
+
+  protected XSLogicalParser newXSLogicalParser() {
+    XSLogicalParser logicalParser = getContext().getXSObjectFactory().newXSLogicalParser();
+    logicalParser.setValidating(isValidating());
+    for (int i = 0;  i < addedImports.size();  i++) {
+      XSLogicalParser.AddedImport addedImport = (XSLogicalParser.AddedImport) addedImports.get(i);
+      if (addedImport.getNode() == null) {
+        logicalParser.addImport(addedImport.getNamespace(), addedImport.getSchemaLocation());
+      } else {
+        logicalParser.addImport(addedImport.getNamespace(), addedImport.getSchemaLocation(), addedImport.getNode());
+      }
+    }
+    return logicalParser;
+  }
+
+  /** <p>Parses the given XML schema and returns a logical representation.</p>
+   */
+  public XSSchema parse(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
+    XSContext myData = getContext();
+    parser.set(this);
+    try {
+      return newXSLogicalParser().parse(pSource);
+    } finally {
+      myData.setCurrentContentHandler(null);
+      parser.set(null);
+    }
+  }
+
+  /** <p>Parses the given DOM node containing an an XML schema and returns
+   * a logical representation.</p>
+   * @param pNode A node containing a valid XML document. Must be either
+   *   an instance of {@link org.w3c.dom.Document}, an instance of
+   *   {@link org.w3c.dom.Element}, or an instance of
+   *   {@link org.w3c.dom.DocumentFragment}. In the latter case, make
+   *   sure, that the fragment contains a single root element.
+   */
+  public XSSchema parse(Node pNode) throws SAXException {
+    XSContext myData = getContext();
+    parser.set(this);
+    try {
+      return newXSLogicalParser().parse(pNode);
+    } finally {
+      myData.setCurrentContentHandler(null);
+      parser.set(null);
+    }
+  }
+
+  /** <p>Returns an instance of {@link XSContentHandler} for parsing a stream
+   * of SAX events.</p>
+   */
+  public XSContentHandler getXSContentHandler(String pSchemaLocation) throws SAXException {
+    parser.set(this);
+    return newXSLogicalParser().getXSContentHandler(pSchemaLocation);
+  }
+
+  /** <p>Provides access to the currently running instance of <code>XSParser</code>.</p>
+   */
+  public static XSParser getRunningInstance() {
+    return (XSParser) parser.get();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.xml.sax.Locator;
+
+
+/** <p>Interface of a model groups particle.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSParticle {
+  public class Type {
+    private final String name;
+    public Type(String pName) {
+      name = pName;
+    }
+    public String toString() { return name; }
+    public boolean equals(Object o) {
+      return o != null  &&  o instanceof Type  &&  ((Type) o).name.equals(name);
+    }
+    public int hashCode() { return name.hashCode(); }
+  }
+
+  /** <p>The particle type "group".</p>
+   */
+  public Type GROUP = new Type("group");
+
+  /** <p>The particle type "wildcard".</p>
+   */
+  public Type WILDCARD = new Type("wildcard");
+
+  /** <p>The particle type "element".</p>
+   */
+  public Type ELEMENT = new Type("element");
+
+  /** <p>Returns the particle type.</p>
+   */
+  public Type getType();
+
+  /** <p>Shortcut for <code>getType().equals(GROUP)</code>.</p>
+   * @see #getType()
+   * @see #GROUP
+   */
+  public boolean isGroup();
+
+  /** <p>If the particle type is group: Returns the group.</p>
+   * @throws IllegalStateException {@link #isGroup()} returns false
+   */
+  public XSGroup getGroup();
+
+  /** <p>Shortcut for <code>getType().equals(WILDCARD)</code>.</p>
+   * @see #getType()
+   * @see #WILDCARD
+   */
+  public boolean isWildcard();
+
+  /** <p>If the particle type is wildcard: Returns the wildcard.</p>
+   * @throws IllegalStateException {@link #isWildcard()} returns false
+   */
+  public XSAny getWildcard();
+
+  /** <p>Shortcut for <code>getType().equals(ELEMENT)</code>.</p>
+   * @see #getType()
+   * @see #ELEMENT
+   */
+  public boolean isElement();
+
+  /** <p>If the particle type is element: Returns the element.</p>
+   * @throws IllegalStateException {@link #isElement()} returns false
+   */
+  public XSElement getElement();
+
+  /** <p>Returns the particles minOccurs value.</p>
+   */
+  public int getMinOccurs();
+
+  /** <p>Returns the particles maxOccurs value or -1 for unbounded.</p>
+   */
+  public int getMaxOccurs();
+
+  /** <p>Returns the particles Locator.</p>
+   */
+  public Locator getLocator();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSchema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSchema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSchema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import java.util.Map;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+/** <p>This interface is what you are probably most interested in: The
+ * logical XML Schema representation.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSSchema extends XSOpenAttrs {
+  /** <p>Returns the schemas object factory.</p>
+   */
+  public XSObjectFactory getXSObjectFactory();
+
+  /** <p>Returns the schemas context.</p>
+   */
+  public XSContext getContext();
+
+  /** <p>Returns the schemas target namespace. Note, that a
+   * {@link XSSchema logical schema} can combine elements,
+   * attributes, groups, and types of various namespaces by
+   * importing other {@link org.apache.ws.jaxme.xs.xml.XsESchema
+   * syntactical schemas} with different namespaces. Thus
+   * the logical schemas target namespace is in fact the
+   * target namespace of the outermost syntactical schema.</p>
+   * @return Target namespace or null for null (default namespace)
+   */
+  public XsAnyURI getTargetNamespace();
+
+  /** <p>Returns the array of annotations.</p>
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** <p>Returns the array of global types. This includes simple
+   * and complex types. The builtin types are not included.</p>
+   * @see #getType(XsQName)
+   */
+  public XSType[] getTypes();
+
+  /** <p>Returns the array of builtin types. This includes simple
+   * and complex types.</p>
+   * @see #getTypes()
+   */
+  public XSType[] getBuiltinTypes();
+
+  /** <p>Returns the type with the given name. This may be a builtin
+   * type or a type defined by the schema.</p>
+   */
+  public XSType getType(XsQName pName);
+
+  /** <p>Returns the array of global groups.</p>
+   */
+  public XSGroup[] getGroups();
+
+  /** <p>Returns the group with the given name.</p>
+   */
+  public XSGroup getGroup(XsQName pName);
+
+  /** <p>Returns the array of global attribute groups.</p>
+   */
+  public XSAttributeGroup[] getAttributeGroups();
+
+  /** <p>Returns the attribute group with the given name.</p>
+   */
+  public XSAttributeGroup getAttributeGroup(XsQName pName);
+
+  /** <p>Returns the array of global elements.</p>
+   */
+  public XSElement[] getElements();
+
+  /** <p>Returns the element with the given name.</p>
+   */
+  public XSElement getElement(XsQName pName);
+
+  /** <p>Returns the array of global attributes.</p>
+   */
+  public XSAttribute[] getAttributes();
+
+  /** <p>Returns the attribute with the given name.</p>
+   */
+  public XSAttribute getAttribute(XsQName pName);
+
+  /** <p>Returns a map of XSIdentityConstraint objects.
+   * The key is the constraints name. The map is immutable.</p>
+   */
+  public Map getIdentityConstraints();
+
+  /** <p>Returns a map of XSKeyRef objects. The key is the
+   * key refs name. The map is immutable.</p>
+   * */
+  public Map getKeyRefs();
+
+  /** <p>Returns all the schema annotations, types, groups,
+   * attribute groups, elements, and attributes, in the
+   * order of declaration.</p>
+   */
+  public Object[] getChilds();
+
+  /** <p>Adds a new annotation to the schema.</p>
+   */
+  public void add(XSAnnotation pAnnotation);
+
+  /** <p>Adds a new type to the schema.</p>
+   */
+  public void add(XSType pType) throws SAXException;
+
+  /** <p>Redefines an existing type in the schema.</p>
+   */
+  public void redefine(XSType pType) throws SAXException;
+
+  /** <p>Adds a new group to the schema.</p>
+   */
+  public void add(XSGroup pGroup) throws SAXException;
+
+  /** <p>Redefines an existing group in the schema.</p>
+   */
+  public void redefine(XSGroup pGroup) throws SAXException;
+
+  /** <p>Adds a new attribute group to the schema.</p>
+   */
+  public void add(XSAttributeGroup pGroup) throws SAXException;
+
+  /** <p>Redefines an existing attribute group in the schema.</p>
+   */
+  public void redefine(XSAttributeGroup pGroup) throws SAXException;
+
+  /** <p>Adds a new attribute to the schema.</p>
+   */
+  public void add(XSAttribute pAttribute) throws SAXException;
+
+  /** <p>Adds a new element to the schema.</p>
+   */
+  public void add(XSElement pElement) throws SAXException;
+
+  /** <p>Adds a new notation to the schema.</p>
+   */
+  public void add(XSNotation pNotation) throws SAXException;
+
+  /** <p>Adds a new identity constraint to the schema.</p>
+   */
+  public void add( XSIdentityConstraint ic ) throws SAXException;
+
+  /** <p>Adds a new key ref to the schema.</p>
+   */
+  public void add( XSKeyRef rf ) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleContentType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleContentType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleContentType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/** <p>Detail infos of a complex type with simpleContent.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSSimpleContentType {
+  /** <p>Returns the contents type.</p>
+   */
+  public XSType getType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSSimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+
+/** <p>Details of a simple type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSSimpleType {
+  /** <p>Returns whether the simple type is atomic.</p>
+   */
+  public boolean isAtomic();
+  /** <p>Returns the atomic type details.</p>
+   * @throws IllegalStateException The type is a list or union.
+   */
+  public XSAtomicType getAtomicType();
+  /** <p>Returns whether the simple type is a list.</p>
+   */
+  public boolean isList();
+  /** <p>Returns the list type details.</p>
+   * @throws IllegalStateException The type is atomic or a union.
+   */
+  public XSListType getListType();
+  /** <p>Returns whether the simple type is a union.</p>
+   */
+  public boolean isUnion();
+  /** <p>Returns the union type details.</p>
+   * @throws IllegalStateException The type is atomic or a list.
+   */
+  public XSUnionType getUnionType();
+
+  /** <p>Returns the value of the "pattern" facet or null, if the pattern has not been set.</p>
+   * <p>The returned value is an array of pattern arrays. The latter arrays are the
+   * patterns defined in one restriction step. These have to be combined by "OR".
+   * The resulting, combined arrays are being grouped by an "AND". This is according to
+   * <a href="http://www.w3.org/TR/xmlschema-2/index.html#rf-pattern">
+   *   http://www.w3.org/TR/xmlschema-2/index.html#rf-pattern, 4.3.4.3</a>.</p>
+   */
+  public String[][] getPattern();
+
+  /** <p>Returns the values of the "enumeration" facets.</p>
+   */
+  public XSEnumeration[] getEnumerations();
+
+  /** <p>Returns whether the type is a restriction of another
+   * simple type. (Almost all simple types are, the exception being
+   * the ur type {@link org.apache.ws.jaxme.xs.types.XSAnySimpleType}.</p>
+   */
+  public boolean isRestriction();
+
+  /** <p>If the simple type is a restriction, returns the restricted
+   * simple type.</p>
+   *
+   * @throws IllegalStateException This type is no restriction of
+   *   another simple type.
+   */
+  public XSType getRestrictedType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of an XML Schema type. Includes complex and simple types.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSType extends XSOpenAttrs {
+  /** <p>Returns the array of annotations.</p>
+   */
+  public XSAnnotation[] getAnnotations();
+
+  /** <p>Returns whether the type is simple or not.</p>
+   */
+  public boolean isSimple();
+
+  /** <p>Returns the simple types information.</p>
+   * @throws IllegalStateException The type is complex.
+   */
+  public XSSimpleType getSimpleType() throws SAXException;
+
+  /** <p>Returns the complex types information.</p>
+   * @throws IllegalStateException The type is simple
+   */
+  public XSComplexType getComplexType() throws SAXException;
+
+  /** <p>Returns whether the type is global or not.</p>
+   */
+  public boolean isGlobal();
+
+  /** <p>Sets whether the type is global or not.</p>
+   */
+  public void setGlobal(boolean pGlobal);
+
+  /** <p>If the type is global: Returns the types name. Otherwise returns
+   * null.</p>
+   */
+  public XsQName getName();
+
+  /** <p>Returns whether the type is a builtin type of XML Schema.</p>
+   */
+  public boolean isBuiltin();
+
+  /** <p>Returns the types syntactical context or null, if no such context
+   * is available.</p>
+   */
+  public XsSchemaHeader getSchemaHeader();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSUnionType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSUnionType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSUnionType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+/** <p>Details of a union type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSUnionType {
+  /** <p>Returns the array of member types. Each member type is, of course, a simple type.</p>
+   */
+  public XSType[] getMemberTypes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSWildcard.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSWildcard.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/XSWildcard.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs;
+
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+
+
+/** <p>Interface of a wildcard.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSWildcard extends XSOpenAttrs, XSAttributable {
+	/** <p>Returns the namespace list.</p>
+	 */
+	public XsNamespaceList getNamespaceList();
+
+	/** <p>Returns how to process unknown content.</p>
+	 */
+	public XsTWildcard.ProcessContents getProcessContents();
+
+	/** <p>Returns information on the wildcards syntactical context.</p>
+	 */
+	public XsSchemaHeader getSchemaHeader();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/DOMSerializer.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/DOMSerializer.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/DOMSerializer.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import javax.xml.XMLConstants;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.AttributesImpl;
+
+/** <p>Serializes a DOM node into a stream of SAX events. This code
+ * is duplicated and copied from
+ * {@link org.apache.ws.jaxme.util.DOMSerializer}. The reason for
+ * duplicating the code is, that the JaxMe runtime should not depend
+ * on JaxMeXS. On the other hand, JaxMeXS should not depend on
+ * JaxMe.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: DOMSerializer.java 231934 2004-08-27 01:03:17Z jochen $
+ */
+public class DOMSerializer {
+    private boolean namespaceDeclarationAttribute;
+    private boolean parentsNamespaceDeclarationDisabled;
+    
+    /** <p>Sets whether XML declarations are being serialized as
+     * attributes or as SAX events (default).</p>
+     */
+    public void setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute) {
+        namespaceDeclarationAttribute = pXmlDeclarationAttribute;
+    }
+    
+    /** <p>Returns whether XML declarations are being serialized as
+     * attributes or as SAX events (default).</p>
+     */
+    public boolean isNamespaceDeclarationAttribute() {
+        return namespaceDeclarationAttribute;
+    }
+    
+    /** <p>Returns whether XML declarations present in the parent nodes
+     * are being serialized (default) or not. This option takes effect
+     * only if the namespace declarations are sent as events. In other
+     * words, if the <code>namespaceDeclarationAttribute</code>
+     * properts is false.</p>
+     */
+    public void setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled) {
+        parentsNamespaceDeclarationDisabled = pParentsXmlDeclarationDisabled;
+    }
+    
+    /** <p>Sets whether XML declarations present in the parent nodes
+     * are being serialized (default) or not. This option takes effect
+     * only if the namespace declarations are sent as events. In other
+     * words, if the <code>namespaceDeclarationAttribute</code>
+     * properts is false.</p>
+     */
+    public boolean isParentsNamespaceDeclarationDisabled() {
+        return parentsNamespaceDeclarationDisabled;
+    }
+    
+    protected void doSerializeChilds(Node pNode, ContentHandler pHandler)
+    throws SAXException {
+        for (Node child = pNode.getFirstChild();  child != null;
+        child = child.getNextSibling()) {
+            doSerialize(child, pHandler);
+        }
+    }
+    
+    protected void parentsStartPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+    throws SAXException {
+        if (pNode != null) {
+            parentsStartPrefixMappingEvents(pNode.getParentNode(), pHandler);
+            if (pNode.getNodeType() == Node.ELEMENT_NODE) {
+                startPrefixMappingEvents(pNode, pHandler);
+            }
+        }
+    }
+    
+    protected void parentsEndPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+    throws SAXException {
+        if (pNode != null) {
+            if (pNode.getNodeType() == Node.ELEMENT_NODE) {
+                endPrefixMappingEvents(pNode, pHandler);
+            }
+            parentsEndPrefixMappingEvents(pNode.getParentNode(), pHandler);
+        }
+    }
+    
+    protected void startPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+    		throws SAXException {
+        NamedNodeMap nnm = pNode.getAttributes();
+        if (nnm != null) {
+            for (int i = 0;  i < nnm.getLength();  i++) {
+                Node attr = nnm.item(i);
+                if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+                    String prefix;
+                    if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) {
+                        prefix = attr.getLocalName();
+                    } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getNodeName())) {
+                        prefix = "";
+                    } else {
+                        throw new IllegalStateException("Unable to parse namespace declaration: " + attr.getNodeName());
+                    }
+                    String uri = attr.getNodeValue();
+                    if (uri == null) {
+                        uri = "";
+                    }
+                    pHandler.startPrefixMapping(prefix, uri);
+                }
+            }
+        }
+    }
+    
+    protected void endPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+    throws SAXException {
+        NamedNodeMap nnm = pNode.getAttributes();
+        if (nnm != null) {
+            for (int i = nnm.getLength()-1;  i >= 0;  i--) {
+                Node attr = nnm.item(i);
+                if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+                    String prefix = attr.getLocalName();
+                    pHandler.endPrefixMapping(prefix);
+                }
+            }
+        }
+    }
+
+    /** Serializes the given node by firing SAX events into the
+     * SAX handler <code>pHandler</code>.
+     */
+    public void serialize(Node pNode, ContentHandler pHandler)
+            throws SAXException {
+        pHandler.startDocument();
+        if (!isNamespaceDeclarationAttribute()  &&
+                !isParentsNamespaceDeclarationDisabled()) {
+            parentsStartPrefixMappingEvents(pNode.getParentNode(), pHandler);
+        }
+        doSerialize(pNode, pHandler);
+        if (!isNamespaceDeclarationAttribute()  &&
+                !isParentsNamespaceDeclarationDisabled()) {
+            parentsEndPrefixMappingEvents(pNode.getParentNode(), pHandler);
+        }
+        pHandler.endDocument();
+    }
+    
+    protected void doSerialize(Node pNode, ContentHandler pHandler)
+    throws SAXException {
+        switch (pNode.getNodeType()) {
+            case Node.DOCUMENT_NODE:
+                doSerializeChilds(pNode, pHandler);
+            break;
+            case Node.DOCUMENT_FRAGMENT_NODE:
+                doSerializeChilds(pNode, pHandler);
+            break;
+            case Node.ELEMENT_NODE:
+                AttributesImpl attr = new AttributesImpl();
+            boolean isNamespaceDeclarationAttribute = isNamespaceDeclarationAttribute();
+            if (!isNamespaceDeclarationAttribute) {
+                startPrefixMappingEvents(pNode, pHandler);
+            }
+            NamedNodeMap nnm = pNode.getAttributes();
+            if (nnm != null) {
+                for (int i = 0;  i < nnm.getLength();  i++) {
+                    Node a = nnm.item(i);
+                    if (isNamespaceDeclarationAttribute  ||
+                            !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(a.getNamespaceURI())) {
+                        String aUri = a.getNamespaceURI();
+                        String aLocalName = a.getLocalName();
+                        String aNodeName = a.getNodeName();
+                        if (aLocalName == null) {
+                            if (aUri == null  ||  aUri.length() == 0) {
+                                aLocalName = aNodeName;
+                            } else {
+                                throw new IllegalStateException("aLocalName is null");
+                            }
+                        }
+                        attr.addAttribute(aUri == null ? "" : aUri, aNodeName,
+                                aLocalName, "CDATA", a.getNodeValue());
+                    }
+                }
+            }
+            String nUri = pNode.getNamespaceURI();
+            if (nUri == null) {
+                nUri = "";
+            }
+            pHandler.startElement(nUri, pNode.getLocalName(),
+                    pNode.getNodeName(), attr);
+            doSerializeChilds(pNode, pHandler);
+            pHandler.endElement(nUri, pNode.getLocalName(),
+                    pNode.getNodeName());
+            if (!isNamespaceDeclarationAttribute) {
+                endPrefixMappingEvents(pNode, pHandler);
+            }
+            break;
+            case Node.TEXT_NODE:
+            case Node.CDATA_SECTION_NODE:
+            {
+                String s = pNode.getNodeValue();
+                pHandler.characters(s.toCharArray(), 0, s.length());
+            }
+            break;
+            case Node.PROCESSING_INSTRUCTION_NODE:
+                pHandler.processingInstruction(pNode.getNodeName(), pNode.getNodeValue());
+            break;
+            case Node.ENTITY_REFERENCE_NODE:
+                pHandler.skippedEntity(pNode.getNodeName());
+            break;
+            case Node.COMMENT_NODE:
+                if (pHandler instanceof LexicalHandler) {
+                    String s = pNode.getNodeValue();
+                    ((LexicalHandler) pHandler).comment(s.toCharArray(), 0, s.length());
+                }
+            break;
+            default:
+                throw new IllegalStateException("Unknown node type: " + pNode.getNodeType());
+        }
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAppinfo;
+import org.apache.ws.jaxme.xs.XSDocumentation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.XsEDocumentation;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnnotationImpl extends XSOpenAttrsImpl implements XSAnnotation {
+  private final XSAppinfo[] appinfos;
+  private final XSDocumentation[] documentations;
+
+  protected XSAnnotationImpl(XSObject pParent, XsEAnnotation pBaseAnnotation)  throws SAXException {
+    super(pParent, pBaseAnnotation);
+
+    XsEDocumentation[] xsDocumentations = ((XsEAnnotation) getXsObject()).getDocumentations();
+    documentations = new XSDocumentation[xsDocumentations.length];
+    for (int i = 0;  i < xsDocumentations.length;  i++) {
+      documentations[i] = getXSSchema().getXSObjectFactory().newXSDocumentation(this, xsDocumentations[i]);
+    }
+
+    XsEAppinfo[] xsAppinfos = ((XsEAnnotation) getXsObject()).getAppinfos();
+    appinfos = new XSAppinfo[xsAppinfos.length];
+    for (int i = 0;  i < xsAppinfos.length;  i++) {
+      XsEAppinfo xsAppinfo = xsAppinfos[i];
+      XSAppinfo appinfo = getXSSchema().getXSObjectFactory().newXSAppinfo(this, xsAppinfo);
+      appinfos[i] = appinfo;
+    }
+  }
+
+  public XSDocumentation[] getDocumentations() {
+    return documentations;
+  }
+
+  public XSAppinfo[] getAppinfos() {
+    return appinfos;
+  }
+
+  public void validate() throws SAXException {
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsEAny;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnyImpl extends XSWildcardImpl implements XSAny {
+  protected XSAnyImpl(XSObject pParent, XsEAny pBaseObject) {
+    super(pParent, pBaseObject);
+  }
+
+  public void validate() throws SAXException {
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAppinfoImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAppinfoImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAppinfoImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAppinfo;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAppinfoImpl extends XSObjectImpl implements XSAppinfo {
+  /** <p>Creates a new instance of XSAppinfoImpl.</p>
+   */
+  protected XSAppinfoImpl(XSObject pParent, XsEAppinfo pBaseObject) {
+    super(pParent, pBaseObject);
+  }
+
+  public XsAnyURI getSource() {
+    return ((XsEAppinfo) getXsObject()).getSource();
+  }
+
+  public Object[] getChilds() {
+    return ((XsEAppinfo) getXsObject()).getChilds();
+  }
+
+  public String getText() {
+    StringBuffer sb = new StringBuffer();
+    Object[] childs = ((XsEAppinfo) getXsObject()).getChilds();
+    for (int i = 0;  i < childs.length;  i++) {
+      if (childs[i] instanceof String) {
+        sb.append((String) childs[i]);
+      }
+    }
+    return sb.toString();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAtomicTypeRestrictionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAtomicTypeRestrictionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAtomicTypeRestrictionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsEFractionDigits;
+import org.apache.ws.jaxme.xs.xml.XsELength;
+import org.apache.ws.jaxme.xs.xml.XsEMaxExclusive;
+import org.apache.ws.jaxme.xs.xml.XsEMaxInclusive;
+import org.apache.ws.jaxme.xs.xml.XsEMaxLength;
+import org.apache.ws.jaxme.xs.xml.XsEMinExclusive;
+import org.apache.ws.jaxme.xs.xml.XsEMinInclusive;
+import org.apache.ws.jaxme.xs.xml.XsEMinLength;
+import org.apache.ws.jaxme.xs.xml.XsETotalDigits;
+import org.apache.ws.jaxme.xs.xml.XsEWhiteSpace;
+import org.apache.ws.jaxme.xs.xml.XsGSimpleRestrictionModel;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAtomicTypeRestrictionImpl extends XSSimpleTypeRestrictionImpl implements XSAtomicType {
+  private final XSAtomicType atomicBaseType;
+
+  /** Creates a new atomic type restricting <code>pBaseType</code>
+   * with the constraints <code>pRestriction</code>.
+   */
+  public XSAtomicTypeRestrictionImpl(XSType pParent,
+                                     XSType pBaseType, XsGSimpleRestrictionModel pRestriction)
+      throws SAXException {
+    super(pParent, pBaseType, pRestriction);
+    atomicBaseType = pBaseType.getSimpleType().getAtomicType();
+  }
+
+  public boolean isAtomic() { return true; }
+
+  public XSAtomicType getAtomicType() {
+    return this;
+  }
+
+  public Long getFractionDigits() {
+    XsEFractionDigits fractionDigits = getRestriction().getFractionDigits();
+    if (fractionDigits == null) {
+      return atomicBaseType.getFractionDigits();
+    } else {
+      return new Long(fractionDigits.getValue());
+    }
+  }
+
+  public Long getLength() {
+    XsELength length = getRestriction().getLength();
+    if (length == null) {
+      return atomicBaseType.getLength();
+    } else {
+      return new Long(length.getValue());
+    }
+  }
+
+  public String getMaxExclusive() {
+    XsEMaxExclusive maxExclusive = getRestriction().getMaxExclusive();
+    if (maxExclusive == null) {
+      return atomicBaseType.getMaxExclusive();
+    } else {
+      return maxExclusive.getValue();
+    }
+  }
+
+  public String getMaxInclusive() {
+    XsEMaxInclusive maxInclusive = getRestriction().getMaxInclusive();
+    if (maxInclusive == null) {
+      return atomicBaseType.getMaxInclusive();
+    } else {
+      return maxInclusive.getValue();
+    }
+  }
+
+  public Long getMaxLength() {
+    XsEMaxLength length = getRestriction().getMaxLength();
+    if (length == null) {
+      return atomicBaseType.getMaxLength();
+    } else {
+      return new Long(length.getValue());
+    }
+  }
+
+  public String getMinExclusive() {
+    XsEMinExclusive minExclusive = getRestriction().getMinExclusive();
+    if (minExclusive == null) {
+      return atomicBaseType.getMinExclusive();
+    } else {
+      return minExclusive.getValue();
+    }
+  }
+
+  public String getMinInclusive() {
+    XsEMinInclusive minInclusive = getRestriction().getMinInclusive();
+    if (minInclusive == null) {
+      return atomicBaseType.getMinInclusive();
+    } else {
+      return minInclusive.getValue();
+    }
+  }
+
+  public Long getMinLength() {
+    XsEMinLength length = getRestriction().getMinLength();
+    if (length == null) {
+      return atomicBaseType.getMinLength();
+    } else {
+      return new Long(length.getValue());
+    }
+  }
+
+  public Long getTotalDigits() {
+    XsETotalDigits totalDigits = getRestriction().getTotalDigits();
+    if (totalDigits == null) {
+      return atomicBaseType.getTotalDigits();
+    } else {
+      return new Long(totalDigits.getValue());
+    }
+  }
+
+  public boolean isReplacing() {
+    XsEWhiteSpace whiteSpace = getRestriction().getWhiteSpace();
+    if (whiteSpace == null) {
+      return atomicBaseType.isReplacing();
+    } else {
+      return whiteSpace.isReplacing() || whiteSpace.isCollapsing();
+    }
+  }
+
+  public boolean isCollapsing() {
+    XsEWhiteSpace whiteSpace = getRestriction().getWhiteSpace();
+    if (whiteSpace == null) {
+      return atomicBaseType.isReplacing();
+    } else {
+      return whiteSpace.isCollapsing();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSAttributeGroup;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsGAttrDecls;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTAttribute;
+import org.apache.ws.jaxme.xs.xml.XsTAttributeGroup;
+import org.apache.ws.jaxme.xs.xml.XsTAttributeGroupRef;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAttributeGroupImpl extends XSOpenAttrsImpl implements XSAttributeGroup {
+  private final XsQName name;
+  private boolean isValidated;
+  private XSAttributable[] attributes;
+
+  protected XsTAttributeGroup getXsTAttributeGroup() {
+    return (XsTAttributeGroup) getXsObject();
+  }
+
+  protected boolean isReference() {
+    return getXsTAttributeGroup().getRef() != null;
+  }
+
+  protected XSAttributeGroupImpl(XSObject pParent, XsTAttributeGroup pBaseGroup)
+      throws SAXException {
+    super(pParent, pBaseGroup);
+    XsQName qName;
+    if (isReference()) {
+      qName = getXsTAttributeGroup().getRef();
+    } else {
+      XsNCName myName = pBaseGroup.getName();
+      if (myName == null) {
+        throw new LocSAXException("Invalid attribute group: Neither of its 'name' or 'ref' attributes are set.",
+                                     pBaseGroup.getLocator());
+      } else {
+        XsESchema schema = pBaseGroup.getXsESchema();
+        qName = new XsQName(schema.getTargetNamespace(), myName.toString(), schema.getTargetNamespacePrefix());
+      }
+    }
+    name = qName;
+  }
+
+  public XsQName getName() {
+    return name;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated) {
+      return;
+    } else {
+      isValidated = true;
+    }
+
+    if (isReference()) {
+      XSAttributeGroup referencedGroup = getXSSchema().getAttributeGroup(getName());
+      if (referencedGroup == null) {
+        throw new LocSAXException("Invalid attribute group: Unknown attribute group " + name + " referenced",
+                                   getLocator());
+      }
+      referencedGroup.validate();
+      attributes = referencedGroup.getAttributes();
+    } else {
+      XsTAttributeGroup attributeGroup = (XsTAttributeGroup) getXsObject();
+      attributes = getAttributes(this, attributeGroup);
+    }
+  }
+
+  public XSAttributable[] getAttributes() {
+    return attributes;
+  }
+
+  protected static XSAttributable[] getAttributes(XSObjectImpl pObject,
+                                                  XsGAttrDecls pAttrDecls) throws SAXException {
+    List attributes = new ArrayList();
+    Object[] allAttributes = pAttrDecls.getAllAttributes();
+    for (int i = 0;  i < allAttributes.length;  i++) {
+      Object o = allAttributes[i];
+      if (o == null) {
+        throw new NullPointerException("Null attribute detected.");
+      } else if (o instanceof XsTAttribute) {
+        XsTAttribute xsTAttr = (XsTAttribute) o;
+        if (XsTAttribute.PROHIBITED.equals(xsTAttr.getUse())) {
+        	continue;
+        }
+        XSAttribute attribute = pObject.getXSSchema().getXSObjectFactory().newXSAttribute(pObject, xsTAttr);
+        attribute.validate();
+        attributes.add(attribute);
+      } else if (o instanceof XsTAttributeGroupRef) {
+        XsTAttributeGroupRef agRef = (XsTAttributeGroupRef) o;
+        XsQName ref = agRef.getRef();
+        if (ref == null) {
+          throw new LocSAXException("Invalid attribute group: Missing 'ref' attribute", pObject.getLocator());
+        }
+        XSAttributeGroup attributeGroup = pObject.getXSSchema().getAttributeGroup(ref);
+        if (attributeGroup == null) {
+          throw new LocSAXException("Unknown attribute group name: " + ref, pObject.getLocator());
+        }
+        attributeGroup.validate();
+        XSAttributable[] agAttributes = attributeGroup.getAttributes();
+        for (int j = 0;  j < agAttributes.length;  j++) {
+          attributes.add(agAttributes[j]);
+        }
+      } else if (o instanceof XsTAttributeGroup) {
+        XsTAttributeGroup ag = (XsTAttributeGroup) o;
+        XSAttributable[] agAttributes = getAttributes(pObject, ag);
+        for (int j = 0;  j < agAttributes.length;  j++) {
+          attributes.add(agAttributes[j]);
+        }
+      } else if (o instanceof XsTWildcard) {
+        XSWildcard wildcard = pObject.getXSSchema().getXSObjectFactory().newXSWildcard(pObject, (XsTWildcard) o);
+        wildcard.validate();
+        attributes.add(wildcard);
+      } else {
+        throw new IllegalStateException("Unknown attribute type: " + o.getClass().getName());
+      }
+    }
+    return (XSAttributable[]) attributes.toArray(new XSAttributable[attributes.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSAttributeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.types.XSAnySimpleType;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsFormChoice;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTAttribute;
+import org.apache.ws.jaxme.xs.xml.XsTLocalSimpleType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAttributeImpl extends XSOpenAttrsImpl implements XSAttribute {
+  private final XsQName name;
+  private final XsEAnnotation xsAnnotation;
+  private final boolean isGlobal;
+  private XSAnnotation[] annotations;
+  private boolean isValidated;
+  private XSType type;
+
+  protected XsTAttribute getXsTAttribute() {
+    return (XsTAttribute) getXsObject();
+  }
+
+  protected boolean isReference() {
+    return getXsTAttribute().getRef() != null;
+  }
+
+  protected boolean isInnerSimpleType() {
+    return getXsTAttribute().getSimpleType() != null;
+  }
+
+  protected XSAttributeImpl(XSObject pParent, XsTAttribute pBaseAttribute) throws SAXException {
+    super(pParent, pBaseAttribute);
+    if (isReference()) {
+      this.name = pBaseAttribute.getRef();
+      isGlobal = pBaseAttribute.isGlobal();
+    } else {
+      XsNCName myName = pBaseAttribute.getName();
+      if (myName == null) {
+        throw new LocSAXException("Invalid attribute: Neither of its 'name' or 'ref' attributes are set.",
+                                     pBaseAttribute.getLocator());
+      }
+      XsESchema schema = pBaseAttribute.getXsESchema();
+      XsAnyURI namespace;
+      String namespacePrefix;
+      boolean qualified = isGlobal = pBaseAttribute.isGlobal();
+      if (!qualified) {
+        XsFormChoice form = pBaseAttribute.getForm();
+        if (form == null) {
+          form = schema.getAttributeFormDefault();
+        }
+        qualified = XsFormChoice.QUALIFIED.equals(form);
+      }
+      if (qualified) {
+        namespace = schema.getTargetNamespace();
+        namespacePrefix = schema.getTargetNamespacePrefix();
+      } else {
+        namespace = null;
+        namespacePrefix = null;
+      }
+      this.name = new XsQName(namespace, myName.toString(), namespacePrefix);
+    }
+
+    xsAnnotation = pBaseAttribute.getAnnotation();
+  }
+
+  public boolean isGlobal() {
+    return isGlobal;
+  }
+
+  public XsQName getName() {
+    return name;
+  }
+
+  public XSType getType() {
+    return type;
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    return annotations;
+  }
+
+  protected boolean isValidated() {
+    return isValidated;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    } else {
+      isValidated = true;
+    }
+
+    if (xsAnnotation == null) {
+      annotations = new XSAnnotation[0];
+    } else {
+      XSAnnotation ann = getXSSchema().getXSObjectFactory().newXSAnnotation(this, xsAnnotation);
+      annotations = new XSAnnotation[]{ ann };
+      ann.validate();
+    }
+
+    XSType myType;
+    if (isReference()) {
+      XSAttribute attribute = getXSSchema().getAttribute(getName());
+      attribute.validate();
+      if (attribute == null) {
+        throw new LocSAXException("Invalid attribute reference: No type named " + getName() + " defined.",
+                                     getXsTAttribute().getLocator());
+      }
+      myType = attribute.getType();
+      if (myType == null) {
+          throw new IllegalStateException("The referenced attributes type must not be null.");
+      }
+    } else if (isInnerSimpleType()) {
+      XsTLocalSimpleType innerSimpleType = getXsTAttribute().getSimpleType();
+      myType = getXSSchema().getXSObjectFactory().newXSType(this, innerSimpleType);
+      myType.validate();
+    } else {
+      XsQName typeName = getXsTAttribute().getType();
+      if (typeName == null) {
+        typeName = XSAnySimpleType.getInstance().getName();
+      }
+      myType = getXSSchema().getType(typeName);
+      if (myType == null) {
+        throw new LocSAXException("Invalid attribute: The referenced type " + typeName + " is not defined in the schema.",
+                                     getXsTAttribute().getLocator());
+      }
+    }
+    this.type = myType;
+  }
+
+  public boolean isOptional() {
+    XsTAttribute.Use use = getXsTAttribute().getUse();
+    if (XsTAttribute.PROHIBITED.equals(use)) {
+      throw new IllegalStateException("This attribute is prohibited.");
+    }
+    return XsTAttribute.OPTIONAL.equals(use);
+  }
+
+  public String getDefault() {
+    return getXsTAttribute().getDefault();
+  }
+
+  public String getFixed() {
+    return getXsTAttribute().getFixed();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSContentHandlerImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSContentHandlerImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSContentHandlerImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.xs.impl;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSContentHandler;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+class XSContentHandlerImpl implements XSContentHandler {
+  private final XSLogicalParser parser;
+  private final XsSAXParser xsSAXParser;
+  private boolean finished;
+  private int level = 0;
+  private final String systemId;
+
+  XSContentHandlerImpl(XSLogicalParser pParser, String pSystemId) throws SAXException {
+    parser = pParser;
+	systemId = pSystemId;
+    XSContext data = parser.getData();
+    data.setXSLogicalParser(parser);
+    parser.clearSyntaxSchemas();
+    XsObjectFactory factory = data.getXsObjectFactory();
+    XsESchema mySchema = factory.newXsESchema();
+    parser.setSchema(data.getXSObjectFactory().newXSSchema(data, mySchema));
+    xsSAXParser = factory.newXsSAXParser(mySchema);
+    parser.addSyntaxSchema(mySchema);
+    data.setCurrentContentHandler(xsSAXParser);
+  }
+
+  public XSSchema getXSSchema() {
+    if (!finished) {
+      throw new IllegalStateException("The endDocument() method has not yet been invoked.");
+    }
+    return parser.getSchema();
+  }
+
+  public void startDocument() throws SAXException {
+    xsSAXParser.startDocument();
+  }
+
+  public void endDocument() throws SAXException {
+    xsSAXParser.endDocument();
+    XsESchema syntaxSchema = (XsESchema) xsSAXParser.getBean();
+    parser.removeSyntaxSchema();
+    XSContext data = parser.getData();
+    data.setCurrentContentHandler(null);
+
+    try {
+      parser.parse(syntaxSchema, systemId);
+      XSSchema mySchema = parser.getSchema();
+      parser.createSubstitutionGroups(mySchema);
+      mySchema.validate();
+      finished = true;
+    } catch (IOException e) {
+      throw new SAXException(e);
+    } catch (ParserConfigurationException e) {
+      throw new SAXException(e);
+    } catch (RuntimeException e) {
+      Exception ex = e;
+      for (;;) {
+        UndeclaredThrowableException te = null;
+        Throwable t;
+        if (ex instanceof UndeclaredThrowableException) {
+          te = ((UndeclaredThrowableException) ex);
+          t = te.getUndeclaredThrowable();
+        } else if (ex instanceof InvocationTargetException) {
+          t = ((InvocationTargetException) ex).getTargetException();
+        } else {
+          break;
+        }
+        if (t instanceof Exception) {
+          ex = (Exception) t;
+        } else {
+          if (te == null) {
+            te = new UndeclaredThrowableException(t);
+          }
+          t.printStackTrace();
+          throw te;
+        }
+      }
+      throw new LocSAXException(ex.getClass().getName() + ": " + ex.getMessage(),
+                                 parser.getData().getLocator(), ex);
+    }
+  }
+
+  public void characters(char[] pChars, int pStart, int pLen) throws SAXException {
+    xsSAXParser.characters(pChars, pStart, pLen);
+  }
+
+  public void ignorableWhitespace(char[] pChars, int pStart, int pLen) throws SAXException {
+    xsSAXParser.ignorableWhitespace(pChars, pStart, pLen);
+  }
+
+  public void endPrefixMapping(String pPrefix) throws SAXException {
+    xsSAXParser.endPrefixMapping(pPrefix);
+  }
+
+  public void skippedEntity(String pEntity) throws SAXException {
+    xsSAXParser.skippedEntity(pEntity);
+  }
+
+  public void setDocumentLocator(Locator pLocator) {
+    xsSAXParser.setDocumentLocator(pLocator);
+  }
+
+  public void processingInstruction(String pTarget, String pData) throws SAXException {
+    xsSAXParser.processingInstruction(pTarget, pData);
+  }
+
+  public void startPrefixMapping(String pPrefix, String pURI) throws SAXException {
+    xsSAXParser.startPrefixMapping(pPrefix, pURI);
+  }
+
+  public void endElement(String pNamespaceURI, String pLocalName, String pQName) throws SAXException {
+    xsSAXParser.endElement(pNamespaceURI, pLocalName, pQName);
+    --level;
+  }
+
+  public void startElement(String pNamespaceURI, String pLocalName, String pQName, Attributes pAttrs)
+      throws SAXException {
+    xsSAXParser.startElement(pNamespaceURI, pLocalName, pQName, pAttrs);
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSDocumentationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSDocumentationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSDocumentationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSDocumentation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XmlLang;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsEDocumentation;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSDocumentationImpl extends XSObjectImpl implements XSDocumentation {
+
+  /** <p>Creates a new instance of XSDocumentationImpl.java.</p>
+   */
+  protected XSDocumentationImpl(XSObject pParent, XsEDocumentation pBaseDocumentation) {
+    super(pParent, pBaseDocumentation);
+  }
+
+  /* @see org.apache.ws.jaxme.xs.XSDocumentation#getLanguage()
+   */
+  public XmlLang getLanguage() {
+    return ((XsEDocumentation) getXsObject()).getLang();
+  }
+
+  /* @see org.apache.ws.jaxme.xs.XSDocumentation#getSource()
+   */
+  public XsAnyURI getSource() {
+    return ((XsEDocumentation) getXsObject()).getSource();
+  }
+
+  /* @see org.apache.ws.jaxme.xs.XSDocumentation#getChilds()
+   */
+  public Object[] getChilds() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /* @see org.apache.ws.jaxme.xs.XSDocumentation#getText()
+   */
+  public String getText() {
+    return ((XsEDocumentation) getXsObject()).getText();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSElementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSElementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSElementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,309 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSKeyRef;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsBlockSet;
+import org.apache.ws.jaxme.xs.xml.XsEKey;
+import org.apache.ws.jaxme.xs.xml.XsEKeyref;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsEUnique;
+import org.apache.ws.jaxme.xs.xml.XsFormChoice;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTElement;
+import org.apache.ws.jaxme.xs.xml.XsTIdentityConstraint;
+import org.apache.ws.jaxme.xs.xml.XsTTopLevelElement;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSElementImpl extends XSOpenAttrsImpl implements XSElement {
+  private static final XSIdentityConstraint[] NO_CONSTRAINTS
+  = new XSIdentityConstraint[] {};
+
+  private static final XSKeyRef[] NO_KEY_REFS = new XSKeyRef[] {};
+
+  private final XsQName name;
+  private final boolean isGlobal;
+  private XSAnnotation[] annotations;
+  private boolean isValidated;
+  private boolean isNillable;
+  private XSType type;
+  private XSGroup substitutionGroup;
+  private XSIdentityConstraint[] identityConstraints;
+  private XSKeyRef[] keyReferences;
+
+  protected XsTElement getXsTElement() {
+    return (XsTElement) getXsObject();
+  }
+
+  protected boolean isReference() {
+    return getXsTElement().getRef() != null;
+  }
+
+  protected boolean isInnerSimpleType() {
+    return getXsTElement().getSimpleType() != null;
+  }
+
+  protected boolean isInnerComplexType() {
+    return getXsTElement().getComplexType() != null;
+  }
+
+  protected XSElementImpl(XSObject pParent, XsTElement pBaseElement)
+      throws SAXException 
+  {
+    super(pParent, pBaseElement);
+
+    XsQName qName;
+
+    if (isReference()) {
+      qName = pBaseElement.getRef();
+    } else {
+      XsNCName myName = pBaseElement.getName();
+      if (myName == null) {
+        throw new LocSAXException("Invalid element: Must have either of its 'ref' or 'name' attributes set.",
+                                     getLocator());
+      }
+
+      XsESchema schema = pBaseElement.getXsESchema();
+      XsAnyURI namespace;
+      String namespacePrefix;
+      boolean qualified = pBaseElement.isGlobal();
+      if (!qualified) {
+        XsFormChoice form = pBaseElement.getForm();
+        if (form == null) {
+          form = schema.getElementFormDefault();
+        }
+        qualified = XsFormChoice.QUALIFIED.equals(form);
+      }
+      if (qualified) {
+        namespace = schema.getTargetNamespace();
+        namespacePrefix = schema.getTargetNamespacePrefix();
+      } else {
+        namespace = null;
+        namespacePrefix = null;
+      }
+      qName = new XsQName(namespace, myName.toString(), namespacePrefix);
+
+      configureIdentityConstraints(pParent, pBaseElement);
+    }
+
+    name = qName;
+    isGlobal = isReference()  ||  (pBaseElement instanceof XsTTopLevelElement);
+    isNillable = pBaseElement.getNillable();
+
+    annotations = getXSSchema().getXSObjectFactory().newXSAnnotations(
+      this, 
+      pBaseElement.getAnnotation()
+    );
+  }
+
+  public boolean isGlobal() {
+    return isGlobal;
+  }
+  
+  public boolean isNillable() {
+    return isNillable;
+  }  
+
+  public XsQName getName() {
+    return name;
+  }
+
+  public XSType getType() {
+    return type;
+  }
+
+  protected boolean isValidated() {
+    return isValidated;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    } else {
+      isValidated = true;
+    }
+
+    XSSchema schema = getXSSchema();
+    XSObjectFactory factory = schema.getXSObjectFactory();
+
+    XSType myType;
+    if (isReference()) {
+      XSElement element = schema.getElement(getName());
+      if (element == null) {
+        throw new LocSAXException("Invalid element reference: " + getName() + " is not defined.",
+                                     getLocator());
+      }
+      element.validate();
+      isNillable = element.isNillable();    
+      myType = element.getType();
+      
+    } else {
+      XsTElement element = getXsTElement();
+      if (isInnerSimpleType()) {
+        myType = factory.newXSType(this, element.getSimpleType());
+      } else if (isInnerComplexType()) {
+        myType = factory.newXSType(this, element.getComplexType());
+      } else {
+        XsQName typeName = element.getType();
+        if (typeName == null) {
+          throw new LocSAXException("Invalid element: Either of its 'type' or 'ref' attributes or its 'simpleType' or 'complexType' children must be set.",
+                                       getLocator());
+        }
+        myType = schema.getType(typeName);
+        if (myType == null) {
+          throw new LocSAXException("Invalid element: The type " + typeName + " is not defined.",
+                                       getLocator());
+        }
+      }
+    }
+    this.type = myType;
+    
+
+    myType.validate();
+    validateAllIn( annotations );
+    validateAllIn( identityConstraints );
+    validateAllIn( keyReferences );
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    return annotations;
+  }
+
+  public String getDefault() {
+    return getXsTElement().getDefault();
+  }
+
+  public String getFixed() {
+    return getXsTElement().getFixed();
+  }
+
+  public XsQName getSubstitutionGroupName() {
+    return getXsTElement().getSubstitutionGroup();
+  }
+
+  public boolean isBlockedForSubstitution() {
+    XsBlockSet blockSet = getXsTElement().getBlock();
+    if (blockSet == null) {
+      blockSet = getXsTElement().getXsESchema().getBlockDefault();
+    }
+    return !blockSet.isSubstitutionAllowed();
+  }
+
+  public boolean isAbstract() {
+    return getXsTElement().getAbstract();
+  }
+
+  public void setSubstitutionGroup(XSGroup pGroup) {
+    substitutionGroup = pGroup;
+  }
+
+  public XSGroup getSubstitutionGroup() {
+    return substitutionGroup;
+  }
+
+  public XSIdentityConstraint[] getIdentityConstraints() {
+    return identityConstraints;
+  }
+
+  public XSKeyRef[] getKeyRefs() {
+    return keyReferences;
+  }
+
+  /**
+   * Process the unique, key and keyref identity constraints into instances
+   * of XSIdentityConstraint and XSKeyRef.
+   */
+  private void configureIdentityConstraints(XSObject pParent, XsTElement base)
+    throws SAXException
+  {
+    XsTIdentityConstraint[] rawConstraints = base.getIdentityConstraints();
+    final int numRawConstraints = rawConstraints.length;
+
+    if ( numRawConstraints == 0 ) {
+      identityConstraints = NO_CONSTRAINTS;
+      keyReferences = NO_KEY_REFS;
+
+      return;
+    }
+
+    XSSchema schema = getXSSchema();
+    XSObjectFactory factory = schema.getXSObjectFactory();
+    List constraints = new ArrayList(1);
+    List refKeys  = new ArrayList(1);
+
+    for ( int i=0; i<numRawConstraints; i++ ) {
+      XsTIdentityConstraint raw = rawConstraints[i];
+
+      if ( raw instanceof XsEKeyref ) {
+        XSKeyRef keyRef = factory.newXSKeyRef( this, (XsEKeyref) raw );
+
+        refKeys.add( keyRef );
+        schema.add( keyRef );
+      } else if ( raw instanceof XsEKey ) {
+        XSIdentityConstraint ic = factory.newXSIdentityConstraint( 
+          this, 
+          (XsEKey) raw 
+        );
+
+        constraints.add( ic );
+        schema.add( ic );
+      } else if( raw instanceof XsEUnique ) {
+        XSIdentityConstraint ic = factory.newXSIdentityConstraint( 
+          this, 
+          (XsEUnique) raw 
+        );
+
+        constraints.add( ic );
+        schema.add( ic );
+      }
+    }
+
+    int numConstraints = constraints.size();
+    if ( numConstraints == 0 ) {
+      identityConstraints =  NO_CONSTRAINTS;
+    } else {
+      identityConstraints = (XSIdentityConstraint[]) constraints.toArray( 
+        new XSIdentityConstraint[numConstraints] 
+      );
+    }
+
+    int numKeyRefs = refKeys.size();
+    if ( numKeyRefs == 0 ) {
+      keyReferences =  NO_KEY_REFS;
+    } else {
+      keyReferences = (XSKeyRef[]) refKeys.toArray(new XSKeyRef[numKeyRefs]);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSEnumerationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSEnumerationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSEnumerationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of an <code>xs:enumeration</code> facet, as specified
+ * by {@link org.apache.ws.jaxme.xs.XSEnumeration}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSEnumerationImpl extends XSObjectImpl implements XSEnumeration {
+  private final XSAnnotation[] annotations;
+
+  /** <p>Creates a new instance of XSEnumerationImpl.java.</p>
+   */
+  public XSEnumerationImpl(XSObject pParent, XsEEnumeration pBaseEnumeration) throws SAXException {
+    super(pParent, pBaseEnumeration);
+    if (pBaseEnumeration.getValue() == null) {
+      throw new NullPointerException("Missing attribute: 'value'");
+    }
+    XsEAnnotation xsAnnotation = pBaseEnumeration.getAnnotation();
+    if (xsAnnotation == null) {
+      annotations = new XSAnnotation[0];
+    } else {
+      annotations = new XSAnnotation[]{getXSSchema().getXSObjectFactory().newXSAnnotation(this, xsAnnotation)};
+    }
+  }
+
+  public String getValue() { return ((XsEEnumeration) getXsObject()).getValue(); }
+
+  public XSAnnotation[] getAnnotations() { return annotations; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,313 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSModelGroup;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsAGOccurs;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsEAny;
+import org.apache.ws.jaxme.xs.xml.XsEChoice;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsESequence;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTAll;
+import org.apache.ws.jaxme.xs.xml.XsTGroupRef;
+import org.apache.ws.jaxme.xs.xml.XsTLocalElement;
+import org.apache.ws.jaxme.xs.xml.XsTNamedGroup;
+import org.apache.ws.jaxme.xs.xml.XsTNestedParticle;
+import org.apache.ws.jaxme.xs.xml.XsTParticle;
+import org.apache.ws.jaxme.xs.xml.impl.XsTGroupRefImpl;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSGroupImpl extends XSOpenAttrsImpl implements XSGroup {
+  private final XsQName name;
+  private final XsTNestedParticle[] nestedParticles;
+  private final XsTParticle[] particles;
+  private final XsEAnnotation xsAnnotation;
+  private XSAnnotation[] annotations;
+  private boolean isGlobal;
+  private XSModelGroup modelGroup;
+  private final XSModelGroupImpl modelGroupImpl;
+  private boolean isValidated;
+
+  protected XSGroupImpl(XSObject pParent, XsTGroupRef pBaseGroup)
+      throws SAXException {
+    super(pParent, pBaseGroup);
+    XsQName qName = pBaseGroup.getRef();
+    if (qName == null) {
+      qName = getQName(pBaseGroup.getName());
+    } else {
+      setGlobal(true);
+    }
+    name = qName;
+    modelGroupImpl = null;
+    nestedParticles = null;
+    particles = null;
+    xsAnnotation = pBaseGroup.getAnnotation();
+  }
+
+  protected XSGroupImpl(XSObject pParent, XsTNamedGroup pBaseGroup) throws SAXException {
+    super(pParent, pBaseGroup);
+    name = getQName(pBaseGroup.getName());
+    XSModelGroupImpl myModelGroup;
+    XsTNamedGroup group = (XsTNamedGroup) getXsObject();
+    if (group.getSequence() != null) {
+      myModelGroup = modelGroupImpl = new XSModelGroupImpl(XSModelGroup.SEQUENCE, pBaseGroup.getLocator());
+      nestedParticles = group.getSequence().getParticles();
+      particles = null;
+    } else if (group.getChoice() != null) {
+      myModelGroup = modelGroupImpl = new XSModelGroupImpl(XSModelGroup.CHOICE, pBaseGroup.getLocator());
+      nestedParticles = group.getChoice().getParticles();
+      particles = null;
+    } else if (group.getAll() != null) {
+      myModelGroup = modelGroupImpl = new XSModelGroupImpl(XSModelGroup.ALL, pBaseGroup.getLocator());
+      nestedParticles = group.getAll().getElements();
+      particles = null;
+    } else {
+      throw new IllegalStateException("Invalid group: Neither of 'sequence', 'choice'. or 'all' elements is set.");
+    }
+    this.modelGroup = myModelGroup;
+    xsAnnotation = pBaseGroup.getAnnotation();
+  }
+
+  protected XSGroupImpl(XSObject pParent, XsEChoice pChoice) throws SAXException {
+    super(pParent, pChoice);
+    name = null;
+    modelGroup = modelGroupImpl = new XSModelGroupImpl(XSModelGroup.CHOICE, pChoice.getLocator());
+    particles = pChoice.getParticles();
+    nestedParticles = null;
+    xsAnnotation = pChoice.getAnnotation();
+  }
+
+  protected XSGroupImpl(XSObject pParent, XsESequence pSequence) throws SAXException {
+    super(pParent, pSequence);
+    name = null;
+    modelGroup = modelGroupImpl = new XSModelGroupImpl(XSModelGroup.SEQUENCE, pSequence.getLocator());
+    particles = pSequence.getParticles();
+    nestedParticles = null;
+    xsAnnotation = pSequence.getAnnotation();
+  }
+
+  protected XSGroupImpl(XSObject pParent, XsTAll pAll) throws SAXException {
+    super(pParent, pAll);
+    name = null;
+    modelGroup = modelGroupImpl = new XSModelGroupImpl(XSModelGroup.ALL, pAll.getLocator());
+    particles = pAll.getParticles();
+    nestedParticles = null;
+    xsAnnotation = pAll.getAnnotation();
+  }
+
+  protected XsQName getQName(XsNCName pName) throws SAXException {
+    if (pName == null) {
+      throw new LocSAXException("Invalid group: Either of its 'ref' or 'name' attributes must be set.",
+                                   getLocator());
+    }
+    XsESchema syntaxSchema = getXsObject().getXsESchema();
+    return new XsQName(syntaxSchema.getTargetNamespace(), pName.toString(), syntaxSchema.getTargetNamespacePrefix());
+  }
+
+  protected void initParticles(XSModelGroupImpl pModelGroup, XsTNestedParticle[] pParticles) throws SAXException {
+    for (int i = 0;  i < pParticles.length;  i++) {
+      addParticle(pModelGroup, pParticles[i]);
+    }
+  }
+
+  protected void initParticles(XSModelGroupImpl pModelGroup, XsTParticle[] pParticles) throws SAXException {
+    for (int i = 0;  i < pParticles.length;  i++) {
+      addParticle(pModelGroup, pParticles[i]);
+    }
+  }
+
+  protected void addParticle(XSModelGroupImpl pModelGroup, XsTParticle pParticle) throws SAXException {
+    XsAGOccurs occurs;
+    XSParticleImpl p;
+    if (pParticle instanceof XsTAll) {
+      XsTAll all = (XsTAll) pParticle;
+      occurs = all;
+      XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, all);
+      group.validate();
+      p = new XSParticleImpl(group);
+    } else if (pParticle instanceof XsTNestedParticle) {
+      addParticle(pModelGroup, (XsTNestedParticle) pParticle);
+      return;
+    } else {
+      throw new IllegalStateException("Unknown particle type: " + pParticle.getClass().getName());
+    }
+    pModelGroup.addParticle(p);
+    p.setMaxOccurs(occurs.getMaxOccurs());
+    p.setMinOccurs(occurs.getMinOccurs());
+  }
+
+  protected void addParticle(XSModelGroupImpl pModelGroup, XsTNestedParticle pParticle) throws SAXException {
+    XsAGOccurs occurs;
+    XSParticleImpl p;
+    if (pParticle instanceof XsEAny) {
+      XsEAny any = (XsEAny) pParticle;
+      occurs = any;
+      XSAny wildcard = getXSSchema().getXSObjectFactory().newXSAny(this, any);
+      wildcard.validate();
+      p = new XSParticleImpl(wildcard);
+    } else if (pParticle instanceof XsEChoice) {
+      XsEChoice choice = (XsEChoice) pParticle;
+      occurs = choice;
+      XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, choice);
+      group.validate();
+      p = new XSParticleImpl(group);
+    } else if (pParticle instanceof XsESequence) {
+      XsESequence sequence = (XsESequence) pParticle;
+      occurs = sequence;
+      XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, sequence);
+      group.validate();
+      p = new XSParticleImpl(group);
+    } else {
+      XsTGroupRef groupRef = null;
+      XsTLocalElement localElement = null;
+      if (pParticle instanceof XsTGroupRef) {
+        groupRef = (XsTGroupRef) pParticle;
+      } else if (pParticle instanceof XsTLocalElement) {
+        localElement = (XsTLocalElement) pParticle;
+        // May be the referenced element is the head of a substitution group
+        XsQName ref = localElement.getRef();
+        if (ref != null) {
+          XSElement referencedElement = getXSSchema().getElement(ref);
+          if (referencedElement == null) {
+            throw new LocSAXException("The referenced element " + ref + " is undefined.", localElement.getLocator());
+          }
+          XSGroup substitutedGroup = referencedElement.getSubstitutionGroup();
+          if (substitutedGroup != null  &&  substitutedGroup != this) {
+            XsObject parent = localElement.getParentObject();
+            XsTGroupRefImpl groupRefImpl = (XsTGroupRefImpl) localElement.getObjectFactory().newXsTGroupRef(parent);
+            groupRefImpl.setRef(substitutedGroup.getName());
+            int maxOccurs = localElement.getMaxOccurs();
+            if (maxOccurs == -1) {
+              groupRefImpl.setMaxOccurs("unbounded");
+            } else {
+              groupRefImpl.setMaxOccurs(Integer.toString(maxOccurs));
+            }
+            groupRefImpl.setMinOccurs(localElement.getMinOccurs());
+            groupRef = groupRefImpl;
+          }
+        }
+      } else {
+        throw new IllegalStateException("Unknown particle type: " + pParticle.getClass().getName());
+      }
+      if (groupRef == null) {
+        occurs = localElement;
+        XSElement element = getXSSchema().getXSObjectFactory().newXSElement(this, localElement);
+        element.validate();
+        p = new XSParticleImpl(element);
+      } else {
+        occurs = groupRef;
+        XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, groupRef);
+        group.validate();
+        p = new XSParticleImpl(group);
+      }
+    }
+    pModelGroup.addParticle(p);
+    p.setMaxOccurs(occurs.getMaxOccurs());
+    p.setMinOccurs(occurs.getMinOccurs());
+  }
+
+  public boolean isGlobal() {
+    return isGlobal;
+  }
+
+  public void setGlobal(boolean pGlobal) {
+    isGlobal = pGlobal;
+  }
+
+  public XsQName getName() {
+    return name;
+  }
+
+  protected boolean isValidated() {
+    return isValidated;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    } else {
+      isValidated = true;
+    }
+
+    if (xsAnnotation == null) {
+      annotations = new XSAnnotation[0];
+    } else {
+      XSAnnotation result = getXSSchema().getXSObjectFactory().newXSAnnotation(this, xsAnnotation);
+      result.validate();
+      annotations = new XSAnnotation[]{result};
+    }
+
+    if (modelGroup == null) {
+      XsQName myName = getName();
+      if (myName == null) {
+        throw new NullPointerException("Missing group name");
+      }
+      XSGroup group = getXSSchema().getGroup(myName);
+      if (group == null) {
+        throw new LocSAXException("Unknown group: " + myName, getLocator());
+      }
+      modelGroup = group;
+    }
+
+    if (particles != null) {
+      initParticles(modelGroupImpl, particles);
+    } else if (nestedParticles != null) {
+      initParticles(modelGroupImpl, nestedParticles);
+    }
+
+    modelGroup.validate();
+  }
+
+  public Compositor getCompositor() {
+    return modelGroup.getCompositor();
+  }
+
+  public XSParticle[] getParticles() {
+    return modelGroup.getParticles();
+  }
+
+  public boolean isSequence() {
+    return modelGroup.isSequence();
+  }
+
+  public boolean isChoice() {
+    return modelGroup.isChoice();
+  }
+
+  public boolean isAll() {
+    return modelGroup.isAll();
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    return annotations;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSIdentityConstraintImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSIdentityConstraintImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSIdentityConstraintImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSElementOrAttrRef;
+import org.apache.ws.jaxme.xs.XPathMatcher;
+import org.apache.ws.jaxme.xs.xml.XsEKey;
+import org.apache.ws.jaxme.xs.xml.XsTKeybase;
+import org.apache.ws.jaxme.xs.xml.XsEUnique;
+import org.xml.sax.SAXException;
+
+/** 
+ * Default implementation of the XSIdentityConstraint.
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public class XSIdentityConstraintImpl extends XSOpenAttrsImpl 
+  implements XSIdentityConstraint 
+{
+  private XSAnnotation[] annotations;
+  private String name;
+  private boolean isUnique;
+  private XsTKeybase keyBase;
+  private XSElementOrAttrRef[][] matchCriteria;
+
+  protected XSIdentityConstraintImpl( XSElement pParent, XsEKey key ) 
+    throws SAXException
+  {
+    super( pParent, key );
+
+    initSelf( pParent, key, false );
+  }
+
+  protected XSIdentityConstraintImpl( XSElement pParent, XsEUnique unique ) 
+    throws SAXException
+  {
+    super( pParent, unique );
+
+    initSelf( pParent, unique, true );
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    return annotations;
+  }
+
+  /** 
+   * @see XSIdentityConstraintImpl#getName
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @see XSIdentityConstraintImpl#isUnique
+   */
+  public boolean isUnique() {
+    return isUnique;
+  }
+
+  /**
+   * @see XSIdentityConstraintImpl#getMatchCriteria
+   */
+  public XSElementOrAttrRef[][] getMatchCriteria() {
+    return matchCriteria;
+  }
+
+  public void validate() throws SAXException {
+    matchCriteria = XPathMatcher.match( 
+      keyBase, 
+      (XSElement) getParentObject() 
+    );
+
+    validateAllIn( annotations );
+  }
+
+  private void initSelf( 
+    XSElement pParent, 
+    XsTKeybase keyBase, 
+    boolean isUnique 
+  ) throws SAXException {
+    this.isUnique = isUnique;
+    this.name = keyBase.getName().getValue();
+    this.keyBase = keyBase;
+
+    this.annotations = getXSSchema().getXSObjectFactory().newXSAnnotations(
+      this, 
+      keyBase.getAnnotation()
+    );
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSKeyRefImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSKeyRefImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSKeyRefImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XPathMatcher;
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSElementOrAttrRef;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSKeyRef;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEKeyref;
+import org.xml.sax.SAXException;
+
+/** 
+ * Default implementation of the XSKeyRef.
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public class XSKeyRefImpl extends XSOpenAttrsImpl 
+  implements XSKeyRef
+{
+  private XSAnnotation[] annotations;
+  private String name;
+  private XSIdentityConstraint identityConstraint;
+  private XsEKeyref keyRef;
+  private XSElementOrAttrRef[][] matchCriteria;
+
+  protected XSKeyRefImpl( XSElement pParent, XsEKeyref keyRef ) 
+    throws SAXException
+  {
+    super( pParent, keyRef );
+
+    this.annotations = getXSSchema().getXSObjectFactory().newXSAnnotations(
+      this, 
+      keyRef.getAnnotation()
+    );
+
+    this.name = keyRef.getName().getValue();
+    this.keyRef = keyRef;
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    return annotations;
+  }
+
+  /** 
+   * @see XSKeyRef#getName
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @see XSKeyRef#getIdentityConstraint
+   */
+  public XSIdentityConstraint getIdentityConstraint() {
+    return identityConstraint;
+  }
+
+  /**
+   * @see XSKeyRef#getMatchCriteria
+   */
+  public XSElementOrAttrRef[][] getMatchCriteria() {
+    return matchCriteria;
+  }
+
+  public void validate() throws SAXException {
+    validateAllIn( annotations );
+
+    String referredIdentity = keyRef.getRefer().getLocalName();
+    identityConstraint = (XSIdentityConstraint) getXSSchema().getIdentityConstraints().get(
+      referredIdentity 
+    );
+
+    if ( identityConstraint == null ) {
+      throw new LocSAXException( 
+        "Unknown identity constraint: " + referredIdentity, 
+        keyRef.getLocator()
+      );
+    }
+
+    matchCriteria = XPathMatcher.match( 
+      keyRef, 
+      (XSElement) getParentObject() 
+    );
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEList;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTLocalSimpleType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSListTypeImpl extends XSSimpleTypeImpl implements XSListType {
+  private static final String[][] ZERO_PATTERNS = new String[0][];
+  private static final XSEnumeration[] ZERO_ENUMERATIONS = new XSEnumeration[0];
+  private final XSType itemType;
+
+  public boolean isRestriction() { return false; }
+  public XSType getRestrictedType() {
+    throw new IllegalStateException("This is a basic list type and not a restriction of another simple type.");
+  }
+
+  public XSListTypeImpl(XSType pOwner, XsEList pBaseList) throws SAXException {
+    XsQName itemTypeName = pBaseList.getItemType();
+    if (itemTypeName == null) {
+      XsTLocalSimpleType simpleType = pBaseList.getSimpleType();
+      if (simpleType == null) {
+        throw new LocSAXException("You must either set the 'itemType' attribute or add a 'simpleType' element.",
+                                   pBaseList.getLocator());
+      }
+      XSType type = pOwner.getXSSchema().getXSObjectFactory().newXSType(pOwner, simpleType);
+      type.validate();
+      itemType = type;
+    } else {
+      XSType type = pOwner.getXSSchema().getType(itemTypeName);
+      if (type == null) {
+        throw new LocSAXException("Unknown item type: " + itemTypeName, pBaseList.getLocator());
+      }
+      type.validate();
+      if (!type.isSimple()) {
+        throw new LocSAXException("The item type " + itemTypeName + " is complex.",
+                                     pBaseList.getLocator());
+      }
+      itemType = type;
+    }
+  }
+
+  public boolean isList() { return true; }
+  public XSListType getListType() { return this; }
+  public String[][] getPattern() { return ZERO_PATTERNS; }
+  public XSEnumeration[] getEnumerations() { return ZERO_ENUMERATIONS; }
+  public Long getLength() { return null; }
+  public Long getMinLength() { return null; }
+  public Long getMaxLength() { return null; }
+  public XSType getItemType() { return itemType; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeRestrictionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeRestrictionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSListTypeRestrictionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsELength;
+import org.apache.ws.jaxme.xs.xml.XsEMaxLength;
+import org.apache.ws.jaxme.xs.xml.XsEMinLength;
+import org.apache.ws.jaxme.xs.xml.XsGSimpleRestrictionModel;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSListTypeRestrictionImpl extends XSSimpleTypeRestrictionImpl implements XSListType {
+  private final XSListType listBaseType;
+
+  public XSListTypeRestrictionImpl(XSType pParent,
+                                    XSType pRestrictedType, XsGSimpleRestrictionModel pRestriction)
+      throws SAXException {
+    super(pParent, pRestrictedType, pRestriction);
+    listBaseType = pRestrictedType.getSimpleType().getListType();
+  }
+
+  public boolean isList() { return true; }
+
+  public XSListType getListType() {
+    return this;
+  }
+
+  public XSType getItemType() {
+    return listBaseType.getItemType();
+  }
+
+  public Long getLength() {
+    XsELength length = getRestriction().getLength();
+    if (length == null) {
+      return listBaseType.getLength();
+    } else {
+      return new Long(length.getValue());
+    }
+  }
+
+  public Long getMinLength() {
+    XsEMinLength length = getRestriction().getMinLength();
+    if (length == null) {
+      return listBaseType.getMinLength();
+    } else {
+      return new Long(length.getValue());
+    }
+  }
+
+  public Long getMaxLength() {
+    XsEMaxLength length = getRestriction().getMaxLength();
+    if (length == null) {
+      return listBaseType.getMaxLength();
+    } else {
+      return new Long(length.getValue());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSLogicalParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,708 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.SchemaTransformer;
+import org.apache.ws.jaxme.xs.XSContentHandler;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsEImport;
+import org.apache.ws.jaxme.xs.xml.XsEInclude;
+import org.apache.ws.jaxme.xs.xml.XsENotation;
+import org.apache.ws.jaxme.xs.xml.XsERedefine;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsETopLevelSimpleType;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsRedefinable;
+import org.apache.ws.jaxme.xs.xml.XsTAttribute;
+import org.apache.ws.jaxme.xs.xml.XsTAttributeGroup;
+import org.apache.ws.jaxme.xs.xml.XsTComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTLocalElement;
+import org.apache.ws.jaxme.xs.xml.XsTNamedGroup;
+import org.apache.ws.jaxme.xs.xml.XsTSimpleExplicitGroup;
+import org.apache.ws.jaxme.xs.xml.XsTTopLevelElement;
+import org.w3c.dom.Node;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>Implementation of a logical parser.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSLogicalParser {
+	/** This class is used to ensure, that schemata aren't loaded
+	 * twice. It can also be used for preloading schemata.
+	 */
+	public static class AddedImport {
+		private final String targetNamespace, schemaLocation;
+		private final Node node;
+		/** Creates a new instance with the given target namespace and
+		 * schema location.
+		 * @param pTargetNamespace The schemas target namespace.
+		 * @param pSchemaLocation The schemas location.
+		 */
+		public AddedImport(XsAnyURI pTargetNamespace, String pSchemaLocation) {
+			this(pTargetNamespace == null ? "" : pTargetNamespace.toString(), pSchemaLocation);
+		}
+		/** Creates a new instance with the given target namespace and
+		 * schema location.
+		 * @param pTargetNamespace The schemas target namespace.
+		 * @param pSchemaLocation The schemas location.
+		 */
+		public AddedImport(String pTargetNamespace, String pSchemaLocation) {
+			this(pTargetNamespace, pSchemaLocation, null);
+		}
+		/** Creates a new instance with the given target namespace and
+		 * schema location. The schema isn't parsed from the location.
+		 * Instead, the supplied nodes contents should be used as a
+		 * schema.
+		 * @param pTargetNamespace The schemas target namespace.
+		 * @param pSchemaLocation The schemas location.
+		 * @param pNode The schemas contents as a DOM node.
+		 */
+		public AddedImport(String pTargetNamespace, String pSchemaLocation, Node pNode) {
+			targetNamespace = pTargetNamespace == null ? "" : pTargetNamespace.toString();
+			if (pSchemaLocation == null) {
+				throw new IllegalStateException("The schemaLocation must not be null.");
+			}
+			schemaLocation = pSchemaLocation;
+			node = pNode;
+		}
+		public boolean equals(Object pOther) {
+			if (pOther instanceof AddedImport) {
+				AddedImport other = (AddedImport) pOther;
+				return targetNamespace.equals(other.targetNamespace) &&
+				schemaLocation.equals(other.schemaLocation);
+			} else {
+				return false;
+			}
+		}
+		public int hashCode() {
+			return targetNamespace.hashCode() + schemaLocation.hashCode();
+		}
+		
+		/** Returns the imported schemas target namespace.
+		 */
+		public String getNamespace() {
+			return targetNamespace;
+		}
+		
+		/** Returns the URL, from which the schema is being loaded.
+		 * Returns null, if the schema is loaded from a DOM node.
+		 */
+		public String getSchemaLocation() {
+			return schemaLocation;
+		}
+		
+		/** Returns the DOM node, from which the schema is being loaded.
+		 * Returns null, if the schema is loaded from an URL.
+		 */
+		public Node getNode() {
+			return node;
+		}
+	}
+	
+	private boolean notValidating;
+	private List syntaxSchemas = new ArrayList();
+	private XsESchema[] syntaxSchemaArray;
+	private XSSchema schema;
+	private Set parsedSchemas;
+	private List addedImports = new ArrayList();
+	
+	protected XSContext getData() {
+		return XSParser.getRunningInstance().getContext();
+	}
+	
+	/** <p>Sets whether the parser is validating.</p>
+	 */
+	public void setValidating(boolean pValidating) {
+		notValidating = !pValidating;
+	}
+	
+	/** <p>Returns whether the parser is validating.</p>
+	 */
+	public boolean isValidating() {
+		return !notValidating;
+	}
+	
+	/** <p>Adds a schema being imported by the parser. This feature
+	 * is useful, if a schema silently assumes the presence of additional
+	 * datatypes. For example, a WSDL definition will contain references
+	 * to SOAP datatypes without explicit import.</p>
+	 * <p>In practice, the declaration will silently create an
+	 * "xs:import" node.</p>
+	 * @param pNamespace Matches the "xs:import" nodes "namespace" attribute.
+	 *   In particular it may be null, in which case the imported schema may
+	 *   not have a targetNamespace.
+	 * @param pSchemaLocation Matches the "xs:import" nodes "schemaLocation"
+	 *   attribute. In particular it may be null.
+	 */
+	public void addImport(String pNamespace, String pSchemaLocation) {
+		addedImports.add(new AddedImport(pNamespace, pSchemaLocation));
+	}
+	
+	/** <p>Adds a schema being imported by the parser. The schema is
+	 * provided as a DOM node. This feature is useful, if a schema
+	 * silently assumes the presence of additional datatypes. For
+	 * example, a WSDL definition will contain references to SOAP
+	 * datatypes without explicit import.</p>
+	 * @param pNamespace Matches the "xs:import" nodes "namespace"
+	 *   attribute. In particular it may be null, in which case the
+	 *   imported schema may not have a targetNamespace.
+	 * @param pSchemaLocation System ID of the schema being imported,
+	 * if known, or null. Knowing the system ID is important only,
+	 * if you need to prevent recursive parsing of schemata.
+	 * @param pSchema A DOM node with the schema being imported.
+	 */
+	public void addImport(String pNamespace, String pSchemaLocation, Node pSchema) {
+		addedImports.add(new XSLogicalParser.AddedImport(pNamespace, pSchemaLocation, pSchema));
+	}
+	
+	/** <p>Returns the array of added imports, typically empty.</p>
+	 */
+	public AddedImport[] getAddedImports() {
+		return (AddedImport[]) addedImports.toArray(new AddedImport[addedImports.size()]);
+	}
+	
+	/** <p>Returns the schema, which is currently being parsed.</p>
+	 */
+	public XSSchema getSchema() { return schema; }
+	
+	/** <p>Sets the schema, which is currently being parsed.</p>
+	 */
+	protected void setSchema(XSSchema pSchema) {
+		schema = pSchema;
+	}
+	
+	protected XsESchema parseSyntax(Node pNode) throws SAXException {
+		XSContext data = getData();
+		try {
+			XsObjectFactory factory = data.getXsObjectFactory();
+			XsESchema mySchema = factory.newXsESchema();
+			XsSAXParser xsSAXParser = factory.newXsSAXParser(mySchema);
+			addSyntaxSchema(mySchema);
+			try {
+				data.setCurrentContentHandler(xsSAXParser);
+				DOMSerializer ds = new DOMSerializer();
+				ds.serialize(pNode, xsSAXParser);
+				return (XsESchema) xsSAXParser.getBean();
+			} finally {
+				removeSyntaxSchema();
+			}
+		} finally {
+			data.setCurrentContentHandler(null);
+		}
+	}
+	
+	/** <p>Converts the given URI into an instance of InputSource.</p>
+	 */
+	protected InputSource getInputSource(String pReferencingSystemId, String pURI) throws SAXException {
+		URL url = null;
+		if (pReferencingSystemId != null) {
+			// Try to create the new URI based on the old URI; may be its relative?
+			try {
+				url = new URL(new URL(pReferencingSystemId), pURI);
+			} catch (MalformedURLException e) {
+			}
+			
+			if (url == null) {
+				try {
+					url = new File(new File(pReferencingSystemId).getParentFile(), pURI).toURL();
+				} catch (MalformedURLException e) {
+				}
+			}
+		}
+		
+		if (url == null) {
+			try {
+				url = new URL(pURI);
+			} catch (MalformedURLException e) {
+				try {
+					url = new File(pURI).toURL();
+				} catch (MalformedURLException f) {
+					throw new SAXException("Failed to parse the URI " + pURI);
+				}
+			}
+		}
+		
+		try {
+			InputSource isource = new InputSource(url.openStream());
+			isource.setSystemId(url.toString());
+			return isource;
+		} catch (IOException e) {
+			throw new SAXException("Failed to open the URL " + url, e);
+		}
+	}
+	
+	
+	protected XsESchema parseSyntax(Locator pLocator, String pSchemaLocation)
+	throws SAXException, IOException, ParserConfigurationException {
+		XsESchema result = getData().getXsObjectFactory().newXsESchema();
+		parseSyntax(pLocator, pSchemaLocation, result);
+		return result;
+	}
+	
+	protected void parseSyntax(Locator pLocator, String pSchemaLocation,
+			XsESchema pSchema)
+	throws SAXException, IOException, ParserConfigurationException {
+		XSContext data = getData();
+		try {
+			XsObjectFactory factory = data.getXsObjectFactory();
+			XMLReader xr = factory.newXMLReader(isValidating());
+			EntityResolver entityResolver = xr.getEntityResolver();
+			InputSource schemaSource = null;
+			if (entityResolver != null) {
+				schemaSource = entityResolver.resolveEntity(null, pSchemaLocation);
+			}
+			if (schemaSource == null) {
+				schemaSource = getInputSource(pLocator == null ? null : pLocator.getSystemId(),
+						pSchemaLocation);
+			}
+			
+			XsSAXParser xsSAXParser = factory.newXsSAXParser(pSchema);
+			addSyntaxSchema(pSchema);
+			try {
+				data.setCurrentContentHandler(xsSAXParser);
+				xr.setContentHandler(xsSAXParser);
+				xr.parse(schemaSource);
+			} finally {
+				removeSyntaxSchema();
+			}
+		} finally {
+			data.setCurrentContentHandler(null);
+		}
+	}
+	
+	/** <p>Redefines the given {@link XsRedefinable}.</p>
+	 */
+	protected void redefine(XsESchema pSyntaxSchema,
+			XsERedefine pRedefine, XsRedefinable pChild) throws SAXException {
+		XSSchema mySchema = getSchema();
+		XSContext data = getData();
+		XSObjectFactory factory = data.getXSObjectFactory();
+		if (pChild instanceof XsTAttributeGroup) {
+			XsTAttributeGroup attributeGroup = (XsTAttributeGroup) pChild;
+			mySchema.redefine(factory.newXSAttributeGroup(mySchema, attributeGroup));
+		} else if (pChild instanceof XsTNamedGroup) {
+			XsTNamedGroup group = (XsTNamedGroup) pChild;
+			mySchema.redefine(factory.newXSGroup(mySchema, group));
+		} else if (pChild instanceof XsETopLevelSimpleType) {
+			XsETopLevelSimpleType type = (XsETopLevelSimpleType) pChild;
+			mySchema.redefine(factory.newXSType(mySchema, type));
+		} else if (pChild instanceof XsTComplexType) {
+			XsTComplexType type = (XsTComplexType) pChild;
+			mySchema.redefine(factory.newXSType(mySchema, type));
+		} else {
+			Locator locator = (pChild instanceof XsObject) ? ((XsObject) pChild).getLocator() : pRedefine.getLocator();
+			throw new LocSAXException("Unknown type for redefinition: " + pChild.getClass().getName() +
+					", perhaps you should handle this in a subclass?", locator);
+		}
+	}
+	
+	
+	
+	/** <p>Adds the given object to the schema.</p>
+	 * 
+	 */
+	protected void add(XsESchema pSyntaxSchema, Object pChild) throws SAXException {
+		XSSchema mySchema = getSchema();
+		XSContext data = getData();
+		XSObjectFactory factory = data.getXSObjectFactory();
+		if (pChild instanceof XsEAnnotation) {
+			XsEAnnotation annotation = (XsEAnnotation) pChild;
+			mySchema.add(factory.newXSAnnotation(mySchema, annotation));
+		} else if (pChild instanceof XsETopLevelSimpleType) {
+			XsETopLevelSimpleType type = (XsETopLevelSimpleType) pChild;
+			mySchema.add(factory.newXSType(mySchema, type));
+		} else if (pChild instanceof XsTComplexType) {
+			XsTComplexType type = (XsTComplexType) pChild;
+			mySchema.add(factory.newXSType(mySchema, type));
+		} else if (pChild instanceof XsTNamedGroup) {
+			XsTNamedGroup group = (XsTNamedGroup) pChild;
+			mySchema.add(factory.newXSGroup(mySchema, group));
+		} else if (pChild instanceof XsTAttributeGroup) {
+			XsTAttributeGroup attributeGroup = (XsTAttributeGroup) pChild;
+			mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
+		} else if (pChild instanceof XsTTopLevelElement) {
+			XsTTopLevelElement element = (XsTTopLevelElement) pChild;
+			mySchema.add(factory.newXSElement(mySchema, element));
+		} else if (pChild instanceof XsTAttribute) {
+			XsTAttribute attribute = (XsTAttribute) pChild;
+			mySchema.add(factory.newXSAttribute(mySchema, attribute));
+		} else if (pChild instanceof XsENotation) {
+			XsENotation notation = (XsENotation) pChild;
+			mySchema.add(factory.newXSNotation(mySchema, notation));
+		} else {
+			Locator locator = (pChild instanceof XsObject) ?
+					((XsObject) pChild).getLocator() : pSyntaxSchema.getLocator();
+					throw new LocSAXException("Unknown child type: " + pChild.getClass().getName() +
+							", perhaps you should handle this in a subclass?", locator);
+		}
+	}
+	
+	/** <p>Handles xs:refefine.</p>
+	 */
+	protected void redefineSchema(XsESchema pRedefiningSchema,
+			XsERedefine pRedefine)
+	throws SAXException, IOException, ParserConfigurationException {
+		// TODO: Implement redefine
+		throw new LocSAXException("Redefine isn't yet implemented.", pRedefine.getLocator());
+	}
+	
+	/** <p>Handles xs:include.</p>
+	 */
+	protected void includeSchema(XsESchema pIncludingSchema,
+			XsEInclude pInclude)
+	throws SAXException, IOException, ParserConfigurationException {
+		final XsAnyURI schemaLocation = pInclude.getSchemaLocation();
+		if (schemaLocation == null) {
+			throw new LocSAXException("Invalid include: Missing 'schemaLocation' attribute.",
+					pInclude.getLocator());
+		}
+		Locator locator = pInclude.getLocator();
+		XsESchema includedSchema = parseSyntax(locator, schemaLocation.toString());
+		XsAnyURI incNamespace = includedSchema.getTargetNamespace();
+		if (incNamespace == null) {
+			if (pIncludingSchema.getTargetNamespace() != null) {
+				includedSchema.setTargetNamespace(pIncludingSchema.getTargetNamespace());
+			}
+		} else {
+			XsAnyURI myNamespace = includedSchema.getTargetNamespace();
+			if (!incNamespace.equals(myNamespace)) {
+				throw new LocSAXException("Invalid include: The included schemas target namespace " +
+						incNamespace + " and the including schemas target namespace " +
+						myNamespace + " do not match.",
+						pInclude.getLocator());
+			}
+		}
+		parse(includedSchema, schemaLocation.toString());
+	}
+	
+	private void checkValidImportSchema(XsESchema pImportingSchema, String pNamespace,
+			Locator pLocator)
+	throws SAXException {
+		if (pNamespace == null) {
+			if (pImportingSchema.getTargetNamespace() == null) {
+				throw new LocSAXException("The importing schema has no 'targetNamespace' attribute and" +
+						" the 'import' element has no 'namespace' attribute, which is" +
+						" forbidden. Perhaps you want to use include?",
+						pLocator);
+			}
+		} else {
+			if ("".equals(pNamespace)) {
+				throw new LocSAXException("Invalid import: Empty 'namespace' attribute, which is forbidden." +
+						" Perhaps you want to omit the attribute to indicate the absence of a namespace?",
+						pLocator);
+			}
+			XsAnyURI targetNamespace = pImportingSchema.getTargetNamespace();
+			if (targetNamespace != null  &&
+					pNamespace.equals(targetNamespace.toString())) {
+				throw new LocSAXException("The importing schema and the imported schema have the same namespace, which is forbidden. Perhaps you want to use include?",
+						pLocator);
+			}
+		}
+	}
+	
+	private void importSchema(XsESchema pImportingSchema, String pNamespace,
+			XsESchema pImportedSchema, Locator pLocator,
+			String pSchemaLocation)
+	throws SAXException, ParserConfigurationException, IOException {
+		XsAnyURI impNamespace = pImportedSchema.getTargetNamespace();
+		if (pNamespace == null) {
+			if (impNamespace != null) {
+				throw new LocSAXException("The 'import' element does not have a 'namespace' attribute, but the imported schema has target namespace " +
+						impNamespace + ", it ought to match and have none.",
+						pLocator);
+			}
+		} else {
+			if (impNamespace == null) {
+				throw new LocSAXException("The 'import' element has a 'namespace' attribute (" + pNamespace +
+						"), but the imported schema has no 'targetNamespace' attribute.",
+						pLocator);
+			} else if (!pNamespace.equals(impNamespace.toString())) {
+				throw new LocSAXException("The 'import' elements 'namespace' attribute (" + pNamespace +
+						") and the imported schemas 'targetNamespace' attribute (" +
+						impNamespace + ") do not match.",
+						pLocator);
+			}
+		}
+		parse(pImportedSchema, pSchemaLocation);
+	}
+	
+	/** <p>Handles xs:import.</p>
+	 */
+	protected void importSchema(XsESchema pImportingSchema,
+			String pNamespace, String pSchemaLocation,
+			Locator pLocator)
+	throws SAXException, IOException, ParserConfigurationException {
+		if (pSchemaLocation == null) {
+			return;
+		}
+		checkValidImportSchema(pImportingSchema, pNamespace, pLocator);
+		
+		XsESchema importedSchema = parseSyntax(pLocator, pSchemaLocation);
+		importSchema(pImportingSchema, pNamespace, importedSchema, pLocator, pSchemaLocation);
+	}
+	
+	protected void importSchema(XsESchema pImportingSchema, String pNamespace, Node pNode,
+			String pSchemaLocation)
+	throws SAXException, IOException, ParserConfigurationException {
+		checkValidImportSchema(pImportingSchema, pNamespace, null);
+		XsESchema importedSchema = parseSyntax(pNode);
+		importSchema(pImportingSchema, pNamespace, importedSchema, null, pSchemaLocation);
+	}
+	
+	/** <p>Parses the given {@link InputSource} syntactically and
+	 * converts the objects that it finds into logical objects.
+	 * These logical objects are added to the given {@link XSSchema}.</p>
+	 */
+	protected void parse(XsESchema pSyntaxSchema, String pSchemaLocation)
+			throws ParserConfigurationException, SAXException, IOException {
+		if (pSchemaLocation != null) {
+			AddedImport schema = new AddedImport(pSyntaxSchema.getTargetNamespace(),
+									 			 pSchemaLocation);
+			if (parsedSchemas == null) {
+				parsedSchemas = new HashSet();
+			} else if (parsedSchemas.contains(schema)) {
+				return; // Already imported/included, ignore it
+			}
+			parsedSchemas.add(schema);
+
+			for (int i = 0;  i < addedImports.size();  i++) {
+				AddedImport addedImport = (AddedImport) addedImports.get(i);
+				if (schema.equals(addedImport)) {
+					return;
+				}
+			}
+		}
+		addSyntaxSchema(pSyntaxSchema);
+		try {
+			Object[] childs = pSyntaxSchema.getChilds();
+			
+			for (int i = 0;  i < childs.length;  i++) {
+				Object o = childs[i];
+				if (o instanceof XsEInclude) {
+					includeSchema(pSyntaxSchema, (XsEInclude) o);
+				} else if (o instanceof XsERedefine) {
+					redefineSchema(pSyntaxSchema, (XsERedefine) o);
+				} else if (o instanceof XsEImport) {
+					XsEImport xsEImport = (XsEImport) o;
+					XsAnyURI namespace = xsEImport.getNamespace();
+					XsAnyURI schemaLocation = xsEImport.getSchemaLocation();
+					importSchema(pSyntaxSchema, namespace == null ? null : namespace.toString(),
+							schemaLocation == null ? null : schemaLocation.toString(),
+									xsEImport.getLocator());
+				} else {
+					add(pSyntaxSchema, childs[i]);
+				}
+			}
+		} finally {
+			removeSyntaxSchema();
+		}
+	}
+	
+	
+	private static class SubstitutionGroup {
+		private final List members = new ArrayList();
+		private final XSElement head;
+		
+		public SubstitutionGroup(XSElement pHead) {
+			head = pHead;
+		}
+		public XSElement getHead() { return head; }
+		public XSElement[] getMembers() {
+			return (XSElement[]) members.toArray(new XSElement[members.size()]);
+		}
+		public void addMember(XSElement pElement) {
+			members.add(pElement);
+		}
+	}
+	
+	protected void createSubstitutionGroups(XSSchema pSchema) throws SAXException {
+		Object[] myChilds = pSchema.getChilds();
+		
+		// Build the Map of substitution groups.
+		Map substitutionGroups = new HashMap();
+		for (int i = 0;  i < myChilds.length;  i++) {
+			if (myChilds[i] instanceof XSElement) {
+				XSElement element = (XSElement) myChilds[i];
+				XsQName qName = element.getSubstitutionGroupName();
+				if (qName != null) {
+					SubstitutionGroup group = (SubstitutionGroup) substitutionGroups.get(qName);
+					if (group == null) {
+						XSElement head = pSchema.getElement(qName);
+						if (head == null) {
+							throw new LocSAXException("The substituted element " + qName + " is missing in the schema.",
+									element.getLocator());
+						}
+						if (head.isBlockedForSubstitution()) {
+							throw new LocSAXException("The substituted element " + qName + " is blocked for substitution.",
+									element.getLocator());
+						}
+						group = new SubstitutionGroup(head);
+						if (!head.isAbstract()) {
+							group.addMember(head);
+						}
+						substitutionGroups.put(qName, group);
+					}
+					group.addMember(element);
+				}
+			}
+		}
+		
+		// For any substitution group: Build an implicit choice group, which
+		// may be used to replace the substitution groups head, if required.
+		for (Iterator iter = substitutionGroups.values().iterator();  iter.hasNext();  ) {
+			SubstitutionGroup group = (SubstitutionGroup) iter.next();
+			XSElementImpl head = (XSElementImpl) group.getHead();
+			XsObject object = head.getXsObject();
+			XsESchema syntaxSchema = object.getXsESchema();
+			
+			// Find a name for the group
+			String namespace = syntaxSchema.getTargetNamespace().toString();
+			String localName = head.getName().getLocalName() + "Group";
+			XsQName suggestion = new XsQName(namespace, localName);
+			if (pSchema.getGroup(suggestion) != null) {
+				for (int i = 0;  ;  i++) {
+					suggestion = new XsQName(namespace, localName + i);
+					if (pSchema.getGroup(suggestion) == null) {
+						break;
+					}
+				}
+			}
+			
+			XsTNamedGroup namedGroup = object.getObjectFactory().newXsTNamedGroup(syntaxSchema);
+			namedGroup.setName(new XsNCName(suggestion.getLocalName()));
+			XsTSimpleExplicitGroup choice = namedGroup.createChoice();
+			XSElement[] members = group.getMembers();
+			for (int j = 0;  j < members.length;  j++) {
+				XSElement member = members[j];
+				XsTLocalElement memberElement = choice.createElement();
+				memberElement.setRef(member.getName());
+			}
+			
+			XSGroupImpl xsGroup = (XSGroupImpl) getSchema().getXSObjectFactory().newXSGroup(pSchema, namedGroup);
+			pSchema.add(xsGroup);
+			head.setSubstitutionGroup(xsGroup);
+		}
+	}
+	
+	/** <p>This is the logical parsers frontend for parsing a stream
+	 * of SAX events.</p>
+	 * @param pSystemId System Id (schema location of the schema being parsed, if known.
+	 * Null otherwise. Knowing the system id is important only, if you want
+	 * to prevent recursive includes.
+	 */
+	public XSContentHandler getXSContentHandler(String pSystemId) throws SAXException {
+		return new XSContentHandlerImpl(this, pSystemId);
+	}
+	
+	/** <p>This is the logical parsers frontend for parsing a DOM node.</p>
+	 */
+	public XSSchema parse(Node pNode) throws SAXException {
+		XSContentHandler handler = getXSContentHandler(null);
+		DOMSerializer ds = new DOMSerializer();
+		ds.serialize(pNode, handler);
+		return handler.getXSSchema();
+	}
+	
+	/** <p>This is the logical parsers frontend for parsing the given
+	 * {@link InputSource}. If the parsed schema includes or imports other
+	 * schemas, they are also parsed and added to the parsers object
+	 * tree.</p>
+	 * @see #getXSContentHandler()
+	 */
+	public XSSchema parse(InputSource pSource)
+	throws ParserConfigurationException, SAXException, IOException {
+		XSContentHandler contentHandler = getXSContentHandler(pSource.getSystemId());
+		XSContext data = getData();
+		XMLReader xr = data.getXsObjectFactory().newXMLReader(isValidating());
+		xr.setContentHandler(contentHandler);
+		SchemaTransformer transformer = data.getXSObjectFactory().getSchemaTransformer();
+		if (transformer != null) {
+			transformer.parse(pSource, xr);
+			pSource = transformer.getTransformedInputSource();
+			xr = transformer.getTransformedXMLReader();
+		}
+		xr.parse(pSource);
+		return getSchema();
+	}
+	
+	protected void clearSyntaxSchemas() {
+		syntaxSchemas.clear();
+		syntaxSchemaArray = null;
+	}
+	
+	protected void addSyntaxSchema(XsESchema pSyntaxSchema) {
+		syntaxSchemas.add(pSyntaxSchema);
+		syntaxSchemaArray = null;
+	}
+	
+	protected void removeSyntaxSchema() {
+		syntaxSchemas.remove(syntaxSchemas.size()-1);
+		syntaxSchemaArray = null;
+	}
+	
+	/** <p>Provides context information to the schema which is currently being parsed.
+	 * The schema with index 0 is the outermost schema, on which the parser is actually
+	 * invoked.</p>
+	 */
+	public XsESchema[] getSyntaxSchemas() {
+		if (syntaxSchemaArray == null) {
+			syntaxSchemaArray = (XsESchema[]) syntaxSchemas.toArray(new XsESchema[syntaxSchemas.size()]);
+		}
+		return syntaxSchemaArray;
+	}
+	
+	/** <p>Returns the syntax schema, which is currently being parsed.</p>
+	 */
+	public XsESchema getCurrentSyntaxSchema() {
+		if (syntaxSchemaArray == null  ||  syntaxSchemaArray.length == 0) {
+			return null;
+		} else {
+			return syntaxSchemaArray[syntaxSchemaArray.length-1];
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSModelGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSModelGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSModelGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.XSModelGroup;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSModelGroupImpl implements XSModelGroup {
+  private final XSModelGroup.Compositor compositor;
+  private final List particles = new ArrayList();
+  private final Locator locator;
+
+  public XSModelGroupImpl(XSModelGroup.Compositor pCompositor, Locator pLocator) {
+    if (pCompositor == null) {
+      throw new NullPointerException("The model group compositor must not be null.");
+    }
+    compositor = pCompositor;
+    locator = pLocator;
+  }
+
+  public Compositor getCompositor() {
+    return compositor;
+  }
+
+  public boolean isSequence() {
+    return XSModelGroup.SEQUENCE.equals(compositor);
+  }
+
+  public boolean isChoice() {
+    return XSModelGroup.CHOICE.equals(compositor);
+  }
+
+  public boolean isAll() {
+    return XSModelGroup.ALL.equals(compositor);
+  }
+
+  public void addParticle(XSParticle pParticle) throws SAXException {
+    if (isAll()) {
+      if (pParticle.getMaxOccurs() == -1  ||  pParticle.getMaxOccurs() > 1) {
+        throw new LocSAXException("Illegal 'maxOccurs' value inside 'all' group: " + pParticle.getMaxOccurs(),
+                                     pParticle.getLocator());
+      }
+    }
+    if (pParticle.getMaxOccurs() != -1  &&  pParticle.getMaxOccurs() < pParticle.getMinOccurs()) {
+      throw new LocSAXException("Illegal 'maxOccurs' value, which is lower than 'minOccurs' value: " +
+                                   pParticle.getMaxOccurs() + " < " + pParticle.getMinOccurs(),
+                                   pParticle.getLocator());
+    }
+    particles.add(pParticle);
+  }
+
+  public XSParticle[] getParticles() {
+    return (XSParticle[]) particles.toArray(new XSParticle[particles.size()]);
+  }
+
+  public void validate() throws SAXException {
+    if (isChoice()  &&  particles.size() == 0) {
+      throw new LocSAXException("A 'choice' model group must have at least one 'group', 'any', or 'element'.",
+                                   getLocator());
+    }
+    for (Iterator iter = particles.iterator();  iter.hasNext();  ) {
+      XSParticle particle = (XSParticle) iter.next();
+      if (particle.isElement()) {
+        particle.getElement().validate();
+      } else if (particle.isGroup()) {
+        particle.getGroup().validate();
+      } else if (particle.isWildcard()) {
+        particle.getWildcard().validate();
+      } else {
+        throw new IllegalStateException("Invalid particle");
+      }
+    }
+  }
+
+  public Locator getLocator() {
+    return locator;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSNotationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSNotationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSNotationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSNotation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNotationImpl extends XSObjectImpl implements XSNotation {
+  protected XSNotationImpl(XSObject pParent, XsObject pBaseObject) {
+    super(pParent, pBaseObject);
+  }
+
+  public void validate() throws SAXException {
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.SchemaTransformer;
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSAppinfo;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSAttributeGroup;
+import org.apache.ws.jaxme.xs.XSDocumentation;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSKeyRef;
+import org.apache.ws.jaxme.xs.XSNotation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Default implementation of the {@link XSObjectFactory}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSObjectFactoryImpl implements XSObjectFactory {
+  private static final XSAnnotation[] NO_ANNOTATIONS = new XSAnnotation[] {};
+
+  public XSLogicalParser newXSLogicalParser() {
+    return new XSLogicalParser();
+  }
+
+  public XSSchema newXSSchema(XSContext pContext, XsESchema pSchema) throws SAXException {
+    return new XSSchemaImpl(pContext, pSchema);
+  }
+
+  public XSAnnotation newXSAnnotation(XSObject pParent, XsEAnnotation pAnnotation) throws SAXException {
+    return new XSAnnotationImpl(pParent, pAnnotation);
+  }
+
+  public XSAnnotation[] newXSAnnotations(XSObject pParent, XsEAnnotation pAnnotation) throws SAXException {
+    if ( pAnnotation == null ) {
+      return NO_ANNOTATIONS;
+    } else {
+      return new XSAnnotation[] { newXSAnnotation(pParent, pAnnotation) };
+    }
+  }
+
+
+  public XSAppinfo newXSAppinfo(XSObject pParent, XsEAppinfo pAppinfo) {
+    return new XSAppinfoImpl(pParent, pAppinfo);
+  }
+
+  public XSSimpleType newXSAtomicType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException {
+    return new XSAtomicTypeRestrictionImpl(pParent, pRestrictedType, pRestriction);
+  }
+
+  public XSSimpleType newXSAtomicType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException {
+    return new XSAtomicTypeRestrictionImpl(pParent, pRestrictedType, pRestriction);
+  }
+
+  public XSAttribute newXSAttribute(XSObject pParent, XsTAttribute pAttribute) throws SAXException {
+    return new XSAttributeImpl(pParent, pAttribute);
+  }
+
+  public XSAttributeGroup newXSAttributeGroup(XSObject pParent, XsTAttributeGroup pGroup) throws SAXException {
+    return new XSAttributeGroupImpl(pParent, pGroup);
+  }
+
+  public XSDocumentation newXSDocumentation(XSObject pParent, XsEDocumentation pDocumentation) throws SAXException {
+    return new XSDocumentationImpl(pParent, pDocumentation);
+  }
+
+  public XSElement newXSElement(XSObject pParent, XsTElement pElement) throws SAXException {
+    return new XSElementImpl(pParent, pElement);
+  }
+
+  public XSEnumeration newXSEnumeration(XSObject pParent, XsEEnumeration pEnumeration) throws SAXException {
+    return new XSEnumerationImpl(pParent, pEnumeration);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsTAll pAll) throws SAXException {
+    return new XSGroupImpl(pParent, pAll);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsEChoice pChoice) throws SAXException {
+    return new XSGroupImpl(pParent, pChoice);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsESequence pSequence) throws SAXException {
+    return new XSGroupImpl(pParent, pSequence);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsTGroupRef pGroupRef) throws SAXException {
+    return new XSGroupImpl(pParent, pGroupRef);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsTNamedGroup pNamedGroup) throws SAXException {
+    return new XSGroupImpl(pParent, pNamedGroup);
+  }
+
+  public XSSimpleType newXSListType(XSType pParent, XsEList pList) throws SAXException {
+    return new XSListTypeImpl(pParent, pList);
+  }
+
+  public XSSimpleType newXSListType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException {
+    return new XSListTypeRestrictionImpl(pParent, pRestrictedType, pRestriction);
+  }
+
+  public XSSimpleType newXSListType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException {
+    return new XSListTypeRestrictionImpl(pParent, pRestrictedType, pRestriction);
+  }
+
+  public XSType newXSType(XSObject pParent, XsETopLevelSimpleType pType) throws SAXException {
+    return new XSTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTComplexType pType) throws SAXException {
+    return new XSTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTLocalComplexType pType) throws SAXException {
+    return new XSTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTLocalSimpleType pType) throws SAXException {
+    return new XSTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTSimpleRestrictionType pType) throws SAXException {
+    return new XSTypeImpl(pParent, pType);
+  }
+
+  public XSSimpleType newXSUnionType(XSType pParent, XsEUnion pUnion) throws SAXException {
+    return new XSUnionTypeImpl(pParent, pUnion);
+  }
+
+  public XSSimpleType newXSUnionType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException {
+    return new XSUnionTypeRestrictionImpl(pParent, pRestrictedType, pRestriction);
+  }
+
+  public XSSimpleType newXSUnionType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException {
+    return new XSUnionTypeRestrictionImpl(pParent, pRestrictedType, pRestriction);
+  }
+
+  public XSNotation newXSNotation(XSObject pParent, XsENotation pNotation) throws SAXException {
+    return new XSNotationImpl(pParent, pNotation);
+  }
+
+  public XSAny newXSAny(XSObject pParent, XsEAny pAny) throws SAXException {
+    return new XSAnyImpl(pParent, pAny);
+  }
+
+  public XSSimpleContentType newXSSimpleContentType(XSType pParent, XSType pSimpleType, XsObject pBaseType) throws SAXException {
+    return new XSSimpleContentTypeImpl(pParent, pSimpleType, pBaseType);
+  }
+
+  public XSWildcard newXSWildcard(XSObject pParent, XsTWildcard pWildcard) throws SAXException {
+    return new XSWildcardImpl(pParent, pWildcard);
+  }
+
+  public XSIdentityConstraint newXSIdentityConstraint( 
+    XSElement pParent, 
+    XsEKey key 
+  )
+    throws SAXException 
+  {
+    return new XSIdentityConstraintImpl( pParent, key );
+  }
+
+  public XSKeyRef newXSKeyRef( 
+    XSElement pParent, 
+    XsEKeyref keyRef 
+  ) throws SAXException {
+    return new XSKeyRefImpl( pParent, keyRef );
+  }
+
+  public XSIdentityConstraint newXSIdentityConstraint( 
+    XSElement pParent, 
+    XsEUnique unique 
+  ) throws SAXException {
+    return new XSIdentityConstraintImpl( pParent, unique );
+  }
+
+  public SchemaTransformer getSchemaTransformer() {
+	return null;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSObjectImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XSObjectImpl implements XSObject {
+  private final XSObject parent;
+  private final XsObject baseObject;
+
+  protected XSObjectImpl(XSObject pParent, XsObject pBaseObject) {
+    if (pParent == null) {
+      if (!(this instanceof XSSchema)) {
+        throw new IllegalStateException("Null parents are allowed for XSSchema objects only.");
+      }
+    } else {
+      if (this instanceof XSSchema) {
+        throw new IllegalStateException("An XSSchema object must have a null parent.");
+      }
+    }
+    parent = pParent;
+    baseObject = pBaseObject;
+  }
+
+  public XSObject getParentObject() { return parent; }
+  public XSSchema getXSSchema() {
+    if (parent == null) {
+      return (XSSchema) this;
+    } else {
+      return parent.getXSSchema();
+    }
+  }
+  public boolean isTopLevelObject() { return parent == null  ||  parent instanceof XSSchema; }
+  public Locator getLocator() { return baseObject.getLocator(); }
+  protected XsObject getXsObject() { return baseObject; }
+  public void validate() throws SAXException {}
+
+
+  /**
+   * Utility method used to call validate() on every element within an 
+   * array.
+   *
+   * @param objects Array must not have any null elements.
+   */
+  protected final void validateAllIn( XSObject[] objects ) 
+    throws SAXException 
+  {
+    if ( objects == null ) {
+      return;
+    }
+
+    int numObjects = objects.length;
+
+    for ( int i=0; i<numObjects; i++ ) {
+      objects[i].validate();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSOpenAttrsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSOpenAttrsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSOpenAttrsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSOpenAttrs;
+import org.apache.ws.jaxme.xs.xml.XsTOpenAttrs;
+import org.xml.sax.Attributes;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSOpenAttrsImpl extends XSObjectImpl implements XSOpenAttrs {
+  private final Attributes openAttributes;
+
+  public XSOpenAttrsImpl(XSObject pParent, XsTOpenAttrs pXsOpenAttrs) {
+    super(pParent, pXsOpenAttrs);
+    openAttributes = pXsOpenAttrs.getOpenAttributes();
+  }
+
+  public Attributes getOpenAttributes() {
+    return openAttributes;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSParticleImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSParticleImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSParticleImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Default implementation of a particle.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSParticleImpl implements XSParticle {
+  private final XSGroup group;
+  private final XSAny wildcard;
+  private final XSElement element;
+  private int minOccurs = 1;
+  private int maxOccurs = 1;
+
+  public XSParticleImpl(XSGroup pGroup) throws SAXException {
+    if (pGroup == null) {
+      throw new NullPointerException("The particle group must not be null.");
+    }
+    group = pGroup;
+    element = null;
+    wildcard = null;
+  }
+
+  public XSParticleImpl(XSAny pWildcard) {
+    if (pWildcard == null) {
+      throw new NullPointerException("The particle wildcard must not be null.");
+    }
+    wildcard = pWildcard;
+    group = null;
+    element = null;
+  }
+
+  public XSParticleImpl(XSElement pElement) {
+    if (pElement == null) {
+      throw new NullPointerException("The particle element must not be null.");
+    }
+    element = pElement;
+    group = null;
+    wildcard = null;
+  }
+
+  public XSParticle.Type getType() {
+    if (group != null) {
+      return XSParticle.GROUP;
+    } else if (wildcard != null) {
+      return XSParticle.WILDCARD;
+    } else if (element != null) {
+      return XSParticle.ELEMENT;
+    } else {
+      throw new IllegalStateException("Neither of the particle group, wildcard, or element has been set.");
+    }
+  }
+
+  public boolean isGroup() {
+    return group != null;
+  }
+
+  public XSGroup getGroup() {
+    if (group == null) {
+      throw new IllegalStateException("This particle doesn't have the group type.");
+    }
+    return group;
+  }
+
+  public boolean isWildcard() {
+    return wildcard != null;
+  }
+
+  public XSAny getWildcard() {
+    if (wildcard == null) {
+      throw new IllegalStateException("This particle doesn't have the wildcard type.");
+    }
+    return wildcard;
+  }
+
+  public boolean isElement() {
+    return element != null;
+  }
+
+  public XSElement getElement() {
+    if (element == null) {
+      throw new IllegalStateException("This particle doesn't have the element type.");
+    }
+    return element;
+  }
+
+  public int getMinOccurs() {
+    return minOccurs;
+  }
+
+  public void setMinOccurs(int pMinOccurs) {
+    minOccurs = pMinOccurs;
+  }
+
+  public int getMaxOccurs() {
+    return maxOccurs;
+  }
+
+  public void setMaxOccurs(int pMaxOccurs) {
+    maxOccurs = pMaxOccurs;
+  }
+
+  public Locator getLocator() {
+    if (isWildcard()) {
+      return getWildcard().getLocator();
+    } else if (isElement()) {
+      return getElement().getLocator();
+    } else if (isGroup()) {
+      return getGroup().getLocator();
+    } else {
+      throw new IllegalStateException("Invalid particle, neither of element, wildcard, or model group.");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,463 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSAttributeGroup;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSKeyRef;
+import org.apache.ws.jaxme.xs.XSNotation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.types.*;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of an XML Schema, as defined by the
+ * {@link XSSchema} interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSSchemaImpl implements XSSchema {
+  private static final XSType[] BUILTIN_TYPES = new XSType[]{
+    XSAnySimpleType.getInstance(),
+    XSAnyURI.getInstance(),
+    XSBase64Binary.getInstance(),
+    XSBoolean.getInstance(),
+    XSByte.getInstance(),
+    XSDate.getInstance(),
+    XSDateTime.getInstance(),
+    XSDecimal.getInstance(),
+    XSDouble.getInstance(),
+    XSDuration.getInstance(),
+    XSEntities.getInstance(),
+    XSEntity.getInstance(),
+    XSFloat.getInstance(),
+    XSGDay.getInstance(),
+    XSGMonth.getInstance(),
+    XSGMonthDay.getInstance(),
+    XSGYear.getInstance(),
+    XSGYearMonth.getInstance(),
+    XSHexBinary.getInstance(),
+    XSID.getInstance(),
+    XSIDREF.getInstance(),
+    XSIDREFs.getInstance(),
+    XSInt.getInstance(),
+    XSInteger.getInstance(),
+    XSLanguage.getInstance(),
+    XSLong.getInstance(),
+    XSName.getInstance(),
+    XSNCName.getInstance(),
+    XSNegativeInteger.getInstance(),
+    XSNMToken.getInstance(),
+    XSNMTokens.getInstance(),
+    XSNonNegativeInteger.getInstance(),
+    XSNonPositiveInteger.getInstance(),
+    XSNormalizedString.getInstance(),
+    org.apache.ws.jaxme.xs.types.XSNotation.getInstance(),
+    XSPositiveInteger.getInstance(),
+    XSQName.getInstance(),
+    XSShort.getInstance(),
+    XSString.getInstance(),
+    XSTime.getInstance(),
+    XSToken.getInstance(),
+    XSUnsignedByte.getInstance(),
+    XSUnsignedInt.getInstance(),
+    XSUnsignedLong.getInstance(),
+    XSUnsignedShort.getInstance(),
+    XSAnyType.getInstance()
+  };
+
+  private final XSContext context;
+  private final XsESchema syntaxSchema;
+  private final List childs = new ArrayList(1);
+  private final Map types = new HashMap(1);
+  private final Map builtinTypes = new HashMap(1);
+  private final Map groups = new HashMap(1);
+  private final Map attributeGroups = new HashMap(1);
+  private final Map attributes = new HashMap(1);
+  private final Map elements = new HashMap(1);
+  private final Attributes openAttrs;
+
+  private final Map identityConstraintsMap = new HashMap(1);
+  private final Map keyRefsMap = new HashMap(1);
+
+  private final Map immutableIdentityConstraintsMap 
+    = Collections.unmodifiableMap( identityConstraintsMap );
+  private final Map immutableKeyRefsMap = Collections.unmodifiableMap( 
+    keyRefsMap 
+  );
+
+  private boolean isValidated;
+
+  /** <p>Creates a new logical schema by loading data,
+   * which represents the given syntactical schema
+   * <code>pSchema</code> and uses the given context
+   * <code>pContext</code> for acquiring additional
+   * information.</p>
+   */
+  public XSSchemaImpl(XSContext pContext, XsESchema pSchema) {
+    context = pContext;
+    syntaxSchema = pSchema;
+    for (int i = 0;  i < BUILTIN_TYPES.length;  i++) {
+      builtinTypes.put(BUILTIN_TYPES[i].getName(), BUILTIN_TYPES[i]);
+    }
+    openAttrs = pSchema.getOpenAttributes();
+  }
+
+  public XSContext getContext() { return context; }
+  public boolean isTopLevelObject() { return true; }
+  public XSObject getParentObject() { return null; }
+  public XSObjectFactory getXSObjectFactory() { return context.getXSObjectFactory(); }
+  public Locator getLocator() { return syntaxSchema.getLocator(); }
+  public XSSchema getXSSchema() { return this; }
+  protected XsESchema getXsESchema() { return syntaxSchema; }
+
+  /** <p>Adds a new child to the array returned by {@link #getChilds()}.</p>
+   */
+  protected void addChild(Object pChild) {
+    childs.add(pChild);
+  }
+
+  /** <p>Replaces the existing child <code>pOldChild</code> with
+   * the replacement object <code>pNewChild</code>. This method
+   * is used from within the various <code>redefine()</code> methods.</p>
+   */
+  protected void replace(Object pOldChild, Object pNewChild) {
+    for (ListIterator iter = childs.listIterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o.equals(pOldChild)) {
+        iter.set(pNewChild);
+        return;
+      }
+    }
+    throw new NoSuchElementException();
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XSAnnotation) {
+        result.add(o);
+      }
+    }
+    return (XSAnnotation[]) result.toArray(new XSAnnotation[result.size()]);
+  }
+
+  public XSType[] getTypes() {
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XSType) {
+        result.add(o);
+      }
+    }
+    return (XSType[]) result.toArray(new XSType[result.size()]);
+  }
+
+  public XSType[] getBuiltinTypes() {
+    return BUILTIN_TYPES;
+  }
+
+  public XSType getType(XsQName pName) {
+    XSType result = (XSType) types.get(pName);
+    if (result == null) {
+      result = (XSType) builtinTypes.get(pName);
+    }
+    return result;
+  }
+
+  public XSGroup[] getGroups() {
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XSGroup) {
+        result.add(o);
+      }
+    }
+    return (XSGroup[]) result.toArray(new XSGroup[result.size()]);
+  }
+
+  public XSGroup getGroup(XsQName pName) {
+    return (XSGroup) groups.get(pName);
+  }
+
+  public XSAttributeGroup[] getAttributeGroups() {
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XSAttributeGroup) {
+        result.add(o);
+      }
+    }
+    return (XSAttributeGroup[]) result.toArray(new XSAttributeGroup[result.size()]);
+  }
+
+  public XSAttributeGroup getAttributeGroup(XsQName pName) {
+    return (XSAttributeGroup) attributeGroups.get(pName);
+  }
+
+  public XSElement[] getElements() {
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XSElement) {
+        result.add(o);
+      }
+    }
+    return (XSElement[]) result.toArray(new XSElement[result.size()]);
+  }
+
+  public XSElement getElement(XsQName pName) {
+    return (XSElement) elements.get(pName);
+  }
+
+  public Map getIdentityConstraints() {
+    return immutableIdentityConstraintsMap;
+  }
+
+  public Map getKeyRefs() {
+    return immutableKeyRefsMap;
+  }
+
+  public void add( XSIdentityConstraint ic ) throws SAXException {
+    String name = ic.getName();
+
+    if ( name == null ) {
+      throw new LocSAXException(
+        "An identity constraint must have a 'name' attribute.", 
+        ic.getLocator()
+      );
+    } else if ( identityConstraintsMap.put( name, ic ) != null ) {
+      throw new LocSAXException(
+        "No two identity constraints may share the same name.", 
+        ic.getLocator()
+      );
+    }
+
+    identityConstraintsMap.put( name, ic );
+  }
+
+  public void add( XSKeyRef rf ) throws SAXException {
+    String name = rf.getName();
+
+    if ( name == null ) {
+      throw new LocSAXException(
+        "A key ref must have a 'name' attribute.", 
+        rf.getLocator()
+      );
+    } else if ( keyRefsMap.put( name, rf ) != null ) {
+      throw new LocSAXException(
+        "No two key refs may share the same name.", 
+        rf.getLocator()
+      );
+    }
+
+    keyRefsMap.put( name, rf );
+  }
+
+
+
+  public XSAttribute[] getAttributes() {
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XSAttribute) {
+        result.add(o);
+      }
+    }
+    return (XSAttribute[]) result.toArray(new XSAttribute[result.size()]);
+  }
+
+  public XSAttribute getAttribute(XsQName pQName) {
+    return (XSAttribute) attributes.get(pQName);
+  }
+
+  public void add(XSAnnotation pAnnotation) {
+    addChild(pAnnotation);
+  }
+
+  public void add(XSType pType) throws SAXException {
+    XsQName name = pType.getName();
+    if (name == null) {
+      throw new LocSAXException("A global type must have a 'name' attribute.", pType.getLocator());
+    }
+    if (types.containsKey(name)) {
+      throw new LocSAXException("A global type " + name + " is already defined.", pType.getLocator());
+    }
+    types.put(name, pType);
+    pType.setGlobal(true);
+    addChild(pType);
+  }
+
+  public void redefine(XSType pType) throws SAXException {
+    XsQName name = pType.getName();
+    if (name == null) {
+      throw new LocSAXException("A global type must have a 'name' attribute.", pType.getLocator());
+    }
+    Object oldType = types.get(name);
+    if (oldType == null) {
+      throw new LocSAXException("The global type " + name + " cannot be redefined, as it doesn't yet exist.",
+                                   pType.getLocator());
+    }
+    types.put(name, pType);
+    pType.setGlobal(true);
+    replace(oldType, pType);
+  }
+
+  public void add(XSGroup pGroup) throws SAXException {
+    XsQName name = pGroup.getName();
+    if (name == null) {
+      throw new LocSAXException("A global group must have a 'name' attribute.", pGroup.getLocator());
+    }
+    if (groups.containsKey(name)) {
+      throw new LocSAXException("A global group " + name + " is already defined.", pGroup.getLocator());
+    }
+    groups.put(name, pGroup);
+    addChild(pGroup);
+    pGroup.setGlobal(true);
+  }
+
+  public void redefine(XSGroup pGroup) throws SAXException {
+    XsQName name = pGroup.getName();
+    if (name == null) {
+      throw new LocSAXException("A global group must have a 'name' attribute.", pGroup.getLocator());
+    }
+    Object oldGroup = groups.get(name);
+    if (oldGroup == null) {
+      throw new LocSAXException("The global group " + name + " cannot be redefined, as it doesn't yet exist.",
+                                   pGroup.getLocator());
+    }
+    groups.put(name, pGroup);
+    replace(oldGroup, pGroup);
+  }
+
+  public void add(XSAttributeGroup pGroup) throws SAXException {
+    XsQName name = pGroup.getName();
+    if (name == null) {
+      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pGroup.getLocator());
+    }
+    if (attributeGroups.containsKey(name)) {
+      throw new LocSAXException("A global attribute group " + name + " is already defined.", pGroup.getLocator());
+    }
+    attributeGroups.put(name, pGroup);
+    addChild(pGroup);
+  }
+
+  public void redefine(XSAttributeGroup pGroup) throws SAXException {
+    XsQName name = pGroup.getName();
+    if (name == null) {
+      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pGroup.getLocator());
+    }
+    Object oldGroup = attributeGroups.get(name);
+    if (!attributeGroups.containsKey(name)) {
+      throw new LocSAXException("The global attribute group " + name + " cannot be redefined, as it doesn't yet exist.",
+                                   pGroup.getLocator());
+    }
+    attributeGroups.put(name, pGroup);
+    replace(oldGroup, pGroup);
+  }
+
+  public void add(XSAttribute pAttribute) throws SAXException {
+    XsQName name = pAttribute.getName();
+    if (name == null) {
+      throw new LocSAXException("A global attribute must have a 'name' attribute.", pAttribute.getLocator());
+    }
+    if (attributes.containsKey(name)) {
+      throw new LocSAXException("A global attribute " + name + " is already defined.", pAttribute.getLocator());
+    }
+    attributes.put(name, pAttribute);
+    addChild(pAttribute);
+  }
+
+  public void add(XSElement pElement) throws SAXException {
+    XsQName name = pElement.getName();
+    if (name == null) {
+      throw new LocSAXException("A global element must have a 'name' attribute.", pElement.getLocator());
+    }
+    if (elements.containsKey(name)) {
+      throw new LocSAXException("A global element " + name + " is already defined.", pElement.getLocator());
+    }
+    elements.put(name, pElement);
+    addChild(pElement);
+  }
+
+  public void add(XSNotation pNotation) {
+    addChild(pNotation);
+  }
+
+  public Object[] getChilds() {
+    return childs.toArray();
+  }
+
+  protected void validate(Object pChild) throws SAXException {
+    if (pChild instanceof XSObject) {
+      ((XSObject) pChild).validate();
+    } else {
+      throw new IllegalStateException("Unable to validate the child " + pChild +
+                                       ", perhaps you should overwrite the method " +
+                                       getClass().getName() + ".validate(Object).");
+    }
+  }
+
+  protected boolean isValidated() {
+    return isValidated;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    } else {
+      isValidated = true;
+    }
+
+    Object[] myChilds = getChilds();
+    for (int i = 0;  i < myChilds.length;  i++) {
+      validate(myChilds[i]);
+    }
+  }
+
+    public Attributes getOpenAttributes() {
+    	return openAttrs;
+    }
+
+    public XsAnyURI getTargetNamespace() {
+		return syntaxSchema.getTargetNamespace();
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleContentTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleContentTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleContentTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSSimpleContentTypeImpl implements XSSimpleContentType {
+  private final XSType simpleType, complexType;
+  private final XsObject baseType;
+  
+  protected XSSimpleContentTypeImpl(XSType pComplexType, XSType pSimpleType,
+                                     XsObject pBaseType) {
+    if (!pSimpleType.isSimple()) {
+      throw new IllegalStateException("Embedded content type must be simple.");
+    }
+    simpleType = pSimpleType;
+    if (pComplexType.isSimple()) {
+      throw new IllegalStateException("Embedded content type must be simple.");
+    }
+    complexType = pComplexType;
+    baseType = pBaseType;
+  }
+
+  protected XSType getComplexType() { return complexType; }
+  protected XsObject getBaseType() { return baseType; }
+  public XSType getType() { return simpleType; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XSSimpleTypeImpl implements XSSimpleType {
+  public boolean isAtomic() { return false; }
+  public XSAtomicType getAtomicType() { throw new IllegalStateException("This type is not atomic."); }
+  public boolean isList() { return false; }
+  public XSListType getListType() { throw new IllegalStateException("This type is no list."); }
+  public boolean isUnion() { return false; }
+  public XSUnionType getUnionType() { throw new IllegalStateException("This type is no union."); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeRestrictionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeRestrictionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSSimpleTypeRestrictionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
+import org.apache.ws.jaxme.xs.xml.XsEPattern;
+import org.apache.ws.jaxme.xs.xml.XsGSimpleRestrictionModel;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XSSimpleTypeRestrictionImpl extends XSSimpleTypeImpl {
+  private final XSSimpleType baseType;
+  private final XSType restrictedType;
+  private final XsGSimpleRestrictionModel restriction;
+  private final XSEnumeration[] enumerations;
+
+  protected XSSimpleTypeRestrictionImpl(XSType pParent,
+                                         XSType pRestrictedType,
+                                         XsGSimpleRestrictionModel pRestriction)
+      throws SAXException {
+    restrictedType = pRestrictedType;
+    baseType = pRestrictedType.getSimpleType();
+    restriction = pRestriction;
+
+    XsEEnumeration[] enums = restriction.getEnumerations();
+    if (enums.length == 0) {
+      enumerations = getBaseType().getEnumerations();
+    } else {
+      enumerations = new XSEnumeration[enums.length];
+      for (int i = 0;  i < enums.length;  i++) {
+        enumerations[i] = pParent.getXSSchema().getXSObjectFactory().newXSEnumeration(pParent, enums[i]);
+      }
+    }
+  }
+
+  protected XSSimpleType getBaseType() {
+    return baseType;
+  }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return restrictedType; }
+
+  protected XsGSimpleRestrictionModel getRestriction() {
+    return restriction;
+  }
+
+  public String[][] getPattern() {
+    XsEPattern[] patterns = restriction.getPatterns();
+    String[][] base = getBaseType().getPattern();
+    if (patterns.length == 0) {
+      return base;
+    } else {
+      String[][] result;
+      if (base == null) {
+          result = new String[1][];
+      } else {
+	      result = new String[base.length+1][];
+	      for (int i = 0;  i < base.length;  i++) {
+	        result[i+1] = base[i];
+	      }
+      }
+      String[] thisStepsPatterns = new String[patterns.length];
+      for (int i = 0;  i < patterns.length;  i++) {
+        thisStepsPatterns[i] = patterns[i].getValue();
+      }
+      result[0] = thisStepsPatterns;
+      return result;
+    }
+  }
+
+  public XSEnumeration[] getEnumerations() {
+    return enumerations;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,763 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSModelGroup;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.types.XSAnyType;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @author <a href="mailto:iasandcb at tmax.co.kr">Ias</a>
+ */
+public class XSTypeImpl extends XSOpenAttrsImpl implements XSType {
+  public abstract class XSComplexTypeImpl implements XSComplexType {
+    protected final XSType owner;
+    private final XsTComplexType myComplexType;
+    protected XSType extendedType, restrictedType;
+
+    public XSComplexTypeImpl(XSType pOwner, XsTComplexType pType) {
+      owner = pOwner;
+      myComplexType = pType;
+    }
+
+    protected XsTComplexType getXsTComplexType() { return myComplexType; }
+    protected XSType getOwner() { return owner; }
+
+    public boolean isSequence() { return false; }
+    public boolean isChoice() { return false; }
+    public boolean isAll() { return false; }
+    public boolean hasSimpleContent() { return false; }
+    public XSSimpleContentType getSimpleContent() {
+      throw new IllegalStateException("This complex type doesn't have simple content.");
+    }
+    public boolean hasComplexContent() { return false; }
+    public boolean isEmpty() { return XsComplexContentType.EMPTY.equals(getComplexContentType()); }
+    public boolean isElementOnly() { return XsComplexContentType.ELEMENT_ONLY.equals(getComplexContentType()); }
+    public boolean isMixed() { return XsComplexContentType.MIXED.equals(getComplexContentType()); }
+
+    public void validate() throws SAXException {
+    }
+
+
+    public boolean isExtension() { return extendedType != null; }
+    public XSType getExtendedType() {
+      if (extendedType == null) {
+        throw new IllegalStateException("This type is no extension.");
+      }
+      return extendedType;
+    }
+
+    public boolean isRestriction() { return restrictedType != null; }
+    public XSType getRestrictedType() {
+      if (restrictedType == null) {
+        throw new IllegalStateException("This type is no restriction.");
+      }
+      return restrictedType;
+    }
+  }
+
+  public class XSSimpleContentImpl extends XSComplexTypeImpl {
+    private final XsESimpleContent simpleContent;
+    private final XSSimpleContentType simpleContentType;
+    private final XSAttributable[] attributes;
+
+    public boolean isElementOnly() { return false; }
+	public boolean isEmpty() { return false; }
+	public boolean isMixed() { return false; }
+
+	public XSSimpleContentImpl(XSType pOwner, XsTComplexType pType, XsESimpleContent pSimpleContent)
+        throws SAXException {
+      super(pOwner, pType);
+      simpleContent = pSimpleContent;
+      XsTSimpleExtensionType extension = simpleContent.getExtension();
+      if (extension == null) {
+        XsTSimpleRestrictionType restriction = simpleContent.getRestriction();
+        if (restriction == null) {
+          throw new LocSAXException("Invalid 'simpleContent', neither of the 'extension' or 'restriction' child elements are present.",
+                                       simpleContent.getLocator());
+        }
+        XsQName restrictedTypesName = restriction.getBase();
+        if (restrictedTypesName == null) {
+          throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute.", restriction.getLocator());
+        }
+        restrictedType = getXSSchema().getType(restrictedTypesName);
+        if (restrictedType == null) {
+          throw new LocSAXException("Invalid 'restriction': The base type " + restrictedTypesName + " is unknown.",
+                                     restriction.getLocator());
+        }
+        restrictedType.validate();
+        extendedType = null;
+        XSObjectFactory factory = pOwner.getXSSchema().getXSObjectFactory();
+        XSType contentType = factory.newXSType(pOwner, restriction);
+        simpleContentType = factory.newXSSimpleContentType(pOwner, contentType, restriction);
+        attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
+      } else {
+        XsQName extendedTypesName = extension.getBase();
+        if (extendedTypesName == null) {
+          throw new LocSAXException("Invalid 'extension': Missing 'base' attribute.",
+                                       extension.getLocator());
+        }
+        extendedType = getXSSchema().getType(extendedTypesName);
+        if (extendedType == null) {
+          throw new LocSAXException("Invalid 'extension': Unknown 'base' type " + extendedTypesName,
+                                       extension.getLocator());
+        }
+        extendedType.validate();
+        restrictedType = null;
+        XSAttributable[] inheritedAttributes;
+        if (extendedType.isSimple()) {
+          simpleContentType = getOwner().getXSSchema().getXSObjectFactory().newXSSimpleContentType(pOwner,
+                                                                                     extendedType, extension);
+          inheritedAttributes = new XSAttributable[0];
+        } else {
+          XSComplexType myComplexType = extendedType.getComplexType();
+          if (!myComplexType.hasSimpleContent()) {
+            throw new LocSAXException("Invalid 'extension': The base type " + extendedTypesName +
+                                         " is neither a simple type nor a complex type with simple content.",
+                                         extension.getLocator());
+          }
+          simpleContentType = myComplexType.getSimpleContent();
+          inheritedAttributes = myComplexType.getAttributes();
+        }
+        XSAttributable[] myAttributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, extension);
+        attributes = new XSAttributable[inheritedAttributes.length + myAttributes.length];
+        System.arraycopy(inheritedAttributes, 0, attributes, 0, inheritedAttributes.length);
+        System.arraycopy(myAttributes, 0, attributes, inheritedAttributes.length, myAttributes.length);
+      }
+    }
+
+    public boolean hasSimpleContent() { return true; }
+    public XSSimpleContentType getSimpleContent() { return simpleContentType; }
+    public XSAttributable[] getAttributes() { return attributes; }
+    public XSParticle getParticle() {
+      throw new IllegalStateException("This complex type doesn't have a model group particle.");
+    }
+    public XsComplexContentType getComplexContentType() {
+        throw new IllegalStateException("This complex type (" + this.getClass().getName() +
+                                         ") doesn't have complex content.");
+    }
+  }
+
+  public class XSComplexContentImpl extends XSComplexTypeImpl {
+    private final XsEComplexContent complexContent;
+    private final XSParticle complexContentParticle;
+    private final XsComplexContentType complexContentType;
+    private final XSAttributable[] attributes;
+
+    protected XsEComplexContent getComplexContent() {
+      return complexContent;
+    }
+
+    protected XSGroup getGroupByParticle(XsTTypeDefParticle pParticle) throws SAXException {
+      XSGroup result;
+      XSType myOwner = getOwner();
+      XSObjectFactory factory = myOwner.getXSSchema().getXSObjectFactory();
+      if (pParticle == null) {
+        return null;
+      } else if (pParticle instanceof XsEChoice) {
+        XsEChoice choice = (XsEChoice) pParticle;
+        result = factory.newXSGroup(myOwner, choice);
+      } else if (pParticle instanceof XsESequence) {
+        XsESequence sequence = (XsESequence) pParticle;
+        result = factory.newXSGroup(myOwner, sequence);
+      } else if (pParticle instanceof XsTAll) {
+        XsTAll all = (XsTAll) pParticle;
+        result = factory.newXSGroup(myOwner, all);
+      } else if (pParticle instanceof XsTGroupRef) {
+        XsTGroupRef groupRef = (XsTGroupRef) pParticle;
+        result = factory.newXSGroup(myOwner, groupRef);
+      } else {
+        throw new IllegalStateException("Unknown TypeDefParticle type: " + pParticle.getClass().getName());
+      }
+      result.validate();
+      return result;
+    }
+
+    protected XsComplexContentType getContentTypeByParticle(XsTTypeDefParticle pParticle, XSGroup pGroup) 
+        throws SAXException {
+      if (pParticle == null) {
+        return XsComplexContentType.EMPTY;
+      } else if (pParticle instanceof XsEChoice) {
+        if (pGroup.getParticles().length == 0) {
+          XsEChoice choice = (XsEChoice) pParticle;
+          if (choice.getMinOccurs() == 0) {
+            return XsComplexContentType.EMPTY;
+          } else {
+            throw new LocSAXException("Invalid choice: Neither child elements, nor 'minOccurs'=0", choice.getLocator());
+          }
+        } else {
+        }
+      } else if (pParticle instanceof XsESequence) {
+        if (pGroup.getParticles().length == 0) {
+          return XsComplexContentType.EMPTY;
+        }
+      } else if (pParticle instanceof XsTAll) {
+        if (pGroup.getParticles().length == 0) {
+          return XsComplexContentType.EMPTY;
+        }
+      } else if (pParticle instanceof XsTGroupRef) {
+      } else {
+        throw new IllegalStateException("Unknown TypeDefParticle type: " + pParticle.getClass().getName());
+      }
+      boolean isMixed;
+      if (complexContent.isMixed() == null) {
+        isMixed = ((XsTComplexType) getXsObject()).isMixed();
+      } else {
+        isMixed = complexContent.isMixed().booleanValue();
+      }
+      return isMixed ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY;
+    }
+
+    private class ExtensionGroup implements XSGroup {
+      private final XSObject parent;
+      private final XSParticle[] particles;
+      private ExtensionGroup(XSObject pParent, XSParticle[] pParticles) {
+        parent = pParent;
+        particles = pParticles;
+      }
+      public boolean isTopLevelObject() { return false; }
+      public boolean isGlobal() { return false; }
+      public XsQName getName() { return null; }
+      public XSSchema getXSSchema() { return XSTypeImpl.this.getXSSchema(); }
+      public Locator getLocator() { return getComplexContent().getLocator(); }
+      public XSObjectFactory getXSObjectFactory() { return getXSObjectFactory(); }
+      public void validate() throws SAXException {}
+      public XSModelGroup.Compositor getCompositor() { return XSModelGroup.SEQUENCE; }
+      public boolean isSequence() { return true; }
+      public boolean isChoice() { return false; }
+      public boolean isAll() { return false; }
+      public XSParticle[] getParticles() { return particles; }
+      public XSAnnotation[] getAnnotations() { return new XSAnnotation[0]; }
+      public void setGlobal(boolean pGlobal) {
+        if (pGlobal) {
+          throw new IllegalStateException("An extensions model group cannot be made global.");
+        }
+      }
+      public XSObject getParentObject() { return parent; }
+      public Attributes getOpenAttributes() { return null; }
+    }
+
+    public XSComplexContentImpl(XSType pOwner, XsTComplexType pType, XsEComplexContent pComplexContent)
+        throws SAXException {
+      super(pOwner, pType);
+      complexContent = pComplexContent;
+      XsTExtensionType extension = complexContent.getExtension();
+      if (extension == null) {
+        XsTComplexRestrictionType restriction = complexContent.getRestriction();
+        if (restriction == null) {
+          // TODO: Restriction of the ur-type
+          throw new LocSAXException("Neither of extension or restriction, aka restriction of the ur-type: Not implemented",
+                                       complexContent.getLocator());
+        }
+        XsQName base = restriction.getBase();
+        if (base == null) {
+          throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute", getLocator());
+        }
+        XSType type = getXSSchema().getType(base);
+        if (type == null) {
+          throw new LocSAXException("Invalid 'restriction': Unknown base type " + base, getLocator());
+        }
+        if (type.isSimple()) {
+          throw new LocSAXException("Invalid 'restriction': The base type " + getName() + " is simple.", getLocator());
+        }
+        XsTTypeDefParticle particle = restriction.getTypeDefParticle();
+
+        XSGroup group = getGroupByParticle(particle);
+        if (group == null) {
+          // TODO: Restriction of the ur-type
+          complexContentParticle = null;
+        } else {
+          complexContentParticle = new XSParticleImpl(group);
+        }
+        complexContentType = getContentTypeByParticle(particle, group);
+        attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
+        restrictedType = type;
+      } else {
+        XsQName base = extension.getBase();
+        if (base == null) {
+          throw new LocSAXException("Invalid 'extension': Missing 'base' attribute", getLocator());
+        }
+        XSType type = getXSSchema().getType(base);
+        if (type == null) {
+          throw new LocSAXException("Invalid 'extension': Unknown base type " + base, getLocator());
+        }
+        if (type.isSimple()) {
+          throw new LocSAXException("Invalid 'extension': The base type " + base + " is simple.", getLocator());
+        }
+        XSComplexType extendedComplexType = type.getComplexType();
+        if (extendedComplexType.hasSimpleContent()) {
+          throw new LocSAXException("Invalid 'extension': The base type " + base + " has simple content.",
+                                       getLocator());
+        }
+        XsTTypeDefParticle particle = extension.getTypeDefParticle();
+        XSGroup group = getGroupByParticle(particle);
+        XsComplexContentType groupType = getContentTypeByParticle(particle, group);
+
+        if (XsComplexContentType.EMPTY.equals(groupType)) {
+        	if (type == XSAnyType.getInstance()) {
+        		complexContentType = null;
+        		complexContentParticle = null;
+        	} else {
+        		complexContentType = extendedComplexType.getComplexContentType();
+        		complexContentParticle = extendedComplexType.getParticle();
+        	}
+        } else if (extendedComplexType.isEmpty()) {
+          complexContentType = groupType;
+          complexContentParticle = new XSParticleImpl(group);
+        } else {
+          XSGroup sequenceGroup = new ExtensionGroup(pOwner, new XSParticle[]{extendedComplexType.getParticle(), new XSParticleImpl(group)});
+          complexContentParticle = new XSParticleImpl(sequenceGroup);
+          complexContentType = groupType;
+        }
+
+        XSAttributable[] inheritedAttributes = extendedComplexType.getAttributes();
+        XSAttributable[] myAttributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, extension);
+        attributes = new XSAttributable[inheritedAttributes.length + myAttributes.length];
+        System.arraycopy(inheritedAttributes, 0, attributes, 0, inheritedAttributes.length);
+        System.arraycopy(myAttributes, 0, attributes, inheritedAttributes.length, myAttributes.length);
+        extendedType = type;
+      }
+    }
+
+    public boolean hasComplexContent() { return true; }
+
+    public XsComplexContentType getComplexContentType() {
+      return complexContentType;
+    }
+
+    public XSParticle getParticle() {
+      return complexContentParticle;
+    }
+
+    public XSAttributable[] getAttributes() { return attributes; }
+  }
+
+
+  public abstract class XSBasicComplexTypeImpl extends XSComplexTypeImpl {
+    private final XSAttributable[] attributes;
+    private XSParticle particle;
+    private XsComplexContentType contentType;
+
+    public XSBasicComplexTypeImpl(XSType pOwner, XsTComplexType pType) throws SAXException {
+      super(pOwner, pType);
+      attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, pType);
+    }
+
+    public void setParticle(XsComplexContentType pType, XSParticle pParticle) {
+      contentType = pType;
+      particle = pParticle;
+    }
+    public XSParticle getParticle() { return particle; }
+    public XSAttributable[] getAttributes() { return attributes; }
+    public XsComplexContentType getComplexContentType() { return contentType; }
+  }
+
+  public class XSSequenceComplexTypeImpl extends XSBasicComplexTypeImpl {
+    private final XsESequence sequence;
+
+    public XSSequenceComplexTypeImpl(XSType pOwner, XsTComplexType pType) throws SAXException {
+      super(pOwner, pType);
+      sequence = null;
+      setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.EMPTY, null);
+    }
+    public XSSequenceComplexTypeImpl(XSType pOwner, XsTComplexType pType, XsESequence pSequence) throws SAXException {
+      super(pOwner, pType);
+      sequence = pSequence;
+      XSGroup group = pOwner.getXSSchema().getXSObjectFactory().newXSGroup(pOwner, sequence);
+      group.validate();
+      XSParticleImpl particle = new XSParticleImpl(group);
+      particle.setMaxOccurs(pSequence.getMaxOccurs());
+      particle.setMinOccurs(pSequence.getMinOccurs());
+      if (group.getParticles().length == 0) {
+        setParticle(XsComplexContentType.EMPTY, particle);
+      } else {
+        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
+      }
+    }
+
+    public boolean isSequence() { return true; }
+  }
+
+  public class XSChoiceComplexTypeImpl extends XSBasicComplexTypeImpl {
+    private final XsEChoice choice;
+
+    public XSChoiceComplexTypeImpl(XSType pOwner, XsTComplexType pType, XsEChoice pChoice) throws SAXException {
+      super(pOwner, pType);
+      choice = pChoice;
+      XSGroup group = pOwner.getXSSchema().getXSObjectFactory().newXSGroup(pOwner, choice);
+      group.validate();
+      XSParticleImpl particle = new XSParticleImpl(group);
+      particle.setMaxOccurs(pChoice.getMaxOccurs());
+      particle.setMinOccurs(pChoice.getMinOccurs());      
+      if (group.getParticles().length == 0) {
+        throw new LocSAXException("The complex type must not have an empty element group, as it is a choice.",
+                                     choice.getLocator());
+      } else {
+        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
+      }
+    }
+
+    public boolean isChoice() { return true; }
+  }
+
+  public class XSAllComplexTypeImpl extends XSBasicComplexTypeImpl {
+    private final XsTAll all;
+
+    public XSAllComplexTypeImpl(XSType pOwner, XsTComplexType pType, XsTAll pAll) throws SAXException {
+      super(pOwner, pType);
+      all = pAll;
+      XSGroup group = pOwner.getXSSchema().getXSObjectFactory().newXSGroup(pOwner, all);
+      group.validate();
+      XSParticleImpl particle = new XSParticleImpl(group);
+      particle.setMaxOccurs(pAll.getMaxOccurs());
+      particle.setMinOccurs(pAll.getMinOccurs());
+      if (group.getParticles().length == 0) {
+        setParticle(XsComplexContentType.EMPTY, particle);
+      } else {
+        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
+      }
+    }
+
+    public boolean isAll() { return true; }
+  }
+
+  public class XSGroupComplexTypeImpl extends XSBasicComplexTypeImpl {
+    private final XSGroup group;
+
+    public XSGroupComplexTypeImpl(XSType pOwner, XsTComplexType pType, XSGroup pGroup,
+    							  XsTGroupRef pRef) throws SAXException {
+      super(pOwner, pType);
+      group = pGroup;
+      XSParticleImpl particle = new XSParticleImpl(group);
+      particle.setMinOccurs(pRef.getMinOccurs());
+      particle.setMaxOccurs(pRef.getMaxOccurs());
+      if (group.getParticles().length == 0) {
+        setParticle(XsComplexContentType.EMPTY, particle);
+      } else {
+        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
+      }
+    }
+
+    public boolean isAll() { return group.isAll(); }
+    public boolean isChoice() { return group.isChoice(); }
+    public boolean isSequence() { return group.isSequence(); }
+  }
+
+  private final boolean isSimple;
+  private final XsQName name;
+  private boolean isGlobal;
+  private XSSimpleType simpleType;
+  private XSComplexType complexType;
+  private boolean isValidated;
+  private final XsEAnnotation xsAnnotation;
+  private XSAnnotation[] annotations;
+
+  protected boolean isValidated() { return isValidated; }
+
+  protected XSTypeImpl(XSObject pParent, XsETopLevelSimpleType pSimpleType)
+       throws SAXException {
+    super(pParent, pSimpleType);
+    isSimple = true;
+    XsNCName myName = pSimpleType.getName();
+    if (myName == null) {
+      throw new LocSAXException("Invalid simple type: Missing 'name' attribute.",
+                                   pSimpleType.getLocator());
+    }
+    XsESchema schema = pSimpleType.getXsESchema();
+    this.name = new XsQName(schema.getTargetNamespace(), myName.toString(), schema.getTargetNamespacePrefix());
+    xsAnnotation = pSimpleType.getAnnotation();
+  }
+
+  protected XSTypeImpl(XSObject pParent, XsTLocalSimpleType pSimpleType) {
+    super(pParent, pSimpleType);
+    isSimple = true;
+    name = null;
+    xsAnnotation = pSimpleType == null ? null : pSimpleType.getAnnotation();
+  }
+
+  protected XSTypeImpl(XSObject pParent, XsTComplexType pComplexType)
+      throws SAXException {
+    super(pParent, pComplexType);
+    isSimple = false;
+    XsNCName myName = pComplexType.getName();
+    if (myName == null) {
+      throw new LocSAXException("Invalid complex type: Missing 'name' attribute.",
+                                   pComplexType.getLocator());
+    }
+    XsESchema schema = pComplexType.getXsESchema();
+    this.name = new XsQName(schema.getTargetNamespace(), myName.toString(), schema.getTargetNamespacePrefix());
+    xsAnnotation = pComplexType.getAnnotation();
+  }
+
+  protected XSTypeImpl(XSObject pParent, XsTLocalComplexType pComplexType) {
+    super(pParent, pComplexType);
+    isSimple = false;
+    name = null;
+    xsAnnotation = pComplexType.getAnnotation();
+  }
+
+  protected XSTypeImpl(XSObject pParent, XsTSimpleRestrictionType pRestriction)
+      throws SAXException {
+    super(pParent, pRestriction);
+    XsQName myName = pRestriction.getBase();
+    if (myName == null) {
+      throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute.",
+                                   pRestriction.getLocator());
+    }
+    XSType type = getXSSchema().getType(myName);
+    if (type == null) {
+      throw new LocSAXException("Invalid 'restriction': Unknown 'base' type " + myName,
+                                   pRestriction.getLocator());
+    }
+    type.validate();
+    if (type.isSimple()) {
+      throw new LocSAXException("The 'base' type " + myName + " of 'simpleContent/restriction' is simple." +
+                                   " It ought to be a complex type with simple content: ",
+                                   pRestriction.getLocator());
+    }
+    XSComplexType myComplexType = type.getComplexType();
+    if (!myComplexType.hasSimpleContent()) {
+      throw new LocSAXException("The 'base' type " + myName + " of 'simpleContent/restriction' is complex," +
+                                   " but doesn't have simple content: ", pRestriction.getLocator());
+    }
+    XSObjectFactory factory = pParent.getXSSchema().getXSObjectFactory();
+    if (myComplexType.isExtension()) {
+      XSType extendedType = myComplexType.getSimpleContent().getType();
+      extendedType.validate();
+      XSSimpleType extendedSimpleType = extendedType.getSimpleType();
+	
+      XSSimpleType mySimpleType;
+      if (extendedSimpleType.isAtomic()) {
+      	mySimpleType = factory.newXSAtomicType(this, extendedType, pRestriction);
+      } else if (extendedSimpleType.isList()) {
+      	mySimpleType = factory.newXSListType(this, extendedType, pRestriction);
+      } else if (extendedSimpleType.isUnion()) {
+      	mySimpleType = factory.newXSUnionType(this, extendedType, pRestriction);
+      } else {
+      	throw new LocSAXException("Unknown restriction type: " + extendedType, 
+      			                  pRestriction.getLocator());
+      }
+
+      simpleType = mySimpleType;
+      //was: setSimpleType( extendedType.getSimpleType() );
+    } else {
+      XsTLocalSimpleType localSimpleType = pRestriction.getSimpleType();
+      XSType restrictedType;
+      if (localSimpleType != null) {
+        restrictedType = factory.newXSType(this, localSimpleType);
+      } else {
+        restrictedType = myComplexType.getSimpleContent().getType();
+      }
+      restrictedType.validate();
+      XSSimpleType restrictedSimpleType = restrictedType.getSimpleType();
+      if (restrictedSimpleType.isAtomic()) {
+        simpleType = factory.newXSAtomicType(this, restrictedType, pRestriction);
+      } else if (restrictedSimpleType.isList()) {
+        simpleType = factory.newXSListType(this, restrictedType, pRestriction);
+      } else if (restrictedSimpleType.isUnion()) {
+        simpleType = factory.newXSUnionType(this, restrictedType, pRestriction);
+      }
+    }
+    this.name = null;
+    isSimple = true;
+    xsAnnotation = pRestriction.getAnnotation();
+  }
+
+  public XsQName getName() {
+    return name;
+  }
+
+  public boolean isSimple() {
+    return isSimple;
+  }
+
+  public boolean isGlobal() {
+    return isGlobal;
+  }
+
+  public void setGlobal(boolean pGlobal) {
+    isGlobal = pGlobal;
+  }
+
+  public XSAnnotation[] getAnnotations() {
+    return annotations;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    } else {
+      isValidated = true;
+    }
+
+    if (xsAnnotation == null) {
+      annotations = new XSAnnotation[0];
+    } else {
+      XSAnnotation result = getXSSchema().getXSObjectFactory().newXSAnnotation(this, xsAnnotation);
+      result.validate();
+      annotations = new XSAnnotation[]{result};
+    }
+
+    if (isSimple()) {
+      XSSimpleType mySimpleType;
+      Object baseObject = getXsObject();
+      if (baseObject instanceof XsTSimpleType) {
+      	XsTSimpleType myXsTSimpleType = (XsTSimpleType) baseObject;
+      	XsEList list = myXsTSimpleType.getList();
+      	if (list == null) {
+      		XsEUnion union = myXsTSimpleType.getUnion();
+      		if (union == null) {
+      			XsERestriction restriction = myXsTSimpleType.getRestriction();
+      			if (restriction == null) {
+      				throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
+      						myXsTSimpleType.getLocator());
+      			}
+      			XsQName myName = restriction.getBase();
+      			XSType restrictedType;          
+      			if (myName == null) {
+      				XsTLocalSimpleType baseType = restriction.getSimpleType();
+      				if (baseType == null) {
+      					throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
+      							restriction.getLocator());
+      				} else {
+      					restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
+      				}
+      			} else {
+      				restrictedType = getXSSchema().getType(myName);
+      				if (restrictedType == null) {
+      					throw new LocSAXException("Unknown base type: " + myName,
+      							restriction.getLocator());
+      				}
+      			}
+      			restrictedType.validate();
+      			if (!restrictedType.isSimple()) {
+      				throw new LocSAXException("The restricted type " + myName + " is complex.",
+      						restriction.getLocator());
+      			}
+      			XSSimpleType baseType = restrictedType.getSimpleType();
+      			if (baseType.isAtomic()) {
+      				mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
+      			} else if (baseType.isList()) {
+      				mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
+      			} else if (baseType.isUnion()) {
+      				mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, restrictedType, restriction);
+      			} else {
+      				throw new LocSAXException("Unknown restriction type: " + baseType, restriction.getLocator());
+      			}
+      		} else {
+      			mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, union);
+      		}
+      	} else {
+      		mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, list);
+      	}
+      }
+      else {
+      	mySimpleType = getSimpleType();
+      }
+      
+      this.simpleType = mySimpleType;
+    } else {
+      XSComplexTypeImpl myComplexType;
+      XsTComplexType myXsTComplexType = (XsTComplexType) getXsObject();
+      XsESimpleContent simpleContent = myXsTComplexType.getSimpleContent();
+      if (simpleContent == null) {
+        XsEComplexContent complexContent = myXsTComplexType.getComplexContent();
+        if (complexContent == null) {
+          XsTTypeDefParticle particle = myXsTComplexType.getTypeDefParticle();
+          if (particle == null) {
+            myComplexType = new XSSequenceComplexTypeImpl(this, myXsTComplexType);
+          } else if (particle instanceof XsESequence) {
+            myComplexType = new XSSequenceComplexTypeImpl(this, myXsTComplexType, (XsESequence) particle);
+          } else if (particle instanceof XsEChoice) {
+            myComplexType = new XSChoiceComplexTypeImpl(this, myXsTComplexType, (XsEChoice) particle);
+          } else if (particle instanceof XsTAll) {
+            myComplexType = new XSAllComplexTypeImpl(this, myXsTComplexType, (XsTAll) particle);
+          } else if (particle instanceof XsTGroupRef) {
+            XsTGroupRef groupRef = (XsTGroupRef) particle;
+            XsQName myName = groupRef.getRef();
+            if (myName == null) {
+              throw new LocSAXException("Missing 'ref' attribute", groupRef.getLocator());
+            }
+            XSGroup group = getXSSchema().getGroup(myName);
+            if (group == null) {
+              throw new LocSAXException("Unknown group: " + myName, getLocator());
+            }
+            group.validate();
+            myComplexType = new XSGroupComplexTypeImpl(this, myXsTComplexType, group, groupRef);
+          } else {
+            throw new IllegalStateException("Invalid particle: " + particle.getClass().getName());
+          }
+        } else {
+          XSComplexContentImpl complexContentImpl = new XSComplexContentImpl(this, myXsTComplexType, complexContent);
+          myComplexType = complexContentImpl;
+        }
+      } else {
+        XSSimpleContentImpl simpleContentImpl = new XSSimpleContentImpl(this, myXsTComplexType, simpleContent);
+        myComplexType = simpleContentImpl;
+      }
+      this.complexType = myComplexType;
+      myComplexType.validate();
+    }
+  }
+
+  public XSSimpleType getSimpleType() throws SAXException {
+    validate();
+    XSSimpleType result = simpleType;
+    if (result == null) {
+      throw new IllegalStateException("This is a complex type.");
+    }
+    return result;
+  }
+
+  public XSComplexType getComplexType() throws SAXException {
+    validate();
+    XSComplexType result = complexType;
+    if (result == null) {
+      if (getName() == null) {
+        throw new IllegalStateException("This is a simple type.");
+      } else {
+        throw new IllegalStateException("The type " + getName() + " is simple.");
+      }
+    }
+    return result;
+  }
+
+  public boolean isBuiltin() {
+	return false;
+  }
+
+  public XsSchemaHeader getSchemaHeader() {
+  	return getXsObject().getXsESchema();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEUnion;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTLocalSimpleType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUnionTypeImpl extends XSSimpleTypeImpl implements XSUnionType {
+  private static final String[][] ZERO_PATTERNS = new String[0][];
+  private static final XSEnumeration[] ZERO_ENUMERATIONS = new XSEnumeration[0];
+  private final List memberTypes = new ArrayList();
+
+  public XSUnionTypeImpl(XSType pOwner,
+                          XsEUnion pBaseUnion) throws SAXException {
+    XsQName[] names = pBaseUnion.getMemberTypes();
+    if (names != null) {
+      for (int i = 0;  i < names.length;  i++) {
+        XsQName name = names[i];
+        XSType type = pOwner.getXSSchema().getType(name);
+        if (type == null) {
+          throw new LocSAXException("Unknown member type: " + name, pBaseUnion.getLocator());
+        }
+        type.validate();
+        if (!type.isSimple()) {
+          throw new LocSAXException("The member type " + name + " is complex.",
+                                       pBaseUnion.getLocator());
+        }
+        memberTypes.add(type);
+      }
+    }
+    XsTLocalSimpleType[] simpleTypes = pBaseUnion.getSimpleTypes();
+    if (simpleTypes != null) {
+      for (int i = 0;  i < simpleTypes.length;  i++) {
+        XsTLocalSimpleType localSimpleType = simpleTypes[i];
+        XSType type = pOwner.getXSSchema().getXSObjectFactory().newXSType(pOwner, localSimpleType);
+        type.validate();
+        memberTypes.add(type);
+      }
+    }
+    if (memberTypes.size() == 0) {
+      throw new LocSAXException("Neither the 'memberTypes' attribute nor the 'simpleType' child elements did define a member type.",
+                                   pBaseUnion.getLocator());
+    }
+  }
+
+  public boolean isUnion() { return true; }
+  public boolean isRestriction() { return false; }
+  public XSType getRestrictedType() {
+    throw new IllegalStateException("This is a basic list type and not a restriction of another simple type.");
+  }
+  public XSUnionType getUnionType() { return this; }
+  public String[][] getPattern() { return ZERO_PATTERNS; }
+  public XSEnumeration[] getEnumerations() { return ZERO_ENUMERATIONS; }
+  public XSType[] getMemberTypes() {
+    return (XSType[]) memberTypes.toArray(new XSType[memberTypes.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeRestrictionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeRestrictionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUnionTypeRestrictionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+import org.apache.ws.jaxme.xs.xml.XsGSimpleRestrictionModel;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUnionTypeRestrictionImpl extends XSSimpleTypeRestrictionImpl implements XSUnionType {
+  private final XSUnionType unionBaseType;
+
+  protected XSUnionTypeRestrictionImpl(XSType pParent, XSType pRestrictedType, XsGSimpleRestrictionModel pRestriction) throws SAXException {
+    super(pParent, pRestrictedType, pRestriction);
+    unionBaseType = pRestrictedType.getSimpleType().getUnionType();
+  }
+
+  public boolean isUnion() { return true; }
+
+  public XSUnionType getUnionType() {
+    return this;
+  }
+
+  public XSType[] getMemberTypes() {
+    return unionBaseType.getMemberTypes();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUtil.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUtil.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSUtil.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAppinfo;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUtil {
+  /** <p>Returns all childs of xs:annotation/xs:appinfo implementing
+   * or extending the given class.</p>
+   */
+  public static List getAppinfos(XSAnnotation[] annotations, Class pClass) {
+    List result = new ArrayList();
+    for (int i = 0;  i < annotations.length;  i++) {
+      XSAppinfo[] appinfos = annotations[i].getAppinfos();
+      for (int j = 0;  j < appinfos.length;  j++) {
+        Object[] childs = appinfos[j].getChilds();
+        for (int k = 0;  k < childs.length;  k++) {
+          if (pClass.isAssignableFrom(childs[k].getClass())) {
+            result.add(childs[k]);
+          }
+        }
+      }
+    }
+    return result;
+  }
+
+  /** <p>Returns the first child of xs:annotation/xs:appinfo implementing
+   * or extending the given class. Ensures that the child is unique.</p>
+   * @return The unique child or null, if no such child exists.
+   */
+  public static Object getSingleAppinfo(XSAnnotation[] annotations, Class pClass) throws SAXException {
+    Object result = null;
+    if (annotations != null) {
+      for (int i = 0;  i < annotations.length;  i++) {
+        XSAppinfo[] appinfos = annotations[i].getAppinfos();
+        for (int j = 0;  j < appinfos.length;  j++) {
+          Object[] childs = appinfos[j].getChilds();
+          for (int k = 0;  k < childs.length;  k++) {
+            if (pClass.isAssignableFrom(childs[k].getClass())) {
+              if (result == null) {
+                result = childs[k];
+              } else {
+                throw new LocSAXException("Multiple instances of " + pClass.getName() +
+                                           " in xs:annotation/xs:appinfo are forbidden.",
+                                           appinfos[j].getLocator());
+              }
+            }
+          }
+        }
+      }
+    }
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSWildcardImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSWildcardImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/XSWildcardImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSWildcardImpl extends XSOpenAttrsImpl implements XSWildcard {
+    private boolean isValidated;
+    private XSAnnotation[] annotations;
+    private final XsEAnnotation xsAnnotation;
+    
+    protected XSWildcardImpl(XSObject pParent, XsTWildcard pBaseObject) {
+		super(pParent, pBaseObject);
+		xsAnnotation = pBaseObject.getAnnotation();
+	}
+	
+	public XsNamespaceList getNamespaceList() {
+		return ((XsTWildcard) getXsObject()).getNamespace();
+	}
+
+	public XsTWildcard.ProcessContents getProcessContents() {
+		return ((XsTWildcard) getXsObject()).getProcessContents();
+	}
+
+	protected boolean isValidated() {
+	    return isValidated;
+	}
+
+	public void validate() throws SAXException {
+	    if (isValidated()) {
+	        return;
+	    } else {
+	        isValidated = true;
+	    }
+
+	    if (xsAnnotation == null) {
+	        annotations = new XSAnnotation[0];
+	    } else {
+	        XSAnnotation ann = getXSSchema().getXSObjectFactory().newXSAnnotation(this, xsAnnotation);
+	        annotations = new XSAnnotation[]{ ann };
+	        ann.validate();
+	    }
+	}
+
+	public XsSchemaHeader getSchemaHeader() {
+	    return getXsObject().getXsESchema();
+	}
+
+	public XSAnnotation[] getAnnotations() {
+	    return annotations;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Basic generic implementation of the JaxMeXS parser for XML Schema.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAny.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAny.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAny.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSAny;
+
+/** <p>JAXB specific extension of XSAny.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBAny extends XSAny, JAXBWildcard {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAttribute.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAttribute.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBAttribute.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSAttribute;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBAttribute extends XSAttribute, JAXBPropertyOwner {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClass.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClass.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClass.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>This interface implements the JAXB class bindings.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBClass.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface JAXBClass extends XsObject {
+  /** <p>Returns the classes name, without the package. The package
+   * name is specified by the schema bindings package declaration.</p>
+   */
+  public String getName();
+
+  /** <p>Returns the implementations class name, including a package
+   * name.</p>
+   */
+  public String getImplClass();
+
+  /** <p>Returns the classes JavaDoc documentation.</p>
+   */
+  public JAXBJavadoc getJavadoc();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClassOwner.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClassOwner.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBClassOwner.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBClassOwner {
+  /** <p>Returns the groups schemaBindings.</p>
+   */
+  public JAXBSchemaBindings getJAXBSchemaBindings();
+
+  /** <p>Returns the groups class customization settings.</p>
+   */
+  public JAXBClass getJAXBClass();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSElement;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBElement extends XSElement, JAXBClassOwner, JAXBPropertyOwner {
+  /** <p>Returns the elements property customization settings.</p>
+   */
+  public JAXBProperty getJAXBProperty();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBEnumeration.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBEnumeration.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBEnumeration.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSEnumeration;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBEnumeration extends XSEnumeration {
+  /** <p>Returns the jaxb:typesafeEnumMember details.</p>
+   */
+  public JAXBTypesafeEnumMember getJAXBTypesafeEnumMember();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGlobalBindings.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGlobalBindings.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGlobalBindings.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>This interface implements the JAXB global bindings.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBGlobalBindings.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface JAXBGlobalBindings {
+  /** <p>Enumeration class holding possible values for {@link JAXBGlobalBindings#getUnderscoreBinding()}.</p>
+   */
+  public class UnderscoreBinding {
+    private final String name;
+    private UnderscoreBinding(String pName) {
+      name = pName;
+    }
+    public String toString() { return name; }
+    public String getName() { return name; }
+    public static final UnderscoreBinding AS_WORD_SEPARATOR = new UnderscoreBinding("asWordSeparator");
+    public static final UnderscoreBinding AS_CHAR_IN_WORD = new UnderscoreBinding("asCharInWord");
+    public static UnderscoreBinding valueOf(String pName) {
+      if (AS_WORD_SEPARATOR.name.equals(pName)) {
+        return AS_WORD_SEPARATOR;
+      } else if (AS_CHAR_IN_WORD.name.equals(pName)) {
+        return AS_CHAR_IN_WORD;
+      } else {
+        throw new IllegalArgumentException("Invalid value for underscoreBinding: " + pName +
+                                            ", expected either of asWordSeparator|asCharInWord");
+      }
+    }
+  }
+
+  /** <p>Returns the collection type; either of null ("indexed",
+   * default) or an implementation of <code>java.util.List</code>.</p>
+   */
+  public String getCollectionType();
+
+  /** <p>Returns whether fixed attributes are implemented as a
+   * constant property. Defaults to false.</p>
+   */
+  public boolean isFixedAttributeAsConstantProperty();
+
+  /** <p>Returns whether a <code>isSet()</code> method is being
+   * generated. Defaults to false.</p>
+   */
+  public boolean isGenerateIsSetMethod();
+
+  /** <p>Returns whether FailFastCheck is enabled. Defaults to
+   * false.</p>
+   */
+  public boolean isEnableFailFastCheck();
+
+  /** <p>Returns the <code>choiceContentProperty</code> value. Defaults
+   * to false. This value is ignored, if <code>bindingStyle</code> is
+   * defined as <code>elementBinding</code>. In this case, setting
+   * <code>choiceContentProperty</code> is an error. Defaults to false.</p>
+   */
+  public boolean isChoiceContentProperty();
+
+  /** <p>Returns the binding of underscores. Defaults to "asWordSeparator"
+   * (false). The value true indicates "asCharInWord".
+   */
+  public UnderscoreBinding getUnderscoreBinding();
+
+  /** <p>Returns whether Java naming conventions are enabled. Defaults to
+   * true.</p>
+   */
+  public boolean isEnableJavaNamingConventions();
+
+  /** <p>Returns a list of QNames, which are being implemented as type
+   * safe enumerations, if the <code>xs:enumeration</code> facet is
+   * used. Defaults to <code>xs:NCName</code> (single element list).</p>
+   */
+  public XsQName[] getTypesafeEnumBase();
+
+  /** <p>Returns whether the typesafeEnumMemberName generates an
+   * error (false, default) or a name.</p>
+   */
+  public boolean isTypesafeEnumMemberName();
+
+  /** <p>Returns whether the <code>elementBinding</code> style is
+   * being used (true, default) or not.</p>
+   */
+  public boolean isBindingStyleModelGroup();
+
+  /** <p>Returns the list of <code>javaType</code> declarations.</p>
+   */
+  public JAXBJavaType.JAXBGlobalJavaType[] getJavaType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSGroup;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBGroup extends XSGroup, JAXBClassOwner {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>This interface implements the JAXB javaType bindings.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBJavaType.java 231996 2004-09-30 00:09:30Z jochen $
+ */
+public interface JAXBJavaType extends XsObject {
+  public interface JAXBGlobalJavaType extends JAXBJavaType {
+    /** <p>Returns the xmlType.</p>
+     */
+    public XsQName getXmlType();
+  }
+
+  /** <p>Returns the runtime type.</p>
+   */
+  public String getName();
+
+  /** Returns the XML type.
+   */
+  public XsQName getXmlType();
+
+  /** <p>Returns whether the <code>print()</code> and/or
+   * <code>parse()</code> methods have an additional
+   * <code>nsContext</code> attribute.</p>
+   */
+  public boolean hasNsContext();
+
+  /** <p>Returns the name of the <code>parse()</code> method.</p>
+   */
+  public String getParseMethod();
+
+  /** <p>Returns the name of the <code>print()</code> method.</p>
+   */
+  public String getPrintMethod();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaTypeOwner.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaTypeOwner.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavaTypeOwner.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,12 @@
+package org.apache.ws.jaxme.xs.jaxb;
+
+
+/** Interface of an element providing a <code>jaxb:javaType</code>
+ * customization.
+ */
+public interface JAXBJavaTypeOwner {
+	/** Returns the elements <code>jaxb:javaType</code> customization,
+     * if any, or null.
+	 */
+    public JAXBJavaType getJAXBJavaType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavadoc.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavadoc.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBJavadoc.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implements a <code>&lt;javadoc&gt;...&lt;/javadoc&gt;</code>
+ * element.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBJavadoc.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface JAXBJavadoc extends XsObject {
+  /** <p>Returns the text contained in the Javadoc element.</p>
+   */
+  public String getText();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBProperty.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBProperty.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBProperty.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>This interface implements the JAXB property bindings.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBProperty.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface JAXBProperty extends XsObject {
+  public interface BaseType extends XsObject {
+    /** <p>Returns the Java type.</p>
+     */
+    public JAXBJavaType getJavaType();
+  }
+
+  /** <p>Returns the property name.</p>
+   */
+  public String getName();
+
+  /** <p>Returns the collection type; either of "indexed"
+   * or an implementation of <code>java.util.List</code>.
+   * The value null indicates, that the attribute has not
+   * been set.</p>
+   */
+  public String getCollectionType();
+
+  /** <p>Returns whether fixed attributes are implemented as a
+   * constant property. The value null indicates, that the
+   * attribute has not been set.</p>
+   */
+  public Boolean isFixedAttributeAsConstantProperty();
+
+  /** <p>Returns whether a <code>isSet()</code> method is being
+   * generated. The value null indicates, that the attribute
+   * has not been set.</p>
+   */
+  public Boolean isGenerateIsSetMethod();
+
+  /** <p>Returns whether FailFastCheck is enabled. The value null
+   * indicates, that the attribute has not been set.</p>
+   */
+  public Boolean isEnableFailFastCheck();
+
+  /** <p>Returns the getter methods JavaDoc documentation.</p>
+   */
+  public JAXBJavadoc getJavadoc();
+
+  /** <p>Returns the base type.</p>
+   */
+  public BaseType getBaseType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBPropertyOwner.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBPropertyOwner.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBPropertyOwner.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBPropertyOwner {
+  /** <p>Returns the types schemaBindings.</p>
+   */
+  public JAXBSchemaBindings getJAXBSchemaBindings();
+
+  /** <p>Returns the attributes property customization settings.</p>
+   */
+  public JAXBProperty getJAXBProperty();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSSchema;
+
+
+/** <p>Interface of a JAXB schema. It inherits the methods of
+ * {@link JAXBGlobalBindings}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBSchema extends XSSchema {
+  /** <p>Returns the schemas globalBindings. This is guaranteed to be non-null.</p>
+   */
+  public JAXBGlobalBindings getJAXBGlobalBindings();
+
+  /** <p>Returns the schemas <code>jaxb:version</code> attribute.</p>
+   */
+  public String getJaxbVersion();
+
+  /** <p>Returns the schemas <code>jaxb:extensionBindingPrefixes</code> list.</p>
+   */
+  public String[] getJaxbExtensionBindingPrefixes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchemaBindings.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchemaBindings.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSchemaBindings.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>This interface implements the JAXB schema bindings.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBSchemaBindings.java 231789 2004-02-22 00:52:34Z jochen $
+ */
+public interface JAXBSchemaBindings {
+  /** <p>Configures the package that is used in this schema.</p>
+   */
+  public interface Package extends XsObject {
+    /** <p>Returns the package name.</p>
+     */
+    public String getName();
+
+    /** <p>Returns the packages JavaDoc documentation.</p>
+     */
+    public JAXBJavadoc getJavadoc();
+  }
+
+  public interface NameTransformation extends XsObject {
+    /** <p>Returns the suffix.</p>
+     */
+    public String getSuffix();
+    /** <p>Returns the prefix.</p>
+     */
+    public String getPrefix();
+  }
+
+  public interface NameXmlTransform extends XsObject {
+    /** <p>Returns the <code>typeName</code>'s NameTransformation.</p>
+     */
+    public NameTransformation getTypeName();
+    /** <p>Returns the <code>elementName</code>'s NameTransformation.</p>
+     */
+    public NameTransformation getElementName();
+    /** <p>Returns the <code>modelGroupName</code>'s NameTransformation.</p>
+     */
+    public NameTransformation getModelGroupName();
+    /** <p>Returns the <code>anonymousTypeName</code>'s NameTransformation.</p>
+     */
+    public NameTransformation getAnonymousTypeName();
+  }
+
+  /** <p>Returns the package declaration.</p>
+   */
+  public Package getPackage();
+
+  /** <p>Returns the list of NameXmlTransforms.</p>
+   */
+  public NameXmlTransform[] getNameXmlTransform();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleContentType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleContentType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleContentType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBSimpleContentType extends XSSimpleContentType, JAXBPropertyOwner {
+  /** <p>Returns the complex types schemaBindings.</p>
+   */
+  public JAXBSchemaBindings getJAXBSchemaBindings();
+
+  /** <p>Returns the customization details of the content type.</p>
+   */
+  public JAXBProperty getJAXBProperty();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBSimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSSimpleType;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBSimpleType extends XSSimpleType {
+  /** <p>Returns the jaxb:javaType customization details.</p>
+   */
+  public JAXBJavaType getJAXBJavaType();
+
+  /** <p>Returns the jaxb:typesafeEnumClass details.</p>
+   */
+  public JAXBTypesafeEnumClass getJAXBTypesafeEnumClass();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSType;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBType extends XSType, JAXBClassOwner, JAXBJavaTypeOwner {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumClass.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumClass.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumClass.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import java.util.Iterator;
+
+
+/** <p>This interface implements the JAXB typesafeEnumClass bindings.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBTypesafeEnumClass.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public interface JAXBTypesafeEnumClass {
+  /** <p>Returns the enumeration classes name, without any package
+   * prefix.</p>
+   */
+  public String getName();
+
+  /** <p>Returns the list of members. Any element in the list is
+   * an instance of <code>TypesafeEnumMember</code>.</p>
+   */
+  public Iterator getTypesafeEnumMember();
+
+  /** <p>Returns the created classess JavaDoc documentation.</p>
+   */
+  public JAXBJavadoc getJavadoc();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumMember.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumMember.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBTypesafeEnumMember.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBTypesafeEnumMember {
+  /** <p>Returns the members name.</p>
+   */
+  public String getName();
+  /** <p>Returns the members value,</p>
+   */
+  public String getValue();
+
+  /** <p>Returns the created constants JavaDoc documentation.</p>
+   */
+  public JAXBJavadoc getJavadoc();
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBWildcard.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBWildcard.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBWildcard.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.XSWildcard;
+
+
+/** <p>JAXB specific extension of XSWildcard.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBWildcard extends JAXBPropertyOwner, XSWildcard {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsObjectFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsObjectFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsObjectFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+
+
+
+/** <p>Implementation of the XsObjectFactory for parsing a
+ * JAXB schema.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBXsObjectFactory extends XsObjectFactory {
+  /** <p>Returns a new instance of JAXBProperty.BaseType.</p>
+   */
+  public JAXBProperty.BaseType newBaseType(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBClass.</p>
+   */
+  public JAXBClass newJAXBClass(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBGlobalBindings.</p>
+   */
+  public JAXBGlobalBindings newJAXBGlobalBindings(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBJavadoc.</p>
+   */
+  public JAXBJavadoc newJAXBJavadoc(XsObject pParent);
+
+  /** <p>Returns a new instance of NameXmlTransform.</p>
+   */
+  public JAXBSchemaBindings.NameXmlTransform newNameXmlTransform(XsObject pParent);
+
+  /** <p>Returns a new instance of NameTransformation.</p>
+   */
+  public JAXBSchemaBindings.NameTransformation newNameTransformation(XsObject pParent);
+
+  /** <p>Returns a new instance of Package.</p>
+   */
+  public JAXBSchemaBindings.Package newPackage(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBProperty.</p>
+   */
+  public JAXBProperty newJAXBProperty(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBJavaType.</p>
+   */
+  public JAXBJavaType newJAXBJavaType(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBGlobalJavaType.</p>
+   */
+  public JAXBJavaType.JAXBGlobalJavaType newJAXBGlobalJavaType(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBSchemaBindings.</p>
+   */
+  public JAXBSchemaBindings newJAXBSchemaBindings(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBTypesafeEnumClass.</p>
+   */
+  public JAXBTypesafeEnumClass newJAXBTypesafeEnumClass(XsObject pParent);
+
+  /** <p>Returns a new instance of JAXBTypesafeEnumMember.</p>
+   */
+  public JAXBTypesafeEnumMember newJAXBTypesafeEnumMember(XsObject pParent);
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsSchema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsSchema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/JAXBXsSchema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb;
+
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+
+
+/** <p>Syntactical representation of a JAXB schema. Most probably
+ * you aren't interested in the logical representation,
+ * {@link org.apache.ws.jaxme.xs.jaxb.JAXBSchema}, and not in this
+ * interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface JAXBXsSchema extends XsESchema {
+  /** <p>Returns the <code>jaxb:version</code> attribute.</p>
+   */
+  public String getJaxbVersion();
+
+  /** <p>Returns the list of <code>extension binding prefixes</code>.</p>
+   */
+  public String[] getJaxbExtensionBindingPrefixes();
+
+  public JAXBSchemaBindings getJAXBSchemaBindings();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAppinfoImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAppinfoImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAppinfoImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.*;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsTSimpleType;
+import org.apache.ws.jaxme.xs.xml.impl.XsEAppinfoImpl;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBAppinfoImpl extends XsEAppinfoImpl {
+  /** <p>Creates a new instance of JAXBAppinfo.</p>
+   */
+  public JAXBAppinfoImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  protected JAXBXsObjectFactory getJAXBXsObjectFactory() { return (JAXBXsObjectFactory) getObjectFactory(); }
+
+  /** <p>Creates a new instance of {@link JAXBClass}.</p>
+   */
+  public JAXBClass createClass() {
+    JAXBClass jaxbClass = getJAXBXsObjectFactory().newJAXBClass(this);
+    addChild(jaxbClass);
+    return jaxbClass;
+  }
+
+  /** <p>Creates a new instance of {@link JAXBGlobalBindings}.</p>
+   */
+  public JAXBGlobalBindings createGlobalBindings() {
+    JAXBGlobalBindings jaxbGlobalBindings = getJAXBXsObjectFactory().newJAXBGlobalBindings(this);
+    addChild(jaxbGlobalBindings);
+    return jaxbGlobalBindings;
+  }
+
+  /** <p>Creates a new instance of {@link JAXBJavadoc}.</p>
+   */
+  public JAXBJavadoc createJavadoc() {
+    JAXBJavadoc jaxbJavadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
+    addChild(jaxbJavadoc);
+    return jaxbJavadoc;
+  }
+
+  /** <p>Creates a new instance of {@link JAXBJavaType}.</p>
+   */
+  public JAXBJavaType createJavaType() {
+    JAXBJavaType jaxbJavaType = getJAXBXsObjectFactory().newJAXBJavaType(this);
+    addChild(jaxbJavaType);
+    return jaxbJavaType;
+  }
+
+  /** <p>Creates a new instance of {@link JAXBProperty}.</p>
+   */
+  public JAXBProperty createProperty() {
+    JAXBProperty jaxbProperty = getJAXBXsObjectFactory().newJAXBProperty(this);
+    addChild(jaxbProperty);
+    return jaxbProperty;
+  }
+
+  /** <p>Creates a new instance of {@link JAXBSchemaBindings}.</p>
+   */
+  public JAXBSchemaBindings createSchemaBindings() {
+    JAXBSchemaBindings jaxbSchemaBindings = getJAXBXsObjectFactory().newJAXBSchemaBindings(this);
+    addChild(jaxbSchemaBindings);
+    return jaxbSchemaBindings;
+  }
+
+  /** <p>Creates a new instance of {@link JAXBTypesafeEnumClass}.</p>
+   */
+  public JAXBTypesafeEnumClass createTypesafeEnumClass() throws SAXException {
+    XsObject annotationParent = getParentObject();
+    if (annotationParent instanceof XsEAnnotation) {
+      XsObject simpleTypeParent = annotationParent.getParentObject();
+      if (simpleTypeParent instanceof XsTSimpleType) {
+        JAXBTypesafeEnumClass jaxbTypesafeEnumClass = getJAXBXsObjectFactory().newJAXBTypesafeEnumClass(this);
+        addChild(jaxbTypesafeEnumClass);
+        return jaxbTypesafeEnumClass;
+      }
+    }
+    System.err.println("this = " + this);
+    System.err.println("AnnotationParent = " + annotationParent);
+    System.err.println("annotationParent.parent = " + annotationParent.getParentObject());
+    throw new LocSAXException("The declaration of a typesafeEnumClass is only allowed in xs:simpleType/xs:annotation/xs:appinfo.", getLocator());
+  }
+
+  /** <p>Creates a new instance of {@link JAXBTypesafeEnumMember}.</p>
+   */
+  public JAXBTypesafeEnumMember createTypesafeEnumMember() {
+    JAXBTypesafeEnumMember jaxbTypesafeEnumMember = getJAXBXsObjectFactory().newJAXBTypesafeEnumMember(this);
+    addChild(jaxbTypesafeEnumMember);
+    return jaxbTypesafeEnumMember;
+  }
+
+  public ContentHandler getChildHandler(String pQName, String pNamespaceURI, String pLocalName) throws SAXException {
+    if (JAXBParser.JAXB_SCHEMA_URI.equals(pNamespaceURI)) {
+      return null;
+    } else {
+      return super.getChildHandler(pQName, pNamespaceURI, pLocalName);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAttributeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAttributeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBAttributeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.impl.XSAttributeImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBAttribute;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsSchema;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsTAttribute;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBAttributeImpl extends XSAttributeImpl implements JAXBAttribute {
+  private JAXBProperty jaxbProperty;
+
+  /** <p>Creates a new instance of JAXBAttributeImpl.</p>
+   */
+  protected JAXBAttributeImpl(XSObject pParent, XsTAttribute pBaseAttribute)
+      throws SAXException {
+    super(pParent, pBaseAttribute);
+  }
+
+  public JAXBSchemaBindings getJAXBSchemaBindings() {
+    return ((JAXBXsSchema) getXsObject().getXsESchema()).getJAXBSchemaBindings();
+  }
+
+  public JAXBProperty getJAXBProperty() { return jaxbProperty; }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    } else {
+      super.validate();
+      jaxbProperty = (JAXBProperty) XSUtil.getSingleAppinfo(getAnnotations(), JAXBProperty.class);
+    }
+
+    if (jaxbProperty == null) {
+      XsTAttribute attr = (XsTAttribute) getXsObject();
+      if (attr.getRef() != null) {
+        JAXBAttribute refAttr = (JAXBAttribute) getXSSchema().getAttribute(attr.getRef());
+        if (refAttr != null) {
+          jaxbProperty = refAttr.getJAXBProperty();
+        }
+      }
+    } else {
+      if (isGlobal()  &&  jaxbProperty != null  &&  jaxbProperty.getBaseType() != null) {
+        throw new LocSAXException("The element jaxb:property/jaxb:baseType is forbidden in global attributes." +
+                                   " You may set it in the reference using the attribute locally. [JAXB 6.8.1.2.1]",
+                                   jaxbProperty.getLocator());
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBClassImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBClassImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBClassImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBClassImpl.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class JAXBClassImpl extends JAXBXsObjectImpl implements JAXBClass {
+  /** <p>Creates a new instance of ClassImpl.</p>
+   */
+  protected JAXBClassImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  private String name;
+  private String implClass;
+  private JAXBJavadoc javadoc;
+
+  /** <p>Sets the interfaces class name, not including the package name.
+   * The package name is set in the schema bindings or
+   * derived from the target namespace.</p>
+   */
+  public void setName(String pName) {
+    name = pName;
+  }
+
+  /** <p>Returns the interfaces class name, not including the package name.
+   * The package name is set in the schema bindings or
+   * derived from the target namespace.</p>
+   */
+  public String getName() {
+    return name;
+  }
+
+  /** <p>Sets the implementation classes name, including the package
+   * name.</p>
+   */
+  public void setImplClass(String pImplClass) {
+    implClass = pImplClass;
+  }
+
+  /** <p>Returns the implementation classes name, including the package
+   * name.</p>
+   */
+  public String getImplClass() {
+    return implClass;
+  }
+
+  /** <p>Sets the classes Javadoc documentation.</p>
+   */
+  public JAXBJavadoc createJavadoc() {
+    if (javadoc == null) {
+      javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
+      return javadoc;
+    } else {
+      throw new IllegalStateException("Multiple Javadoc elements are not supported.");
+    }
+  }
+
+  /** <p>Returns the classes Javadoc documentation.</p>
+   */
+  public JAXBJavadoc getJavadoc() {
+    return javadoc;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBElementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBElementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBElementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.impl.XSElementImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBElement;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsTElement;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBElementImpl extends XSElementImpl implements JAXBElement {
+  private JAXBClass jaxbClass;
+  private JAXBProperty jaxbProperty;
+
+  /** <p>Creates a new instance of JAXBElementImpl.</p>
+   */
+  protected JAXBElementImpl(XSObject pParent, XsTElement pBaseElement)
+      throws SAXException {
+    super(pParent, pBaseElement);
+  }
+
+  public JAXBSchemaBindings getJAXBSchemaBindings() {
+    return ((JAXBXsSchemaImpl) getXsObject().getXsESchema()).getJAXBSchemaBindings();
+  }
+
+
+  public JAXBClass getJAXBClass() { return jaxbClass; }
+  public JAXBProperty getJAXBProperty() { return jaxbProperty; }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    }
+    super.validate();
+    jaxbClass = (JAXBClass) XSUtil.getSingleAppinfo(getAnnotations(), JAXBClass.class);
+    jaxbProperty = (JAXBProperty) XSUtil.getSingleAppinfo(getAnnotations(), JAXBProperty.class);
+
+    if (jaxbProperty == null) {
+      XsTElement elem = (XsTElement) getXsObject();
+      if (elem.getRef() != null) {
+        JAXBElement refElem = (JAXBElement) getXSSchema().getElement(elem.getRef());
+        if (refElem != null) {
+          jaxbProperty = refElem.getJAXBProperty();
+        }
+      }
+    } else {
+      if (isGlobal()) {
+        if (jaxbProperty != null  &&  jaxbProperty.getBaseType() != null) {
+          throw new LocSAXException("The element jaxb:property/jaxb:baseType is forbidden in global elements." +
+                                     " You may set it in the reference using the element locally. [JAXB 6.8.1.2.1]",
+                                     jaxbProperty.getLocator());
+        }
+      }
+    }
+
+    if (jaxbClass != null  &&  jaxbClass.getImplClass() != null) {
+      if (isGlobal()) {
+        if (jaxbClass != null  &&  jaxbClass.getImplClass() != null) {
+          throw new LocSAXException("The implClass attribute is invalid for global elements. [JAXB 6.7.3.4]",
+                                     jaxbClass.getLocator());
+        }
+      } else {
+        if (jaxbClass != null  &&  jaxbClass.getImplClass() != null) {
+          throw new LocSAXException("The implClass attribute is invalid for local elements. [JAXB 6.7.3.5]",
+                                     jaxbClass.getLocator());
+        }
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBEnumerationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBEnumerationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBEnumerationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.impl.XSEnumerationImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBEnumeration;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumMember;
+import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBEnumerationImpl extends XSEnumerationImpl implements JAXBEnumeration {
+  private final JAXBTypesafeEnumMember member;
+
+  /** <p>Creates a new instance of JAXBEnumerationImpl.</p>
+   */
+  public JAXBEnumerationImpl(XSObject pParent, XsEEnumeration pBaseEnumeration) throws SAXException {
+    super(pParent, pBaseEnumeration);
+    member = (JAXBTypesafeEnumMember) XSUtil.getSingleAppinfo(getAnnotations(), JAXBTypesafeEnumMember.class);
+  }
+
+  public JAXBTypesafeEnumMember getJAXBTypesafeEnumMember() { return member; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGlobalBindingsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGlobalBindingsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGlobalBindingsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.XMLConstants;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsSchema;
+import org.apache.ws.jaxme.xs.parser.XsObjectCreator;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.types.XSBase64Binary;
+import org.apache.ws.jaxme.xs.types.XSDate;
+import org.apache.ws.jaxme.xs.types.XSDateTime;
+import org.apache.ws.jaxme.xs.types.XSDuration;
+import org.apache.ws.jaxme.xs.types.XSGDay;
+import org.apache.ws.jaxme.xs.types.XSGMonth;
+import org.apache.ws.jaxme.xs.types.XSGMonthDay;
+import org.apache.ws.jaxme.xs.types.XSGYear;
+import org.apache.ws.jaxme.xs.types.XSGYearMonth;
+import org.apache.ws.jaxme.xs.types.XSHexBinary;
+import org.apache.ws.jaxme.xs.types.XSNCName;
+import org.apache.ws.jaxme.xs.types.XSQName;
+import org.apache.ws.jaxme.xs.types.XSTime;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBGlobalBindingsImpl extends XsObjectImpl implements JAXBGlobalBindings {
+  private static final XsQName[] forbiddenEnumQNames =
+    new XsQName[]{
+      XSQName.getInstance().getName(),
+      XSBase64Binary.getInstance().getName(),
+      XSHexBinary.getInstance().getName(),
+      XSDate.getInstance().getName(),
+      XSDateTime.getInstance().getName(),
+      XSTime.getInstance().getName(),
+      XSDuration.getInstance().getName(),
+      XSGDay.getInstance().getName(),
+      XSGMonth.getInstance().getName(),
+      XSGYear.getInstance().getName(),
+      XSGMonthDay.getInstance().getName(),
+      XSGYearMonth.getInstance().getName()
+    };
+
+  private String collectionType;
+  private boolean fixedAttributeAsConstantProperty, generateIsSetMethod,
+    enableFailFastCheck, choiceContentProperty,
+    javaNamingConventionsDisabled, typesafeEnumMemberNameGeneratesName,
+    isBindingStyleModelGroup;
+  private List javaTypes;
+  private JAXBGlobalBindings.UnderscoreBinding underscoreBinding =
+    JAXBGlobalBindings.UnderscoreBinding.AS_WORD_SEPARATOR;
+  private XsQName[] typesafeEnumBase = new XsQName[]{XSNCName.getInstance().getName()};
+
+  /** <p>Creates a new instance of JAXBGlobalBindingsImpl.</p>
+   */
+  protected JAXBGlobalBindingsImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setCollectionType(String pType) {
+    collectionType = pType;
+  }
+
+  public String getCollectionType() {
+    return collectionType;
+  }
+
+  public void setFixedAttributeAsConstantProperty(boolean pFixedAttributeAsConstantProperty) {
+    fixedAttributeAsConstantProperty = pFixedAttributeAsConstantProperty;
+  }
+
+  public boolean isFixedAttributeAsConstantProperty() {
+    return fixedAttributeAsConstantProperty;
+  }
+
+  public void setGenerateIsSetMethod(boolean pGenerateIsSetMethod) {
+    generateIsSetMethod = pGenerateIsSetMethod;
+  }
+
+  public boolean isGenerateIsSetMethod() {
+    return generateIsSetMethod;
+  }
+
+  public void setEnableFailFastCheck(boolean pEnableFailFastCheck) {
+    enableFailFastCheck = pEnableFailFastCheck;
+  }
+
+  public boolean isEnableFailFastCheck() {
+    return enableFailFastCheck;
+  }
+
+  public void setChoiceContentProperty(boolean pChoiceContentProperty) {
+    choiceContentProperty = pChoiceContentProperty;
+  }
+
+  public boolean isChoiceContentProperty() {
+    return choiceContentProperty;
+  }
+
+  public void setUnderscoreBinding(JAXBGlobalBindings.UnderscoreBinding pUnderscoreBinding) {
+    underscoreBinding = pUnderscoreBinding;
+  }
+
+  public JAXBGlobalBindings.UnderscoreBinding getUnderscoreBinding() {
+    return underscoreBinding;
+  }
+
+  public void setEnableJavaNamingConventions(boolean pEnableJavaNamingConventions) {
+    javaNamingConventionsDisabled = !pEnableJavaNamingConventions;
+  }
+
+  public boolean isEnableJavaNamingConventions() {
+    return !javaNamingConventionsDisabled;
+  }
+
+  public void setTypesafeEnumBase(XsQName[] pTypes) {
+    typesafeEnumBase = pTypes;
+  }
+
+  public void setTypesafeEnumBase(String pTypesafeEnumBase) throws SAXException {
+    List list = new ArrayList();
+    String[] parts = new String[3];
+    for (StringTokenizer st = new StringTokenizer(pTypesafeEnumBase, " ,");
+         st.hasMoreTokens();  ) {
+      String token = st.nextToken();
+      getNamespaceSupport().processName(token, parts, false);
+      XsQName qName = new XsQName(parts[0], parts[1], XsQName.prefixOf(token));
+      for (int i = 0;  i < forbiddenEnumQNames.length;  i++) {
+        if (forbiddenEnumQNames[i].equals(qName)) {
+          throw new LocSAXException("The type " + qName +
+                                     " must not be specified in the typesafeEnumBase (JAXB 6.5.1)",
+                                     getLocator());
+        }
+      }
+      list.add(qName);
+    }
+    setTypesafeEnumBase((XsQName[]) list.toArray(new XsQName[list.size()]));
+  }
+
+  public XsQName[] getTypesafeEnumBase() {
+    return typesafeEnumBase;
+  }
+
+  public void setTypesafeEnumMemberName(boolean pTypesafeEnumMemberName) {
+    typesafeEnumMemberNameGeneratesName = pTypesafeEnumMemberName;
+  }
+
+  public boolean isTypesafeEnumMemberName() {
+    return typesafeEnumMemberNameGeneratesName;
+  }
+
+  public void setBindingStyle(String pBindingStyle) throws SAXException {
+    if ("elementBinding".equals(pBindingStyle)) {
+      isBindingStyleModelGroup = false;
+    } else if ("modelGroupBinding".equals(pBindingStyle)) {
+      isBindingStyleModelGroup = true;
+    } else {
+      throw new LocSAXException("Illegal value for 'bindingStyle': " + pBindingStyle + ", expected either of 'elementBinding' or 'modelGroupBinding'.",
+                                 getLocator());
+    }
+  }
+
+  public boolean isBindingStyleModelGroup() {
+    return isBindingStyleModelGroup;
+  }
+
+  public JAXBJavaType createJavaType() {
+    JAXBJavaType.JAXBGlobalJavaType javaTypeImpl = ((JAXBXsObjectFactory) getObjectFactory()).newJAXBGlobalJavaType(this);
+    if (javaTypes == null) {
+    	javaTypes = new ArrayList();
+    }
+    javaTypes.add(javaTypeImpl);
+    return javaTypeImpl;
+  }
+
+  private static final JAXBJavaType.JAXBGlobalJavaType[] DEFAULT_JAXB_JAVA_TYPES =
+      new JAXBJavaType.JAXBGlobalJavaType[0];
+  public JAXBJavaType.JAXBGlobalJavaType[] getJavaType() {
+    if (javaTypes == null) {
+      return DEFAULT_JAXB_JAVA_TYPES;
+    } else {
+      return (JAXBJavaType.JAXBGlobalJavaType[]) javaTypes.toArray(new JAXBJavaType.JAXBGlobalJavaType[javaTypes.size()]);
+    }
+  }
+
+  protected XsObjectCreator[] getXsObjectCreators() {
+      return null;
+  }
+
+  protected boolean isPrefixEnabled(String pPrefix) {
+      // The list of extension prefixes is in the outermost schema.
+      String[] prefixes;
+      XSLogicalParser xsParser = getContext().getXSLogicalParser();
+      if (xsParser == null) {
+          // Just syntax parsing, take this schema as outermost instance.
+          JAXBXsSchema jaxbXsSchema = (JAXBXsSchema) getXsESchema();
+          prefixes = jaxbXsSchema.getJaxbExtensionBindingPrefixes();
+      } else {
+          prefixes = ((JAXBXsSchema) xsParser.getSyntaxSchemas()[0]).getJaxbExtensionBindingPrefixes();
+      }
+
+      for (int i = 0;  i < prefixes.length;  i++) {
+          if (prefixes[i].equals(pPrefix)) {
+              return true;
+          }
+      }
+      return false;
+  }
+
+  protected XsObject getBeanByParent(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException {
+      XsObjectCreator[] creators = getXsObjectCreators();
+      if (creators != null) {
+          for (int i = 0;  i < creators.length;  i++) {
+              XsObject result = creators[i].newBean(pParent, pLocator, pQName);
+              if (result != null) {
+                  return result;
+              }
+          }
+      }
+      return null;
+  }
+
+  public ContentHandler getChildHandler(String pQName, String pNamespaceURI,
+                                        String pLocalName) throws SAXException {
+    if (JAXBParser.JAXB_SCHEMA_URI.equals(pNamespaceURI)  ||
+        XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)  ||
+        XMLConstants.XML_NS_URI.equals(pNamespaceURI)) {
+      return null;
+    }
+
+    int offset = pQName.indexOf(':');
+    if (offset > 0) {
+      String prefix = pQName.substring(0, offset);
+      if (isPrefixEnabled(prefix)) {
+          XsQName qName = new XsQName(pNamespaceURI, pLocalName, XsQName.prefixOf(pQName));
+          XsObject result = getBeanByParent(this, getObjectFactory().getLocator(), qName);
+          if (result != null) {
+              return getObjectFactory().newXsSAXParser(result);
+          } else {
+              return new DefaultHandler();
+          }
+      }
+    }
+    throw new LocSAXException("Unknown child element " + pQName + ", use the schemas jaxb:extensionBindingPrefixes attribute to ignore it.",
+                               getLocator());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.impl.XSGroupImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGroup;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsSchema;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEChoice;
+import org.apache.ws.jaxme.xs.xml.XsESequence;
+import org.apache.ws.jaxme.xs.xml.XsTAll;
+import org.apache.ws.jaxme.xs.xml.XsTGroupRef;
+import org.apache.ws.jaxme.xs.xml.XsTNamedGroup;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBGroupImpl extends XSGroupImpl implements JAXBGroup {
+  private JAXBClass jaxbClass;
+
+  /** <p>Creates a new instance of JAXBGroupImpl.</p>
+   */
+  protected JAXBGroupImpl(XSObject pParent, XsTGroupRef pBaseGroup)
+      throws SAXException {
+    super(pParent, pBaseGroup);
+  }
+
+  /** <p>Creates a new instance of JAXBGroupImpl.</p>
+   */
+  protected JAXBGroupImpl(XSObject pParent, XsTNamedGroup pBaseGroup)
+      throws SAXException {
+    super(pParent, pBaseGroup);
+  }
+
+  /** <p>Creates a new instance of JAXBGroupImpl.</p>
+   */
+  protected JAXBGroupImpl(XSObject pParent, XsEChoice pChoice)
+      throws SAXException {
+    super(pParent, pChoice);
+  }
+
+  /** <p>Creates a new instance of JAXBGroupImpl.</p>
+   */
+  protected JAXBGroupImpl(XSObject pParent, XsESequence pSequence)
+      throws SAXException {
+    super(pParent, pSequence);
+  }
+
+  /** <p>Creates a new instance of JAXBGroupImpl.</p>
+   */
+  public JAXBGroupImpl(XSObject pParent, XsTAll pAll)
+      throws SAXException {
+    super(pParent, pAll);
+  }
+
+  public JAXBSchemaBindings getJAXBSchemaBindings() {
+    return ((JAXBXsSchema) getXsObject().getXsESchema()).getJAXBSchemaBindings();
+  }
+
+  public JAXBClass getJAXBClass() {
+    return jaxbClass;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    }
+    super.validate();
+    jaxbClass = (JAXBClass) XSUtil.getSingleAppinfo(getAnnotations(), JAXBClass.class);
+
+    if (!isGlobal()  &&  jaxbClass != null  &&  jaxbClass.getImplClass() != null) {
+      throw new LocSAXException("The implClass attribute is valid for global groups only.",
+                                 jaxbClass.getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavaTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavaTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavaTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBJavaTypeImpl.java 231996 2004-09-30 00:09:30Z jochen $
+ */
+public class JAXBJavaTypeImpl extends XsObjectImpl implements JAXBJavaType {
+  public static class JAXBGlobalJavaTypeImpl extends JAXBJavaTypeImpl implements JAXBJavaType.JAXBGlobalJavaType {
+    /** <p>Creates a new instance of JAXBJavaTypeImpl.java.</p>
+     */
+    protected JAXBGlobalJavaTypeImpl(XsObject pParent) {
+      super(pParent);
+    }
+
+    private XsQName xmlType;
+    public void setXmlType(XsQName pType) { xmlType = pType; }
+    public void setXmlType(String pType) throws SAXException {
+      String[] parts = new String[3];
+      getNamespaceSupport().processName(pType, parts, false);
+      setXmlType(new XsQName(parts[0], parts[1], XsQName.prefixOf(pType)));
+    }
+    public XsQName getXmlType() { return xmlType; }
+    public void validate() throws SAXException {
+      super.validate();
+      if (getXmlType() == null) {
+        throw new LocSAXException("Missing attribute: 'xmlType'", getLocator());
+      }
+    }
+  }
+
+  private String name;
+  private boolean hasNsContext;
+  private String parseMethod, printMethod;
+  private XsQName xmlType;
+
+  /** <p>Creates a new instance of JAXBJavaTypeImpl.java.</p>
+   */
+  protected JAXBJavaTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(String pName) { name = pName; }
+  public String getName() { return name; }
+
+  public void setHasNsContext(boolean pHasNsContext) {
+    hasNsContext = pHasNsContext;
+  }
+
+  public boolean hasNsContext() {
+    return hasNsContext;
+  }
+
+  public void setParseMethod(String pParseMethod) {
+    parseMethod = pParseMethod;
+  }
+
+  public String getParseMethod() {
+    return parseMethod;
+  }
+
+  public void setPrintMethod(String pPrintMethod) {
+    printMethod = pPrintMethod;
+  }
+
+  public String getPrintMethod() {
+    return printMethod;
+  }
+
+  /** Sets the XML Type being customized by this element.
+   */
+  public void setXmlType(String pXmlType) throws SAXException {
+  	setXmlType(asXsQName(pXmlType));
+  }
+
+  /** Sets the XML Type being customized by this element.
+   */
+  public void setXmlType(XsQName pXmlType) {
+  	xmlType = pXmlType;
+  }
+
+  public XsQName getXmlType() {
+  	return xmlType;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavadocImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavadocImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBJavadocImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+
+
+/** <p>Implementation of the Javadoc interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBJavadocImpl.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class JAXBJavadocImpl extends XsObjectImpl implements JAXBJavadoc {
+  /** <p>Creates a new instance of JAXBJavadocImpl.</p>
+   */
+  protected JAXBJavadocImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  private String text;
+
+  public void addText(String pText) {
+    text = pText;
+  }
+
+  public String getText() {
+    return text;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBObjectFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBObjectFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBObjectFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.impl.XSObjectFactoryImpl;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.XsEChoice;
+import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
+import org.apache.ws.jaxme.xs.xml.XsEList;
+import org.apache.ws.jaxme.xs.xml.XsERestriction;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsESequence;
+import org.apache.ws.jaxme.xs.xml.XsETopLevelSimpleType;
+import org.apache.ws.jaxme.xs.xml.XsEUnion;
+import org.apache.ws.jaxme.xs.xml.XsTAll;
+import org.apache.ws.jaxme.xs.xml.XsTAttribute;
+import org.apache.ws.jaxme.xs.xml.XsTComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTElement;
+import org.apache.ws.jaxme.xs.xml.XsTGroupRef;
+import org.apache.ws.jaxme.xs.xml.XsTLocalComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTLocalSimpleType;
+import org.apache.ws.jaxme.xs.xml.XsTNamedGroup;
+import org.apache.ws.jaxme.xs.xml.XsTSimpleRestrictionType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBObjectFactoryImpl extends XSObjectFactoryImpl {
+  public XSSimpleType newXSAtomicType(XSType pResultType, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSAtomicType(pResultType, pRestrictedType, pRestriction));
+  }
+
+  public XSSimpleType newXSAtomicType(XSType pResultType, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSAtomicType(pResultType, pRestrictedType, pRestriction));
+  }
+
+  public XSAttribute newXSAttribute(XSObject pParent, XsTAttribute pAttribute) throws SAXException {
+    return new JAXBAttributeImpl(pParent, pAttribute);
+  }
+
+  public XSEnumeration newXSEnumeration(XSObject pParent, XsEEnumeration pEnumeration) throws SAXException {
+    return new JAXBEnumerationImpl(pParent, pEnumeration);
+  }
+
+  public XSSchema newXSSchema(XSContext pContext, XsESchema pSchema) throws SAXException {
+    return new JAXBSchemaImpl(pContext, pSchema);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsTAll pAll) throws SAXException {
+    return new JAXBGroupImpl(pParent, pAll);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsEChoice pChoice) throws SAXException {
+    return new JAXBGroupImpl(pParent, pChoice);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsESequence pSequence) throws SAXException {
+    return new JAXBGroupImpl(pParent, pSequence);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsTGroupRef pGroupRef) throws SAXException {
+    return new JAXBGroupImpl(pParent, pGroupRef);
+  }
+
+  public XSGroup newXSGroup(XSObject pParent, XsTNamedGroup pNamedGroup) throws SAXException {
+    return new JAXBGroupImpl(pParent, pNamedGroup);
+  }
+
+  public XSSimpleType newXSListType(XSType pResultType, XsEList pList) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSListType(pResultType, pList));
+  }
+
+  public XSSimpleType newXSListType(XSType pResultType, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSListType(pResultType, pRestrictedType, pRestriction));
+  }
+
+  public XSSimpleType newXSListType(XSType pResultType, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSListType(pResultType, pRestrictedType, pRestriction));
+  }
+
+  public XSType newXSType(XSObject pParent, XsETopLevelSimpleType pType) throws SAXException {
+    return new JAXBTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTComplexType pType) throws SAXException {
+    return new JAXBTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTLocalComplexType pType) throws SAXException {
+    return new JAXBTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTLocalSimpleType pType) throws SAXException {
+    return new JAXBTypeImpl(pParent, pType);
+  }
+
+  public XSType newXSType(XSObject pParent, XsTSimpleRestrictionType pType) throws SAXException {
+    return new JAXBTypeImpl(pParent, pType);
+  }
+
+  public XSElement newXSElement(XSObject pParent, XsTElement pElement) throws SAXException {
+    return new JAXBElementImpl(pParent, pElement);
+  }
+
+  public XSSimpleType newXSUnionType(XSType pResultType, XsEUnion pUnion) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSUnionType(pResultType, pUnion));
+  }
+
+  public XSSimpleType newXSUnionType(XSType pResultType, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSUnionType(pResultType, pRestrictedType, pRestriction));
+  }
+
+  public XSSimpleType newXSUnionType(XSType pResultType, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException {
+    return new JAXBSimpleTypeImpl(pResultType, super.newXSUnionType(pResultType, pRestrictedType, pRestriction));
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+
+
+/** <p>Subclass of XSParser for parsing a JAXB schema.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBParser extends XSParser {
+  public static final XSObjectFactory JAXB_OBJECT_FACTORY = new JAXBObjectFactoryImpl();
+  public static final JAXBXsObjectFactory JAXB_XS_OBJECT_FACTORY = new JAXBXsObjectFactoryImpl();
+
+  /** <p>The JAXB Schema URI: <code>http://java.sun.com/xml/ns/jaxb</code></p>
+   */
+  public static final String JAXB_SCHEMA_URI = "http://java.sun.com/xml/ns/jaxb";
+
+  /** <p>The XJC Schema URI: <code>http://java.sun.com/xml/ns/jaxb/xjc</code></p>
+   */
+  public static final String XJC_SCHEMA_URI = "http://java.sun.com/xml/ns/jaxb/xjc";
+
+  public JAXBParser() {
+    XSContext data = getContext();
+    data.setXsObjectFactory(JAXB_XS_OBJECT_FACTORY);
+    data.setXSObjectFactory(JAXB_OBJECT_FACTORY);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBPropertyImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBPropertyImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBPropertyImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of the Property interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBPropertyImpl.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class JAXBPropertyImpl extends JAXBXsObjectImpl implements JAXBProperty {
+  public static class BaseTypeImpl extends JAXBXsObjectImpl implements JAXBProperty.BaseType {
+    /** <p>Creates a new instance of JAXBPropertyImpl.</p>
+     */
+    protected BaseTypeImpl(XsObject pParent) {
+      super(pParent);
+    }
+
+    private JAXBJavaType javaType;
+
+    public JAXBJavaType createJavaType() {
+      if (javaType != null) {
+        throw new IllegalStateException("Only one instance of javaType supported.");
+      }
+      javaType = ((JAXBXsObjectFactory) getObjectFactory()).newJAXBJavaType(this);
+      return javaType;
+    }
+
+    public JAXBJavaType getJavaType() {
+      return javaType;
+    }
+  }
+
+  private String name;
+  private String collectionType;
+  private Boolean fixedAttributeAsConstantProperty, generateIsSetMethod, enableFailFastCheck;
+  private JAXBJavadoc javadoc;
+  private BaseType baseType;
+
+  /** <p>Creates a new instance of JAXBPropertyImpl.</p>
+   */
+  protected JAXBPropertyImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(String pName) {
+    name = pName;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setCollectionType(String pType) throws ClassNotFoundException {
+    collectionType = pType;
+  }
+
+  public String getCollectionType() { return collectionType; }
+
+  public void setFixedAttributeAsConstantProperty(Boolean pFixedAttributeAsConstantProperty) {
+    fixedAttributeAsConstantProperty = pFixedAttributeAsConstantProperty;
+  }
+
+  public Boolean isFixedAttributeAsConstantProperty() {
+    return fixedAttributeAsConstantProperty;
+  }
+
+  public void setGenerateIsSetMethod(Boolean pGenerateIsSetMethod) {
+    generateIsSetMethod = pGenerateIsSetMethod;
+  }
+
+  public Boolean isGenerateIsSetMethod() {
+    return generateIsSetMethod;
+  }
+
+  public void setEnableFailFastCheck(Boolean pEnableFailFastCheck) {
+    enableFailFastCheck = pEnableFailFastCheck;
+  }
+
+  public Boolean isEnableFailFastCheck() {
+    return enableFailFastCheck;
+  }
+
+  public JAXBJavadoc createJavadoc() {
+    if (javadoc != null) {
+      throw new IllegalStateException("Multiple javadoc elements are not supported.");
+    }
+    javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
+    return javadoc;
+  }
+
+  public JAXBJavadoc getJavadoc() {
+    return javadoc;
+  }
+
+  public BaseType createBaseType() {
+    if (baseType != null) {
+      throw new IllegalStateException("Multiple instances of baseType are not supported.");
+    }
+    baseType = ((JAXBXsObjectFactory) getObjectFactory()).newBaseType(this);
+    return baseType;
+  }
+
+  public BaseType getBaseType() {
+    return baseType;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaBindingsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaBindingsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaBindingsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+
+
+/** <p>Implementation of the SchemaBindings interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBSchemaBindingsImpl.java 231789 2004-02-22 00:52:34Z jochen $
+ */
+public class JAXBSchemaBindingsImpl extends JAXBXsObjectImpl implements JAXBSchemaBindings {
+  private Package myPackage;
+  private List nameXmlTransforms;
+
+  public static class PackageImpl extends JAXBXsObjectImpl implements JAXBSchemaBindings.Package {
+    /** <p>Creates a new instance of JAXBSchemaBindingsImpl.</p>
+     */
+    protected PackageImpl(XsObject pParent) {
+      super(pParent);
+    }
+
+    private String name;
+    private JAXBJavadoc javadoc;
+
+    public void setName(String pName) {
+      name = pName;
+    }
+
+    public String getName() {
+      return name;
+    }
+
+    public JAXBJavadoc createJavadoc() {
+      if (javadoc != null) {
+        throw new IllegalStateException("Multiple javadoc elements are not supported.");
+      }
+      javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
+      return javadoc;
+    }
+
+    public JAXBJavadoc getJavadoc() {
+      return javadoc;
+    }
+  }
+
+  public static class NameXmlTransformImpl extends XsObjectImpl
+      implements JAXBSchemaBindings.NameXmlTransform {
+    public static class NameTransformationImpl extends XsObjectImpl
+        implements JAXBSchemaBindings.NameTransformation {
+      /** <p>Creates a new instance of JAXBSchemaBindingsImpl.</p>
+       */
+      protected NameTransformationImpl(XsObject pParent) {
+        super(pParent);
+      }
+
+      private String suffix, prefix;
+
+      public void setSuffix(String pSuffix) {
+        suffix = pSuffix;
+      }
+
+      public String getSuffix() {
+        return suffix;
+      }
+
+      public void setPrefix(String pPrefix) {
+        prefix = pPrefix;
+      }
+
+      public String getPrefix() {
+        return prefix;
+      }
+    }
+
+    /** <p>Creates a new instance of JAXBSchemaBindingsImpl.</p>
+     */
+    protected NameXmlTransformImpl(XsObject pParent) {
+      super(pParent);
+    }
+
+    private NameTransformation typeName, elementName, modelGroupName, anonymousTypeName;
+
+    public NameTransformation createTypeName() {
+      if (typeName != null) {
+        throw new IllegalStateException("Multiple instances of typeName are not supported.");
+      }
+      typeName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this);
+      return typeName;
+    }
+
+    public NameTransformation getTypeName() {
+      return typeName;
+    }
+
+    public NameTransformation createElementName() {
+      if (elementName != null) {
+        throw new IllegalStateException("Multiple instances of elementName are not supported.");
+      }
+      elementName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this);
+      return elementName;
+    }
+
+    public NameTransformation getElementName() {
+      return elementName;
+    }
+
+    public NameTransformation createModelGroupName() {
+      if (modelGroupName != null) {
+        throw new IllegalStateException("Multiple instances of modelGroupName are not supported.");
+      }
+      modelGroupName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this);
+      return modelGroupName;
+    }
+
+    public NameTransformation getModelGroupName() {
+      return modelGroupName;
+    }
+
+    public NameTransformation createAnonymousTypeName() {
+      if (anonymousTypeName != null) {
+        throw new IllegalStateException("Multiple instances of anonymousTypeName are not supported.");
+      }
+      anonymousTypeName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this);
+      return anonymousTypeName;
+    }
+
+    public NameTransformation getAnonymousTypeName() {
+      return anonymousTypeName;
+    }
+  }
+
+  /** <p>Creates a new instance of SchemaBindings with the given
+   * GlobalBindings.</p>
+   */
+  protected JAXBSchemaBindingsImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  /** <p>Creates a new Package implementation.</p>
+   */
+  public Package createPackage() {
+    if (myPackage != null) {
+      throw new IllegalStateException("Multiple package declarations are not supported.");
+    }
+    myPackage = ((JAXBXsObjectFactory) getObjectFactory()).newPackage(this);
+    return myPackage;
+  }
+
+  public Package getPackage() {
+    return myPackage;
+  }
+
+  /** <p>Creates a new NameXmlTransform implementation.</p>
+   */
+  public NameXmlTransform createNameXmlTransform() {
+    if (nameXmlTransforms == null) {
+      nameXmlTransforms = new ArrayList();
+    }
+    NameXmlTransform result = ((JAXBXsObjectFactory) getObjectFactory()).newNameXmlTransform(this);
+    nameXmlTransforms.add(result);
+    return result;
+  }
+
+  private static final NameXmlTransform[] DEFAULT_NAME_XML_TRANSFORMATION = new NameXmlTransform[0];
+  public NameXmlTransform[] getNameXmlTransform() {
+    if (nameXmlTransforms == null) {
+      return DEFAULT_NAME_XML_TRANSFORMATION;
+    } else {
+      return (NameXmlTransform[]) nameXmlTransforms.toArray(new NameXmlTransform[nameXmlTransforms.size()]);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.impl.XSSchemaImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.*;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchema;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBSchemaImpl extends XSSchemaImpl implements JAXBSchema {
+  private JAXBGlobalBindings globalBindings;
+
+  /** <p>Creates a new instance of JAXBSchemaImpl.</p>
+   */
+  protected JAXBSchemaImpl(XSContext pContext, XsESchema pSchema) throws SAXException {
+    super(pContext, pSchema);
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    }
+    super.validate();
+    JAXBGlobalBindings gBindings = (JAXBGlobalBindings) XSUtil.getSingleAppinfo(getAnnotations(), JAXBGlobalBindings.class);
+    globalBindings = gBindings == null ?
+      ((JAXBXsObjectFactory) getXsESchema().getObjectFactory()).newJAXBGlobalBindings(getXsESchema()) : gBindings;
+  }
+
+  public JAXBGlobalBindings getJAXBGlobalBindings() {
+    return globalBindings;
+  }
+
+  public String getJaxbVersion() {
+    return ((JAXBXsSchema) getXsESchema()).getJaxbVersion();
+  }
+
+  public String[] getJaxbExtensionBindingPrefixes() {
+    return ((JAXBXsSchema) getXsESchema()).getJaxbExtensionBindingPrefixes();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleContentTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleContentTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleContentTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.impl.XSSimpleContentTypeImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSimpleContentType;
+import org.apache.ws.jaxme.xs.xml.XsTComplexType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBSimpleContentTypeImpl extends XSSimpleContentTypeImpl implements JAXBSimpleContentType {
+  private final JAXBProperty jaxbProperty;
+
+  /** <p>Creates a new instance of JAXBSimpleContentTypeImpl.</p>
+   */
+  protected JAXBSimpleContentTypeImpl(XSType pComplexType, XSType pSimpleType,
+                                       XsTComplexType pBaseType) throws SAXException {
+    super(pComplexType, pSimpleType, pBaseType);
+    jaxbProperty = (JAXBProperty) XSUtil.getSingleAppinfo(pComplexType.getAnnotations(), JAXBProperty.class);
+  }
+
+  public JAXBSchemaBindings getJAXBSchemaBindings() {
+    return ((JAXBXsSchemaImpl) getBaseType().getXsESchema()).getJAXBSchemaBindings();
+  }
+  public JAXBProperty getJAXBProperty() { return jaxbProperty; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBSimpleTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSimpleType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumClass;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBSimpleTypeImpl implements JAXBSimpleType {
+  private final XSSimpleType baseType;
+  private final JAXBJavaType jaxbJavaType;
+  private final JAXBTypesafeEnumClass jaxbTypesafeEnumClass;
+
+  /** <p>Creates a new instance of JAXBSimpleTypeImpl.</p>
+   */
+  protected JAXBSimpleTypeImpl(XSType pMyType, XSSimpleType pBaseType) throws SAXException {
+    jaxbJavaType = (JAXBJavaType) XSUtil.getSingleAppinfo(pMyType.getAnnotations(), JAXBJavaType.class);
+    jaxbTypesafeEnumClass = (JAXBTypesafeEnumClass) XSUtil.getSingleAppinfo(pMyType.getAnnotations(), JAXBTypesafeEnumClass.class);
+    baseType = pBaseType;
+  }
+
+  public JAXBJavaType getJAXBJavaType() { return jaxbJavaType; }
+  public JAXBTypesafeEnumClass getJAXBTypesafeEnumClass() { return jaxbTypesafeEnumClass; }
+  public boolean isAtomic() { return baseType.isAtomic(); }
+  public XSAtomicType getAtomicType() { return baseType.getAtomicType(); }
+  public boolean isList() { return baseType.isList(); }
+  public XSListType getListType() { return baseType.getListType(); }
+  public boolean isUnion() { return baseType.isUnion(); }
+  public XSUnionType getUnionType() { return baseType.getUnionType(); }
+  public String[][] getPattern() { return baseType.getPattern(); }
+  public XSEnumeration[] getEnumerations() { return baseType.getEnumerations(); }
+  public boolean isRestriction() { return baseType.isRestriction(); }
+  public XSType getRestrictedType() { return baseType.getRestrictedType(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.impl.XSTypeImpl;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBType;
+import org.apache.ws.jaxme.xs.xml.XsETopLevelSimpleType;
+import org.apache.ws.jaxme.xs.xml.XsTComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTLocalComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTLocalSimpleType;
+import org.apache.ws.jaxme.xs.xml.XsTSimpleRestrictionType;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBTypeImpl extends XSTypeImpl implements JAXBType {
+  private JAXBClass jaxbClass;
+  private JAXBJavaType jaxbJavaType;
+
+  /** <p>Creates a new instance of JAXBTypeImpl.</p>
+   */
+  protected JAXBTypeImpl(XSObject pParent, XsETopLevelSimpleType pSimpleType) throws SAXException {
+    super(pParent, pSimpleType);
+  }
+
+  /** <p>Creates a new instance of JAXBTypeImpl.</p>
+   */
+  protected JAXBTypeImpl(XSObject pParent, XsTLocalSimpleType pSimpleType) throws SAXException {
+    super(pParent, pSimpleType);
+  }
+
+  /** <p>Creates a new instance of JAXBTypeImpl.</p>
+   */
+  protected JAXBTypeImpl(XSObject pParent, XsTSimpleRestrictionType pSimpleType) throws SAXException {
+    super(pParent, pSimpleType);
+  }
+
+  /** <p>Creates a new instance of JAXBTypeImpl.</p>
+   */
+  protected JAXBTypeImpl(XSObject pParent, XsTComplexType pComplexType) throws SAXException {
+    super(pParent, pComplexType);
+  }
+
+  /** <p>Creates a new instance of JAXBTypeImpl.</p>
+   */
+  protected JAXBTypeImpl(XSObject pParent, XsTLocalComplexType pComplexType) throws SAXException {
+    super(pParent, pComplexType);
+  }
+
+  public JAXBSchemaBindings getJAXBSchemaBindings() {
+    return ((JAXBXsSchemaImpl) getXsObject().getXsESchema()).getJAXBSchemaBindings();
+  }
+
+  public JAXBClass getJAXBClass() {
+    return jaxbClass;
+  }
+
+  public JAXBJavaType getJAXBJavaType() {
+  	return jaxbJavaType;
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    }
+    super.validate();
+    jaxbClass = (JAXBClass) XSUtil.getSingleAppinfo(getAnnotations(), JAXBClass.class);
+    jaxbJavaType = (JAXBJavaType) XSUtil.getSingleAppinfo(getAnnotations(), JAXBJavaType.class);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumClassImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumClassImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumClassImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumMember;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of the TypesafeEnumClass interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: JAXBTypesafeEnumClassImpl.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class JAXBTypesafeEnumClassImpl extends JAXBXsObjectImpl implements JAXBTypesafeEnumClass {
+  private String name;
+  private JAXBJavadoc javadoc;
+  private List typesafeEnumMembers;
+
+  /** <p>Creates a new instance of JAXBTypesafeEnumClassImpl.java.</p>
+   */
+  protected JAXBTypesafeEnumClassImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(String pName) {
+    name = pName;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public JAXBTypesafeEnumMember createTypesafeEnumMember() {
+    if (typesafeEnumMembers == null) {
+      typesafeEnumMembers = new ArrayList();
+    }
+    JAXBTypesafeEnumMember result = ((JAXBXsObjectFactory) getObjectFactory()).newJAXBTypesafeEnumMember(this);
+    typesafeEnumMembers.add(result);
+    return result;
+  }
+
+  public Iterator getTypesafeEnumMember() {
+    return (typesafeEnumMembers == null ? Collections.EMPTY_LIST : typesafeEnumMembers).iterator();
+  }
+
+  public JAXBJavadoc createJavadoc() {
+    if (javadoc != null) {
+      throw new IllegalStateException("Multiple javadoc elements are not supported.");
+    }
+    javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
+    return javadoc;
+  }
+
+  public JAXBJavadoc getJavadoc() {
+    return javadoc;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumMemberImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumMemberImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBTypesafeEnumMemberImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumMember;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBTypesafeEnumMemberImpl extends JAXBXsObjectImpl
+    implements JAXBTypesafeEnumMember {
+  /** <p>Creates a new instance of JAXBTypesafeEnumClassImpl.java.</p>
+   */
+  protected JAXBTypesafeEnumMemberImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  private String name, value;
+  private JAXBJavadoc javadoc;
+
+  public void setName(String pName) {
+    name = pName;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setValue(String pValue) {
+    value = pValue;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public JAXBJavadoc createJavadoc() {
+    if (javadoc != null) {
+      throw new IllegalStateException("Multiple javadoc elements are not supported.");
+    }
+    javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
+    return javadoc;
+  }
+
+  public JAXBJavadoc getJavadoc() {
+    return javadoc;
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBWildcardImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBWildcardImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBWildcardImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.impl.XSUtil;
+import org.apache.ws.jaxme.xs.impl.XSWildcardImpl;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBWildcard;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsSchema;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBWildcardImpl extends XSWildcardImpl implements JAXBWildcard {
+    private JAXBProperty jaxbProperty;
+
+    protected JAXBWildcardImpl(XSObject pParent, XsTWildcard pBaseObject) {
+        super(pParent, pBaseObject);
+    }
+
+    public JAXBProperty getJAXBProperty() { return jaxbProperty; }
+
+    public void validate() throws SAXException {
+        if (isValidated()) {
+            return;
+        } else {
+            super.validate();
+            jaxbProperty = (JAXBProperty) XSUtil.getSingleAppinfo(getAnnotations(), JAXBProperty.class);
+        }
+    }
+
+    public JAXBSchemaBindings getJAXBSchemaBindings() {
+        return ((JAXBXsSchema) getXsObject().getXsESchema()).getJAXBSchemaBindings();
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.*;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectFactoryImpl;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBXsObjectFactoryImpl extends XsObjectFactoryImpl implements JAXBXsObjectFactory {
+  public JAXBProperty.BaseType newBaseType(XsObject pParent) {
+    return new JAXBPropertyImpl.BaseTypeImpl(pParent);
+  }
+  public JAXBClass newJAXBClass(XsObject pParent) {
+    return new JAXBClassImpl(pParent);
+  }
+  public JAXBGlobalBindings newJAXBGlobalBindings(XsObject pParent) {
+    return new JAXBGlobalBindingsImpl(pParent);
+  }
+  public JAXBJavadoc newJAXBJavadoc(XsObject pParent) {
+    return new JAXBJavadocImpl(pParent);
+  }
+  public JAXBJavaType newJAXBJavaType(XsObject pParent) {
+    return new JAXBJavaTypeImpl(pParent);
+  }
+  public JAXBJavaType.JAXBGlobalJavaType newJAXBGlobalJavaType(XsObject pParent) {
+    return new JAXBJavaTypeImpl.JAXBGlobalJavaTypeImpl(pParent);
+  }
+  public JAXBSchemaBindings.NameXmlTransform newNameXmlTransform(XsObject pParent) {
+    return new JAXBSchemaBindingsImpl.NameXmlTransformImpl(pParent);
+  }
+  public JAXBSchemaBindings.NameTransformation newNameTransformation(XsObject pParent) {
+    return new JAXBSchemaBindingsImpl.NameXmlTransformImpl.NameTransformationImpl(pParent);
+  }
+  public JAXBSchemaBindings.Package newPackage(XsObject pParent) {
+    return new JAXBSchemaBindingsImpl.PackageImpl(pParent);
+  }
+  public JAXBProperty newJAXBProperty(XsObject pParent) {
+    return new JAXBPropertyImpl(pParent);
+  }
+  public JAXBSchemaBindings newJAXBSchemaBindings(XsObject pParent) {
+    return new JAXBSchemaBindingsImpl(pParent);
+  }
+  public JAXBTypesafeEnumClass newJAXBTypesafeEnumClass(XsObject pParent) {
+    return new JAXBTypesafeEnumClassImpl(pParent);
+  }
+  public JAXBTypesafeEnumMember newJAXBTypesafeEnumMember(XsObject pParent) {
+    return new JAXBTypesafeEnumMemberImpl(pParent);
+  }
+  public XsEAppinfo newXsEAppinfo(XsObject pParent) {
+    return new JAXBAppinfoImpl(pParent);
+  }
+  public XsESchema newXsESchema() {
+    return new JAXBXsSchemaImpl(getContext());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsObjectImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class JAXBXsObjectImpl extends XsObjectImpl {
+  /** <p>Creates a new instance of JAXBXsObjectImpl.</p>
+   */
+  public JAXBXsObjectImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  protected JAXBXsObjectFactory getJAXBXsObjectFactory() {
+    return (JAXBXsObjectFactory) getObjectFactory();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsSchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsSchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/JAXBXsSchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.xs.jaxb.*;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.impl.XsESchemaImpl;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBXsSchemaImpl extends XsESchemaImpl implements JAXBXsSchema {
+  private JAXBSchemaBindings schemaBindings;
+  private String jaxbVersion;
+  private String[] jaxbExtensionBindingPrefixes;
+
+  public void setJaxbVersion(String pVersion) {
+    jaxbVersion = pVersion;
+  }
+
+  public void setJaxbExtensionBindingPrefixes(String pExtensionBindingPrefixes) {
+    List result = new ArrayList();
+    for (StringTokenizer st = new StringTokenizer(pExtensionBindingPrefixes);  st.hasMoreTokens();  ) {
+      result.add(st.nextToken());
+    }
+    jaxbExtensionBindingPrefixes = (String[]) result.toArray(new String[result.size()]);
+  }
+
+  public String[] getJaxbExtensionBindingPrefixes() {
+    return jaxbExtensionBindingPrefixes == null ? new String[0] : jaxbExtensionBindingPrefixes;
+  }
+
+  public String getJaxbVersion() {
+    return jaxbVersion;
+  }
+
+  /** <p>Creates a new instance of JAXBXsSchemaImpl.</p>
+   */
+  public JAXBXsSchemaImpl(XSContext pContext) {
+    super(pContext);
+  }
+
+  public void validate() throws SAXException {
+    if (isValidated()) {
+      return;
+    }
+    super.validate();
+    Object[] childs = getChilds();
+    for (int i = 0;  i < childs.length;  i++) {
+      if (!(childs[i] instanceof XsEAnnotation)) {
+        continue;
+      }
+      XsEAnnotation annotation = (XsEAnnotation) childs[i];
+      XsEAppinfo[] appinfos = annotation.getAppinfos();
+      for (int j = 0;  j < appinfos.length;  j++) {
+        Object[] appinfoChilds = appinfos[j].getChilds();
+        for (int k = 0;  k < appinfoChilds.length;  k++) {
+          if (!(appinfoChilds[k] instanceof JAXBSchemaBindings)) {
+            continue;
+          }
+          if (schemaBindings == null) {
+            schemaBindings = (JAXBSchemaBindings) appinfoChilds[k];
+          } else {
+            throw new LocSAXException("A schema must have at most a single instance of 'schemaBindings'",
+                                       appinfos[j].getLocator());
+          }
+        }
+      }
+    }
+
+    if (schemaBindings == null) {
+      schemaBindings = ((JAXBXsObjectFactory) getObjectFactory()).newJAXBSchemaBindings(this);
+    }
+  }
+
+  public JAXBSchemaBindings getJAXBSchemaBindings() {
+    return schemaBindings;
+  }
+
+  public boolean setAttribute(String pQName, String pNamespaceURI, String pLocalName,
+                                String pValue) throws SAXException {
+    if (JAXBParser.JAXB_SCHEMA_URI.equals(pNamespaceURI)) {
+      if ("version".equals(pLocalName)) {
+        setJaxbVersion(pValue);
+        return true;
+      } else if ("extensionBindingPrefixes".equals(pLocalName)) {
+        setJaxbExtensionBindingPrefixes(pValue);
+        return true;
+      } else {
+        throw new LocSAXException("Invalid attribute: " + pQName, getLocator());
+      }
+    } else {
+      return super.setAttribute(pQName, pNamespaceURI, pLocalName, pValue);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Basic implementation of the JAXB specialization of the JaxMeXS parser 
+for XML Schema.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/jaxb/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Specialization of the JaxMeXS parser for XML Schema for the needs of JAXB.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ClaesLarssonTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ClaesLarssonTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ClaesLarssonTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+import java.io.File;
+import java.io.FileInputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.InputSource;
+
+public class ClaesLarssonTest extends TestCase {
+  public ClaesLarssonTest(String pName) {
+    super(pName);
+  }
+
+  public void testParse() throws Exception {
+    XSParser xsp = new XSParser();
+    xsp.setValidating(false);
+
+    String xmlFileName = "examples/xs/Claes_Larsson/schema.xsd";
+    java.net.URL xmlSystemId = new File(xmlFileName).toURL();
+
+    InputSource isource = new InputSource(new FileInputStream(xmlFileName));
+    isource.setSystemId(xmlSystemId.toString());
+    XSSchema schema = xsp.parse(isource);
+
+    // Print the names of all global elements:
+    XSElement[] elements = schema.getElements();
+    assertEquals(154, elements.length);
+
+    XSElement localTransformationElement = schema.getElement(new XsQName((String) null, "local_transformation"));
+    assertNotNull(localTransformationElement);
+    XSType localTransformationType = localTransformationElement.getType();
+    assertTrue(!localTransformationType.isSimple());
+    XSComplexType localTransformationComplexType = localTransformationType.getComplexType();
+    assertTrue(!localTransformationComplexType.hasSimpleContent());
+    XSParticle localTransformationParticle = localTransformationComplexType.getParticle();
+    XSGroup localTransformationGroup = localTransformationParticle.getGroup();
+    XSParticle[] particles = localTransformationGroup.getParticles();
+    assertEquals(0, particles[0].getMinOccurs());
+    assertEquals(1, particles[0].getMaxOccurs());
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DTDParserTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DTDParserTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DTDParserTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+package org.apache.ws.jaxme.xs.junit;
+
+import java.io.File;
+import java.io.FileReader;
+
+import org.apache.ws.jaxme.xs.util.DTDParser;
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+
+/** A unit test for the
+ *  {@link org.apache.ws.jaxme.xs.util.DTDParser}.
+ */
+public class DTDParserTest extends TestCase {
+    /** Creates a new test case with the given name.
+     */
+	public DTDParserTest(String pName) { super(pName); }
+
+    /** Parses the file XMLSchema.dtd.
+     */
+	public void testXMLSchemaDtd() throws Exception {
+		String path = System.getProperty("path.xmlSchema.dtd", "examples/xs/XMLSchema.dtd");
+        File f = new File(path);
+        InputSource isource = new InputSource(new FileReader(f));
+        isource.setSystemId(f.toURL().toString());
+        new DTDParser().parse(isource);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DumpUtils.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DumpUtils.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/DumpUtils.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSElementOrAttrRef;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSKeyRef;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSType;
+import org.xml.sax.SAXException;
+
+
+/** 
+ * Debug tool. Prints an XS data object to standard out.
+ *
+ * @author <a href="mailto:mrck1996 at yahoo.co.uk">Chris Kirk</a>
+ */
+public class DumpUtils  {
+ private static void dumpElements( XSElement[] elements, String prefix ) 
+    throws SAXException 
+  {
+    int numElements = elements.length;
+
+    for ( int i=0; i<numElements; i++ ) {
+      dumpElement( elements[i], prefix );
+    }
+  }
+
+  private static void dumpElement( XSElement element, String prefix ) 
+    throws SAXException 
+  {
+    String indented = "  " + prefix;
+    System.out.println( 
+      prefix + "Element "+System.identityHashCode(element)
+      + ": " + element.getName() 
+    );
+
+    dumpType( element.getType(), indented );
+    dumpIdentityConstraints( element.getIdentityConstraints(), indented );
+    dumpKeyRefs( element.getKeyRefs(), indented );
+   }
+
+  private static void dumpType( XSType type, String prefix ) 
+    throws SAXException 
+  {
+    String indented = "  " + prefix;
+    System.out.print( prefix + "Type: " );
+
+    if ( type.isSimple() ) {
+      System.out.println( "simple - " + type.getName() );
+    } else {
+      System.out.println( "complex - " + type.getName() );
+
+      dumpComplexType( type.getComplexType(), indented );
+    }
+  }
+
+  private static void dumpComplexType( XSComplexType type, String prefix ) 
+    throws SAXException 
+  {
+    String indented = prefix;
+    XSAttributable[] attributables = type.getAttributes();
+    int numAttribables = attributables.length;
+
+    for ( int i=0; i<numAttribables; i++ ) {
+      dumpAttributable( attributables[i], indented );
+    }
+
+    if ( !type.isEmpty() ) {
+      dumpParticle( type.getParticle(), indented ); 
+    }
+  }
+
+  private static void dumpIdentityConstraints( 
+    XSIdentityConstraint[] constraints,
+    String prefix 
+  ) {
+    int numConstraints = constraints.length;
+
+    for ( int i=0; i<numConstraints; i++ ) {
+      dumpIdentityConstraint( constraints[i], prefix );
+    }
+  }
+
+  private static void dumpKeyRefs( XSKeyRef[] keyRefs, String prefix ) {
+    int numKeyRefs = keyRefs == null ? 0 : keyRefs.length;
+
+    for ( int i=0; i<numKeyRefs; i++ ) {
+      dumpKeyRef( keyRefs[i], prefix );
+    }
+  }
+
+  private static void dumpIdentityConstraint(
+    XSIdentityConstraint constraint,
+    String prefix
+  ) {
+    System.out.println( 
+      prefix + "constraint: " + constraint.getName() 
+      + (constraint.isUnique() ? " (unique)" : "")
+    );
+
+    dumpMatchCriteria( constraint.getMatchCriteria(), prefix + "  " );
+  }
+
+  private static void dumpKeyRef( XSKeyRef keyRef, String prefix ) {
+    System.out.println( 
+      prefix + "keyref: " + keyRef.getName() + ": refers " 
+      + keyRef.getIdentityConstraint()
+    );
+
+    dumpMatchCriteria( keyRef.getMatchCriteria(), prefix + "  " );
+  }
+
+  private static void dumpMatchCriteria( 
+    XSElementOrAttrRef[][] criteria,
+    String prefix
+  ) {
+    int numKeyParts = criteria.length;
+
+    for ( int i=0; i<numKeyParts; i++ ) {
+      XSElementOrAttrRef[] keys = criteria[i];
+
+      int numOptions = keys.length;
+      for ( int j=0; j<numOptions; j++ ) {
+        dumpElementOrAttrRef( keys[j], i + ": " );
+      }
+    }
+  }
+
+  private static void dumpElementOrAttrRef(
+    XSElementOrAttrRef ref, String prefix
+  ) {
+    if ( ref.isAttributeRef() ) {
+      System.out.println( prefix + ref.getAttribute().getName() + " (attr) " );
+    } else {
+      System.out.println( prefix + ref.getElement().getName() + " (ele) " );
+    }
+  }
+
+  private static void dumpAttributable( 
+    XSAttributable attributable, 
+    String prefix
+  ) throws SAXException {
+    if ( attributable instanceof XSAttribute ) {
+      XSAttribute attr = (XSAttribute) attributable;
+      System.out.println( 
+        prefix + "attribute " + System.identityHashCode(attr) + ": " 
+        + attr.getName() + " " 
+        + (attr.getType().isSimple() ? "simple" : "complex!!!")
+        + (attr.isOptional() ? " optional" : " required")
+      );
+    } else {
+      System.out.println( prefix + "??? attrributable " + attributable );
+    }
+  }
+
+  private static void dumpParticle( XSParticle particle, String prefix ) 
+    throws SAXException 
+  {
+    String indented = "  " + prefix;
+    System.out.print( 
+      prefix + " particle: min=" + particle.getMinOccurs()
+      + " max=" + particle.getMaxOccurs() + " particle_type=" 
+      + particle.getType()
+    );
+
+    if ( particle.isElement() ) {
+      System.out.println( " element" );
+      dumpElement( particle.getElement(), indented );
+    } else if ( particle.isGroup() ) {
+      System.out.println( " group" );
+      dumpGroup( particle.getGroup(), indented );
+    } else if ( particle.isWildcard() ) {
+      System.out.println( " wildcard" );
+    }
+  }
+
+  private static void dumpGroup( XSGroup group, String prefix ) throws SAXException {
+    String indented = "  " + prefix;
+    System.out.println( prefix + "group: name=" + group.getName() );
+
+    XSParticle[] particles = group.getParticles();
+    int numParticles = particles.length;
+    for ( int i=0; i<numParticles; i++ ) {
+      dumpParticle( particles[i], indented );
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/FormatTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/FormatTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/FormatTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.ws.jaxme.xs.util.XsDateFormat;
+import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
+import org.apache.ws.jaxme.xs.util.XsTimeFormat;
+
+import junit.framework.TestCase;
+
+/** <p>Test case for the various instances of {@link java.text.Format},
+ * which are being used to parse special types like <code>xs:dateTime</code>.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class FormatTest extends TestCase {
+    /** Creates a new test with the given name.
+     */
+    public FormatTest(String pName) {
+        super(pName);
+    }
+
+    private Calendar getCalendar(TimeZone pTimeZone) {
+        Calendar cal = Calendar.getInstance(pTimeZone);
+        cal.set(2004, 01-1, 14, 03, 12, 07);
+        cal.set(Calendar.MILLISECOND, 0);
+        return cal;
+    }
+
+    /** Test for
+     * {@link org.apache.ws.jaxme.xs.util.XsDateTimeFormat#format(Object, StringBuffer, java.text.FieldPosition)}.
+     */
+    public void testFormatDateTime() {
+        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        XsDateTimeFormat format = new XsDateTimeFormat();
+        String got = format.format(cal);
+        String expect = "2004-01-14T03:12:07Z";
+        assertEquals(expect, got);
+
+        cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        got = format.format(cal);
+        expect = "2004-01-14T03:12:07-03:00";
+        assertEquals(expect, got);
+    }
+
+    /** Test for
+     * {@link org.apache.ws.jaxme.xs.util.XsDateTimeFormat#parseObject(String, java.text.ParsePosition)}.
+     */
+    public void testParseDateTime() throws ParseException {
+        String[] dateTimes = new String[]{
+			"2004-01-14T03:12:07.000Z",
+			"2004-01-14T03:12:07",
+			"2004-01-14T03:12:07-00:00",
+			"2004-01-14T03:12:07+00:00",
+		};
+        XsDateTimeFormat format = new XsDateTimeFormat();
+        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
+        for (int i = 0;  i < dateTimes.length;  i++) {
+            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
+            assertEquals(expect, got);
+        }
+
+        String dateTime = "2004-01-14T03:12:07.000-03:00";
+        expect = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
+        Calendar got = (Calendar) format.parseObject(dateTime);
+        assertEquals(expect, got);
+    }
+
+    /** Test for
+     * {@link org.apache.ws.jaxme.xs.util.XsDateFormat#format(Object, StringBuffer, java.text.FieldPosition)}.
+     */
+    public void testFormatDate() {
+        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        XsDateFormat format = new XsDateFormat();
+        String got = format.format(cal);
+        String expect = "2004-01-14Z";
+        assertEquals(expect, got);
+
+        cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        got = format.format(cal);
+        expect = "2004-01-14-03:00";
+        assertEquals(expect, got);
+    }
+
+    protected void assertEqualDate(Calendar pExpect, Calendar pGot) {
+        assertEquals(pExpect.get(Calendar.YEAR), pGot.get(Calendar.YEAR));
+        assertEquals(pExpect.get(Calendar.MONTH), pGot.get(Calendar.MONTH));
+        assertEquals(pExpect.get(Calendar.DAY_OF_MONTH), pGot.get(Calendar.DAY_OF_MONTH));
+        assertEquals(pExpect.getTimeZone(), pGot.getTimeZone());
+    }
+
+    protected void assertEqualTime(Calendar pExpect, Calendar pGot) {
+        assertEquals(pExpect.get(Calendar.HOUR_OF_DAY), pGot.get(Calendar.HOUR_OF_DAY));
+        assertEquals(pExpect.get(Calendar.MINUTE), pGot.get(Calendar.MINUTE));
+        assertEquals(pExpect.get(Calendar.SECOND), pGot.get(Calendar.SECOND));
+        assertEquals(pExpect.get(Calendar.MILLISECOND), pGot.get(Calendar.MILLISECOND));
+        assertEquals(pExpect.getTimeZone(), pGot.getTimeZone());
+    }
+
+    /** Test for
+     * {@link org.apache.ws.jaxme.xs.util.XsDateFormat#parseObject(String, java.text.ParsePosition)}.
+     */
+    public void testParseDate() throws ParseException {
+        String[] dateTimes = new String[]{
+			"2004-01-14Z",
+			"2004-01-14",
+			"2004-01-14+00:00",
+			"2004-01-14-00:00",
+        };
+        XsDateFormat format = new XsDateFormat();
+        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
+        for (int i = 0;  i < dateTimes.length;  i++) {
+            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
+            assertEqualDate(expect, got);
+        }
+
+        String dateTime = "2004-01-14-03:00";
+        expect = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
+        Calendar got = (Calendar) format.parseObject(dateTime);
+        assertEqualDate(expect, got);
+    }
+
+    /** Test for
+     * {@link org.apache.ws.jaxme.xs.util.XsTimeFormat#format(Object, StringBuffer, java.text.FieldPosition)}.
+     */
+    public void testFormatTime() {
+        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        XsTimeFormat format = new XsTimeFormat();
+        String got = format.format(cal);
+        String expect = "03:12:07Z";
+        assertEquals(expect, got);
+
+        cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        got = format.format(cal);
+        expect = "03:12:07-03:00";
+        assertEquals(expect, got);
+    }
+
+    /** Test for
+     * {@link org.apache.ws.jaxme.xs.util.XsTimeFormat#parseObject(String, java.text.ParsePosition)}.
+     */
+    public void testParseTime() throws ParseException {
+        String[] dateTimes = new String[]{
+			"03:12:07.000Z",
+			"03:12:07",
+			"03:12:07-00:00",
+			"03:12:07+00:00",
+        };
+        XsTimeFormat format = new XsTimeFormat();
+        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
+        for (int i = 0;  i < dateTimes.length;  i++) {
+            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
+            assertEqualTime(expect, got);
+        }
+
+        String dateTime = "03:12:07.000-03:00";
+        expect = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
+        Calendar got = (Calendar) format.parseObject(dateTime);
+        assertEqualTime(expect, got);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JAXBParserTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JAXBParserTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JAXBParserTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,919 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import java.io.StringReader;
+import java.util.Iterator;
+
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBAttribute;
+import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBElement;
+import org.apache.ws.jaxme.xs.jaxb.JAXBEnumeration;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGroup;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc;
+import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchema;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSimpleType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBType;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumClass;
+import org.apache.ws.jaxme.xs.jaxb.JAXBTypesafeEnumMember;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser;
+import org.apache.ws.jaxme.xs.types.XSDateTime;
+import org.apache.ws.jaxme.xs.types.XSNCName;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class JAXBParserTest extends ParserTest {
+  public JAXBParserTest(String pName) { super(pName); }
+
+  public void testJAXBGlobalBindingsDefaults() throws Exception {
+    // Parse a schema without globalBindings; it should have the default
+    // settings.
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>\n";
+    
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testGlobalBindingsDefaults.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    JAXBGlobalBindings globalBindings = schema.getJAXBGlobalBindings();
+    String collectionType = globalBindings.getCollectionType();
+    assertNull(collectionType);
+    JAXBJavaType[] javaTypes = globalBindings.getJavaType();
+    assertNotNull(javaTypes);
+    assertEquals(0, javaTypes.length);
+    XsQName[] typesafeEnumBase = globalBindings.getTypesafeEnumBase();
+    assertNotNull(typesafeEnumBase);
+    assertEquals(1, typesafeEnumBase.length);
+    XsQName qName = typesafeEnumBase[0];
+    assertEquals(XSNCName.getInstance().getName(), qName);
+    boolean bindingStyleModelGroup = globalBindings.isBindingStyleModelGroup();
+    assertTrue(!bindingStyleModelGroup);
+    boolean choiceContentProperty = globalBindings.isChoiceContentProperty();
+    assertTrue(!choiceContentProperty);
+    boolean enableFailFastCheck = globalBindings.isEnableFailFastCheck();
+    assertTrue(!enableFailFastCheck);
+    boolean enableJavaNamingConventions = globalBindings.isEnableJavaNamingConventions();
+    assertTrue(enableJavaNamingConventions);
+    boolean fixedAttributeAsConstantProperty = globalBindings.isFixedAttributeAsConstantProperty();
+    assertTrue(!fixedAttributeAsConstantProperty);
+    boolean generateIsSetMethod = globalBindings.isGenerateIsSetMethod();
+    assertTrue(!generateIsSetMethod);
+    JAXBGlobalBindings.UnderscoreBinding underscoreBinding = globalBindings.getUnderscoreBinding();
+    assertEquals(JAXBGlobalBindings.UnderscoreBinding.AS_WORD_SEPARATOR, underscoreBinding);
+  }
+
+  public void testJAXBGlobalBindings() throws Exception {
+    // Parse a schema with globalBindings
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation>\n" +
+      "    <xs:appinfo>\n" +
+      "      <jaxb:globalBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'\n" +
+      "          collectionType='java.util.ArrayList'\n" +
+      "          typesafeEnumBase='xs:string xs:NCName'\n" +
+      "          bindingStyle='modelGroupBinding'\n" +
+      "          choiceContentProperty='true'\n" +
+      "          enableFailFastCheck='1'\n" +
+      "          enableJavaNamingConventions='false'\n" +
+      "          fixedAttributeAsConstantProperty='true'\n" +
+      "          generateIsSetMethod='1'\n" +
+      "          underscoreBinding='asCharInWord'/>\n" +
+      "    </xs:appinfo\n>" +
+      "  </xs:annotation>\n" +
+      "</xs:schema>";
+    
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testGlobalBindingsDefaults.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    JAXBGlobalBindings globalBindings = schema.getJAXBGlobalBindings();
+    String collectionType = globalBindings.getCollectionType();
+    assertEquals("java.util.ArrayList", collectionType);
+  
+    XsQName[] typesafeEnumBase = globalBindings.getTypesafeEnumBase();
+    assertNotNull(typesafeEnumBase);
+    assertEquals(2, typesafeEnumBase.length);
+    XsQName qName = typesafeEnumBase[0];
+    assertEquals(qName, XSString.getInstance().getName());
+    qName = typesafeEnumBase[1];
+    assertEquals(qName, XSNCName.getInstance().getName());
+  
+    boolean bindingStyleModelGroup = globalBindings.isBindingStyleModelGroup();
+    assertTrue(bindingStyleModelGroup);
+  
+    boolean choiceContentProperty = globalBindings.isChoiceContentProperty();
+    assertTrue(choiceContentProperty);
+  
+    boolean enableFailFastCheck = globalBindings.isEnableFailFastCheck();
+    assertTrue(enableFailFastCheck);
+  
+    boolean enableJavaNamingConventions = globalBindings.isEnableJavaNamingConventions();
+    assertTrue(!enableJavaNamingConventions);
+  
+    boolean fixedAttributeAsConstantProperty = globalBindings.isFixedAttributeAsConstantProperty();
+    assertTrue(fixedAttributeAsConstantProperty);
+  
+    boolean generateIsSetMethod = globalBindings.isGenerateIsSetMethod();
+    assertTrue(generateIsSetMethod);
+  
+    JAXBGlobalBindings.UnderscoreBinding underscoreBinding = globalBindings.getUnderscoreBinding();
+    assertEquals(JAXBGlobalBindings.UnderscoreBinding.AS_CHAR_IN_WORD, underscoreBinding);
+  
+    JAXBJavaType[] javaTypes = globalBindings.getJavaType();
+    assertNotNull(javaTypes);
+    assertEquals(0, javaTypes.length);
+  }
+
+  public void testJAXBSchemaBindingsDefaults() throws Exception {
+    // Parse a schema without schemaBindings; it should have the default
+    // settings.
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:complexType name='a'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element name='b' type='xs:string'/>\n" +
+      "    </xs:sequence>\n" +
+      "  </xs:complexType>\n" +
+      "</xs:schema>";
+    
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testSchemaBindingsDefaults.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    JAXBType a = (JAXBType) schema.getType(new XsQName((String) null, "a"));
+    assertNotNull(a);
+    assertComplexType(a);
+  
+    JAXBSchemaBindings schemaBindings = a.getJAXBSchemaBindings();
+    JAXBSchemaBindings.NameXmlTransform[] nameXmlTransforms = schemaBindings.getNameXmlTransform();
+    assertNotNull(nameXmlTransforms);
+    assertEquals(0, nameXmlTransforms.length);
+    assertNull(schemaBindings.getPackage());
+  }
+
+  public void testJAXBSchemaBindings() throws Exception {
+    final String myPackageName = "org.apache.ws.jaxme.somepackage";
+  
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:annotation>\n" +
+      "    <xs:appinfo>\n" +
+      "      <jaxb:schemaBindings xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "        <jaxb:package name='" + myPackageName + "'>\n" +
+      "          <jaxb:javadoc>Test documentation</jaxb:javadoc>\n" +
+      "        </jaxb:package>\n" +
+      "        <jaxb:nameXmlTransform>\n" +
+      "          <jaxb:typeName prefix='b' suffix='a'/>\n" +
+      "        </jaxb:nameXmlTransform>\n" +
+      "      </jaxb:schemaBindings>\n" +
+      "    </xs:appinfo>\n" +
+      "  </xs:annotation>\n" +
+      "  <xs:complexType name='a'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element name='x' type='xs:int'/>\n" +
+      "    </xs:sequence>\n" +
+      "    <xs:attribute name='y' type='xs:string'/>\n" +
+      "  </xs:complexType>\n" +
+      "  <xs:element name='b' type='a'/>\n" +
+      "</xs:schema>";
+    
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testSchemaBindings.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    JAXBType a = (JAXBType) schema.getType(new XsQName((String) null, "a"));
+    JAXBSchemaBindings schemaBindings = a.getJAXBSchemaBindings();
+  
+    JAXBSchemaBindings.Package schemaPackage = schemaBindings.getPackage();
+    assertNotNull(schemaPackage);
+    assertEquals(myPackageName, schemaPackage.getName());
+    JAXBJavadoc javadoc = schemaPackage.getJavadoc();
+    assertNotNull(javadoc);
+    assertEquals("Test documentation", javadoc.getText());
+  
+    JAXBSchemaBindings.NameXmlTransform[] nameXmlTransforms = schemaBindings.getNameXmlTransform();
+    assertNotNull(nameXmlTransforms);
+    assertEquals(1, nameXmlTransforms.length);
+    JAXBSchemaBindings.NameXmlTransform nameXmlTransform = nameXmlTransforms[0];
+    assertNotNull(nameXmlTransform);
+    JAXBSchemaBindings.NameTransformation transformation = nameXmlTransform.getTypeName();
+    assertEquals("a", transformation.getSuffix());
+    assertEquals("b", transformation.getPrefix());
+  }
+
+  public void testJAXBClass() throws Exception {
+    {
+      final String schemaSource =
+        "<?xml version='1.0'?>\n" +
+        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+        "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+        "  <xs:complexType name='a'>\n" +
+        "    <xs:annotation>\n" +
+        "      <xs:appinfo>\n" +
+        "        <jaxb:class name='b' implClass='com.b.c'/>\n" +
+        "      </xs:appinfo>\n" +
+        "    </xs:annotation>\n" +
+        "    <xs:sequence>\n" +
+        "      <xs:element name='x' type='xs:int'/>\n" +
+        "      <xs:element name='f' type='xs:string'>\n" +
+        "        <xs:annotation><xs:appinfo>\n" +
+        "            <jaxb:class name='x'/>\n" +
+        "        </xs:appinfo></xs:annotation>\n" +
+        "      </xs:element>\n" +
+        "    </xs:sequence>\n" +
+        "    <xs:attribute name='y' type='xs:string'/>\n" +
+        "  </xs:complexType>\n" +
+        "  <xs:element name='g' type='xs:string'/>\n" +
+        "  <xs:group name='m'>\n" +
+        "    <xs:annotation>\n" +
+        "      <xs:appinfo>\n" +
+        "        <jaxb:class name='k' implClass='com.b.i'/>\n" +
+        "      </xs:appinfo>\n" +
+        "    </xs:annotation>\n" +
+        "    <xs:sequence>\n" +
+        "      <xs:element name='n' type='xs:float'/>\n" +
+        "    </xs:sequence>\n" +
+        "  </xs:group>\n" +
+        "</xs:schema>";
+  
+      JAXBParser parser = newJAXBParser();
+      InputSource isource = new InputSource(new StringReader(schemaSource));
+      isource.setSystemId("testClass1.xsd");
+      JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+      JAXBType a = (JAXBType) schema.getType(new XsQName((String) null, "a"));
+      assertNotNull(a);
+      JAXBClass jaxbClass = a.getJAXBClass();
+      assertNotNull(jaxbClass);
+      assertEquals("b", jaxbClass.getName());
+      assertEquals("com.b.c", jaxbClass.getImplClass());
+      XSParticle p1 = assertComplexContent(assertComplexType(a));
+      XSGroup group = assertGroup(p1);
+      XSParticle[] particles = group.getParticles();
+      assertEquals(2, particles.length);
+      JAXBElement f = (JAXBElement) assertElement(particles[1]);
+      jaxbClass = f.getJAXBClass();
+      assertNotNull(jaxbClass);
+      assertEquals("x", jaxbClass.getName());
+      assertNull(jaxbClass.getImplClass());
+
+
+      JAXBElement g = (JAXBElement) schema.getElement(new XsQName((String) null, "g"));
+      assertNotNull(g);
+      assertNull(g.getJAXBClass());
+
+      JAXBGroup m = (JAXBGroup) schema.getGroup(new XsQName((String) null, "m"));
+      jaxbClass = m.getJAXBClass();
+      assertNotNull(jaxbClass);
+      assertEquals("k", jaxbClass.getName());
+      assertEquals("com.b.i", jaxbClass.getImplClass());
+    }
+
+    {
+      final String schemaSource =
+        "<?xml version='1.0'?>\n" +
+        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+        "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+        "  <xs:complexType name='d'>\n" +
+        "    <xs:sequence>\n" +
+        "      <xs:element name='e'>\n" +
+        "        <xs:complexType name='a'>\n" +
+        "          <xs:annotation>\n" +
+        "            <xs:appinfo>\n" +
+        "              <jaxb:class name='b'/>\n" +
+        "            </xs:appinfo>\n" +
+        "          </xs:annotation>\n" +
+        "          <xs:sequence>\n" +
+        "            <xs:element name='x' type='xs:int'/>\n" +
+        "          </xs:sequence>\n" +
+        "          <xs:attribute name='y' type='xs:string'/>\n" +
+        "        </xs:complexType>\n" +
+        "      </xs:element>\n" +
+        "      <xs:element name='f' type='xs:string'>\n" +
+        "        <xs:annotation>\n" +
+        "          <xs:appinfo>\n" +
+        "            <jaxb:class name='x'/>\n" +
+        "          </xs:appinfo>\n" +
+        "        </xs:annotation>\n" +
+        "      </xs:element>\n" +
+        "      <xs:element name='g' type='xs:string'/>\n" +
+        "    </xs:sequence>\n" +
+        "  </xs:complexType>\n" +
+        "</xs:schema>";
+  
+      JAXBParser parser = newJAXBParser();
+      InputSource isource = new InputSource(new StringReader(schemaSource));
+      isource.setSystemId("testJAXBClass2.xsd");
+      JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+      JAXBType d = (JAXBType) schema.getType(new XsQName((String) null, "d"));
+      assertNotNull(d);
+      XSGroup dGroup = assertGroup(assertComplexContent(assertComplexType(d)));
+      assertSequence(dGroup);
+      XSParticle[] particles = dGroup.getParticles();
+      assertEquals(3, particles.length);
+      JAXBElement e = (JAXBElement) assertElement(particles[0]);
+      JAXBType a = (JAXBType) e.getType();
+      JAXBClass jaxbClass = a.getJAXBClass();
+      assertNotNull(jaxbClass);
+      assertEquals("b", jaxbClass.getName());
+      assertNull(jaxbClass.getImplClass());
+
+      JAXBElement f = (JAXBElement) assertElement(particles[1]);
+      assertEquals(new XsQName((String) null, "f"), f.getName());
+      assertNotNull(f);
+      jaxbClass = f.getJAXBClass();
+      assertNotNull(jaxbClass);
+      assertEquals("x", jaxbClass.getName());
+      assertNull(jaxbClass.getImplClass());
+
+      JAXBElement g = (JAXBElement) assertElement(particles[2]);
+      assertEquals(new XsQName((String) null, "g"), g.getName());
+      assertNotNull(g);
+      assertNull(g.getJAXBClass());
+    }
+
+    {
+      final String schemaSource =
+        "<?xml version='1.0'?>\n" +
+        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+        "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+        "  <xs:element name='x'>\n" +
+        "    <xs:annotation><xs:appinfo>\n" +
+        "      <jaxb:class name='b' implClass='com.b.c'/>\n" +
+        "    </xs:appinfo></xs:annotation>\n" +
+        "    <xs:complexType>\n" +
+        "      <xs:sequence>\n" +
+        "        <xs:element name='e'>\n" +
+        "          <xs:complexType>\n" +
+        "            <xs:sequence>\n" +
+        "              <xs:element name='x' type='xs:int'/>\n" +
+        "            </xs:sequence>\n" +
+        "            <xs:attribute name='y' type='xs:string'/>\n" +
+        "          </xs:complexType>\n" +
+        "        </xs:element>\n" +
+        "      </xs:sequence>\n" +
+        "    </xs:complexType>\n" +
+        "  </xs:element>\n" +
+        "</xs:schema>";
+  
+      JAXBParser parser = newJAXBParser();
+      InputSource isource = new InputSource(new StringReader(schemaSource));
+      isource.setSystemId("testJAXBClass3.xsd");
+      boolean haveException = false;
+      try {
+        parser.parse(isource);
+      } catch (SAXException e) {
+        haveException = true;
+        assertTrue(e.getMessage().indexOf("[JAXB 6.7.3.4]") >= 0);
+      }
+      assertTrue(haveException);
+    }
+  }
+
+  public void testJAXBProperty1() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+      "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "  <xs:complexType name='ct'>\n" +
+      "    <xs:sequence>\n" +
+      "    </xs:sequence>\n" +
+      "    <xs:attribute name='a' type='xs:dateTime'>\n" +
+      "      <xs:annotation><xs:appinfo>\n" +
+      "        <jaxb:property name='ap' collectionType='indexed'\n" +
+      "            fixedAttributeAsConstantProperty='true'\n" +
+      "            generateIsSetMethod='false'\n" +
+      "            enableFailFastCheck='1'>\n" +
+      "          <jaxb:baseType>\n" +
+      "            <jaxb:javaType name='java.math.BigDecimal'\n" +
+      "                parseMethod='javax.xml.bind.DatatypeConverter.parseInteger'\n" +
+      "                printMethod='javax.xml.bind.DatatypeConverter.printInteger'/>\n" +
+      "          </jaxb:baseType>\n" +
+      "        </jaxb:property>\n" +
+      "      </xs:appinfo></xs:annotation>\n" +
+      "    </xs:attribute>" +
+      "  </xs:complexType>\n" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testJAXBProperty1.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    XSType type = schema.getType(new XsQName((String) null, "ct"));
+    XSComplexType complexType = assertComplexType(type);
+    XSAttributable[] attributes = complexType.getAttributes();
+    assertNotNull(attributes);
+    assertEquals(1, attributes.length);
+    JAXBAttribute a1 = (JAXBAttribute) attributes[0];
+    assertEquals(XSDateTime.getInstance(), a1.getType());
+    JAXBProperty ap1 = a1.getJAXBProperty();
+    assertNotNull(ap1);
+    assertEquals("ap", ap1.getName());
+    assertEquals("indexed", ap1.getCollectionType());
+    Boolean b = ap1.isFixedAttributeAsConstantProperty();
+    assertTrue(b != null  &&  b.booleanValue());
+    b = ap1.isGenerateIsSetMethod();
+    assertTrue(b != null  &&  !b.booleanValue());
+    b = ap1.isEnableFailFastCheck();
+    assertTrue(b != null  &&  b.booleanValue());
+    JAXBProperty.BaseType apbt1 = ap1.getBaseType();
+    assertNotNull(apbt1);
+    JAXBJavaType apjt1 = apbt1.getJavaType();
+    assertNotNull(apjt1);
+    assertEquals("java.math.BigDecimal", apjt1.getName());
+    assertEquals("javax.xml.bind.DatatypeConverter.parseInteger", apjt1.getParseMethod());
+    assertEquals("javax.xml.bind.DatatypeConverter.printInteger", apjt1.getPrintMethod());
+  }
+
+  public void testJAXBProperty2() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+      "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "  <xs:attribute name='a' type='xs:dateTime'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:property name='ap' collectionType='indexed'\n" +
+      "          fixedAttributeAsConstantProperty='true'\n" +
+      "          generateIsSetMethod='false'\n" +
+      "          enableFailFastCheck='1'>\n" +
+      "        <jaxb:baseType>\n" +
+      "          <jaxb:javaType name='java.math.BigDecimal'\n" +
+      "              parseMethod='javax.xml.bind.DatatypeConverter.parseInteger'\n" +
+      "              printMethod='javax.xml.bind.DatatypeConverter.printInteger'/>\n" +
+      "        </jaxb:baseType>\n" +
+      "      </jaxb:property>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "  </xs:attribute>" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testJAXBProperty2.xsd");
+    boolean haveException = false;
+    try {
+      parser.parse(isource);
+    } catch (SAXException e) {
+      haveException = true;
+      assertTrue(e.getMessage().indexOf("[JAXB 6.8.1.2.1]") >= 0);
+    }
+    assertTrue(haveException);
+  }
+
+  public void testJAXBProperty3() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+      "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "  <xs:attribute name='a' type='xs:dateTime'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:property name='ap' collectionType='indexed'\n" +
+      "          fixedAttributeAsConstantProperty='true'\n" +
+      "          generateIsSetMethod='false'\n" +
+      "          enableFailFastCheck='1'>\n" +
+      "      </jaxb:property>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "  </xs:attribute>" +
+      "  <xs:complexType name='ct'>\n" +
+      "    <xs:sequence>\n" +
+      "    </xs:sequence>\n" +
+      "    <xs:attribute ref='a'/>\n" +
+      "  </xs:complexType>\n" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testJAXBProperty1.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    XSAttributable[] outerAttr = schema.getAttributes();
+    assertEquals(1, outerAttr.length);
+    JAXBAttribute outerA = (JAXBAttribute) outerAttr[0];
+    
+    XSType ct = schema.getType(new XsQName((String) null, "ct"));
+    XSAttributable[] attributes = assertComplexType(ct).getAttributes();
+    assertNotNull(attributes);
+    assertEquals(1, attributes.length);
+    JAXBAttribute a1 = (JAXBAttribute) attributes[0];
+    assertEquals(XSDateTime.getInstance(), a1.getType());
+    JAXBProperty ap1 = a1.getJAXBProperty();
+    assertEquals(ap1, outerA.getJAXBProperty());
+    assertNotNull(ap1);
+    assertEquals("ap", ap1.getName());
+    assertEquals("indexed", ap1.getCollectionType());
+    Boolean b = ap1.isFixedAttributeAsConstantProperty();
+    assertTrue(b != null  &&  b.booleanValue());
+    b = ap1.isGenerateIsSetMethod();
+    assertTrue(b != null  &&  !b.booleanValue());
+    b = ap1.isEnableFailFastCheck();
+    assertTrue(b != null  &&  b.booleanValue());
+    assertNull(ap1.getBaseType());
+  }
+
+  public void testJAXBJavaType1() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+      "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "  <xs:simpleType name='a'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:javaType name='java.math.BigDecimal'\n" +
+      "          hasNsContext='0'\n" +
+      "          parseMethod='javax.xml.bind.DatatypeConverter.parseInteger'\n" +
+      "          printMethod='javax.xml.bind.DatatypeConverter.printInteger'/>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:string'/>\n" +
+      "  </xs:simpleType>\n" +
+      "  <xs:element name='b'>\n" +
+      "    <xs:simpleType>\n" +
+      "      <xs:restriction base='a'/>\n" +
+      "    </xs:simpleType>\n" +
+      "  </xs:element>\n" +
+      "  <xs:element name='c'>\n" +
+      "    <xs:simpleType>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:javaType name='java.math.BigInteger'\n" +
+      "          hasNsContext='true'\n" +
+      "          parseMethod='javax.xml.bind.DatatypeConverter.parseInt'\n" +
+      "          printMethod='javax.xml.bind.DatatypeConverter.printInt'/>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "      <xs:restriction base='a'/>\n" +
+      "    </xs:simpleType>\n" +
+      "  </xs:element>\n" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testJAXBJavaType1.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    XSType a = schema.getType(new XsQName((String) null, "a"));
+    JAXBSimpleType ast = (JAXBSimpleType) assertSimpleType(a);
+    JAXBJavaType ajjt = ast.getJAXBJavaType();
+    assertEquals("java.math.BigDecimal", ajjt.getName());
+    assertEquals("javax.xml.bind.DatatypeConverter.parseInteger", ajjt.getParseMethod());
+    assertEquals("javax.xml.bind.DatatypeConverter.printInteger", ajjt.getPrintMethod());
+    assertTrue(!ajjt.hasNsContext());
+
+    XSElement b = schema.getElement(new XsQName((String) null, "b"));
+    XSType bt = b.getType();
+    JAXBSimpleType bst = (JAXBSimpleType) assertSimpleType(bt);
+    assertEquals(a, assertRestriction(bst));
+    assertNull(bst.getJAXBJavaType());
+
+    XSElement c = schema.getElement(new XsQName((String) null, "c"));
+    XSType ct = c.getType();
+    JAXBSimpleType cst = (JAXBSimpleType) assertSimpleType(ct);
+    assertEquals(a, assertRestriction(cst));
+    JAXBJavaType cjjt = cst.getJAXBJavaType();
+    assertEquals("java.math.BigInteger", cjjt.getName());
+    assertEquals("javax.xml.bind.DatatypeConverter.parseInt", cjjt.getParseMethod());
+    assertEquals("javax.xml.bind.DatatypeConverter.printInt", cjjt.getPrintMethod());
+    assertTrue(cjjt.hasNsContext());
+  }
+
+  private void checkJAXBTypesafeEnumClass1AType(XSType pType) throws SAXException {
+    JAXBSimpleType ast = (JAXBSimpleType) assertSimpleType(pType);
+    JAXBTypesafeEnumClass aec = ast.getJAXBTypesafeEnumClass();
+    assertEquals("USStateAbbr", aec.getName());
+    assertTrue(!aec.getTypesafeEnumMember().hasNext());
+    XSEnumeration[] enumerations = ast.getEnumerations();
+    assertEquals(2, enumerations.length);
+    JAXBEnumeration e1 = (JAXBEnumeration) enumerations[0];
+    assertEquals("AK", e1.getValue());
+    JAXBTypesafeEnumMember m1 = e1.getJAXBTypesafeEnumMember();
+    assertEquals("STATE_AK", m1.getName());
+    JAXBEnumeration e2 = (JAXBEnumeration) enumerations[1];
+    JAXBTypesafeEnumMember m2 = e2.getJAXBTypesafeEnumMember();
+    assertEquals("STATE_AL", m2.getName());
+    assertEquals("AL", e2.getValue());
+  }
+
+  private void checkJAXBTypesafeEnumClass1BType(XSType pType) throws SAXException {
+    JAXBSimpleType bst = (JAXBSimpleType) assertSimpleType(pType);
+    JAXBTypesafeEnumClass bec = bst.getJAXBTypesafeEnumClass();
+    assertEquals("USStateAbbr2", bec.getName());
+    Iterator iter = bec.getTypesafeEnumMember();
+    assertTrue(iter.hasNext());
+    JAXBTypesafeEnumMember iem = (JAXBTypesafeEnumMember) iter.next();
+    assertEquals("STATE2_AK", iem.getName());
+    assertEquals("AK", iem.getValue());
+    assertTrue(iter.hasNext());
+    iem = (JAXBTypesafeEnumMember) iter.next();
+    assertEquals("STATE2_AL", iem.getName());
+    assertEquals("AL", iem.getValue());
+    assertTrue(!iter.hasNext());
+    XSEnumeration[] enumerations = bst.getEnumerations();
+    assertEquals(2, enumerations.length);
+    JAXBEnumeration be1 = (JAXBEnumeration) enumerations[0];
+    assertEquals("AK", be1.getValue());
+    assertNull(be1.getJAXBTypesafeEnumMember());
+    JAXBEnumeration be2 = (JAXBEnumeration) enumerations[1];
+    assertEquals("AL", be2.getValue());
+    assertNull(be2.getJAXBTypesafeEnumMember());
+  }
+
+  public void testJAXBTypesafeEnumClass1() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
+      "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
+      "  <xs:simpleType name='a'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='USStateAbbr'/>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:NCName'>\n" +
+      "      <xs:enumeration value='AK'>\n" +
+      "        <xs:annotation><xs:appinfo>\n" +
+      "          <jaxb:typesafeEnumMember name='STATE_AK'/>\n" +
+      "        </xs:appinfo></xs:annotation>\n" +
+      "      </xs:enumeration>\n" +
+      "      <xs:enumeration value='AL'>\n" +
+      "        <xs:annotation><xs:appinfo>\n" +
+      "          <jaxb:typesafeEnumMember name='STATE_AL'/>\n" +
+      "        </xs:appinfo></xs:annotation>\n" +
+      "      </xs:enumeration>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "  <xs:simpleType name='b'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='USStateAbbr2'>\n" +
+      "        <jaxb:typesafeEnumMember name='STATE2_AK' value='AK'/>\n" +
+      "        <jaxb:typesafeEnumMember name='STATE2_AL' value='AL'/>\n" +
+      "      </jaxb:typesafeEnumClass>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:NCName'>\n" +
+      "      <xs:enumeration value='AK'/>\n" +
+      "      <xs:enumeration value='AL'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:element name='allTypes'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:sequence>\n" +
+      "        <xs:element name='aElement' type='a'/>\n" +
+      "        <xs:element name='bElement' type='b'/>\n" +
+      "      </xs:sequence>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testJAXBJavaTypesafeEnumClass1.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    XSType a = schema.getType(new XsQName((String) null, "a"));
+    checkJAXBTypesafeEnumClass1AType(a);
+
+    XSType b = schema.getType(new XsQName((String) null, "b"));
+    checkJAXBTypesafeEnumClass1BType(b);
+
+    XSElement[] elements = schema.getElements();
+    assertEquals(1, elements.length);
+    XSElement allTypesElement = elements[0];
+    XSGroup allTypesGroup = assertGroup(assertComplexContent(assertComplexType(allTypesElement.getType())));
+    assertSequence(allTypesGroup);
+    XSParticle[] allTypesChilds = allTypesGroup.getParticles();
+    assertEquals(2, allTypesChilds.length);
+    checkJAXBTypesafeEnumClass1AType(assertElement(allTypesChilds[0]).getType());
+    checkJAXBTypesafeEnumClass1BType(assertElement(allTypesChilds[1]).getType());    
+  }
+
+  public void testJAXBTypesafeEnumClass2() throws Exception {
+    final String schemaSource =
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xml:lang='EN'\n" +
+      "    targetNamespace='http://ws.apache.org/jaxme/examples/misc/enumeration'\n" +
+      "    xmlns:ex='http://ws.apache.org/jaxme/examples/misc/enumeration'\n" +
+      "    xmlns:jaxb='http://java.sun.com/xml/ns/jaxb'\n" +
+      "    elementFormDefault='qualified'\n" +
+      "    attributeFormDefault='unqualified'>\n" +
+      "  <xs:annotation>\n" +
+      "    <xs:documentation>\n" +
+      "      Demonstration of a complex type with all sorts of enumeration values\n" +
+      "    </xs:documentation>\n" +
+      "    <xs:appinfo>\n" +
+      "      <jaxb:globalBindings typesafeEnumBase='xs:string xs:int xs:long xs:short xs:double xs:float'/>\n" +
+      "    </xs:appinfo>\n" +
+      "  </xs:annotation>\n" +
+      "\n" +
+      "  <!-- In this example the typesafeEnumMember instances are part of the\n" +
+      "       typesafeEnumClass. -->\n" +
+      "  <xs:simpleType name='StringType'>\n" +
+      "    <xs:annotation>\n" +
+      "      <xs:appinfo>\n" +
+      "        <jaxb:typesafeEnumClass name='MyStringTypeClass'>\n" +
+      "          <jaxb:typesafeEnumMember name='FOO' value='FOO'/>\n" +
+      "          <jaxb:typesafeEnumMember name='BAR' value='BAR'/>\n" +
+      "        </jaxb:typesafeEnumClass>\n" +
+      "      </xs:appinfo>\n" +
+      "    </xs:annotation>\n" +
+      "    <xs:restriction base='xs:string'>\n" +
+      "      <xs:enumeration value='FOO'/>\n" +
+      "      <xs:enumeration value='BAR'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <!-- Here's another case: The typesafeEnumMember instances are part\n" +
+      "       of their respective values. Choose your own style. -->\n" +
+      "  <xs:simpleType name='IntType'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='MyIntTypeClass'/>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:int'>\n" +
+      "      <xs:enumeration value='3'>\n" +
+      "        <xs:annotation><xs:appinfo>\n" +
+      "          <jaxb:typesafeEnumMember name='INT3'/>\n" +
+      "        </xs:appinfo></xs:annotation>\n" +
+      "      </xs:enumeration>\n" +
+      "      <xs:enumeration value='0'>\n" +
+      "        <xs:annotation><xs:appinfo>\n" +
+      "          <jaxb:typesafeEnumMember name='INT0'/>\n" +
+      "        </xs:appinfo></xs:annotation>\n" +
+      "      </xs:enumeration>\n" +
+      "      <xs:enumeration value='-7'>\n" +
+      "        <xs:annotation><xs:appinfo>\n" +
+      "          <jaxb:typesafeEnumMember name='INT_7'/>\n" +
+      "        </xs:appinfo></xs:annotation>\n" +
+      "      </xs:enumeration>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <!-- I personally prefer the former style, for shortness. So we\n" +
+      "       revert to this style. -->\n" +
+      "  <xs:simpleType name='LongType'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='MyLongTypeClass'>\n" +
+      "        <jaxb:typesafeEnumMember name='LONG_POSITIVE' value='987298379879887'/>\n" +
+      "        <jaxb:typesafeEnumMember name='LONG_ZERO' value='0'/>\n" +
+      "        <jaxb:typesafeEnumMember name='LONG_NEGATIVE' value='-23987982739273989'/>\n" +
+      "      </jaxb:typesafeEnumClass>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:long'>\n" +
+      "      <xs:enumeration value='987298379879887'/>\n" +
+      "      <xs:enumeration value='0'/>\n" +
+      "      <xs:enumeration value='-23987982739273989'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:simpleType name='ShortType'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='MyShortTypeClass'>\n" +
+      "        <jaxb:typesafeEnumMember name='SHORT_POSITIVE' value='3468'/>\n" +
+      "        <jaxb:typesafeEnumMember name='SHORT_ZERO' value='0'/>\n" +
+      "        <jaxb:typesafeEnumMember name='SHORT_NEGATIVE' value='-23'/>\n" +
+      "      </jaxb:typesafeEnumClass>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:short'>\n" +
+      "      <xs:enumeration value='3468'/>\n" +
+      "      <xs:enumeration value='0'/>\n" +
+      "      <xs:enumeration value='-23'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:simpleType name='DoubleType'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='MyDoubleTypeClass'>\n" +
+      "        <jaxb:typesafeEnumMember name='DOUBLE_POSITIVE' value='3249239847982.234'/>\n" +
+      "        <jaxb:typesafeEnumMember name='DOUBLE_ZERO' value='0'/>\n" +
+      "        <jaxb:typesafeEnumMember name='DOUBLE_NEGATIVE' value='-324234.234'/>\n" +
+      "      </jaxb:typesafeEnumClass>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:double'>\n" +
+      "      <xs:enumeration value='3249239847982.234'/>\n" +
+      "      <xs:enumeration value='0'/>\n" +
+      "      <xs:enumeration value='-324234.234'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:simpleType name='FloatType'>\n" +
+      "    <xs:annotation><xs:appinfo>\n" +
+      "      <jaxb:typesafeEnumClass name='MyFloatTypeClass'>\n" +
+      "        <jaxb:typesafeEnumMember name='FLOAT_POSITIVE' value='47982.234'/>\n" +
+      "        <jaxb:typesafeEnumMember name='FLOAT_ZERO' value='0'/>\n" +
+      "        <jaxb:typesafeEnumMember name='FLOAT_NEGATIVE' value='-24234.234'/>\n" +
+      "      </jaxb:typesafeEnumClass>\n" +
+      "    </xs:appinfo></xs:annotation>\n" +
+      "    <xs:restriction base='xs:float'>\n" +
+      "      <xs:enumeration value='47982.234'/>\n" +
+      "      <xs:enumeration value='0'/>\n" +
+      "      <xs:enumeration value='-24234.234'/>\n" +
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "\n" +
+      "  <xs:complexType name='AllSimpleTypes'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element name='StringElem' type='ex:StringType'/>\n" +
+      "      <xs:element name='IntElem' type='ex:IntType'/>\n" +
+      "      <xs:element name='LongElem' type='ex:LongType'/>\n" +
+      "      <xs:element name='ShortElem' type='ex:ShortType'/>\n" +
+      "      <xs:element name='DoubleElem' type='ex:DoubleType'/>\n" +
+      "      <xs:element name='FloatElem' type='ex:FloatType'/>\n" +
+      "      <xs:element name='DateTimeElem' minOccurs='0'>\n" +
+      "        <xs:simpleType>\n" +
+      "          <xs:restriction base='xs:dateTime'>\n" +
+      "            <xs:enumeration value='2002-12-17T12:23:11'/>\n" +
+      "            <xs:enumeration value='2002-12-16T12:00:11'/>\n" +
+      "          </xs:restriction>\n" +
+      "        </xs:simpleType>\n" +
+      "      </xs:element>\n" +
+      "      <xs:element name='DateElem' minOccurs='0'>\n" +
+      "        <xs:simpleType>\n" +
+      "          <xs:restriction base='xs:date'>\n" +
+      "            <xs:enumeration value='2002-12-17'/>\n" +
+      "            <xs:enumeration value='2002-12-16'/>\n" +
+      "          </xs:restriction>\n" +
+      "        </xs:simpleType>\n" +
+      "      </xs:element>\n" +
+      "      <xs:element name='TimeElem' minOccurs='0'>\n" +
+      "        <xs:simpleType>\n" +
+      "          <xs:restriction base='xs:time'>\n" +
+      "            <xs:enumeration value='12:23:11'/>\n" +
+      "            <xs:enumeration value='12:00:11'/>\n" +
+      "          </xs:restriction>\n" +
+      "        </xs:simpleType>\n" +
+      "      </xs:element>\n" +
+      "    </xs:sequence>\n" +
+      "  </xs:complexType>\n" +
+      "\n" +
+      "  <xs:element name='AllTypesElement'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:sequence>\n" +
+      "        <xs:element type='ex:AllSimpleTypes' name='AllSimpleTypesElement'/>\n" +
+      "      </xs:sequence>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testJAXBJavaTypesafeEnumClass2.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+
+    XSType[] types = schema.getTypes();
+    assertEquals(7, types.length);
+
+
+    XSType stringType = types[0];
+    checkJAXBTypesafeEnumClass2StringType(stringType);
+
+    XSElement[] elements = schema.getElements();
+    assertEquals(1, elements.length);
+
+    XSElement allTypesElement = elements[0];
+    XSParticle allTypesElementParticle = assertComplexContent(assertComplexType(allTypesElement.getType()));
+    XSGroup group = allTypesElementParticle.getGroup();
+    assertSequence(group);
+    XSParticle[] allTypesElementsChilds = group.getParticles();
+    assertEquals(1, allTypesElementsChilds.length);
+    XSElement allSimpleTypesElement = assertElement(allTypesElementsChilds[0]);
+    XSParticle allSimpleTypesElementParticle = assertComplexContent(assertComplexType(allSimpleTypesElement.getType()));
+    XSGroup allSimpleTypesElementGroup = allSimpleTypesElementParticle.getGroup();
+    assertSequence(allSimpleTypesElementGroup);
+    XSParticle[] allSimpleTypesElementChilds = allSimpleTypesElementGroup.getParticles();
+    assertEquals(9, allSimpleTypesElementChilds.length);
+
+    XSElement stringTypeElement = assertElement(allSimpleTypesElementChilds[0]);
+    checkJAXBTypesafeEnumClass2StringType(stringTypeElement.getType());
+  }
+
+  private void checkJAXBTypesafeEnumClass2StringType(XSType pType) throws SAXException {
+    XSSimpleType stStringType = assertSimpleType(pType);
+    assertEquals(XSString.getInstance(), assertRestriction(stStringType));
+    assertTrue(stStringType instanceof JAXBSimpleType);
+    JAXBSimpleType jaxbStringType = (JAXBSimpleType) stStringType;
+    JAXBTypesafeEnumClass typesafeEnumClass = jaxbStringType.getJAXBTypesafeEnumClass();
+    assertNotNull(typesafeEnumClass);
+    assertEquals("MyStringTypeClass", typesafeEnumClass.getName());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JiraTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JiraTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/JiraTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,207 @@
+package org.apache.ws.jaxme.xs.junit;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.types.XSID;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/** Collection of schemas from Jira.
+ */
+public class JiraTest extends ParserTestBase {
+	/** Creates a new instance with the given name.
+	 */
+    public JiraTest(String pName) {
+    	super(pName);
+    }
+
+    private XSSchema parse(String pSchema, String pName)
+            throws ParserConfigurationException, SAXException, IOException {
+        InputSource isource = new InputSource(new StringReader(pSchema));
+        isource.setSystemId(pName);
+        XSParser parser = new XSParser();
+        parser.setValidating(false);
+        return parser.parse(isource);
+    }
+
+    /** Test for JAXME-34 in Jira.
+     */
+    public void testJira34() throws Exception {
+    	final String schemaSpec =
+            "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n"
+          + "  <xs:complexType name='mixedType' mixed='true'>\n"
+          + "    <xs:attribute name='foo' type='xs:string'/>\n"
+          + "  </xs:complexType>\n"
+          + "</xs:schema>";
+        XSSchema schema = parse(schemaSpec, "jira34.xsd");
+        XSType[] types = schema.getTypes();
+        assertEquals(1, types.length);
+        XSComplexType ct = assertComplexType(types[0]);
+        assertTrue(ct.isMixed());
+    }
+
+    /** Test for JAXME-42 in Jira.
+     */
+    public void testJira42() throws Exception {
+    	XsDateTimeFormat f = new XsDateTimeFormat();
+        Calendar cal = (Calendar) f.parseObject("2004-10-15T13:00:00Z");
+        assertEquals(2004, cal.get(Calendar.YEAR));
+        assertEquals(9, cal.get(Calendar.MONTH));
+        assertEquals(15, cal.get(Calendar.DAY_OF_MONTH));
+        assertEquals(13, cal.get(Calendar.HOUR_OF_DAY));
+        assertEquals(0, cal.get(Calendar.MINUTE));
+        assertEquals(0, cal.get(Calendar.SECOND));
+        assertEquals(0, cal.get(Calendar.MILLISECOND));
+        assertEquals(TimeZone.getTimeZone("GMT"), cal.getTimeZone());
+
+        String s = f.format(cal);
+        assertEquals("2004-10-15T13:00:00Z", s);
+    }
+
+    /** Test for JAXME-44 in Jira.
+     */
+    public void testJira44() throws Exception {
+        final String schemaSpec =
+            "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n"
+            + "  <xs:simpleType name='threeOrFour'>\n"
+            + "    <xs:restriction base='xs:string'>\n"
+            + "      <xs:enumeration value='3'/>\n"
+            + "      <xs:enumeration value='4'/>\n"
+            + "    </xs:restriction>\n"
+            + "  </xs:simpleType>\n"
+            + "\n"
+            + "  <xs:complexType name='outerType1'>\n"
+            + "    <xs:simpleContent>\n"
+            + "      <xs:extension base='threeOrFour'>\n"
+            + "        <xs:attribute name='isOctal' type='xs:boolean'/>\n"
+            + "      </xs:extension>"
+            + "    </xs:simpleContent>\n"
+            + "  </xs:complexType>\n"
+            + "\n"
+            + "  <xs:complexType name='outerType2'>\n"
+            + "    <xs:simpleContent>\n"
+            + "      <xs:restriction base='outerType1'>\n"
+            + "        <xs:enumeration value='4'/>\n"
+            + "      </xs:restriction>\n"
+            + "    </xs:simpleContent>\n"
+            + "  </xs:complexType>\n"
+            + "</xs:schema>";
+
+        XSSchema schema = parse(schemaSpec, "jira44.xsd");
+        XSType[] types = schema.getTypes();
+        assertEquals(3, types.length);
+        XSType threeOrFourType = types[0];
+        XSSimpleType threeOrFourSimpleType = assertSimpleType(threeOrFourType);
+        XSType restrictedType = assertRestriction(threeOrFourSimpleType);
+        XSEnumeration[] threeOrFourTypeEnums = threeOrFourSimpleType.getEnumerations();
+        assertEquals(2, threeOrFourTypeEnums.length);
+        assertEquals("3", threeOrFourTypeEnums[0].getValue());
+        assertEquals("4", threeOrFourTypeEnums[1].getValue());
+        assertEquals(XSString.getInstance(), restrictedType);
+        XSType outerType1 = types[1];
+        assertEquals(new XsQName((XsAnyURI) null, "outerType1"), outerType1.getName());
+        XSComplexType outerType1complexType = assertComplexType(outerType1);
+        XSSimpleContentType outerType1simpleContentType = assertSimpleContent(outerType1complexType);
+        XSType outerType1contentType = outerType1simpleContentType.getType();
+        assertEquals(threeOrFourType, outerType1contentType);
+        XSType outerType2 = types[2];
+        assertEquals(new XsQName((XsAnyURI) null, "outerType2"), outerType2.getName());
+        XSComplexType outerType2complexType = assertComplexType(outerType2);
+        XSSimpleContentType outerType2simpleContentType = assertSimpleContent(outerType2complexType);
+        XSType outerType2contentType = outerType2simpleContentType.getType();
+        assertEquals(threeOrFourType, assertRestriction(outerType2contentType.getSimpleType()));
+        XSEnumeration[] outerType2Enums = outerType2contentType.getSimpleType().getEnumerations();
+        assertEquals(1, outerType2Enums.length);
+        assertEquals("4", outerType2Enums[0].getValue());
+    }
+
+    /** Test for JAXME-46 in Jira.
+     */
+    public void testJira46() throws Exception {
+        final String uri = "http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/";
+        final String schemaSpec =
+            "<xs:schema targetNamespace='" + uri + "'\n" +
+            "    xmlns:eGov_IT='" + uri + "'\n" +
+            "    xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+            "  <xs:element name='Riferimento'>\n" +
+            "    <xs:complexType>\n" +
+            "      <xs:sequence/>\n" +
+            "      <xs:attribute ref='eGov_IT:id' use='required'/>\n" +
+            "    </xs:complexType>\n" +
+            "  </xs:element>\n" +
+            "  <xs:attribute name='id' type='xs:ID'/>\n" +
+            "</xs:schema>\n";
+        XSSchema schema = parse(schemaSpec, "jira46.xsd");
+        XSAttribute[] attrs = schema.getAttributes();
+        assertEquals(1, attrs.length);
+        XSAttribute idAttr = attrs[0];
+        assertEquals(new XsQName(uri, "id"), idAttr.getName());
+        assertEquals(XSID.getInstance(), idAttr.getType());
+        assertTrue(idAttr.isOptional());
+        XSElement[] elements = schema.getElements();
+        assertEquals(1, elements.length);
+        XSElement rifElem = elements[0];
+        XSComplexType ct = assertComplexType(rifElem.getType());
+        XSAttributable[] rifAttrs = ct.getAttributes();
+        assertEquals(1, rifAttrs.length);
+        XSAttribute idRef = (XSAttribute) rifAttrs[0];
+        assertFalse(idRef.equals(idAttr));
+        assertEquals(new XsQName(uri, "id"), idAttr.getName());
+        assertEquals(XSID.getInstance(), idAttr.getType());
+        assertFalse(idRef.isOptional());
+    }
+
+	/** Test for <a href="http://issues.apache.org/jira/browse/JAXME-63">JAXME-63</a>.
+	 */
+	public void testJAXME63() throws Exception {
+		final String xml =
+			"<xs:schema\n"
+			+ "    xmlns:xs='http://www.w3.org/2001/XMLSchema'\n"
+			+ "    elementFormDefault='qualified'>\n"
+			+ "  <xs:group name='params'>\n"
+			+ "    <xs:choice>\n"
+			+ "      <xs:element name='string' type='xs:string'/>\n"
+			+ "      <xs:element name='int' type='xs:int'/>\n"
+			+ "      <xs:element name='boolean' type='xs:boolean'/>\n"
+			+ "    </xs:choice>\n"
+			+ "  </xs:group>\n"
+			+ "  <xs:element name='call'>\n"
+			+ "    <xs:complexType>\n"
+			+ "      <xs:group ref='params' maxOccurs='unbounded'/>\n"
+			+ "    </xs:complexType>\n"
+			+ "  </xs:element>\n"
+			+ "</xs:schema>";
+        XSSchema schema = parse(xml, "jaxme63.xsd");
+        XSElement[] elements = schema.getElements();
+        assertEquals(1, elements.length);
+        XSElement call = elements[0];
+        assertEquals(new XsQName((String) null, "call"), call.getName());
+        XSComplexType type = assertComplexType(call.getType());
+        XSParticle particle = assertComplexContent(type);
+        assertTrue(particle.isGroup());
+        assertChoice(particle.getGroup());
+        assertEquals(1, particle.getMinOccurs());
+        assertEquals(-1, particle.getMaxOccurs());
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/NISTTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/NISTTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/NISTTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+/** <p>A test case running the NIST test suite. To invoke
+ * the test suite, set the system property
+ * <code>NISTXMLSchemaTestSuite.location</code>.</p>
+ * <p>The NIST test suite is delivered as a ZIP file
+ * <a href="http://xw2k.sdct.itl.nist.gov/brady/schema/NISTSchemaTests.zip">NISTSchemaTests.zip</a>.
+ * For example, if you have extracted this file into
+ * <code>c:\jwi\Workspace\ws-jaxme\Nist</code>, then you
+ * should set the property to
+ * <code>file:///c:/jwi/Workspace/ws-jaxme/Nist/</code>.
+ * (Note the trailing slash!)</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class NISTTest extends TestCase {
+    private int numOk;
+    private int numFailed;
+    private boolean verbose;
+
+    public NISTTest(String pName) {
+        super(pName);
+    }
+
+    public void setUp() {
+        numOk = numFailed = 0;
+        verbose = Boolean.valueOf(System.getProperty("verbose")).booleanValue();
+    }
+
+    protected void log(String pMessage) {
+        if (verbose) {
+            System.out.println(pMessage);
+        }
+    }
+
+    public DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(false);
+        dbf.setNamespaceAware(true);
+        return dbf.newDocumentBuilder();
+    }
+
+    protected void runTest(URL pBaseURL, String pName, String pHref) throws Exception {
+        URL url = new URL(pBaseURL, pHref);
+        XSParser parser = new XSParser();
+        parser.setValidating(false);
+        InputSource isource = new InputSource(url.openStream());
+        isource.setSystemId(url.toString());
+        String result;
+        try {
+            parser.parse(isource);
+            ++numOk;
+            result = "Ok";
+        } catch (Exception e) {
+            ++numFailed;
+            result = e.getMessage();
+        }
+        log("Running test " + pName + " with URL " + url+ ": " + result);
+    }
+
+    protected void runTests(URL pBaseURL, String pName, String pHref) throws Exception {
+        URL url = new URL(pBaseURL, pHref);
+        InputSource isource = new InputSource(url.openStream());
+        isource.setSystemId(url.toString());
+        Document document = getDocumentBuilder().parse(isource);
+        NodeList schemas = document.getElementsByTagNameNS(null, "Schema");
+        for (int i = 0;  i < schemas.getLength();  i++) {
+            Element schema = (Element) schemas.item(i);
+            runTest(url, schema.getAttribute("name"), schema.getAttribute("href"));
+        }
+    }
+
+    public void testNIST() throws Exception {
+        String p = "NISTXMLSchemaTestSuite.location";
+        String v = System.getProperty(p);
+        if (v == null  ||  v.length() == 0) {
+            System.out.println("System property " + p + " is not set, skipping this test.");
+            return;
+        }
+
+        URL url = new URL(v);
+        url = new URL(url, "NISTXMLSchemaTestSuite.xml");
+        InputSource isource = new InputSource(url.openStream());
+        isource.setSystemId(url.toString());
+        Document document = getDocumentBuilder().parse(isource);
+        NodeList links = document.getElementsByTagNameNS(null, "Link");
+        for (int i = 0;  i < links.getLength();  i++) {
+            Element link = (Element) links.item(i);
+            runTests(url, link.getAttribute("name"), link.getAttribute("href"));
+        }
+        System.out.println("Result: Passed = " + numOk + ", Failed = " + numFailed);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,1554 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAppinfo;
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSAttribute;
+import org.apache.ws.jaxme.xs.XSAttributeGroup;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSElementOrAttrRef;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSIdentityConstraint;
+import org.apache.ws.jaxme.xs.XSKeyRef;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSModelGroup;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+import org.apache.ws.jaxme.xs.XSWildcard;
+import org.apache.ws.jaxme.xs.jaxb.JAXBGlobalBindings;
+import org.apache.ws.jaxme.xs.jaxb.JAXBSchema;
+import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser;
+import org.apache.ws.jaxme.xs.types.XSBoolean;
+import org.apache.ws.jaxme.xs.types.XSDate;
+import org.apache.ws.jaxme.xs.types.XSDateTime;
+import org.apache.ws.jaxme.xs.types.XSDecimal;
+import org.apache.ws.jaxme.xs.types.XSDouble;
+import org.apache.ws.jaxme.xs.types.XSFloat;
+import org.apache.ws.jaxme.xs.types.XSID;
+import org.apache.ws.jaxme.xs.types.XSInt;
+import org.apache.ws.jaxme.xs.types.XSNMToken;
+import org.apache.ws.jaxme.xs.types.XSPositiveInteger;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>Implements some basic tests for the Schema generator.</p>
+ */
+public class ParserTest extends ParserTestBase {
+	/** <p>Creates a new instance of <code>ParserTest</code> named
+	 * <code>pName</code>.</p>
+	 * @param pName The test name
+	 */
+	public ParserTest(String pName) { super(pName); }
+
+	protected void testSimpleTypes(XSParser pParser) throws SAXException, IOException, ParserConfigurationException {
+		final String schemaSource =
+			"<?xml version='1.0'?>\n" +
+			"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+			"  <xs:simpleType name='a'>\n" +
+			"    <xs:restriction base='xs:string'>\n" +
+			"      <xs:minLength value='3'/>\n" +
+			"    </xs:restriction>\n" +
+			"  </xs:simpleType>\n" +
+			"\n" +
+			"  <xs:simpleType name='b'>\n" +
+			"    <xs:list itemType='xs:int'/>\n" +
+			"  </xs:simpleType>\n" +
+			"\n" +
+			"  <xs:simpleType name='c'>\n" +
+			"    <xs:union memberTypes='a b'/>\n" +
+			"  </xs:simpleType>\n" +
+			"</xs:schema>\n";
+		
+		InputSource isource = new InputSource(new StringReader(schemaSource));
+		isource.setSystemId("testSimpleTypes.xsd");
+		XSSchema schema = pParser.parse(isource);
+		
+		XSType[] types = schema.getTypes();
+		assertEquals(3, types.length);
+		
+		XSType t1 = types[0];
+		assertEquals(new XsQName((String) null, "a"), t1.getName());
+		XSSimpleType st1 = assertSimpleType(t1);
+		assertAtomicType(st1);
+		XSType t1_1 = assertRestriction(st1);
+		assertEquals(XSString.getInstance(), t1_1);
+		
+		XSType t2 = types[1];
+		assertEquals(new XsQName((String) null, "b"), t2.getName());
+		XSSimpleType st2 = assertSimpleType(t2);
+		XSListType lt = assertListType(st2);
+		XSType it = lt.getItemType();
+		assertNotNull(it);
+		assertEquals(XSInt.getInstance(), it);
+		XSSimpleType it2 = assertSimpleType(it);
+		assertAtomicType(it2);
+		
+		XSType t3 = types[2];
+		assertEquals(new XsQName((String) null, "c"), t3.getName());
+		XSSimpleType st3 = assertSimpleType(t3);
+		XSUnionType ut3 = assertUnionType(st3);
+		XSType[] memberTypes = ut3.getMemberTypes();
+		assertEquals(2, memberTypes.length);
+		XSType mt3_1 = memberTypes[0];
+		assertEquals(mt3_1, t1);
+		XSType mt3_2 = memberTypes[1];
+		assertEquals(mt3_2, t2);
+	}
+	
+	/** <p>Tests whether the basic simple types can be parsed:
+	 * Atomic, List, and Union.</p>
+	 * @throws Exception
+	 */
+	public void testSimpleTypes() throws Exception {
+		XSParser xsParser = newXSParser();
+		testSimpleTypes(xsParser);
+		JAXBParser jaxbParser = newJAXBParser();
+		testSimpleTypes(jaxbParser);
+	}
+
+  protected void testAttributes(XSParser pParser) throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:attribute name='a' type='xs:string'/>\n" +
+      "\n" +
+      "  <xs:attribute name='b'>\n" +
+      "    <xs:simpleType>\n" +
+      "      <xs:restriction base='xs:int'/>\n" +
+      "    </xs:simpleType>\n" +
+      "  </xs:attribute>\n" +
+      "\n" +
+      "  <xs:attribute name='c' type='xs:int'/>\n" +
+      "</xs:schema>\n";
+
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testAttributes.xsd");
+    XSSchema schema = pParser.parse(isource);
+
+    XSAttributable[] attr = schema.getAttributes();
+    assertEquals(3, attr.length);
+
+    XSAttribute attr1 = (XSAttribute) attr[0];
+    assertTrue(attr1.isGlobal());
+    assertEquals(new XsQName((String) null, "a"), attr1.getName());
+    XSType t1 = attr1.getType();
+    assertEquals(XSString.getInstance(), t1);
+    XSSimpleType st1 = assertSimpleType(attr1.getType());
+    assertAtomicType(st1);
+
+    XSAttribute attr2 = (XSAttribute) attr[1];
+    assertTrue(attr2.isGlobal());
+    assertEquals(new XsQName((String) null, "b"), attr2.getName());
+    XSType t2 = attr2.getType();
+    assertTrue(!XSInt.getInstance().equals(t2));
+    XSType t2_1 = assertRestriction(assertSimpleType(t2));
+    assertEquals(XSInt.getInstance(), t2_1);
+    XSSimpleType st2 = assertSimpleType(t2);
+    assertAtomicType(st2);
+
+    XSAttribute attr3 = (XSAttribute) attr[2];
+    assertTrue(attr3.isGlobal());
+    assertEquals(new XsQName((String) null, "c"), attr3.getName());
+    XSType t3 = attr3.getType();
+    assertEquals(XSInt.getInstance(), t3);
+    XSSimpleType st3 = assertSimpleType(t3);
+    assertAtomicType(st3);
+  }
+
+  /** Tests typical attribute uses.
+   */
+  public void testAttributes() throws Exception {
+    XSParser xsParser = newXSParser();
+    testAttributes(xsParser);
+    JAXBParser jaxbParser = newJAXBParser();
+    testAttributes(jaxbParser);
+  }
+
+  protected void testAttributeGroups(XSParser pParser) throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:attribute name='a' type='xs:string'/>\n" +
+      "  <xs:attribute name='b' type='xs:int'/>\n" +
+      "\n" +
+      "  <xs:attributeGroup name='c'>\n" +
+      "    <xs:attribute name='d' type='xs:dateTime'/>\n" +
+      "    <xs:attribute name='e' type='xs:float'/>\n" +
+      "    <xs:attribute ref='a'/>\n" +
+      "  </xs:attributeGroup>\n" +
+      "\n" +
+      "  <xs:attributeGroup name='f'>\n" +
+      "    <xs:attribute name='g' type='xs:double'/>\n" +
+      "    <xs:attributeGroup ref='c'/>\n" +
+      "    <xs:attribute ref='b'/>\n" +
+      "  </xs:attributeGroup>\n" +
+      "</xs:schema>\n";
+
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testAttributeGroups.xsd");
+    XSSchema schema = pParser.parse(isource);
+
+    XSAttributeGroup[] groups = schema.getAttributeGroups();
+    assertNotNull(groups);
+    assertEquals(2, groups.length);
+
+    XSAttributeGroup ag1 = groups[0];
+    assertEquals(new XsQName((String) null, "c"), ag1.getName());
+    XSAttributable[] attr1 = ag1.getAttributes();
+    assertEquals(3, attr1.length);
+    XSAttribute attr1_1 = (XSAttribute) attr1[0];
+    assertEquals(new XsQName((String) null, "d"), attr1_1.getName());
+    assertEquals(XSDateTime.getInstance(), attr1_1.getType());
+    XSAttribute attr1_2 = (XSAttribute) attr1[1];
+    assertEquals(new XsQName((String) null, "e"), attr1_2.getName());
+    assertEquals(XSFloat.getInstance(), attr1_2.getType());
+    XSAttribute attr1_3 = (XSAttribute) attr1[2];
+    assertEquals(new XsQName((String) null, "a"), attr1_3.getName());
+    assertEquals(XSString.getInstance(), attr1_3.getType());
+
+    XSAttributeGroup ag2 = groups[1];
+    assertEquals(new XsQName((String) null, "f"), ag2.getName());
+    XSAttributable[] attr2 = ag2.getAttributes();
+    assertEquals(5, attr2.length);
+    XSAttribute attr2_1 = (XSAttribute) attr2[0];
+    assertEquals(new XsQName((String) null, "g"), attr2_1.getName());
+    assertEquals(XSDouble.getInstance(), attr2_1.getType());
+    XSAttribute attr2_2 = (XSAttribute) attr2[1];
+    assertEquals(new XsQName((String) null, "d"), attr2_2.getName());
+    assertEquals(XSDateTime.getInstance(), attr2_2.getType());
+    XSAttribute attr2_3 = (XSAttribute) attr2[2];
+    assertEquals(new XsQName((String) null, "e"), attr2_3.getName());
+    assertEquals(XSFloat.getInstance(), attr2_3.getType());
+    XSAttribute attr2_4 = (XSAttribute) attr2[3];
+    assertEquals(new XsQName((String) null, "a"), attr2_4.getName());
+    assertEquals(XSString.getInstance(), attr2_4.getType());
+    XSAttribute attr2_5 = (XSAttribute) attr2[4];
+    assertEquals(new XsQName((String) null, "b"), attr2_5.getName());
+    assertEquals(XSInt.getInstance(), attr2_5.getType());
+  }
+
+  /** Tests typical attribute group uses.
+   */
+  public void testAttributeGroups() throws Exception {
+    XSParser xsParser = newXSParser();
+    testAttributeGroups(xsParser);
+    JAXBParser jaxbParser = newJAXBParser();
+    testAttributeGroups(jaxbParser);
+  }
+
+  protected void testElements(XSParser pParser) throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:attribute name='id' type='xs:ID'/>\n" +
+      "\n" +
+      "  <xs:element name='a' type='xs:string'/>\n" +
+      "\n" +
+      "  <xs:element name='b'>\n" +
+      "    <xs:simpleType>\n" +
+      "      <xs:restriction base='xs:float'/>\n" +
+      "    </xs:simpleType>\n" +
+      "  </xs:element>\n" +
+      "\n" +
+      "  <xs:element name='c'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:annotation>\n" +
+      "        <xs:documentation>\n" +
+      "          The type of 'c'.\n" +
+      "        </xs:documentation>\n" +
+      "      </xs:annotation>\n" +
+      "      <xs:sequence>\n" +
+      "        <xs:element ref='a'/>\n" +
+      "        <xs:element name='d' type='xs:double' minOccurs='0'>\n" +
+      "          <xs:annotation>\n" +
+      "            <xs:documentation>\n" +
+      "              The element 'd'.\n" +
+      "            </xs:documentation>\n" +
+      "          </xs:annotation>\n" +
+      "        </xs:element>\n" +
+      "      </xs:sequence>\n" +
+      "      <xs:attribute name='e' type='xs:int'>\n" +
+      "        <xs:annotation>\n" +
+      "          <xs:documentation>\n" +
+      "            The attribute 'e'.\n" +
+      "          </xs:documentation>\n" +
+      "        </xs:annotation>\n" +
+      "      </xs:attribute>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "\n" +
+      "  <xs:element name='f'>\n" +
+      "    <xs:complexType>\n" +
+      "      <xs:simpleContent>\n" +
+      "        <xs:extension base='xs:int'>\n" +
+      "          <xs:attribute name='g' type='xs:boolean'/>\n" +
+      "          <xs:attribute ref='id'/>\n" +
+      "        </xs:extension>\n" +
+      "      </xs:simpleContent>\n" +
+      "    </xs:complexType>\n" +
+      "  </xs:element>\n" +
+      "</xs:schema>\n";
+
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testElements.xsd");
+    XSSchema schema = pParser.parse(isource);
+
+    XSObject[] elements = schema.getElements();
+    assertEquals(4, elements.length);
+
+    XSElement e1 = (XSElement) elements[0];
+    assertEquals(new XsQName((String) null, "a"), e1.getName());
+    XSType t1 = e1.getType();
+    assertEquals(XSString.getInstance(), t1);
+
+    XSElement e2 = (XSElement) elements[1];
+    assertEquals(new XsQName((String) null, "b"), e2.getName());
+    XSType t2 = e2.getType();
+    assertEquals(XSFloat.getInstance(), assertRestriction(assertSimpleType(t2)));
+
+    XSElement e3 = (XSElement) elements[2];
+    assertEquals(new XsQName((String) null, "c"), e3.getName());
+    XSComplexType ct3 = assertComplexType(e3.getType());
+    XSParticle p3 = assertComplexContent(ct3);
+    XSGroup g3 = assertGroup(p3);
+    XSParticle[] particles3 = g3.getParticles();
+    assertEquals(2, particles3.length);
+    XSElement e3_1 = assertElement(particles3[0]);
+    assertEquals(new XsQName((String) null, "a"), e3_1.getName());
+    assertEquals(e1.getType(), e3_1.getType());
+    XSParticle p3_2 = particles3[1];
+    assertEquals(0, p3_2.getMinOccurs());
+    XSElement e3_2 = assertElement(p3_2);
+    assertEquals(new XsQName((String) null, "d"), e3_2.getName());
+    assertEquals(XSDouble.getInstance(), e3_2.getType());
+    XSAttributable[] a3 = ct3.getAttributes();
+    assertEquals(1, a3.length);
+    XSAttribute a3_1 = (XSAttribute) a3[0];
+    assertEquals(new XsQName((String) null, "e"), a3_1.getName());
+    assertEquals(XSInt.getInstance(), a3_1.getType());
+
+    XSElement e4 = (XSElement) elements[3];
+    assertEquals(new XsQName((String) null, "f"), e4.getName());
+    XSComplexType ct4 = assertComplexType(e4.getType());
+    XSType t4 = assertSimpleContent(ct4).getType();
+    assertSimpleType(t4);
+    assertEquals(XSInt.getInstance(), t4);
+    XSAttributable[] a4 = ct4.getAttributes();
+    assertEquals(2, a4.length);
+    XSAttribute a4_1 = (XSAttribute) a4[0];
+    assertEquals(new XsQName((String) null, "g"), a4_1.getName());
+    assertEquals(XSBoolean.getInstance(), a4_1.getType());
+    XSAttribute a4_2 = (XSAttribute) a4[1];
+    assertEquals(new XsQName((String) null, "id"), a4_2.getName());
+    assertEquals(XSID.getInstance(), a4_2.getType());
+  }
+
+  /** Tests typical element uses.
+   */
+  public void testElements() throws Exception {
+    XSParser xsParser = newXSParser();
+    testElements(xsParser);
+    JAXBParser jaxbParser = newJAXBParser();
+    testElements(jaxbParser);
+  }
+
+  protected void testFacets(XSParser pParser) throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:simpleType name='USState'>\n" +
+      "    <xs:restriction base='xs:string'>\n" +
+      "      <xs:enumeration value='AK'/>\n" +
+      "      <xs:enumeration value='AL'/>\n" +
+      "      <xs:enumeration value='AR'/>\n" +
+      "      <!-- and so on ... -->\n" +   
+      "    </xs:restriction>\n" +
+      "  </xs:simpleType>\n" +
+      "  <xs:element name='a' type='USState'/>\n" +
+      "</xs:schema>\n";
+    
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testFacets.xsd");
+    XSSchema schema = pParser.parse(isource);
+
+    XSElement[] elements = schema.getElements();
+    assertEquals(1, elements.length);
+    XSElement e1 = elements[0];
+    assertEquals(new XsQName((String) null, "a"), e1.getName());
+    XSSimpleType st1 = assertSimpleType(e1.getType());
+    assertEquals(XSString.getInstance(), assertRestriction(st1));
+    XSEnumeration[] enumerations = st1.getEnumerations();
+    assertNotNull(enumerations);
+    assertEquals(3, enumerations.length);
+    assertEquals(3, enumerations.length);
+    assertEquals("AK", enumerations[0].getValue());
+    assertEquals("AL", enumerations[1].getValue());
+    assertEquals("AR", enumerations[2].getValue());
+  }
+
+  /** Tests various facets.
+   */
+  public void testFacets() throws Exception {
+    XSParser xsParser = newXSParser();
+    testFacets(xsParser);
+    JAXBParser jaxbParser = newJAXBParser();
+    testFacets(jaxbParser);
+  }
+
+  /** Test of the w3c sample schema PO.
+   */
+  public void testPurchaseOrder() throws Exception {
+    final String schemaSource = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+      "\n" +
+      "  <xsd:annotation>\n" +
+      "    <xsd:documentation xml:lang='en'>\n" +
+      "      Purchase order schema for Example.com.\n" +
+      "      Copyright 2000 Example.com. All rights reserved.\n" +
+      "    </xsd:documentation>\n" +
+      "  </xsd:annotation>\n" +
+      "\n" +
+      "  <xsd:element name='purchaseOrder' type='PurchaseOrderType'/>\n" +
+      "\n" +
+      "  <xsd:element name='comment' type='xsd:string'/>\n" +
+      "\n" +
+      "  <xsd:complexType name='PurchaseOrderType'>\n" +
+      "    <xsd:sequence>\n" +
+      "      <xsd:element name='shipTo' type='USAddress'/>\n" +
+      "      <xsd:element name='billTo' type='USAddress'/>\n" +
+      "      <xsd:element ref='comment' minOccurs='0'/>\n" +
+      "      <xsd:element name='items'  type='Items'/>\n" +
+      "    </xsd:sequence>\n" +
+      "    <xsd:attribute name='orderDate' type='xsd:date'/>\n" +
+      "  </xsd:complexType>\n" +
+      "\n" +
+      "  <xsd:complexType name='USAddress'>\n" +
+      "    <xsd:sequence>\n" +
+      "      <xsd:element name='name'   type='xsd:string'/>\n" +
+      "      <xsd:element name='street' type='xsd:string'/>\n" +
+      "      <xsd:element name='city'   type='xsd:string'/>\n" +
+      "      <xsd:element name='state'  type='xsd:string'/>\n" +
+      "      <xsd:element name='zip'    type='xsd:decimal'/>\n" +
+      "    </xsd:sequence>\n" +
+      "    <xsd:attribute name='country' type='xsd:NMTOKEN'\n" +
+      "        fixed='US'/>\n" +
+      "  </xsd:complexType>\n" +
+      "\n" +
+      "  <xsd:complexType name='Items'>\n" +
+      "    <xsd:sequence>\n" +
+      "      <xsd:element name='item' minOccurs='0' maxOccurs='unbounded'>\n" +
+      "        <xsd:complexType>\n" +
+      "          <xsd:sequence>\n" +
+      "            <xsd:element name='productName' type='xsd:string'/>\n" +
+      "            <xsd:element name='quantity'>\n" +
+      "              <xsd:simpleType>\n" +
+      "                <xsd:restriction base='xsd:positiveInteger'>\n" +
+      "                  <xsd:maxExclusive value='100'/>\n" +
+      "                </xsd:restriction>\n" +
+      "              </xsd:simpleType>\n" +
+      "            </xsd:element>\n" +
+      "            <xsd:element name='USPrice'  type='xsd:decimal'/>\n" +
+      "            <xsd:element ref='comment'   minOccurs='0'/>\n" +
+      "            <xsd:element name='shipDate' type='xsd:date' minOccurs='0'/>\n" +
+      "          </xsd:sequence>\n" +
+      "          <xsd:attribute name='partNum' type='SKU' use='required'/>\n" +
+      "        </xsd:complexType>\n" +
+      "      </xsd:element>\n" +
+      "    </xsd:sequence>\n" +
+      "  </xsd:complexType>\n" +
+      "\n" +
+      "  <!-- Stock Keeping Unit, a code for identifying products -->\n" +
+      "  <xsd:simpleType name='SKU'>\n" +
+      "    <xsd:restriction base='xsd:string'>\n" +
+      "      <xsd:pattern value='\\d{3}-[A-Z]{2}'/>\n" +
+      "    </xsd:restriction>\n" +
+      "  </xsd:simpleType>\n" +
+      "</xsd:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testPurchaseOrder.xsd");
+    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
+    JAXBGlobalBindings globalBindings = schema.getJAXBGlobalBindings();
+    assertNotNull(globalBindings);
+
+    XSType[] schemaTypes = schema.getTypes();
+    assertNotNull(schemaTypes);
+    assertEquals(4, schemaTypes.length);
+
+    // Items
+    XSType items = schemaTypes[2];
+    assertEquals(new XsQName((String) null, "Items"), items.getName());
+    assertTrue(items.isGlobal());
+    XSComplexType itemsComplexType = assertComplexType(items);
+    XSParticle itemsParticle = assertComplexContent(itemsComplexType);
+    XSGroup itemsGroup = assertGroup(itemsParticle);
+    assertSequence(itemsGroup);
+    // Items.item
+    XSParticle[] itemsChildren = itemsGroup.getParticles();
+    assertEquals(1, itemsChildren.length);
+    XSParticle item = itemsChildren[0];
+    XSElement itemElement = assertElement(item);
+    assertEquals(new XsQName((String) null, "item"), itemElement.getName());
+    assertTrue(!itemElement.isGlobal());
+    XSComplexType itemComplexType = assertComplexType(itemElement.getType());
+    assertEquals(0, item.getMinOccurs());
+    assertEquals(-1, item.getMaxOccurs());
+    XSParticle itemParticle = assertComplexContent(itemComplexType);
+    XSGroup itemGroup = assertGroup(itemParticle);
+    assertSequence(itemGroup);
+    // Items.item.partNum
+    // <xsd:attribute name='partNum' type='SKU' use='required'/>
+    XSAttributable[] itemAttributes = itemComplexType.getAttributes();
+    assertEquals(1, itemAttributes.length);
+    XSAttribute partNum = (XSAttribute) itemAttributes[0];
+    assertEquals(new XsQName((String) null, "partNum"), partNum.getName());
+    assertTrue(!partNum.isOptional());
+    XSType partNumType = partNum.getType();
+    assertEquals(new XsQName((String) null, "SKU"), partNumType.getName());
+    assertTrue(partNumType.isGlobal());
+
+    XSParticle[] itemGroupParticles = itemGroup.getParticles();
+    assertEquals(5, itemGroupParticles.length);
+
+    // Items.item.productName
+    // <xsd:element name='productName' type='xsd:string'/>
+    XSParticle productName = itemGroupParticles[0];
+    assertEquals(1, productName.getMinOccurs());
+    assertEquals(1, productName.getMaxOccurs());
+    XSElement productNameElement = assertElement(productName);
+    assertEquals(new XsQName((String) null, "productName"), productNameElement.getName());
+    assertSimpleType(productNameElement.getType());
+    assertEquals(XSString.getInstance(), productNameElement.getType());
+
+    // Items.item.quantity
+    XSParticle quantity = itemGroupParticles[1];
+    assertEquals(1, quantity.getMinOccurs());
+    assertEquals(1, quantity.getMaxOccurs());
+    XSElement quantityElement = assertElement(quantity);
+    assertEquals(new XsQName((String) null, "quantity"), quantityElement.getName());
+    XSSimpleType quantitySimpleType = assertSimpleType(quantityElement.getType());
+    assertEquals(XSPositiveInteger.getInstance(), assertRestriction(quantitySimpleType));
+
+    // Items.item.USPrice
+    // <xsd:element name='USPrice'  type='xsd:decimal'/>
+    XSParticle usPrice = itemGroupParticles[2];
+    assertEquals(1, usPrice.getMinOccurs());
+    assertEquals(1, usPrice.getMaxOccurs());
+    XSElement usPriceElement = assertElement(usPrice);
+    assertEquals(new XsQName((String) null, "USPrice"), usPriceElement.getName());
+    assertEquals(XSDecimal.getInstance(), usPriceElement.getType());
+
+    // Items.item.comment
+    // <xsd:element ref='comment'   minOccurs='0'/>
+    XSParticle comment = itemGroupParticles[3];
+    assertEquals(comment.getMinOccurs(), 0);
+    assertEquals(comment.getMaxOccurs(), 1);
+    XSElement commentElement = assertElement(comment);
+    assertEquals(new XsQName((String) null, "comment"), commentElement.getName());
+    assertEquals(XSString.getInstance(), commentElement.getType());
+
+    // Items.item.shipDate
+    // <xsd:element name='shipDate' type='xsd:date' minOccurs='0'/> 
+    XSParticle shipDate = itemGroupParticles[4];
+    assertEquals(shipDate.getMinOccurs(), 0);
+    assertEquals(shipDate.getMaxOccurs(), 1);
+    XSElement shipDateElement = assertElement(shipDate);
+    assertEquals(XSDate.getInstance(), shipDateElement.getType());
+
+    // PurchaseOrderType
+    XSType purchaseOrderType = schemaTypes[0];
+    assertTrue(purchaseOrderType.isGlobal());
+    assertEquals(new XsQName((String) null, "PurchaseOrderType"), purchaseOrderType.getName());
+    XSComplexType purchaseOrderTypeComplexType = assertComplexType(purchaseOrderType);
+    XSParticle purchaseOrderTypeParticle = assertComplexContent(purchaseOrderTypeComplexType);
+    XSGroup purchaseOrderTypeGroup = assertGroup(purchaseOrderTypeParticle);
+    assertSequence(purchaseOrderTypeGroup);
+
+    XSAttributable[] potAttributes = purchaseOrderTypeComplexType.getAttributes();
+    assertEquals(1, potAttributes.length);
+    // PurchaseOrderType.orderDate
+    // <xsd:attribute name='orderDate' type='xsd:date'/>
+    XSAttribute orderDate = (XSAttribute) potAttributes[0];
+    assertEquals(new XsQName((String) null, "orderDate"), orderDate.getName());
+    assertEquals(XSDate.getInstance(), orderDate.getType());
+
+    XSParticle[] potChildren = purchaseOrderTypeGroup.getParticles();
+    assertEquals(4, potChildren.length);
+    // PurchaseOrderType.shipTo
+    // <xsd:element name='shipTo' type='USAddress'/>
+    XSParticle shipTo = potChildren[0];
+    assertEquals(1, shipTo.getMinOccurs());
+    assertEquals(1, shipTo.getMaxOccurs());
+    XSElement shipToElement = assertElement(shipTo);
+    assertEquals(new XsQName((String) null, "shipTo"), shipToElement.getName());
+    XSType shipToType = shipToElement.getType();
+    assertTrue(shipToType.isGlobal());
+    assertEquals(new XsQName((String) null, "USAddress"), shipToType.getName());
+    // PurchaseOrderType.billTo
+    // <xsd:element name='billTo' type='USAddress'/> 
+    XSParticle billTo = potChildren[1];
+    assertEquals(1, billTo.getMinOccurs());
+    assertEquals(1, billTo.getMaxOccurs());
+    XSElement billToElement = assertElement(billTo);
+    assertEquals(new XsQName((String) null, "billTo"), billToElement.getName());
+    XSType billToType = billToElement.getType();
+    assertEquals(shipToType, billToType);
+    // PurchaseOrderType.comment
+    // <xsd:element ref='comment' minOccurs='0'/> 
+    XSParticle potComment = potChildren[2];
+    assertEquals(0, potComment.getMinOccurs());
+    assertEquals(1, potComment.getMaxOccurs());
+    XSElement potCommentElement = assertElement(potComment);
+    assertEquals(new XsQName((String) null, "comment"), potCommentElement.getName());
+    assertEquals(potCommentElement.getType(), commentElement.getType());
+    // PurchaseOrderType.items
+    // <xsd:element name='items'  type='Items'/>
+    XSParticle potItems = potChildren[3];
+    assertEquals(1, potItems.getMinOccurs());
+    assertEquals(1, potItems.getMaxOccurs()); 
+    XSElement potItemsElement = assertElement(potItems);
+    assertEquals(new XsQName((String) null, "items"), potItemsElement.getName());
+    assertEquals(items, potItemsElement.getType());
+
+    // SKU
+    XSType sku = schemaTypes[3];
+    assertTrue(sku.isGlobal());
+    assertEquals(new XsQName((String) null, "SKU"), sku.getName());
+    XSSimpleType skuSimpleType = assertSimpleType(sku);
+    assertEquals(XSString.getInstance(), assertRestriction(skuSimpleType));
+    assertEquals(sku, partNumType);
+
+    // USAddress
+    // <xsd:complexType name='USAddress'> 
+    // <xsd:sequence>
+    XSType usAddress = schemaTypes[1];
+    assertTrue(usAddress.isGlobal());
+    assertEquals(new XsQName((String) null, "USAddress"), usAddress.getName());
+    assertTrue(usAddress.isGlobal());
+    XSComplexType usAddressComplexType = assertComplexType(usAddress);
+    XSParticle usAddressParticle = assertComplexContent(usAddressComplexType);
+    XSGroup usAddressGroup = assertGroup(usAddressParticle);
+    assertSequence(usAddressGroup);
+    // USAddress.country
+    //  <xsd:attribute name='country' type='xsd:string' fixed='US'/>
+    // ToDo: test attribute fixed='US'
+    XSAttributable[] usAddressAttributes = usAddressComplexType.getAttributes();
+    assertEquals(1, usAddressAttributes.length);
+    XSAttribute country = (XSAttribute) usAddressAttributes[0];
+    assertEquals(new XsQName((String) null, "country"), country.getName());
+    assertEquals(XSNMToken.getInstance(), country.getType());
+    // USAddress children
+    String [] nameShouldBe = {"name", "street", "city", "state", "zip"};
+    XSParticle[] usAddressChildren = usAddressGroup.getParticles();
+    assertEquals(5, usAddressChildren.length);
+    for (int i = 0; i < usAddressChildren.length; i++) {
+      XSParticle child = usAddressChildren[i];
+      assertEquals(1, child.getMinOccurs());
+      assertEquals(1, child.getMaxOccurs());
+      XSElement element = assertElement(child);
+      assertEquals(new XsQName((String) null, nameShouldBe[i]), element.getName());
+      assertEquals(i == 4 ? XSDecimal.getInstance() : XSString.getInstance(), element.getType());
+    }
+
+    // purchaseOrder
+    // <xsd:element name='purchaseOrder' type='PurchaseOrderType'/>
+    XSElement[] schemaElements = schema.getElements();
+    assertEquals(2, schemaElements.length);
+    XSElement purchaseOrder = schemaElements[0];
+    assertEquals(new XsQName((String) null, "purchaseOrder"), purchaseOrder.getName());
+    assertEquals(purchaseOrderType, purchaseOrder.getType());
+    assertEquals(new XsQName((String) null, "comment"), schemaElements[1].getName());
+  }
+
+  /** A test case to trigger a previous parser bug.  */
+  public void testRestrictionMaxExclusive() throws Exception {
+    final String schemaSource = 
+      "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+      " <xsd:element name='quantity'> \n" +
+      "  <xsd:simpleType> \n" +
+      "   <xsd:restriction base='xsd:decimal'> \n" +
+      "    <xsd:maxExclusive value='100'/> \n" +
+      "   </xsd:restriction> \n" +
+      "  </xsd:simpleType> \n" +
+      " </xsd:element> \n" +
+      "</xsd:schema> \n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testRestrictionMaxExclusive.xsd");
+    parser.parse(isource);
+  }
+
+  private void verifyLocalNamespaces(String pSchema, boolean pQualified) throws Exception {
+    XsQName fooQualified = new XsQName("http://test.com/namespaces", "foo");
+    XsQName fooUnQualified = new XsQName((String) null, "foo");
+    XsQName barQualified = new XsQName("http://test.com/namespaces", "bar");
+    XsQName barUnQualified = new XsQName((String) null, "bar");
+    
+    XSParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(pSchema));
+    XSSchema schema = parser.parse(isource);
+    XSElement[] schemaElements = schema.getElements();
+    assertEquals(1, schemaElements.length);
+    assertEquals(fooQualified, schemaElements[0].getName());
+    XSAttribute[] schemaAttributes = schema.getAttributes();
+    assertEquals(1, schemaAttributes.length);
+    assertEquals(barQualified, schemaAttributes[0].getName());
+    XSType[] types = schema.getTypes();
+    assertEquals(1, types.length);
+    XSComplexType complexType = assertComplexType(types[0]);
+    XSAttributable[] typeAttributes = complexType.getAttributes();
+    assertEquals(1, typeAttributes.length);
+    assertEquals(pQualified ? barQualified : barUnQualified, ((XSAttribute) typeAttributes[0]).getName());
+    XSGroup group = assertGroup(assertComplexContent(complexType));
+    XSParticle[] particles = group.getParticles();
+    assertEquals(1, particles.length);
+    XSElement typeElement = assertElement(particles[0]);
+    assertEquals(pQualified ? fooQualified : fooUnQualified, typeElement.getName());
+  }
+
+  /** <p>Verify the correct handling of target namespace, and the like.</p>
+   */
+  public void testTargetNamespace() throws Exception {
+    final String schemaSource1 =
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test.com/namespaces'>\n" +
+      "  <xs:element name='foo' type='xs:string'/>\n" +
+      "</xs:schema>\n";
+
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource1));
+    isource.setSystemId("testTargetNamespace1.xsd");
+    XSSchema schema = parser.parse(isource);
+    XSElement[] schemaElements = schema.getElements();
+    assertEquals(1, schemaElements.length);
+    assertEquals(new XsQName("http://test.com/namespaces", "foo"), schemaElements[0].getName());
+    assertNull(schemaElements[0].getName().getPrefix());
+
+    final String schemaSource2 =
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:test='http://test.com/namespaces'" +
+      " targetNamespace='http://test.com/namespaces'>\n" +
+      "  <xs:element name='foo' type='xs:string'/>\n" +
+      "</xs:schema>\n";
+
+    parser = newJAXBParser();
+    isource = new InputSource(new StringReader(schemaSource2));
+    isource.setSystemId("testTargetNamespace1.xsd");
+    schema = parser.parse(isource);
+    schemaElements = schema.getElements();
+    assertEquals(1, schemaElements.length);
+    assertEquals(new XsQName("http://test.com/namespaces", "foo"), schemaElements[0].getName());
+    assertEquals("test", schemaElements[0].getName().getPrefix());
+
+    final String namespaceSchemaHeader =
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:test='http://test.com/namespaces'" +
+      "    targetNamespace='http://test.com/namespaces'";
+    final String namespaceSchemaFooter =
+      "  <xs:complexType name='cType'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element name='foo' type='xs:string'/>\n" +
+      "    </xs:sequence>\n" +
+      "    <xs:attribute name='bar'/>\n" +
+      "   </xs:complexType>\n" +
+      "   <xs:element name='foo' type='xs:string'/>\n" +
+      "   <xs:attribute name='bar'/>\n" +
+      "</xs:schema>\n";
+
+    verifyLocalNamespaces(namespaceSchemaHeader + "  >\n" + namespaceSchemaFooter, false);
+    verifyLocalNamespaces(namespaceSchemaHeader +
+                          "  elementFormDefault='unqualified'\n" +
+                          "  attributeFormDefault='unqualified'>\n" +
+                          namespaceSchemaFooter, false);
+    verifyLocalNamespaces(namespaceSchemaHeader +
+                          "  elementFormDefault='qualified'\n" +
+                          "  attributeFormDefault='qualified'>\n" +
+                          namespaceSchemaFooter, true);
+  }
+
+  /** <p>Verify substitution groups.</p>
+   */
+  public void testSubstitutionGroups() throws Exception {
+    final String schemaSource1 =
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+      "    targetNamespace='http://test.com/namespaces'\n" +
+      "    xmlns:ns='http://test.com/namespaces'>\n" +
+      "  <xs:element name='head' type='xs:string'/>\n" +
+      "  <xs:element name='subst1' type='xs:int' substitutionGroup='ns:head'/>\n" +
+      "  <xs:element name='subst2' type='xs:float' substitutionGroup='ns:head'/>\n" +
+      "  <xs:complexType name='test'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element ref='ns:head'/>\n" +
+      "    </xs:sequence>\n" +
+      "  </xs:complexType>\n" +
+      "</xs:schema>\n";
+    
+    JAXBParser parser = newJAXBParser();
+    InputSource isource = new InputSource(new StringReader(schemaSource1));
+    isource.setSystemId("testTargetNamespace1.xsd");
+    XSSchema schema = parser.parse(isource);
+    XSElement[] elements = schema.getElements();
+    assertEquals(3, elements.length);
+    XsQName headName = new XsQName("http://test.com/namespaces", "head");
+    XsQName subst1Name = new XsQName("http://test.com/namespaces", "subst1");
+    XsQName subst2Name = new XsQName("http://test.com/namespaces", "subst2");
+    assertEquals(headName, elements[0].getName());
+    assertNotNull(elements[0].getSubstitutionGroup());
+    assertNull(elements[0].getSubstitutionGroupName());
+    assertEquals(subst1Name, elements[1].getName());
+    assertNull(elements[1].getSubstitutionGroup());
+    assertEquals(headName, elements[1].getSubstitutionGroupName());
+    assertEquals(subst2Name, elements[2].getName());
+    assertNull(elements[2].getSubstitutionGroup());
+    assertEquals(headName, elements[2].getSubstitutionGroupName());
+
+    XSType[] types = schema.getTypes();
+    assertEquals(1, types.length);
+    XSGroup group = assertGroup(assertComplexContent(assertComplexType(types[0])));
+    XSParticle[] particles = group.getParticles();
+    assertEquals(1, particles.length);
+    XSGroup substitutedGroup = assertGroup(particles[0]);
+    assertEquals(XSModelGroup.CHOICE, substitutedGroup.getCompositor());
+    XSParticle[] substParticles = substitutedGroup.getParticles();
+    assertEquals(3, substParticles.length);
+    assertEquals(headName, assertElement(substParticles[0]).getName());
+    assertEquals(subst1Name, assertElement(substParticles[1]).getName());
+    assertEquals(subst2Name, assertElement(substParticles[2]).getName());
+  }
+
+  /** <p>Verify extension handling.</p>
+   */
+  public void testExtensions() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+      "  <xs:complexType name='a'>\n" +
+      "    <xs:sequence>\n" +
+      "      <xs:element name='ae1' type='xs:int'/>\n" +
+      "      <xs:element name='ae2' type='xs:dateTime'/>\n" +
+      "    </xs:sequence>\n" +
+      "    <xs:attribute name='aa1' type='xs:boolean'/>\n" +
+      "  </xs:complexType>\n" +
+      "\n" +
+      "  <xs:complexType name='b'>\n" +
+      "    <xs:complexContent>\n" +
+      "      <xs:extension base='a'>\n" +
+      "        <xs:choice>\n" +
+      "          <xs:element name='be1' type='xs:anyURI'/>\n" +
+      "          <xs:element name='be2' type='xs:double'/>\n" +
+      "        </xs:choice>\n" +
+      "        <xs:attribute name='ba1'/>\n" +
+      "      </xs:extension>\n" +
+      "    </xs:complexContent>\n" +
+      "  </xs:complexType>\n" +
+      "</xs:schema>\n";
+
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testElements.xsd");
+    XSParser xsParser = newXSParser();
+    XSSchema schema = xsParser.parse(isource);
+
+    XSType[] types = schema.getTypes();
+    assertEquals(2, types.length);
+    XSType a = types[0];
+    assertEquals(new XsQName((String) null, "a"), a.getName());
+    XSComplexType aComplexType = assertComplexType(a);
+    XSAttributable[] aAttributes = aComplexType.getAttributes();
+    assertEquals(1, aAttributes.length);
+    XSAttribute aa1 = (XSAttribute) aAttributes[0];
+    assertEquals(new XsQName((String) null, "aa1"), aa1.getName());
+
+    XSType b = types[1];
+    assertEquals(new XsQName((String) null, "b"), b.getName());
+    XSComplexType bComplexType = assertComplexType(b);
+    assertTrue(bComplexType.isExtension());
+    assertEquals(bComplexType.getExtendedType(), a);
+    XSAttributable[] bAttributes = bComplexType.getAttributes();
+    assertEquals(2, bAttributes.length);
+    assertEquals(aa1, bAttributes[0]);
+    XSAttribute ba1 = (XSAttribute) bAttributes[1];
+    assertEquals(new XsQName((String) null, "ba1"), ba1.getName());
+  }
+
+  /** Tests setting attributes, which aren't specified in the
+   * schema.
+   */
+  public void testAdditionalAttributes() throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0'?>\n" +
+      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:foo='x' foo:a='y'>\n" +
+      "  <xs:element name='test' type='xs:string' foo:b='z'/>\n" +
+      "</xs:schema>\n";
+
+    InputSource isource = new InputSource(new StringReader(schemaSource));
+    isource.setSystemId("testElements.xsd");
+    XSParser xsParser = newXSParser();
+    XSSchema schema = xsParser.parse(isource);
+
+    Attributes schemaOpenAttrs = schema.getOpenAttributes();
+    assertNotNull(schemaOpenAttrs);
+    assertEquals(1, schemaOpenAttrs.getLength());
+    assertEquals("x", schemaOpenAttrs.getURI(0));
+    assertEquals("a", schemaOpenAttrs.getLocalName(0));
+    assertEquals("y", schemaOpenAttrs.getValue(0));
+
+    XSElement[] elements = schema.getElements();
+    assertEquals(1, elements.length);
+    Attributes elementOpenAttrs = elements[0].getOpenAttributes();
+    assertNotNull(elementOpenAttrs);
+    assertEquals(1, elementOpenAttrs.getLength());
+    assertEquals("x", elementOpenAttrs.getURI(0));
+    assertEquals("b", elementOpenAttrs.getLocalName(0));
+    assertEquals("z", elementOpenAttrs.getValue(0));
+  }
+
+  /** Tests restriction of a simple type.
+   */
+  public void testSimpleTypeRestriction() throws Exception {
+      final String schemaSource =
+        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+        "    xmlns='http://teamconnect.com'\n" +
+        "    targetNamespace='http://teamconnect.com'>\n" +
+        "  <xs:simpleType name='ZNSecurityTypeIID'>\n" +
+        "    <xs:annotation>\n" +
+        "      <xs:documentation/>\n" +
+        "    </xs:annotation>\n" +
+        "    <xs:restriction base='xs:int'>\n" +
+        "      <xs:enumeration value='0'/>\n" +
+        "      <xs:enumeration value='2'/>\n" +
+        "    </xs:restriction>\n" +
+        "  </xs:simpleType>\n" +
+        "</xs:schema>\n";
+      InputSource isource = new InputSource(new StringReader(schemaSource));
+      isource.setSystemId("testSimpleTypeRestriction.xsd");
+      XSParser xsParser = newXSParser();
+      XSSchema schema = xsParser.parse(isource);
+      XSType[] types = schema.getTypes();
+      assertEquals(1, types.length);
+      XSSimpleType simpleType = assertSimpleType(types[0]);
+      assertAtomicType(simpleType);
+      XSEnumeration[] enumerations = simpleType.getEnumerations();
+      assertEquals(2, enumerations.length);
+      assertEquals("0", enumerations[0].getValue());
+      assertEquals("2", enumerations[1].getValue());
+  }
+
+  private void testSimpleKey(XSParser parser) throws Exception {
+    final String schemaSource =
+      "<?xml version='1.0' encoding='UTF-8'?>" +
+      "<xs:schema targetNamespace='http://www.teamconnect.com' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns='http://www.teamconnect.com'>" +
+      "  <xs:element name='library'>" +
+      "          <xs:complexType>" +
+      "            <xs:sequence>" +
+      "              <xs:element name='book' minOccurs='0' maxOccurs='unbounded'>" +
+      "                <xs:complexType>" +
+      "                  <xs:attribute name='id' type='xs:int' use='optional'/>" +
+      "                  <xs:attribute name='title' type='xs:string' use='required'/>" +
+      "                  <xs:attribute name='author' type='xs:string' use='optional'/>" +
+      "                </xs:complexType>" +
+      "              </xs:element>" +
+      "            </xs:sequence>" +
+      "          </xs:complexType>" +
+      "          <xs:key name='book-key'>" +
+      "            <xs:selector xpath='./book'/>" +
+      "            <xs:field xpath='@id'/>" +
+      "            <xs:field xpath='.'/>" +
+      "          </xs:key>" +
+      "          <xs:keyref name='book-key-ref' refer='book-key'>" +
+      "            <xs:selector xpath='./book'/>" +
+      "            <xs:field xpath='@title'/>" +
+      "            <xs:field xpath='.'/>" +
+      "          </xs:keyref>" +
+      "  </xs:element>" +
+      "</xs:schema>";
+
+      InputSource isource = new InputSource(new StringReader(schemaSource));
+      isource.setSystemId("testSimpleKey.xsd");
+      XSSchema schema = parser.parse(isource);
+
+      XSElement[] elements = schema.getElements();
+      assertEquals( 1, elements.length );
+
+      XSElement libraryElement = elements[0];
+      XSIdentityConstraint[] ics = libraryElement.getIdentityConstraints();
+
+      assertEquals( 1, ics.length );
+
+      XSIdentityConstraint ic = ics[0];
+      assertEquals( "book-key", ic.getName() );
+
+      XSElementOrAttrRef[][] icMatchCriteria = ic.getMatchCriteria();
+
+      assertEquals( 2, icMatchCriteria.length );
+      assertEquals( 1, icMatchCriteria[0].length );
+      assertEquals( 1, icMatchCriteria[1].length );
+
+      assertEquals(
+        "id", 
+        icMatchCriteria[0][0].getAttribute().getName().getLocalName()
+      );
+      assertEquals(
+        "book", 
+        icMatchCriteria[1][0].getElement().getName().getLocalName()
+      );
+
+      XSKeyRef[] rfs = libraryElement.getKeyRefs();
+      assertEquals( 1, rfs.length );
+
+      XSKeyRef rf = rfs[0];
+      assertEquals( "book-key-ref", rf.getName() );
+
+      XSElementOrAttrRef[][] rfMatchCriteria = rf.getMatchCriteria();
+      assertEquals( 2, rfMatchCriteria.length );
+      assertEquals( 1, rfMatchCriteria[0].length );
+      assertEquals( 1, rfMatchCriteria[1].length );
+
+      assertEquals(
+        "title", 
+        rfMatchCriteria[0][0].getAttribute().getName().getLocalName()
+      );
+      assertEquals(
+        "book", 
+        rfMatchCriteria[1][0].getElement().getName().getLocalName()
+      );
+
+  }
+
+    /** Tests definition of a key.
+     */
+    public void testSimpleKey() throws Exception {
+    	XSParser xsParser = newXSParser();
+    	testSimpleKey(xsParser);
+    	JAXBParser jaxbParser = newJAXBParser();
+    	testSimpleKey(jaxbParser);
+    }
+
+    private void testDocumentationChilds(XSParser pParser) throws Exception {
+        final String schemaSource =
+            "<?xml version='1.0' encoding='UTF-8'?>" +
+            "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' >\n" +
+            "  <xs:annotation>\n" +
+            "    <xs:documentation xmlns:cc='http://www.dummy-namespace.org/'>\n" +
+            "      <cc:foo/>\n" +
+            "    </xs:documentation>\n" +
+            "  </xs:annotation>\n" +
+            "</xs:schema>";
+
+            InputSource isource = new InputSource(new StringReader(schemaSource));
+            isource.setSystemId("testSimpleKey.xsd");
+			pParser.parse(isource);
+    }
+
+    /** <p>Tests whether xs:documentation may have arbitrary childs.</p>
+     */
+    public void testDocumentationChilds() throws Exception {
+    	XSParser xsParser = newXSParser();
+        testDocumentationChilds(xsParser);
+        JAXBParser jaxbParser = newJAXBParser();
+        testDocumentationChilds(jaxbParser);
+    }
+
+    private void testNamespaceLists(XSParser pParser) throws Exception {
+    	final String schemaSource =
+            "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+            "  <xs:complexType name='foo'>\n" +
+			"    <xs:sequence>\n" +
+            "      <xs:any namespace='http://purl.org/dc/elements/1.1/' processContents='strict' minOccurs='0' maxOccurs='unbounded'/>\n" +
+            "      <xs:any namespace='http://www.jeckle.de/rss' processContents='strict' minOccurs='0'/>\n" +
+            "    </xs:sequence>\n" +
+            "    <xs:anyAttribute namespace='http://www.w3.org/1999/02/22-rdf-syntax-ns#' processContents='strict'/>\n" +
+            "  </xs:complexType>\n" +
+            "</xs:schema>\n";
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testNamespaceLists.xsd");
+    	XSSchema schema = pParser.parse(isource);
+    	XSParticle[] particles = assertGroup(assertComplexContent(assertComplexType(schema.getTypes()[0]))).getParticles();
+        assertEquals(2, particles.length);
+        assertTrue(particles[0].isWildcard());
+        XSWildcard wildcard = particles[0].getWildcard();
+        XsNamespaceList namespaceList = wildcard.getNamespaceList();
+        assertTrue(!namespaceList.isAny());
+        assertTrue(!namespaceList.isAny());
+        assertEquals(1, namespaceList.getUris().length);
+        assertEquals("http://purl.org/dc/elements/1.1/", namespaceList.getUris()[0].getURI());
+        assertTrue(particles[1].isWildcard());
+        wildcard = particles[1].getWildcard();
+        namespaceList = wildcard.getNamespaceList();
+        assertTrue(!namespaceList.isAny());
+        assertTrue(!namespaceList.isAny());
+        assertEquals(1, namespaceList.getUris().length);
+        assertEquals("http://www.jeckle.de/rss", namespaceList.getUris()[0].getURI());
+        XSAttributable[] attributes = assertComplexType(schema.getTypes()[0]).getAttributes();
+        assertEquals(1, attributes.length);
+        assertTrue(attributes[0] instanceof XSWildcard);
+        wildcard = (XSWildcard) attributes[0];
+        namespaceList = wildcard.getNamespaceList();
+        assertTrue(!namespaceList.isAny());
+        assertTrue(!namespaceList.isAny());
+        assertEquals(1, namespaceList.getUris().length);
+        assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#", namespaceList.getUris()[0].getURI());
+    }
+        
+    /** <p>Test the handling of namespace lists.</p>
+     */
+    public void testNamespaceLists() throws Exception {
+        XSParser xsParser = newXSParser();
+        testNamespaceLists(xsParser);
+        JAXBParser jaxbParser = newJAXBParser();
+        testNamespaceLists(jaxbParser);
+    }
+
+    private void testSimpleTypeRestriction2(XSParser pParser) throws Exception {
+        final String schemaSource =
+            "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" +
+            "   targetNamespace='http://asi.sbc.com/cpsosasos/trouble/data'\n" +
+            "   xmlns:s='http://asi.sbc.com/cpsosasos/trouble/data'>\n" +
+            "  <element name='foo'>\n" +
+            "    <complexType>\n" +
+            "      <attribute name='bar' type='s:ServiceIDType'/>\n" +
+            "    </complexType>\n" +
+            "  </element>\n" +
+            "  <simpleType name='ServiceIDType'>\n" +
+            "    <restriction base='s:NameTypeType'/>\n" +
+            "  </simpleType>\n" +
+            "  <simpleType name='NameTypeType'>\n" +
+            "    <union memberTypes='integer string'/>\n" +
+            "  </simpleType>\n" +
+            "</schema>\n";
+
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testSimpleTypeRestriction2.xsd");
+        XSSchema schema = pParser.parse(isource);
+        XSType[] types = schema.getTypes();
+        assertEquals(2, types.length);
+        assertEquals(new XsQName("http://asi.sbc.com/cpsosasos/trouble/data", "NameTypeType"),
+                     types[1].getName());
+        XSSimpleType nameTypeType = assertSimpleType(types[1]);
+        assertUnionType(nameTypeType);
+        assertEquals(new XsQName("http://asi.sbc.com/cpsosasos/trouble/data", "ServiceIDType"),
+                     types[0].getName());
+        XSSimpleType serviceIDType = assertSimpleType(types[0]);
+        assertUnionType(serviceIDType);
+        assertTrue(serviceIDType.isRestriction());
+    }
+
+    /** <p>Tests restrictions of simple types.</p>
+     */
+    public void testSimpleTypeRestriction2() throws Exception {
+        testSimpleTypeRestriction2(newXSParser());
+        testSimpleTypeRestriction2(newJAXBParser());
+    }
+
+    private void testAppInfoEmbeddedText(XSParser pParser) throws Exception {
+        final String schemaSource =
+            "<schema xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
+            "  <annotation><appinfo>foo</appinfo></annotation>\n" +
+            "</schema>\n";
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testAppInfoEmbeddedText.xsd");
+        XSSchema schema = pParser.parse(isource);
+        XSAnnotation[] annotations = schema.getAnnotations();
+        assertEquals(1, annotations.length);
+        XSAppinfo[] appinfos = annotations[0].getAppinfos();
+        assertEquals(1, appinfos.length);
+        Object[] childs = appinfos[0].getChilds();
+        assertEquals(1, childs.length);
+        assertEquals("foo", (String) childs[0]);
+    }
+
+    /** <p>Does the <code>xs:appinfo</code> element support embedded text?</p>
+     */
+    public void testAppInfoEmbeddedText() throws Exception {
+        testAppInfoEmbeddedText(newXSParser());
+        testAppInfoEmbeddedText(newJAXBParser());
+    }
+
+    private void testImportSchemaWithoutNamespace(XSParser pParser) throws Exception {
+        final String schemaSource =
+            "<schema xmlns='http://www.w3.org/2001/XMLSchema'" +
+            "	 targetNamespace='xyz' xmlns:p='xyz'>\n" +
+            "  <include schemaLocation='abc.xsd'/>\n" +
+            "  <element name='a' type='string'/>\n" +
+            "  <element name='b'>\n" +
+            "    <complexType>\n" +
+            "      <sequence>\n" +
+            "        <element ref='p:a'/>\n" +
+            "      </sequence>\n" +
+            "    </complexType>\n" +
+            "  </element>\n" +
+            "</schema>\n";
+        final String importedSchema =
+            "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" +
+            "  <xs:element name='c' type='xs:string'/>\n" +
+            "  <xs:element name='d'>\n" +
+            "    <xs:complexType>\n" +
+            "      <xs:sequence>\n" +
+            "        <xs:element ref='c'/>\n" +
+            "      </xs:sequence>\n" +
+            "    </xs:complexType>\n" +
+            "  </xs:element>\n" +
+            "\n" +
+            "  <xs:element name='AnyAttribute'>\n" +
+            "    <xs:complexType>\n" +
+            "      <xs:anyAttribute namespace='##any'/>\n" +
+            "    </xs:complexType>\n" +
+            "  </xs:element>\n" +
+            "\n" +
+            "  <xs:element name='OtherAttribute'>\n" +
+            "    <xs:complexType>\n" +
+            "      <xs:anyAttribute namespace='##other'/>\n" +
+            "    </xs:complexType>\n" +
+            "  </xs:element>\n" +
+            "\n" +
+            "  <xs:element name='ListAttribute'>\n" +
+            "    <xs:complexType>\n" +
+            "      <xs:anyAttribute namespace='##targetNamespace http://ws.apache.org/jaxme/test/misc/wildcards/2'/>\n" +
+            "    </xs:complexType>\n" +
+            "  </xs:element>\n" +
+            "</xs:schema>\n";
+
+		EntityResolver resolver = new EntityResolver(){
+            public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+                if ("abc.xsd".equals(systemId)) {
+                    return new InputSource(new StringReader(importedSchema));
+                } else {
+                    throw new SAXException("Invalid systemId: " + systemId);
+                }
+            }
+        };
+        pParser.getContext().setXsObjectFactory(getXsObjectFactoryProxy(pParser.getContext().getXsObjectFactory(), resolver));
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testImportSchemaWithoutNamespace.xsd");
+        XSSchema schema = pParser.parse(isource);
+        XSElement[] elements = schema.getElements();
+        assertEquals(7, elements.length);
+        assertEquals(new XsQName("xyz", "c"), elements[0].getName());
+        assertEquals(new XsQName("xyz", "d"), elements[1].getName());
+        XSComplexType anyAttrElem = assertComplexType(elements[2].getType());
+        XSAttributable[] attrs = anyAttrElem.getAttributes();
+        assertEquals(1, attrs.length);
+        assertTrue(attrs[0] instanceof XSWildcard);
+        XSWildcard wc = (XSWildcard) attrs[0];
+        XsNamespaceList nsl = wc.getNamespaceList();
+        assertTrue(nsl.isAny());
+        assertNull(nsl.getUris());
+        XSComplexType otherAttrElem = assertComplexType(elements[3].getType());
+        attrs = otherAttrElem.getAttributes();
+        assertEquals(1, attrs.length);
+        assertTrue(attrs[0] instanceof XSWildcard);
+        nsl = ((XSWildcard) attrs[0]).getNamespaceList();
+        assertTrue(nsl.isOther());
+        assertEquals(1, nsl.getUris().length);
+        assertEquals("xyz", nsl.getUris()[0].toString());
+        XSComplexType listAttrElem = assertComplexType(elements[4].getType());
+        attrs = listAttrElem.getAttributes();
+        assertEquals(1, attrs.length);
+        assertTrue(attrs[0] instanceof XSWildcard);
+        nsl = ((XSWildcard) attrs[0]).getNamespaceList();
+        assertTrue(!nsl.isOther());
+        assertTrue(!nsl.isAny());
+        assertEquals(2, nsl.getUris().length);
+        assertEquals("xyz", nsl.getUris()[0].toString());
+        assertEquals("http://ws.apache.org/jaxme/test/misc/wildcards/2", nsl.getUris()[1].toString());
+        assertEquals(new XsQName("xyz", "a"), elements[5].getName());
+        assertEquals(new XsQName("xyz", "b"), elements[6].getName());
+    }
+
+    /** <p>Tests, whether importing a schema without namespace
+     * changes the imported schemas namespace to the local
+     * namespace.</p>
+     */
+    public void testImportSchemaWithoutNamespace() throws Exception {
+        testImportSchemaWithoutNamespace(newXSParser());
+        testImportSchemaWithoutNamespace(newJAXBParser());
+    }
+
+    private void testElementReferenceGlobal(XSParser pParser) throws Exception {
+        final String schemaSource =
+            "<?xml version='1.0' encoding='UTF-8'?>\n" +
+            "<schema xmlns='http://www.w3.org/2001/XMLSchema'" +
+            "    xmlns:jaxb='http://java.sun.com/xml/ns/jaxb'" +
+            "    targetNamespace='http://ws.apache.org/jaxme/test/recursion'" +
+            "    xmlns:rec='http://ws.apache.org/jaxme/test/recursion'" +
+            "    elementFormDefault='qualified' attributeFormDefault='unqualified'>\n" +
+            "  <element name='Attribute'>\n" +
+            "    <complexType>\n" +
+            "      <attribute name='id' type='string' use='required'/>\n" +
+            "      <attribute name='value' type='string' use='optional'/>\n" +
+            "    </complexType>\n" +
+            "  </element>\n" +
+            "\n" +
+            "  <element name='AttributeList'>\n" +
+            "    <complexType>\n" +
+            "      <sequence>\n" +
+            "        <element ref='rec:Attribute'/>\n" +
+            "        <element ref='rec:Attribute' minOccurs='0' maxOccurs='unbounded'/>\n" +
+            "      </sequence>\n" +
+            "    </complexType>\n" +
+            "  </element>\n" +
+            "</schema>\n";
+
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testElementReferenceGlobal.xsd");
+        XSSchema schema = pParser.parse(isource);
+        XSElement[] elements = schema.getElements();
+        assertEquals(2, elements.length);
+        assertEquals(new XsQName("http://ws.apache.org/jaxme/test/recursion", "Attribute"), elements[0].getName());
+        assertTrue(elements[0].isGlobal());
+        assertEquals(new XsQName("http://ws.apache.org/jaxme/test/recursion", "AttributeList"), elements[1].getName());
+        assertTrue(elements[1].isGlobal());
+        XSComplexType complexType = assertComplexType(elements[1].getType());
+        XSParticle particle = assertComplexContent(complexType);
+        XSGroup group = assertGroup(particle);
+        XSParticle[] particles = group.getParticles();
+        assertEquals(2, particles.length);
+        assertEquals(1, particles[0].getMinOccurs());
+        assertEquals(1, particles[0].getMaxOccurs());
+        XSElement refElement = assertElement(particles[0]);
+        assertTrue(refElement.isGlobal());
+        assertEquals(refElement.getName(), elements[0].getName());
+        assertEquals(0, particles[1].getMinOccurs());
+        assertEquals(-1, particles[1].getMaxOccurs());
+        refElement = assertElement(particles[1]);
+        assertTrue(refElement.isGlobal());
+        assertEquals(refElement.getName(), elements[0].getName());
+    }
+
+    /** Tests whether an element reference is flagged as a global
+     * element.
+     */
+    public void testElementReferenceGlobal() throws Exception {
+    	testElementReferenceGlobal(newXSParser());
+        testElementReferenceGlobal(newJAXBParser());
+    }
+
+	private void checkMailTemplateGroup(String pURI, XSType pType) throws SAXException {
+		XSComplexType ct = assertComplexType(pType);
+		assertFalse(ct.isEmpty());
+		XSParticle particle = assertComplexContent(ct);
+		XSGroup group = assertGroup(particle);
+		assertSequence(group);
+		XSParticle[] particles = group.getParticles();
+		assertEquals(2, particles.length);
+		assertElement(particles[0]);
+		assertEquals(new XsQName(pURI, "subject"), particles[0].getElement().getName());
+		XSGroup choice = assertGroup(particles[1]);
+		assertChoice(choice);
+		XSParticle[] choiceParticles = choice.getParticles();
+		assertEquals(2, choiceParticles.length);
+		XSGroup sequence = assertGroup(choiceParticles[0]);
+		assertSequence(sequence);
+		XSParticle[] sequenceParticles = sequence.getParticles();
+		assertEquals(2, sequenceParticles.length);
+		assertEquals(new XsQName(pURI, "prepend"), sequenceParticles[0].getElement().getName());
+		assertEquals(new XsQName(pURI, "append"), sequenceParticles[1].getElement().getName());
+		assertEquals(new XsQName(pURI, "body"), choiceParticles[1].getElement().getName());
+	}
+
+	private void testMailTemplateMixed(XSParser pParser) throws Exception {
+		final String uri = "http://ws.apache.org/jaxme/test/nestedGroups";
+		final String schemaSource =
+			"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'\n" +
+			"    xmlns:ng='" + uri + "'\n" +
+			"    targetNamespace='http://ws.apache.org/jaxme/test/nestedGroups'\n" +
+			"    elementFormDefault='qualified'\n" +
+			"    attributeFormDefault='unqualified'>\n" +
+			"  <xs:group name='MailTemplateGroup'>\n" +
+			"    <xs:sequence>\n" +
+			"      <xs:element name='subject' type='xs:string'/>\n" +
+			"      <xs:choice>\n" +
+			"        <xs:sequence>\n" +
+			"          <xs:element name='prepend' type='xs:string'/>\n" +
+			"          <xs:element name='append' type='xs:string'/>\n" +
+			"        </xs:sequence>\n" +
+			"        <xs:element name='body' maxOccurs='unbounded'>\n" +
+			"          <xs:complexType>\n" +
+			"            <xs:simpleContent>\n" +
+			"              <xs:extension base='xs:string'>\n" +
+			"                <xs:attribute name='delivery' use='required'>\n" +
+			"                  <xs:simpleType>\n" +
+			"                    <xs:restriction base='xs:string'>\n" +
+			"                      <xs:enumeration value='dailyDigest'/>\n" +
+			"                      <xs:enumeration value='immediate'/>\n" +
+			"                    </xs:restriction>\n" +
+			"                  </xs:simpleType>\n" +
+			"                </xs:attribute>\n" +
+			"              </xs:extension>\n" +
+			"            </xs:simpleContent>\n" +
+			"          </xs:complexType>\n" +
+			"        </xs:element>\n" +
+			"      </xs:choice>\n" +
+			"    </xs:sequence>\n" +
+			"  </xs:group>\n" +
+			"\n" +
+			"  <xs:element name='MailTemplate'>\n" +
+			"    <xs:complexType>\n" +
+			"      <xs:group ref='ng:MailTemplateGroup'/>\n" +
+			"      <xs:attribute name='language' type='xs:string' use='optional' default='EN'/>\n" +
+			"      <xs:attribute name='name' type='xs:string' use='required'/>\n" +
+			"    </xs:complexType>\n" +
+			"  </xs:element>\n" +
+			"\n" +
+			"  <xs:element name='MailTemplateMixed'>\n" +
+			"    <xs:complexType mixed='true'>\n" +
+			"      <xs:group ref='ng:MailTemplateGroup'/>\n" +
+			"      <xs:attribute name='language' type='xs:string' use='optional' default='EN'/>\n" +
+			"      <xs:attribute name='name' type='xs:string' use='required'/>\n" +
+			"    </xs:complexType>\n" +
+			"  </xs:element>\n" +
+			"</xs:schema>\n";
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testMailTemplateMixed.xsd");
+        XSSchema schema = pParser.parse(isource);
+		XSElement[] elements = schema.getElements();
+		assertEquals(2, elements.length);
+		assertEquals(new XsQName(uri, "MailTemplate"), elements[0].getName());
+		assertFalse(assertComplexType(elements[0].getType()).isMixed());
+		checkMailTemplateGroup(uri, elements[0].getType());
+		assertEquals(new XsQName(uri, "MailTemplateMixed"), elements[1].getName());
+		assertTrue(assertComplexType(elements[1].getType()).isMixed());
+		checkMailTemplateGroup(uri, elements[1].getType());
+	}
+
+    /** Tests handling of nested groups with and/or without mixed
+     * content.
+     */
+    public void testMailTemplateMixed() throws Exception {
+    	testMailTemplateMixed(newXSParser());
+        testMailTemplateMixed(newJAXBParser());
+    }
+
+	private XsObjectFactory getXsObjectFactoryProxy(final XsObjectFactory pFactory,
+												    final EntityResolver pResolver) {
+		InvocationHandler h = new InvocationHandler() {
+			public Object invoke(Object pProxy, Method pMethod, Object[] pArgs)
+					throws Throwable {
+				if (Object.class.equals(pMethod.getDeclaringClass())) {
+					return pMethod.invoke(pProxy, pArgs);
+				}
+				Object result = pMethod.invoke(pFactory, pArgs);
+				if ("newXMLReader".equals(pMethod.getName())  &&  result instanceof XMLReader) {
+					XMLReader xr = (XMLReader) result;
+					xr.setEntityResolver(pResolver);
+				}
+				return result;
+			}
+		};
+		Class[] classes;
+		if (pFactory instanceof JAXBXsObjectFactory) {
+			classes = new Class[]{JAXBXsObjectFactory.class};
+		} else {
+			classes = new Class[]{XsObjectFactory.class};
+		}
+		return (XsObjectFactory) Proxy.newProxyInstance(getClass().getClassLoader(), classes, h);
+	}
+
+	private void testRecursiveXsInclude(XSParser pParser) throws Exception {
+		final String a = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n"
+			+ "  <xs:include schemaLocation='b.xsd'/>\n"
+			+ "  <xs:element name='a' type='xs:int'/>\n"
+			+ "</xs:schema>\n";
+		final String b = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n"
+			+ "  <xs:include schemaLocation='a.xsd'/>\n"
+			+ "  <xs:element name='b' type='xs:int'/>\n"
+			+ "</xs:schema>\n";
+		final EntityResolver resolver = new EntityResolver(){
+			public InputSource resolveEntity(String pPublicId, String pSystemId) throws SAXException, IOException {
+				final String xml;
+				if ("a.xsd".equals(pSystemId)) {
+					xml = a;
+				} else if ("b.xsd".equals(pSystemId)) {
+					xml = b;
+				} else {
+					return null;
+				}
+				InputSource isource = new InputSource(new StringReader(xml));
+				isource.setSystemId(pSystemId);
+				return isource;
+			}
+		};
+		pParser.getContext().setXsObjectFactory(getXsObjectFactoryProxy(pParser.getContext().getXsObjectFactory(), resolver));
+		InputSource isource = new InputSource(new StringReader(a));
+		isource.setSystemId("a.xsd");
+		XSSchema schema = pParser.parse(isource);
+		assertEquals(2, schema.getElements().length);
+		assertEquals(0, schema.getTypes().length);
+	}
+
+	/** Tests, whether schemas can include each other recursively.
+	 */
+	public void testRecursiveXsInclude() throws Exception {
+		testRecursiveXsInclude(newXSParser());
+		testRecursiveXsInclude(newJAXBParser());
+	}
+
+
+	private void testGroupMultiplicity(XSParser pParser) throws Exception {
+		final String schemaSource =
+			"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n"
+			+ "<xs:element name='PARAMETERS'>\n"
+			+ "  <xs:complexType>\n"
+			+ "    <xs:choice maxOccurs='unbounded'>\n"
+			+ "      <xs:element name='PARAMETER'/>\n"
+			+ "      <xs:element name='SYSTEMPARAMETER'/>\n"
+			+ "      <xs:element name='PREPREF'/>\n"
+			+ "    </xs:choice>\n"
+			+ "  </xs:complexType>\n"
+			+ "</xs:element></xs:schema>\n";
+        InputSource isource = new InputSource(new StringReader(schemaSource));
+        isource.setSystemId("testElementReferenceGlobal.xsd");
+        XSSchema schema = pParser.parse(isource);
+        XSElement[] elements = schema.getElements();
+        assertEquals(1, elements.length);
+        XSElement parameters = elements[0];
+        XSParticle particle = assertComplexContent(assertComplexType(parameters.getType()));
+        assertEquals(1, particle.getMinOccurs());
+        assertEquals(-1, particle.getMaxOccurs());
+	}
+
+	/** Test the representation of groups with multiplicity > 1.
+	 */
+	public void testGroupMultiplicity() throws Exception {
+		testGroupMultiplicity(newXSParser());
+		testGroupMultiplicity(newJAXBParser());
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTestBase.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTestBase.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/ParserTestBase.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import junit.framework.TestCase;
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSElement;
+import org.apache.ws.jaxme.xs.XSGroup;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSModelGroup;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+import org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser;
+import org.apache.ws.jaxme.xs.xml.XsComplexContentType;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class ParserTestBase extends TestCase {
+  protected ParserTestBase(String pName) {
+    super(pName);
+  }
+
+  protected XSParser newXSParser() {
+    XSParser parser = new XSParser();
+    parser.setValidating(false);
+    return parser;
+  }
+
+  protected JAXBParser newJAXBParser() {
+    JAXBParser parser = new JAXBParser();
+    parser.setValidating(false);
+    return parser;
+  }
+
+  protected XSComplexType assertComplexType(XSType pType) throws SAXException {
+    assertTrue(!pType.isSimple());
+    XSComplexType result = pType.getComplexType();
+    assertNotNull(result);
+    boolean haveException = false;
+    try {
+      pType.getSimpleType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    return result;
+  }
+
+  protected XSSimpleType assertSimpleType(XSType pType) throws SAXException {
+    assertTrue(pType.isSimple());
+    XSSimpleType result = pType.getSimpleType();
+    assertNotNull(result);
+    boolean haveException = false;
+    try {
+      pType.getComplexType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    return result;
+  }
+
+  protected XSAtomicType assertAtomicType(XSSimpleType pType) throws SAXException {
+    assertTrue(pType.isAtomic());
+    assertTrue(!pType.isList());
+    assertTrue(!pType.isUnion());
+    XSAtomicType result = pType.getAtomicType();
+    assertNotNull(result);
+    boolean haveException = false;
+    try {
+      pType.getListType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    haveException = false;
+    try {
+      pType.getUnionType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    return result;
+  }
+
+  protected XSListType assertListType(XSSimpleType pType) throws SAXException {
+    assertTrue(!pType.isAtomic());
+    assertTrue(pType.isList());
+    assertTrue(!pType.isUnion());
+    XSListType result = pType.getListType();
+    assertNotNull(result);
+    boolean haveException = false;
+    try {
+      pType.getAtomicType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    haveException = false;
+    try {
+      pType.getUnionType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    return result;
+  }
+
+  protected XSUnionType assertUnionType(XSSimpleType pType) throws SAXException {
+    assertTrue(!pType.isAtomic());
+    assertTrue(!pType.isList());
+    assertTrue(pType.isUnion());
+    XSUnionType result = pType.getUnionType();
+    assertNotNull(result);
+    boolean haveException = false;
+    try {
+      pType.getListType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    haveException = false;
+    try {
+      pType.getAtomicType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    return result;
+  }
+
+  protected XSType assertRestriction(XSSimpleType pType) throws SAXException {
+    assertTrue(pType.isRestriction());
+    XSType result = pType.getRestrictedType();
+    assertNotNull(result);
+    assertSimpleType(result);
+    return result;
+  }
+
+  protected XSParticle assertComplexContent(XSComplexType pType) {
+    assertTrue(!pType.hasSimpleContent());
+    XSParticle result = pType.getParticle();
+    assertNotNull(result);
+    XsComplexContentType ccType = pType.getComplexContentType();
+    assertNotNull(pType.getComplexContentType());
+    int num = 0;
+    if (pType.isElementOnly()) {
+      ++num;
+      assertEquals(XsComplexContentType.ELEMENT_ONLY, ccType);
+    } 
+    if (pType.isEmpty()) {
+      ++num;
+      assertEquals(XsComplexContentType.EMPTY, ccType);
+    } 
+    if (pType.isMixed()) {
+      ++num;
+      assertEquals(XsComplexContentType.MIXED, ccType);
+    } 
+    assertEquals(1, num);
+  
+    num = 0;
+    if (result.isElement()) {
+      ++num;
+      assertNotNull(result.getElement());
+      assertEquals(XSParticle.ELEMENT, result.getType());
+    }
+    if (result.isGroup()) {
+      ++num;
+      assertNotNull(result.getGroup());
+      assertEquals(XSParticle.GROUP, result.getType());
+    }
+    if (result.isWildcard()) {
+      ++num;
+      assertNotNull(result.getWildcard());
+      assertEquals(XSParticle.WILDCARD, result.getType());
+    }
+    assertEquals(1, num);
+  
+    return result;
+  }
+
+  protected XSGroup assertGroup(XSParticle pParticle) {
+    assertTrue(pParticle.isGroup());
+    assertEquals(XSParticle.GROUP, pParticle.getType());
+    XSGroup result = pParticle.getGroup();
+    assertNotNull(result);
+    return result;
+  }
+
+  protected void assertSequence(XSGroup pGroup) {
+    assertTrue(pGroup.isSequence());
+    assertFalse(pGroup.isChoice());
+    assertFalse(pGroup.isAll());
+    assertEquals(XSModelGroup.SEQUENCE, pGroup.getCompositor());
+  }
+
+  protected void assertChoice(XSGroup pGroup) {
+	  assertFalse(pGroup.isSequence());
+	  assertTrue(pGroup.isChoice());
+	  assertFalse(pGroup.isAll());
+	  assertEquals(XSModelGroup.CHOICE, pGroup.getCompositor());
+  }
+
+  protected XSElement assertElement(XSParticle pParticle) {
+    assertTrue(pParticle.isElement());
+    assertEquals(XSParticle.ELEMENT, pParticle.getType());
+    XSElement result = pParticle.getElement();
+    assertNotNull(result);
+    return result;
+  }
+
+  protected XSSimpleContentType assertSimpleContent(XSComplexType pType) {
+    assertTrue(pType.hasSimpleContent());
+    XSSimpleContentType result = pType.getSimpleContent();
+    assertNotNull(result);
+    XSType resultType = result.getType();
+    assertNotNull(resultType);
+    assertTrue(resultType.isSimple());
+    boolean haveException = false;
+    try {
+      pType.getComplexContentType();
+    } catch (IllegalStateException e) {
+      haveException = true;
+    }
+    assertTrue(haveException);
+    assertNotNull(result);
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/SyntaxTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/SyntaxTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/SyntaxTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.junit;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class SyntaxTest extends TestCase {
+  public SyntaxTest(String pName) {
+    super(pName);
+  }
+
+  protected void parseSyntax(File f) throws IOException, SAXException, ParserConfigurationException {
+    XSParser xsp = new XSParser();
+    InputSource isource = new InputSource(new FileInputStream(f));
+    isource.setSystemId(f.toURL().toString());
+    xsp.parseSyntax(isource);
+  }
+
+  protected void parseLogical(File f) throws IOException, SAXException, ParserConfigurationException {
+    XSParser xsp = new XSParser();
+    InputSource isource = new InputSource(new FileInputStream(f));
+    isource.setSystemId(f.toURL().toString());
+    xsp.parse(isource);
+  }
+
+  protected void parseSyntax(String s) throws IOException, SAXException, ParserConfigurationException {
+    parseSyntax(new File(s));
+  }
+
+  protected void parseLogical(String s) throws IOException, SAXException, ParserConfigurationException {
+    parseLogical(new File(s));
+  }
+
+  public void testStructureSyntax() throws Exception {
+    parseSyntax("examples/xs/structures.xsd");
+  }
+
+  public void testDatatypesSyntax() throws Exception {
+    parseSyntax("examples/xs/datatypes.xsd");
+  }
+
+  public void testXmlSyntax() throws Exception {
+    parseSyntax("examples/xs/xml.xsd");
+  }
+
+  public void testStructureLogical() throws Exception {
+    parseLogical("examples/xs/structures.xsd");
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/TestSrcContent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/TestSrcContent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/TestSrcContent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.xs.junit;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.xml.sax.InputSource;
+
+
+public class TestSrcContent extends TestCase {
+  public TestSrcContent(String name) {
+    super(name);
+  }
+
+  public void testSourceFiles() throws Exception {
+    String path = System.getProperty("xstc.zip.file");
+    if (path == null  ||  "".equals(path)) {
+      fail("The property xstc.zip.file is not set.");
+    }
+    File f = new File(path);
+    if (!f.exists()  ||  !f.isFile()) {
+      fail("The file " + f.getAbsolutePath() +
+           ", given by property xstc.zip.file, does not exist ");
+    }
+
+    int passXSDFiles = 0;
+    int failXSDFiles = 0;
+
+    ZipFile zipFile = new ZipFile(f);
+    for (Enumeration en = zipFile.entries();  en.hasMoreElements();  ) {
+      ZipEntry entry = (ZipEntry) en.nextElement();
+      if (entry.isDirectory()) {
+        continue;
+      }
+      String name = entry.getName();
+      if (!name.endsWith(".xsd")) {
+        continue;
+      }
+
+      InputSource iSource = new InputSource(zipFile.getInputStream(entry));
+      iSource.setSystemId(name);
+      System.out.print(name);
+      XSParser parser = new XSParser();
+      parser.setValidating(false);
+      try {
+        parser.parseSyntax(iSource);
+        passXSDFiles++;
+        System.out.println(": PASS");
+      } catch (Exception e) {
+        failXSDFiles++;
+        System.out.println(": FAIL");
+        e.printStackTrace(System.out);
+      }
+    }
+
+    System.out.println();
+    System.out.println();
+    System.out.println("Total files = " + (passXSDFiles + failXSDFiles));
+    System.out.println("Passed      = " + passXSDFiles);
+    System.out.println("Failed      = " + failXSDFiles);
+  }
+
+  public static void main(String[] args) throws Exception {
+    TestSrcContent testSrcContent = new TestSrcContent(TestSrcContent.class.getName());
+    testSrcContent.testSourceFiles();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/WSDLTest.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/WSDLTest.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/junit/WSDLTest.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,7159 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+ package org.apache.ws.jaxme.xs.junit;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import junit.framework.TestCase;
+import org.apache.ws.jaxme.xs.XSContentHandler;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/** <p>A variety of WSDL schemas being tested.</p>
+ *
+ * @author Srinath Perera (hemapani at opensource.lk)
+ * @author Jeyakumaran.C (jkumaran at opensource.lk)
+ */
+public class WSDLTest extends TestCase {
+  private static final boolean parseBySax = false;
+  private static final boolean parseByDom = true;
+
+  public WSDLTest(String pArg0) {
+    super(pArg0);
+  }
+
+  /** <p>This is the actual parsing code.</p>
+   */
+  public void addTypes(org.w3c.dom.Element ele, Document pSoapDataTypes) throws SAXException {
+    Element element = pSoapDataTypes.getDocumentElement();
+    String namespace = element.getAttributeNS(null, "targetNamespace");
+    if (namespace == null  ||  namespace.length() == 0) {
+      throw new IllegalStateException("Namespace is not set");
+    }
+    XSParser parser = new XSParser();
+    parser.addImport(namespace, null, pSoapDataTypes);
+    XSSchema schema = parser.parse(ele);
+    assertNotNull(schema);
+    assertTrue(schema.getElements().length > 0);
+  }
+
+  private class FilterHandler implements ContentHandler {
+    private XSContentHandler xsContentHandler;
+    private List prefixes = new ArrayList();
+    private Locator locator;
+    private List schemas = new ArrayList();
+    private final Document myDataTypes;
+
+    public FilterHandler(Document pSoapDataTypes) {
+      myDataTypes = pSoapDataTypes;
+    }
+
+    public XSSchema[] getSchemas() {
+      return (XSSchema[]) schemas.toArray(new XSSchema[schemas.size()]);
+    }
+
+    public void startDocument() throws SAXException {
+    }
+
+    public void endDocument() throws SAXException {
+    }
+
+    public void characters(char[] pChars, int pOffset, int pLen) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.characters(pChars, pOffset, pLen);
+      }
+    }
+
+    public void ignorableWhitespace(char[] pChars, int pOffset, int pLen) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.ignorableWhitespace(pChars, pOffset, pLen);
+      }
+    }
+
+    public void endPrefixMapping(String pPrefix) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.endPrefixMapping(pPrefix);
+      }
+      int size = prefixes.size();
+      prefixes.remove(size-1);
+      prefixes.remove(size-2);
+    }
+
+    public void skippedEntity(String pEntity) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.skippedEntity(pEntity);
+      }
+    }
+
+    public void setDocumentLocator(Locator pLocator) {
+      if (xsContentHandler != null) {
+        xsContentHandler.setDocumentLocator(pLocator);
+      }
+      locator = pLocator;
+    }
+
+    public void processingInstruction(String pTarget, String pData) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.processingInstruction(pTarget, pData);
+      }
+    }
+
+    public void startPrefixMapping(String pPrefix, String pUri) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.startPrefixMapping(pPrefix, pUri);
+      }
+      prefixes.add(pPrefix);
+      prefixes.add(pUri);
+    }
+
+    public void endElement(String pNamespaceURI, String pLocalName, String pQName) throws SAXException {
+      if (xsContentHandler != null) {
+        xsContentHandler.endElement(pNamespaceURI, pLocalName, pQName);
+        if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)  &&  "schema".equals(pLocalName)) {
+          for (int i = prefixes.size();  i > 0;  i -= 2) {
+            xsContentHandler.endPrefixMapping((String) prefixes.get(i-2));
+          }
+          xsContentHandler.endDocument();
+          schemas.add(xsContentHandler.getXSSchema());
+          xsContentHandler = null;
+        }
+      }
+    }
+
+    public void startElement(String pNamespaceURI, String pLocalName, String pQName,
+                              Attributes pAttr) throws SAXException {
+      if (xsContentHandler == null) {
+        if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)  &&  "schema".equals(pLocalName)) {
+          XSParser parser = new XSParser();
+          Element element = myDataTypes.getDocumentElement();
+          String namespace = element.getAttributeNS(null, "targetNamespace");
+          if (namespace == null  ||  namespace.length() == 0) {
+            throw new IllegalStateException("Namespace is not set");
+          }
+          parser.addImport(namespace, soapDataTypes);
+          xsContentHandler = new XSParser().getXSContentHandler(null);
+          if (locator != null) {
+            xsContentHandler.setDocumentLocator(locator);
+          }
+          xsContentHandler.startDocument();
+          for (int i = 0;  i < prefixes.size();  i += 2) {
+            xsContentHandler.startPrefixMapping((String) prefixes.get(i), (String) prefixes.get(i+1));
+          }
+          xsContentHandler.startElement(pNamespaceURI, pLocalName, pQName, pAttr);
+        }
+      } else {
+        xsContentHandler.startElement(pNamespaceURI, pLocalName, pQName, pAttr);
+      }
+    }
+  }
+
+  public void parseBySax(String file, String name, Document pSoapDataTypes)
+      throws SAXException, ParserConfigurationException, IOException {
+    StringReader sr = new StringReader(file);
+    InputSource isource = new InputSource(sr);
+    isource.setSystemId(name);
+    SAXParserFactory spf = SAXParserFactory.newInstance();
+    spf.setValidating(false);
+    spf.setNamespaceAware(true);
+    SAXParser sp = spf.newSAXParser();
+    XMLReader xr = sp.getXMLReader();
+    FilterHandler fh = new FilterHandler(pSoapDataTypes);
+    xr.setContentHandler(fh);
+    xr.parse(isource);
+    assertTrue(fh.getSchemas().length > 0);
+  }
+
+  public void parseByDom(String file, String name, Document pSoapDataTypes)
+      throws SAXException, IOException, ParserConfigurationException {
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    dbf.setValidating(false);
+    dbf.setNamespaceAware(true);
+    StringReader sr = new StringReader(file);
+    InputSource isource = new InputSource(sr);
+    isource.setSystemId(name);
+    Document doc = dbf.newDocumentBuilder().parse(isource);
+  
+    org.w3c.dom.Element root = doc.getDocumentElement();
+    NodeList nodes = null;
+            
+    if (root.getTagName() != null
+        && root.getTagName().endsWith("schema")) {
+      addTypes(root, pSoapDataTypes);
+    } else if(root.getTagName()!=null && root.getTagName().endsWith("definitions")) {
+      // search for 'types' element        
+      Node node = null;     
+      boolean found = false;
+      nodes = root.getChildNodes();
+      for (int i=0;  i < nodes.getLength();  i++) {
+        node = nodes.item(i);
+        if (node.getNodeName() != null &&
+            node.getNodeName().endsWith("types")) {
+          found=true;
+          break;       
+        }         
+      }
+      if (found) {
+        nodes = node.getChildNodes();
+        for(int i=0; i< nodes.getLength() ; i++ ){
+          node = nodes.item(i);
+          if (node.getNodeName()!=null && node.getNodeName().endsWith("schema")) {
+            addTypes((org.w3c.dom.Element) node, pSoapDataTypes);
+          }
+        }//found      
+      } else{
+        throw new IllegalStateException("I can not handle this. The parameter passed in -doc's root is not the schema or definition");
+      }
+    }
+  }
+
+  public void parseString(String file, String name) throws Exception{
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    dbf.setValidating(false);
+    dbf.setNamespaceAware(true);
+    StringReader sr = new StringReader(soapDataTypes);
+    Document doc = dbf.newDocumentBuilder().parse(new InputSource(sr));
+    
+    // To get better error messages, parse with a special ContentHandler first
+    if (parseBySax) {
+      parseBySax(file, name, doc);
+    }
+
+    if (parseByDom) {
+      parseByDom(file, name, doc);
+    }
+  }
+
+  private static final String soapDataTypes =
+  "<?xml version='1.0' encoding='UTF-8' ?>\n" +
+  "\n" +
+  "<schema xmlns:tns='http://schemas.xmlsoap.org/soap/encoding/'\n" +
+  "        targetNamespace='http://schemas.xmlsoap.org/soap/encoding/' \n" +
+  " xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
+  "        \n" +
+  " <attribute name='root' >\n" +
+  "   <annotation>\n" +
+  "     <documentation>\n" +
+  "    'root' can be used to distinguish serialization roots from other\n" +
+  "       elements that are present in a serialization but are not roots of\n" +
+  "       a serialized value graph \n" +
+  "  </documentation>\n" +
+  "   </annotation>\n" +
+  "   <simpleType>\n" +
+  "     <restriction base='boolean'>\n" +
+  "    <pattern value='0|1' />\n" +
+  "  </restriction>\n" +
+  "   </simpleType>\n" +
+  " </attribute>\n" +
+  "\n" +
+  "  <attributeGroup name='commonAttributes' >\n" +
+  "    <annotation>\n" +
+  "   <documentation>\n" +
+  "     Attributes common to all elements that function as accessors or \n" +
+  "        represent independent (multi-ref) values.  The href attribute is\n" +
+  "        intended to be used in a manner like CONREF.  That is, the element\n" +
+  "        content should be empty iff the href attribute appears\n" +
+  "   </documentation>\n" +
+  " </annotation>\n" +
+  "    <attribute name='id' type='ID' />\n" +
+  "    <attribute name='href' type='anyURI' />\n" +
+  "    <anyAttribute namespace='##other' processContents='lax' />\n" +
+  "  </attributeGroup>\n" +
+  "\n" +
+  " <simpleType name='arrayCoordinate' >\n" +
+  "    <restriction base='string' />\n" +
+  "  </simpleType>\n" +
+  "          \n" +
+  "  <attribute name='arrayType' type='string' />\n" +
+  "  <attribute name='offset' type='tns:arrayCoordinate' />\n" +
+  "  \n" +
+  "  <attributeGroup name='arrayAttributes' >\n" +
+  "    <attribute ref='tns:arrayType' />\n" +
+  "    <attribute ref='tns:offset' />\n" +
+  "  </attributeGroup>    \n" +
+  "  \n" +
+  "  <attribute name='position' type='tns:arrayCoordinate' /> \n" +
+  "  \n" +
+  "  <attributeGroup name='arrayMemberAttributes' >\n" +
+  "    <attribute ref='tns:position' />\n" +
+  "  </attributeGroup>    \n" +
+  "\n" +
+  "  <group name='Array' >\n" +
+  "    <sequence>\n" +
+  "      <any namespace='##any' minOccurs='0' maxOccurs='unbounded' processContents='lax' />\n" +
+  " </sequence>\n" +
+  "  </group>\n" +
+  "\n" +
+  "  <element name='Array' type='tns:Array' />\n" +
+  "  <complexType name='Array' >\n" +
+  "    <annotation>\n" +
+  "   <documentation>\n" +
+  "    'Array' is a complex type for accessors identified by position \n" +
+  "   </documentation>\n" +
+  " </annotation>\n" +
+  "    <group ref='tns:Array' minOccurs='0' />\n" +
+  "    <attributeGroup ref='tns:arrayAttributes' />\n" +
+  "    <attributeGroup ref='tns:commonAttributes' />\n" +
+  "  </complexType> \n" +
+  "\n" +
+  "  \n" +
+  "  <element name='Struct' type='tns:Struct' />\n" +
+  "\n" +
+  "  <group name='Struct' >\n" +
+  "    <sequence>\n" +
+  "      <any namespace='##any' minOccurs='0' maxOccurs='unbounded' processContents='lax' />\n" +
+  " </sequence>\n" +
+  "  </group>\n" +
+  "\n" +
+  "  <complexType name='Struct' >\n" +
+  "    <group ref='tns:Struct' minOccurs='0' />\n" +
+  "    <attributeGroup ref='tns:commonAttributes'/>\n" +
+  "  </complexType> \n" +
+  "\n" +
+  "\n" +
+  "  <simpleType name='base64' >\n" +
+  "    <restriction base='base64Binary' />\n" +
+  "  </simpleType>\n" +
+  "\n" +
+  "\n" +
+  "  <element name='duration' type='tns:duration' />\n" +
+  "  <complexType name='duration' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='duration' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='dateTime' type='tns:dateTime' />\n" +
+  "  <complexType name='dateTime' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='dateTime' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "\n" +
+  "\n" +
+  "  <element name='NOTATION' type='tns:NOTATION' />\n" +
+  "  <complexType name='NOTATION' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='QName' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "  \n" +
+  "\n" +
+  "  <element name='time' type='tns:time' />\n" +
+  "  <complexType name='time' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='time' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='date' type='tns:date' />\n" +
+  "  <complexType name='date' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='date' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='gYearMonth' type='tns:gYearMonth' />\n" +
+  "  <complexType name='gYearMonth' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='gYearMonth' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='gYear' type='tns:gYear' />\n" +
+  "  <complexType name='gYear' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='gYear' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='gMonthDay' type='tns:gMonthDay' />\n" +
+  "  <complexType name='gMonthDay' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='gMonthDay' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='gDay' type='tns:gDay' />\n" +
+  "  <complexType name='gDay' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='gDay' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='gMonth' type='tns:gMonth' />\n" +
+  "  <complexType name='gMonth' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='gMonth' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "  \n" +
+  "  <element name='boolean' type='tns:boolean' />\n" +
+  "  <complexType name='boolean' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='boolean' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='base64Binary' type='tns:base64Binary' />\n" +
+  "  <complexType name='base64Binary' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='base64Binary' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='hexBinary' type='tns:hexBinary' />\n" +
+  "  <complexType name='hexBinary' >\n" +
+  "    <simpleContent>\n" +
+  "     <extension base='hexBinary' >\n" +
+  "       <attributeGroup ref='tns:commonAttributes' />\n" +
+  "     </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='float' type='tns:float' />\n" +
+  "  <complexType name='float' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='float' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='double' type='tns:double' />\n" +
+  "  <complexType name='double' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='double' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='anyURI' type='tns:anyURI' />\n" +
+  "  <complexType name='anyURI' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='anyURI' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='QName' type='tns:QName' />\n" +
+  "  <complexType name='QName' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='QName' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  \n" +
+  "  <element name='string' type='tns:string' />\n" +
+  "  <complexType name='string' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='string' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='normalizedString' type='tns:normalizedString' />\n" +
+  "  <complexType name='normalizedString' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='normalizedString' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='token' type='tns:token' />\n" +
+  "  <complexType name='token' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='token' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='language' type='tns:language' />\n" +
+  "  <complexType name='language' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='language' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='Name' type='tns:Name' />\n" +
+  "  <complexType name='Name' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='Name' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='NMTOKEN' type='tns:NMTOKEN' />\n" +
+  "  <complexType name='NMTOKEN' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='NMTOKEN' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='NCName' type='tns:NCName' />\n" +
+  "  <complexType name='NCName' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='NCName' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='NMTOKENS' type='tns:NMTOKENS' />\n" +
+  "  <complexType name='NMTOKENS' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='NMTOKENS' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='ID' type='tns:ID' />\n" +
+  "  <complexType name='ID' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='ID' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='IDREF' type='tns:IDREF' />\n" +
+  "  <complexType name='IDREF' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='IDREF' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='ENTITY' type='tns:ENTITY' />\n" +
+  "  <complexType name='ENTITY' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='ENTITY' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='IDREFS' type='tns:IDREFS' />\n" +
+  "  <complexType name='IDREFS' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='IDREFS' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='ENTITIES' type='tns:ENTITIES' />\n" +
+  "  <complexType name='ENTITIES' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='ENTITIES' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='decimal' type='tns:decimal' />\n" +
+  "  <complexType name='decimal' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='decimal' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='integer' type='tns:integer' />\n" +
+  "  <complexType name='integer' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='integer' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='nonPositiveInteger' type='tns:nonPositiveInteger' />\n" +
+  "  <complexType name='nonPositiveInteger' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='nonPositiveInteger' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='negativeInteger' type='tns:negativeInteger' />\n" +
+  "  <complexType name='negativeInteger' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='negativeInteger' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='long' type='tns:long' />\n" +
+  "  <complexType name='long' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='long' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='int' type='tns:int' />\n" +
+  "  <complexType name='int' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='int' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='short' type='tns:short' />\n" +
+  "  <complexType name='short' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='short' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='byte' type='tns:byte' />\n" +
+  "  <complexType name='byte' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='byte' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='nonNegativeInteger' type='tns:nonNegativeInteger' />\n" +
+  "  <complexType name='nonNegativeInteger' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='nonNegativeInteger' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='unsignedLong' type='tns:unsignedLong' />\n" +
+  "  <complexType name='unsignedLong' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='unsignedLong' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='unsignedInt' type='tns:unsignedInt' />\n" +
+  "  <complexType name='unsignedInt' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='unsignedInt' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='unsignedShort' type='tns:unsignedShort' />\n" +
+  "  <complexType name='unsignedShort' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='unsignedShort' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='unsignedByte' type='tns:unsignedByte' />\n" +
+  "  <complexType name='unsignedByte' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='unsignedByte' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  "  <element name='positiveInteger' type='tns:positiveInteger' />\n" +
+  "  <complexType name='positiveInteger' >\n" +
+  "    <simpleContent>\n" +
+  "      <extension base='positiveInteger' >\n" +
+  "        <attributeGroup ref='tns:commonAttributes' />\n" +
+  "      </extension>\n" +
+  "    </simpleContent>\n" +
+  "  </complexType>\n" +
+  "\n" +
+  " </schema>\n";
+  
+  private static final String addressBook =
+  "<?xml version='1.0' ?>\n" +
+  "\n" +
+  "<definitions name='urn:AddrNoImplSEI'\n" +
+  "             targetNamespace='urn:AddrNoImplSEI'\n" +
+  "             xmlns:tns='urn:AddrNoImplSEI'\n" +
+  "             xmlns:typens='urn:AddrNoImplSEI'\n" +
+  "             xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+  "             xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'\n" +
+  "             xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/'\n" +
+  "             xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'\n" +
+  "             xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "\n" +
+  "  <!-- type defs -->\n" +
+  "  <types>\n" +
+  "    <xsd:schema targetNamespace='urn:AddrNoImplSEI'\n" +
+  "                xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+  "\n" +
+  "      <xsd:simpleType name='StateType'>\n" +
+  "        <xsd:restriction base='xsd:string'>\n" +
+  "            <xsd:enumeration value='TX'/>                      \n" +
+  "            <xsd:enumeration value='IN'/>                    \n" +
+  "            <xsd:enumeration value='OH'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:element name='Phone'>\n" +
+  "        <xsd:complexType>\n" +
+  "          <xsd:all>\n" +
+  "              <xsd:element name='areaCode' type='xsd:int'/>\n" +
+  "              <xsd:element name='exchange' type='xsd:string'/>\n" +
+  "              <xsd:element name='number' type='xsd:string'/>\n" +
+  "          </xsd:all>\n" +
+  "        </xsd:complexType>\n" +
+  "      </xsd:element>\n" +
+  "\n" +
+  "      <xsd:complexType name='Address'>\n" +
+  "        <xsd:all>\n" +
+  "            <xsd:element name='streetNum' type='xsd:int'/>\n" +
+  "            <xsd:element name='streetName' type='xsd:string'/>\n" +
+  "            <xsd:element name='city' type='xsd:string'/>\n" +
+  "            <xsd:element name='state' type='typens:StateType'/>\n" +
+  "            <xsd:element name='zip' type='xsd:int'/>\n" +
+  "            <xsd:element ref='typens:Phone'/>\n" +
+  "        </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='ArrayOfaddress'>\n" +
+  "         <xsd:complexContent>\n" +
+  "            <xsd:restriction base='soap-enc:Array'>\n" +
+  "                <xsd:attribute ref='soap-enc:arrayType' wsdl:arrayType='typens:Address[]'/>\n" +
+  "            </xsd:restriction>\n" +
+  "         </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "    </xsd:schema>\n" +
+  "  </types>\n" +
+  "\n" +
+  "  <!-- message declns -->\n" +
+  "  <message name='AddEntryRequest'>\n" +
+  "    <part name='name' type='xsd:string'/>\n" +
+  "    <part name='address' type='typens:Address'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='GetAddressFromNameRequest'>\n" +
+  "    <part name='name' type='xsd:string'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='GetAddressFromNameResponse'>\n" +
+  "    <part name='address' type='typens:Address'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='getAddressesRequest'>\n" +
+  "  </message>  \n" +
+  "\n" +
+  "  <message name='getAddressesResponse'>\n" +
+  "    <part name='addresses' type='typens:ArrayOfaddress'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <!-- port type declns -->\n" +
+  "  <portType name='AddressBookNoImplSEI'>\n" +
+  "    <operation name='addEntry'>\n" +
+  "      <input message='tns:AddEntryRequest'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='getAddressFromName'>\n" +
+  "      <input message='tns:GetAddressFromNameRequest'/>\n" +
+  "      <output message='tns:GetAddressFromNameResponse'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='getAddresses'>\n" +
+  "      <input message='tns:getAddressesRequest'/>\n" +
+  "      <output message='tns:getAddressesResponse'/>\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "\n" +
+  "  <!-- binding declns -->\n" +
+  "  <binding name='AddressBookNoImplSEISoapBinding' type='tns:AddressBookNoImplSEI'>\n" +
+  "    <soap:binding style='rpc'\n" +
+  "                  transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "    <operation name='addEntry'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:AddrNoImplSEI'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:AddrNoImplSEI'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='getAddressFromName'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:AddrNoImplSEI'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:AddrNoImplSEI'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='getAddresses'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:AddressFetcher2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:AddressFetcher2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "\n" +
+  "  <!-- service decln -->\n" +
+  "  <service name='AddressBookNoImplSEIService'>\n" +
+  "    <port name='AddressBookNoImplSEI' binding='tns:AddressBookNoImplSEISoapBinding'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/AddressBookNoImplSEI'/>\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "\n" +
+  "</definitions>\n";
+
+  public void testAddressBook() throws Exception {
+    parseString(addressBook, "addressBook.xsd");
+  }
+
+  private final String clash =
+  "<?xml version='1.0' ?>\n" +
+  "\n" +
+  "<definitions \n" +
+  "    name='name clash test'\n" +
+  "    targetNamespace='urn:clash.wsdl.test'\n" +
+  "    xmlns:tns='urn:clash.wsdl.test'\n" +
+  "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+  "    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'\n" +
+  "    xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'\n" +
+  "    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'\n" +
+  "    xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "\n" +
+  "  <!-- type defs -->\n" +
+  "  <types>\n" +
+  "    <xsd:schema targetNamespace='urn:clash.wsdl.test'\n" +
+  "                xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+  "      <xsd:complexType name='sharedName'>\n" +
+  "        <xsd:all>\n" +
+  "          <xsd:element name='sharedName' type='xsd:int'/>\n" +
+  "        </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:element name='sharedName'>\n" +
+  "        <xsd:complexType>\n" +
+  "          <xsd:all>\n" +
+  "            <xsd:element name='sharedName' type='xsd:int'/>\n" +
+  "          </xsd:all>\n" +
+  "        </xsd:complexType>\n" +
+  "      </xsd:element>\n" +
+  "      <xsd:element name='another'>\n" +
+  "        <xsd:complexType>\n" +
+  "          <xsd:all>\n" +
+  "            <xsd:element name='sharedName' type='xsd:boolean'/>\n" +
+  "          </xsd:all>\n" +
+  "        </xsd:complexType>\n" +
+  "      </xsd:element>\n" +
+  "    </xsd:schema>\n" +
+  "  </types>\n" +
+  "\n" +
+  "  <!-- message declns -->\n" +
+  "  <message name='empty'/>\n" +
+  "\n" +
+  "  <message name='sharedName'>\n" +
+  "    <part name='sharedName' type='tns:sharedName'/>\n" +
+  "  </message>\n" +
+  "  <message name='anotherMessage'>\n" +
+  "    <part name='sharedName' type='xsd:int'/>\n" +
+  "  </message>\n" +
+  "  <message name='literalMessage'>\n" +
+  "    <part name='literalPart' element='tns:sharedName'/>\n" +
+  "  </message>\n" +
+  "  <message name='anotherLitMessage'>\n" +
+  "    <part name='sharedName' element='tns:another'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <!-- port type declns -->\n" +
+  "  <portType name='sharedName'>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn' message='tns:empty'/>\n" +
+  "      <output name='sharedNameOut' message='tns:sharedName'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn2' message='tns:sharedName'/>\n" +
+  "      <output name='emptyOut2' message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='anotherIn3' message='tns:anotherMessage'/>\n" +
+  "      <output name='emptyOut3' message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "\n" +
+  "  <portType name='literalPort'>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn' message='tns:empty'/>\n" +
+  "      <output name='sharedNameOut' message='tns:literalMessage'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn2' message='tns:literalMessage'/>\n" +
+  "      <output name='emptyOut2' message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='anotherIn3' message='tns:anotherLitMessage'/>\n" +
+  "      <output name='emptyOut3' message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "\n" +
+  "  <!-- binding declns -->\n" +
+  "  <binding name='nonSharedName' type='tns:sharedName'>\n" +
+  "    <soap:binding\n" +
+  "        style='rpc'\n" +
+  "        transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </input>\n" +
+  "      <output name='sharedNameOut'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn2'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </input>\n" +
+  "      <output name='emptyOut2'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='anotherIn3'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </input>\n" +
+  "      <output name='emptyOut3'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "\n" +
+  "<!-- don't do this one just yet...\n" +
+  "  <binding name='sharedName' type='tns:literalPort'>\n" +
+  "    <soap:binding\n" +
+  "        style='rpc'\n" +
+  "        transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn'>\n" +
+  "        <soap:body use='literal'/>\n" +
+  "      </input>\n" +
+  "      <output name='sharedNameOut'>\n" +
+  "        <soap:body use='literal'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn2'>\n" +
+  "        <soap:body use='literal'/>\n" +
+  "      </input>\n" +
+  "      <output name='emptyOut2'>\n" +
+  "        <soap:body use='literal'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='anotherIn3'>\n" +
+  "        <soap:body use='literal'/>\n" +
+  "      </input>\n" +
+  "      <output name='emptyOut3'>\n" +
+  "        <soap:body use='literal'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "-->\n" +
+  "\n" +
+  "  <binding name='anotherNonSharedName' type='tns:sharedName'>\n" +
+  "    <soap:binding\n" +
+  "        style='rpc'\n" +
+  "        transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </input>\n" +
+  "      <output name='sharedNameOut'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='sharedNameIn2'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </input>\n" +
+  "      <output name='emptyOut2'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='sharedName'>\n" +
+  "      <input name='anotherIn3'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </input>\n" +
+  "      <output name='emptyOut3'>\n" +
+  "        <soap:body use='encoded'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "\n" +
+  "  <!-- service decln -->\n" +
+  "  <service name='sharedName'>\n" +
+  "    <port name='nonSharedName' binding='tns:nonSharedName'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/nonSharedName'/>\n" +
+  "    </port>\n" +
+  "    <port name='anotherNonSharedName' binding='tns:anotherNonSharedName'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/anotherNonSharedName'/>\n" +
+  "    </port>\n" +
+  "<!-- don't do this just yet...\n" +
+  "    <port name='sharedName' binding='tns:sharedName'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/sharedName'/>\n" +
+  "    </port>\n" +
+  "-->\n" +
+  "  </service>\n" +
+  "\n" +
+  "</definitions>\n";
+
+  public void testClash() throws Exception {
+    parseString(clash, "clash.xsd");
+  }
+
+  private static final String getPlan =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "<definitions xmlns:http='http://schemas.xmlsoap.org/wsdl/http/'\n" +
+  "    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'\n" +
+  "    xmlns:s='http://www.w3.org/2001/XMLSchema'\n" +
+  "    xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'\n" +
+  "    xmlns:tm='http://microsoft.com/wsdl/mime/textMatching/'\n" +
+  "    xmlns:s0='http://tempuri.org/'\n" +
+  "    xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'\n" +
+  "    targetNamespace='http://tempuri.org/' xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "  <types>\n" +
+  "    <s:schema elementFormDefault='qualified' targetNamespace='http://tempuri.org/'>\n" +
+  "      <s:element name='GetPlan'>\n" +
+  "        <s:complexType />\n" +
+  "      </s:element>\n" +
+  "      <s:element name='GetPlanResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='GetPlanResult'\n" +
+  "                type='s0:Plan'/>\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "\n" +
+  "      <s:complexType name='Plan'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='Disposition'\n" +
+  "              type='s0:Disposition'/>\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "\n" +
+  "      <s:complexType name='Disposition'>\n" +
+  "        <s:complexContent mixed='false'>\n" +
+  "          <s:extension base='s0:Status' />\n" +
+  "        </s:complexContent>\n" +
+  "      </s:complexType>\n" +
+  "\n" +
+  "      <s:complexType name='Status'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='Code' type='s:string' />\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='Description' \n" +
+  "              type='s:string'/>\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "\n" +
+  "      <s:element name='Plan' nillable='true' type='s0:Plan' />\n" +
+  "    </s:schema>\n" +
+  "  </types>\n" +
+  "  <message name='GetPlanSoapIn'>\n" +
+  "    <part name='parameters' element='s0:GetPlan' />\n" +
+  "  </message>\n" +
+  "  <message name='GetPlanSoapOut'>\n" +
+  "    <part name='parameters' element='s0:GetPlanResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='GetPlanHttpGetIn' />\n" +
+  "  <message name='GetPlanHttpGetOut'>\n" +
+  "    <part name='Body' element='s0:Plan' />\n" +
+  "  </message>\n" +
+  "  <message name='GetPlanHttpPostIn' />\n" +
+  "  <message name='GetPlanHttpPostOut'>\n" +
+  "    <part name='Body' element='s0:Plan' />\n" +
+  "  </message>\n" +
+  "  <portType name='PlanWSSoap'>\n" +
+  "    <operation name='GetPlan'>\n" +
+  "      <input message='s0:GetPlanSoapIn' />\n" +
+  "      <output message='s0:GetPlanSoapOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <portType name='PlanWSHttpGet'>\n" +
+  "    <operation name='GetPlan'>\n" +
+  "      <input message='s0:GetPlanHttpGetIn' />\n" +
+  "      <output message='s0:GetPlanHttpGetOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <portType name='PlanWSHttpPost'>\n" +
+  "    <operation name='GetPlan'>\n" +
+  "      <input message='s0:GetPlanHttpPostIn' />\n" +
+  "      <output message='s0:GetPlanHttpPostOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <binding name='PlanWSSoap' type='s0:PlanWSSoap'>\n" +
+  "    <soap:binding transport='http://schemas.xmlsoap.org/soap/http' \n" +
+  "        style='document'/>\n" +
+  "    <operation name='GetPlan'>\n" +
+  "      <soap:operation soapAction='http://tempuri.org/GetPlan' \n" +
+  "          style='document'/>\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <binding name='PlanWSHttpGet' type='s0:PlanWSHttpGet'>\n" +
+  "    <http:binding verb='GET' />\n" +
+  "    <operation name='GetPlan'>\n" +
+  "      <http:operation location='/GetPlan' />\n" +
+  "      <input>\n" +
+  "        <http:urlEncoded />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <mime:mimeXml part='Body' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <binding name='PlanWSHttpPost' type='s0:PlanWSHttpPost'>\n" +
+  "    <http:binding verb='POST' />\n" +
+  "    <operation name='GetPlan'>\n" +
+  "      <http:operation location='/GetPlan' />\n" +
+  "      <input>\n" +
+  "        <mime:content type='application/x-www-form-urlencoded' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <mime:mimeXml part='Body' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <service name='PlanWS'>\n" +
+  "    <port name='PlanWSSoap' binding='s0:PlanWSSoap'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/PlanWSSoap' />\n" +
+  "    </port>\n" +
+  "    <port name='PlanWSHttpGet' binding='s0:PlanWSHttpGet'>\n" +
+  "      <http:address location='http://localhost:8080/axis/services/PlanWSSoap' />\n" +
+  "    </port>\n" +
+  "    <port name='PlanWSHttpPost' binding='s0:PlanWSHttpPost'>\n" +
+  "      <http:address location='http://localhost:8080/axis/services/PlanWSSoap' />\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "</definitions>\n" +
+  "\n";
+
+  public void testGetPlan() throws Exception {
+    parseString(getPlan, "getPlan.xsd");
+  }
+
+  private String adaptive =
+  "<?xml version='1.0' encoding='UTF-8'?>\n" +
+  "\n" +
+  "<definitions name='Adaptive' targetNamespace='http://com.test/wsdl/Adaptive' xmlns:tns='http://com.test/wsdl/Adaptive' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns2='http://com.test/types/Adaptive' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'>\n" +
+  "  <types>\n" +
+  "    <schema targetNamespace='http://com.test/types/Adaptive' xmlns:tns='http://com.test/types/Adaptive' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns2='http://java.sun.com/jax-rpc-ri/internal' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
+  "      <import namespace='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      <import namespace='http://java.sun.com/jax-rpc-ri/internal'/>\n" +
+  "      <complexType name='ArrayOfResourceInfo'>\n" +
+  "        <complexContent>\n" +
+  "          <restriction base='soap-enc:Array'>\n" +
+  "            <attribute ref='soap-enc:arrayType' wsdl:arrayType='tns:ResourceInfo[]'/></restriction></complexContent></complexType>\n" +
+  "      <complexType name='ResourceInfo'>\n" +
+  "        <sequence>\n" +
+  "          <element name='properties' type='ns2:vector'/>\n" +
+  "          <element name='id' type='string'/></sequence></complexType>\n" +
+  "      <complexType name='ApplicationInfo'>\n" +
+  "        <sequence>\n" +
+  "          <element name='dummy' type='tns:KeyValue'/>\n" +
+  "          <element name='properties' type='ns2:vector'/>\n" +
+  "          <element name='id' type='string'/></sequence></complexType>\n" +
+  "      <complexType name='KeyValue'>\n" +
+  "        <sequence>\n" +
+  "          <element name='key' type='string'/>\n" +
+  "          <element name='value' type='string'/></sequence></complexType>\n" +
+  "      <complexType name='ArrayOfint'>\n" +
+  "        <complexContent>\n" +
+  "          <restriction base='soap-enc:Array'>\n" +
+  "            <attribute ref='soap-enc:arrayType' wsdl:arrayType='int[]'/></restriction></complexContent></complexType>\n" +
+  "      <complexType name='ArrayOfstring'>\n" +
+  "        <complexContent>\n" +
+  "          <restriction base='soap-enc:Array'>\n" +
+  "            <attribute ref='soap-enc:arrayType' wsdl:arrayType='string[]'/></restriction></complexContent></complexType>\n" +
+  "      <complexType name='ArrayOfArrayOfstring'>\n" +
+  "        <complexContent>\n" +
+  "          <restriction base='soap-enc:Array'>\n" +
+  "            <attribute ref='soap-enc:arrayType' wsdl:arrayType='tns:ArrayOfstring[]'/></restriction></complexContent></complexType></schema>\n" +
+  "    <schema targetNamespace='http://java.sun.com/jax-rpc-ri/internal' xmlns:tns='http://java.sun.com/jax-rpc-ri/internal' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
+  "      <import namespace='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      <import namespace='http://com.test/types/Adaptive'/>\n" +
+  "      <complexType name='vector'>\n" +
+  "        <complexContent>\n" +
+  "          <extension base='tns:list'>\n" +
+  "            <sequence/></extension></complexContent></complexType>\n" +
+  "      <complexType name='list'>\n" +
+  "        <complexContent>\n" +
+  "          <extension base='tns:collection'>\n" +
+  "            <sequence/></extension></complexContent></complexType>\n" +
+  "      <complexType name='collection'>\n" +
+  "        <complexContent>\n" +
+  "          <restriction base='soap-enc:Array'>\n" +
+  "            <attribute ref='soap-enc:arrayType' wsdl:arrayType='anyType[]'/></restriction></complexContent></complexType></schema></types>\n" +
+  "  <message name='AdaptiveInterface_getServiceDescription'/>\n" +
+  "  <message name='AdaptiveInterface_getServiceDescriptionResponse'>\n" +
+  "    <part name='result' type='xsd:string'/></message>\n" +
+  "  <message name='AdaptiveInterface_rankResources'>\n" +
+  "    <part name='arrayOfResourceInfo_1' type='ns2:ArrayOfResourceInfo'/>\n" +
+  "    <part name='ApplicationInfo_2' type='ns2:ApplicationInfo'/></message>\n" +
+  "  <message name='AdaptiveInterface_rankResourcesResponse'>\n" +
+  "    <part name='result' type='ns2:ArrayOfResourceInfo'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateTransferTime'>\n" +
+  "    <part name='boolean_1' type='xsd:boolean'/>\n" +
+  "    <part name='ResourceInfo_2' type='ns2:ResourceInfo'/>\n" +
+  "    <part name='arrayOfResourceInfo_3' type='ns2:ArrayOfResourceInfo'/>\n" +
+  "    <part name='long_4' type='xsd:long'/>\n" +
+  "    <part name='Calendar_5' type='xsd:dateTime'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateTransferTimeResponse'>\n" +
+  "    <part name='result' type='ns2:ArrayOfint'/></message>\n" +
+  "  <message name='AdaptiveInterface_logDataTransfer'>\n" +
+  "    <part name='ResourceInfo_1' type='ns2:ResourceInfo'/>\n" +
+  "    <part name='ResourceInfo_2' type='ns2:ResourceInfo'/>\n" +
+  "    <part name='long_3' type='xsd:long'/>\n" +
+  "    <part name='Calendar_4' type='xsd:dateTime'/>\n" +
+  "    <part name='Calendar_5' type='xsd:dateTime'/></message>\n" +
+  "  <message name='AdaptiveInterface_logDataTransferResponse'/>\n" +
+  "  <message name='AdaptiveInterface_estimateUsage'>\n" +
+  "    <part name='boolean_1' type='xsd:boolean'/>\n" +
+  "    <part name='ResourceInfo_2' type='ns2:ResourceInfo'/>\n" +
+  "    <part name='String_3' type='xsd:string'/>\n" +
+  "    <part name='int_4' type='xsd:int'/>\n" +
+  "    <part name='Calendar_5' type='xsd:dateTime'/>\n" +
+  "    <part name='Calendar_6' type='xsd:dateTime'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateUsageResponse'>\n" +
+  "    <part name='result' type='xsd:string'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateMultipleUsage'>\n" +
+  "    <part name='boolean_1' type='xsd:boolean'/>\n" +
+  "    <part name='arrayOfResourceInfo_2' type='ns2:ArrayOfResourceInfo'/>\n" +
+  "    <part name='arrayOfString_3' type='ns2:ArrayOfstring'/>\n" +
+  "    <part name='int_4' type='xsd:int'/>\n" +
+  "    <part name='Calendar_5' type='xsd:dateTime'/>\n" +
+  "    <part name='Calendar_6' type='xsd:dateTime'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateMultipleUsageResponse'>\n" +
+  "    <part name='result' type='ns2:ArrayOfArrayOfstring'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateNetworkGraph'>\n" +
+  "    <part name='boolean_1' type='xsd:boolean'/>\n" +
+  "    <part name='arrayOfResourceInfo_2' type='ns2:ArrayOfResourceInfo'/>\n" +
+  "    <part name='int_3' type='xsd:int'/>\n" +
+  "    <part name='Calendar_4' type='xsd:dateTime'/>\n" +
+  "    <part name='Calendar_5' type='xsd:dateTime'/></message>\n" +
+  "  <message name='AdaptiveInterface_estimateNetworkGraphResponse'>\n" +
+  "    <part name='result' type='ns2:ArrayOfArrayOfstring'/></message>\n" +
+  "  <portType name='AdaptiveInterface'>\n" +
+  "    <operation name='getServiceDescription' parameterOrder=''>\n" +
+  "      <input message='tns:AdaptiveInterface_getServiceDescription'/>\n" +
+  "      <output message='tns:AdaptiveInterface_getServiceDescriptionResponse'/></operation>\n" +
+  "    <operation name='rankResources' parameterOrder='arrayOfResourceInfo_1 ApplicationInfo_2'>\n" +
+  "      <input message='tns:AdaptiveInterface_rankResources'/>\n" +
+  "      <output message='tns:AdaptiveInterface_rankResourcesResponse'/></operation>\n" +
+  "    <operation name='estimateTransferTime' parameterOrder='boolean_1 ResourceInfo_2 arrayOfResourceInfo_3 long_4 Calendar_5'>\n" +
+  "      <input message='tns:AdaptiveInterface_estimateTransferTime'/>\n" +
+  "      <output message='tns:AdaptiveInterface_estimateTransferTimeResponse'/></operation>\n" +
+  "    <operation name='logDataTransfer' parameterOrder='ResourceInfo_1 ResourceInfo_2 long_3 Calendar_4 Calendar_5'>\n" +
+  "      <input message='tns:AdaptiveInterface_logDataTransfer'/>\n" +
+  "      <output message='tns:AdaptiveInterface_logDataTransferResponse'/></operation>\n" +
+  "    <operation name='estimateUsage' parameterOrder='boolean_1 ResourceInfo_2 String_3 int_4 Calendar_5 Calendar_6'>\n" +
+  "      <input message='tns:AdaptiveInterface_estimateUsage'/>\n" +
+  "      <output message='tns:AdaptiveInterface_estimateUsageResponse'/></operation>\n" +
+  "    <operation name='estimateMultipleUsage' parameterOrder='boolean_1 arrayOfResourceInfo_2 arrayOfString_3 int_4 Calendar_5 Calendar_6'>\n" +
+  "      <input message='tns:AdaptiveInterface_estimateMultipleUsage'/>\n" +
+  "      <output message='tns:AdaptiveInterface_estimateMultipleUsageResponse'/></operation>\n" +
+  "    <operation name='estimateNetworkGraph' parameterOrder='boolean_1 arrayOfResourceInfo_2 int_3 Calendar_4 Calendar_5'>\n" +
+  "      <input message='tns:AdaptiveInterface_estimateNetworkGraph'/>\n" +
+  "      <output message='tns:AdaptiveInterface_estimateNetworkGraphResponse'/></operation></portType>\n" +
+  "  <binding name='AdaptiveInterfaceBinding' type='tns:AdaptiveInterface'>\n" +
+  "    <operation name='getServiceDescription'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <operation name='rankResources'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <operation name='estimateTransferTime'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <operation name='logDataTransfer'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <operation name='estimateUsage'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <operation name='estimateMultipleUsage'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <operation name='estimateNetworkGraph'>\n" +
+  "      <input>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></input>\n" +
+  "      <output>\n" +
+  "        <soap:body encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' use='encoded' namespace='http://com.test/wsdl/Adaptive'/></output>\n" +
+  "      <soap:operation soapAction=''/></operation>\n" +
+  "    <soap:binding transport='http://schemas.xmlsoap.org/soap/http' style='rpc'/></binding>\n" +
+  "  <service name='AdaptiveService'>\n" +
+  "    <port name='Adaptive' binding='tns:AdaptiveInterfaceBinding'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/Adaptive'/></port></service></definitions>\n";
+
+  public void testAdaptive() throws Exception {
+    parseString(adaptive, "adaptive.xsd");
+  }
+
+  private String dataService =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "<definitions xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:s='http://www.w3.org/2001/XMLSchema' xmlns:s0='http://tempuri.org/' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tm='http://microsoft.com/wsdl/mime/textMatching/' xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/' targetNamespace='http://tempuri.org/' xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "  <types>\n" +
+  "    <s:schema elementFormDefault='qualified' targetNamespace='http://tempuri.org/'>\n" +
+  "      <s:import namespace='http://www.w3.org/2001/XMLSchema' />\n" +
+  "      <s:element name='GetTitleAuthors'>\n" +
+  "        <s:complexType />\n" +
+  "      </s:element>\n" +
+  "      <s:element name='GetTitleAuthorsResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='GetTitleAuthorsResult'>\n" +
+  "              <s:complexType>\n" +
+  "                <s:sequence>\n" +
+  "                  <s:element ref='s:schema' />\n" +
+  "                  <s:any />\n" +
+  "                </s:sequence>\n" +
+  "              </s:complexType>\n" +
+  "            </s:element>\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='PutTitleAuthors'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='DS'>\n" +
+  "              <s:complexType>\n" +
+  "                <s:sequence>\n" +
+  "                  <s:element ref='s:schema' />\n" +
+  "                  <s:any />\n" +
+  "                </s:sequence>\n" +
+  "              </s:complexType>\n" +
+  "            </s:element>\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='PutTitleAuthorsResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='PutTitleAuthorsResult' type='s:int' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='DataSet' nillable='true'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element ref='s:schema' />\n" +
+  "            <s:any />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "    </s:schema>\n" +
+  "  </types>\n" +
+  "  <message name='GetTitleAuthorsSoapIn'>\n" +
+  "    <part name='parameters' element='s0:GetTitleAuthors' />\n" +
+  "  </message>\n" +
+  "  <message name='GetTitleAuthorsSoapOut'>\n" +
+  "    <part name='parameters' element='s0:GetTitleAuthorsResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='PutTitleAuthorsSoapIn'>\n" +
+  "    <part name='parameters' element='s0:PutTitleAuthors' />\n" +
+  "  </message>\n" +
+  "  <message name='PutTitleAuthorsSoapOut'>\n" +
+  "    <part name='parameters' element='s0:PutTitleAuthorsResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='GetTitleAuthorsHttpGetIn' />\n" +
+  "  <message name='GetTitleAuthorsHttpGetOut'>\n" +
+  "    <part name='Body' element='s0:DataSet' />\n" +
+  "  </message>\n" +
+  "  <message name='GetTitleAuthorsHttpPostIn' />\n" +
+  "  <message name='GetTitleAuthorsHttpPostOut'>\n" +
+  "    <part name='Body' element='s0:DataSet' />\n" +
+  "  </message>\n" +
+  "  <portType name='DataServiceSoap'>\n" +
+  "    <operation name='GetTitleAuthors'>\n" +
+  "      <input message='s0:GetTitleAuthorsSoapIn' />\n" +
+  "      <output message='s0:GetTitleAuthorsSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='PutTitleAuthors'>\n" +
+  "      <input message='s0:PutTitleAuthorsSoapIn' />\n" +
+  "      <output message='s0:PutTitleAuthorsSoapOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <portType name='DataServiceHttpGet'>\n" +
+  "    <operation name='GetTitleAuthors'>\n" +
+  "      <input message='s0:GetTitleAuthorsHttpGetIn' />\n" +
+  "      <output message='s0:GetTitleAuthorsHttpGetOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <portType name='DataServiceHttpPost'>\n" +
+  "    <operation name='GetTitleAuthors'>\n" +
+  "      <input message='s0:GetTitleAuthorsHttpPostIn' />\n" +
+  "      <output message='s0:GetTitleAuthorsHttpPostOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <binding name='DataServiceSoap' type='s0:DataServiceSoap'>\n" +
+  "    <soap:binding transport='http://schemas.xmlsoap.org/soap/http' style='document' />\n" +
+  "    <operation name='GetTitleAuthors'>\n" +
+  "      <soap:operation soapAction='http://tempuri.org/GetTitleAuthors' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='PutTitleAuthors'>\n" +
+  "      <soap:operation soapAction='http://tempuri.org/PutTitleAuthors' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <binding name='DataServiceHttpGet' type='s0:DataServiceHttpGet'>\n" +
+  "    <http:binding verb='GET' />\n" +
+  "    <operation name='GetTitleAuthors'>\n" +
+  "      <http:operation location='/GetTitleAuthors' />\n" +
+  "      <input>\n" +
+  "        <http:urlEncoded />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <mime:mimeXml part='Body' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <binding name='DataServiceHttpPost' type='s0:DataServiceHttpPost'>\n" +
+  "    <http:binding verb='POST' />\n" +
+  "    <operation name='GetTitleAuthors'>\n" +
+  "      <http:operation location='/GetTitleAuthors' />\n" +
+  "      <input>\n" +
+  "        <mime:content type='application/x-www-form-urlencoded' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <mime:mimeXml part='Body' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <service name='DataService'>\n" +
+  "    <port name='DataServiceSoap' binding='s0:DataServiceSoap'>\n" +
+  "      <soap:address location='http://samples.gotdotnet.com/quickstart/aspplus/samples/services/DataService/VB/DataService.asmx' />\n" +
+  "    </port>\n" +
+  "    <port name='DataServiceHttpGet' binding='s0:DataServiceHttpGet'>\n" +
+  "      <http:address location='http://samples.gotdotnet.com/quickstart/aspplus/samples/services/DataService/VB/DataService.asmx' />\n" +
+  "    </port>\n" +
+  "    <port name='DataServiceHttpPost' binding='s0:DataServiceHttpPost'>\n" +
+  "      <http:address location='http://samples.gotdotnet.com/quickstart/aspplus/samples/services/DataService/VB/DataService.asmx' />\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "</definitions>\n";
+
+  public void testDataService() throws Exception {
+    parseString(dataService, "dataService.xsd");
+  }
+
+  private static final String thing =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "<definitions xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' \n" +
+  "xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' \n" +
+  "xmlns:s='http://www.w3.org/2001/XMLSchema' xmlns:s0='urn:Thing' \n" +
+  "xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' \n" +
+  "xmlns:tm='http://microsoft.com/wsdl/mime/textMatching/' \n" +
+  "xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/' \n" +
+  "targetNamespace='urn:Thing' xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "<!--\n" +
+  "\n" +
+  "This test checks out the emitting of holders for container elements\n" +
+  "(arrays) that are inside elements.\n" +
+  "\n" +
+  "-->\n" +
+  "\n" +
+  "\n" +
+  "  <types>\n" +
+  "      <s:schema elementFormDefault='qualified' targetNamespace='urn:Thing'>\n" +
+  "          <s:element name='aThing' type='s0:aThing' final='restriction'/>\n" +
+  "          <s:simpleType name='aThing'>\n" +
+  "              <s:restriction base='s:string'>\n" +
+  "                  <s:maxLength value='255'/>\n" +
+  "              </s:restriction>\n" +
+  "          </s:simpleType>\n" +
+  "          <s:element name='otherData' type='s0:otherData' final='restriction'/>\n" +
+  "          <s:simpleType name='otherData'>\n" +
+  "              <s:restriction base='s:string'>\n" +
+  "                  <s:maxLength value='1024'/>\n" +
+  "              </s:restriction>\n" +
+  "          </s:simpleType>\n" +
+  "          <s:element name='find_aThing' type='s0:find_aThing' final='restriction'/>\n" +
+  "          <s:complexType name='find_aThing' final='restriction'>\n" +
+  "              <s:sequence>\n" +
+  "                  <s:element ref='s0:aThing' maxOccurs='1'/>\n" +
+  "              </s:sequence>\n" +
+  "          </s:complexType>\n" +
+  "          <s:element name='AThingResponse' type='s0:AThingResponse' final='restriction'/>\n" +
+  "          <s:complexType name='AThingResponse' final='restriction'>\n" +
+  "              <s:sequence>\n" +
+  "                  <s:element ref='s0:aThing' minOccurs='0' maxOccurs='unbounded'/>\n" +
+  "                  <s:element ref='s0:otherData' minOccurs='0' maxOccurs='unbounded'/>\n" +
+  "              </s:sequence>\n" +
+  "          </s:complexType>\n" +
+  "      </s:schema>\n" +
+  "  </types>\n" +
+  "  <message name='ThingIn'>\n" +
+  "    <part name='parameters' element='s0:find_aThing' />\n" +
+  "  </message>\n" +
+  "  <message name='ThingOut'>\n" +
+  "    <part name='parameters' element='s0:AThingResponse' />\n" +
+  "  </message>\n" +
+  "  <portType name='Thing'>\n" +
+  "    <operation name='find_aThing'>\n" +
+  "      <input message='s0:ThingIn' />\n" +
+  "      <output message='s0:ThingOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <binding name='Thing' type='s0:Thing'>\n" +
+  "    <soap:binding transport='http://schemas.xmlsoap.org/soap/http' style='document' />\n" +
+  "    <operation name='find_aThing'>\n" +
+  "      <soap:operation soapAction='http://tempuri.org/find_aThing' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <service name='wrapped_holders'>\n" +
+  "    <port name='Thing' binding='s0:Thing'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/Thing' />\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "</definitions>\n" +
+  "\n";
+
+  public void testThing() throws Exception {
+    parseString(thing, "thing.xsd");
+  }
+
+  private final String soap12Test =
+  "<?xml version='1.0'?>\n" +
+  "\n" +
+  "<definitions name='SOAP-12-TestDefinitions'\n" +
+  " targetNamespace='http://whitemesa.net/wsdl/soap12-test'\n" +
+  " xmlns='http://schemas.xmlsoap.org/wsdl/'\n" +
+  " xmlns:soap12='http://schemas.xmlsoap.org/wsdl/soap12/'\n" +
+  " xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+  " xmlns:enc='http://www.w3.org/2003/05/soap-encoding'\n" +
+  " xmlns:tns='http://whitemesa.net/wsdl/soap12-test'\n" +
+  " xmlns:types='http://example.org/ts-tests/xsd'\n" +
+  " xmlns:test='http://example.org/ts-tests'\n" +
+  " xmlns:xlink='http://www.w3.org/1999/xlink'\n" +
+  " xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  " <types>\n" +
+  "   <schema xmlns='http://www.w3.org/2001/XMLSchema' targetNamespace='http://example.org/ts-tests/xsd'>\n" +
+  "\n" +
+  "     <import namespace='http://www.w3.org/2003/05/soap-encoding' />\n" +
+  "\n" +
+  "     <complexType name='ArrayOfstring'>\n" +
+  "       <complexContent>\n" +
+  "         <restriction base='enc:Array'>\n" +
+  "           <sequence>\n" +
+  "             <element name='item' type='xsd:string' minOccurs='0' maxOccurs='unbounded'/>\n" +
+  "           </sequence>\n" +
+  "             <attributeGroup ref='enc:arrayAttributes' /> \n" +
+  "             <attributeGroup ref='enc:commonAttributes' /> \n" +
+  "         </restriction>\n" +
+  "       </complexContent>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <complexType name='ArrayOfint'>\n" +
+  "       <complexContent>\n" +
+  "         <restriction base='enc:Array'>\n" +
+  "           <sequence>\n" +
+  "             <element name='item' type='xsd:int' minOccurs='0' maxOccurs='unbounded'/>\n" +
+  "           </sequence>\n" +
+  "             <attributeGroup ref='enc:arrayAttributes' /> \n" +
+  "             <attributeGroup ref='enc:commonAttributes' /> \n" +
+  "         </restriction>\n" +
+  "       </complexContent>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <complexType name='ArrayOffloat'>\n" +
+  "       <complexContent>\n" +
+  "         <restriction base='enc:Array'>\n" +
+  "           <sequence>\n" +
+  "             <element name='item' type='xsd:float' minOccurs='0' maxOccurs='unbounded'/>\n" +
+  "           </sequence>\n" +
+  "             <attributeGroup ref='enc:arrayAttributes' /> \n" +
+  "             <attributeGroup ref='enc:commonAttributes' /> \n" +
+  "         </restriction>\n" +
+  "       </complexContent>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <complexType name='ArrayOfSOAPStruct'>\n" +
+  "       <complexContent>\n" +
+  "         <restriction base='enc:Array'>\n" +
+  "           <sequence>\n" +
+  "             <element name='item' type='types:SOAPStruct' minOccurs='0' maxOccurs='unbounded'/>\n" +
+  "           </sequence>\n" +
+  "             <attributeGroup ref='enc:arrayAttributes' /> \n" +
+  "             <attributeGroup ref='enc:commonAttributes' /> \n" +
+  "         </restriction>\n" +
+  "       </complexContent>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <complexType name='SOAPStruct'>\n" +
+  "       <all>\n" +
+  "         <element name='varString' type='xsd:string'/>\n" +
+  "         <element name='varInt' type='xsd:int'/>\n" +
+  "         <element name='varFloat' type='xsd:float'/>\n" +
+  "       </all>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='SOAPStructStruct'>\n" +
+  "       <all>\n" +
+  "         <element name='varString' type='xsd:string'/>\n" +
+  "         <element name='varInt' type='xsd:int'/>\n" +
+  "         <element name='varFloat' type='xsd:float'/>\n" +
+  "         <element name='varStruct' type='types:SOAPStruct'/>\n" +
+  "       </all>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <complexType name='SOAPArrayStruct'>\n" +
+  "       <all>\n" +
+  "         <element name='varString' type='xsd:string'/>\n" +
+  "         <element name='varInt' type='xsd:int'/>\n" +
+  "         <element name='varFloat' type='xsd:float'/>\n" +
+  "         <element name='varArray' type='types:ArrayOfstring'/>\n" +
+  "       </all>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "   </schema>\n" +
+  "\n" +
+  "       <schema xmlns='http://www.w3.org/2001/XMLSchema'\n" +
+  "     elementFormDefault='qualified'\n" +
+  "     targetNamespace='http://example.org/ts-tests'>\n" +
+  "\n" +
+  "     <import namespace='http://www.w3.org/1999/xlink' />\n" +
+  "\n" +
+  "     <!-- 3.2.1 echoOk -->\n" +
+  "     <element name='echoOk' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.2 responseOk -->\n" +
+  "     <element name='responseOk' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.3 Ignore -->\n" +
+  "     <element name='Ignore' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.4 requiredHeader -->\n" +
+  "     <element name='requiredHeader' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.5 DataHolder -->\n" +
+  "     <element name='DataHolder' type='test:DataHolder_t'/>\n" +
+  "     <complexType name='DataHolder_t'>\n" +
+  "       <sequence>\n" +
+  "         <element name='Data' type='xsd:string' minOccurs='1' maxOccurs='unbounded'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <!-- 3.2.6 concatAndForwardEchoOk -->\n" +
+  "     <element name='concatAndForwardEchoOk'/>\n" +
+  "\n" +
+  "     <!-- 3.2.7 concatAndForwardEchoOkArg1 -->\n" +
+  "     <element name='concatAndForwardEchoOkArg1' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.8 concatAndForwardEchoOkArg2 -->\n" +
+  "     <element name='concatAndForwardEchoOkArg2' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.9 validateCountryCode -->\n" +
+  "     <element name='validateCountryCode' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.10 validateCountryCodeFault -->\n" +
+  "     <element name='validateCountryCodeFault' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- 3.2.11 echoResolvedRef -->\n" +
+  "     <element name='RelativeReference' type='test:RelativeReference_t'/>\n" +
+  "     <complexType name='RelativeReference_t'>\n" +
+  "       <attribute ref='xml:base'/>\n" +
+  "         <attribute ref='xlink:href'/>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <element name='echoResolvedRef' type='test:echoResolvedRef_t'/>\n" +
+  "     <complexType name='echoResolvedRef_t'>\n" +
+  "       <complexContent>\n" +
+  "         <sequence>\n" +
+  "           <element ref='test:RelativeReference' minOccurs='1' maxOccurs='1'/>\n" +
+  "         </sequence>\n" +
+  "       </complexContent>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "     <!-- 3.2.12 responseResolvedRef -->\n" +
+  "     <element name='responseResolvedRef' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- echoOkUltimateReceiver added to support testing of 'relay' -->\n" +
+  "     <element name='echoOkUltimateReceiver' type='xsd:string'/>\n" +
+  "\n" +
+  "     <!-- responseOkUltimateReceiver added to support testing of 'relay' -->\n" +
+  "     <element name='responseOkUltimateReceiver' type='xsd:string'/>\n" +
+  "\n" +
+  "   </schema>\n" +
+  "\n" +
+  " </types>\n" +
+  "\n" +
+  " <!-- 3.4.1 returnVoid rpc operation -->\n" +
+  " <message name='returnVoidRequest'/>\n" +
+  " <message name='returnVoidResponse'/>\n" +
+  "\n" +
+  " <!-- 3.4.2 echoStruct rpc operation -->\n" +
+  " <message name='echoStructRequest'>\n" +
+  "   <part name='inputStruct' type='types:SOAPStruct'/>\n" +
+  " </message>\n" +
+  " <message name='echoStructResponse'>\n" +
+  "   <part name='return' type='types:SOAPStruct'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.3 echoStructArray rpc operation -->\n" +
+  " <message name='echoStructArrayRequest'>\n" +
+  "   <part name='inputStructArray' type='types:ArrayOfSOAPStruct'/>\n" +
+  " </message>\n" +
+  " <message name='echoStructArrayResponse'>\n" +
+  "   <part name='return' type='types:ArrayOfSOAPStruct'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.4 echoStructAsSimpleTypes rpc operation -->\n" +
+  " <message name='echoStructAsSimpleTypesRequest'>\n" +
+  "   <part name='inputStruct' type='types:SOAPStruct'/>\n" +
+  " </message>\n" +
+  " <message name='echoStructAsSimpleTypesResponse'>\n" +
+  "   <part name='outputString' type='xsd:string'/>\n" +
+  "   <part name='outputInteger' type='xsd:int'/>\n" +
+  "   <part name='outputFloat' type='xsd:float'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.5 echoSimpleTypesAsStruct rpc operation -->\n" +
+  " <message name='echoSimpleTypesAsStructRequest'>\n" +
+  "   <part name='inputString' type='xsd:string'/>\n" +
+  "   <part name='inputInteger' type='xsd:int'/>\n" +
+  "   <part name='inputFloat' type='xsd:float'/>\n" +
+  " </message>\n" +
+  " <message name='echoSimpleTypesAsStructResponse'>\n" +
+  "   <part name='return' type='types:SOAPStruct'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.6 echoNestedStruct rpc operation -->\n" +
+  " <message name='echoNestedStructRequest'>\n" +
+  "   <part name='inputStruct' type='types:SOAPStructStruct'/>\n" +
+  " </message>\n" +
+  " <message name='echoNestedStructResponse'>\n" +
+  "   <part name='return' type='types:SOAPStructStruct'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.7 echoNestedArray rpc operation -->\n" +
+  " <message name='echoNestedArrayRequest'>\n" +
+  "   <part name='inputStruct' type='types:SOAPArrayStruct'/>\n" +
+  " </message>\n" +
+  " <message name='echoNestedArrayResponse'>\n" +
+  "   <part name='return' type='types:SOAPArrayStruct'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.8 echoFloatArray rpc operation -->\n" +
+  " <message name='echoFloatArrayRequest'>\n" +
+  "   <part name='inputFloatArray' type='types:ArrayOffloat'/>\n" +
+  " </message>\n" +
+  " <message name='echoFloatArrayResponse'>\n" +
+  "   <part name='return' type='types:ArrayOffloat'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.9 echoStringArray rpc operation -->\n" +
+  " <message name='echoStringArrayRequest'>\n" +
+  "   <part name='inputStringArray' type='types:ArrayOfstring'/>\n" +
+  " </message>\n" +
+  " <message name='echoStringArrayResponse'>\n" +
+  "   <part name='return' type='types:ArrayOfstring'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.10 echoIntegerArray rpc operation -->\n" +
+  " <message name='echoIntegerArrayRequest'>\n" +
+  "   <part name='inputIntegerArray' type='types:ArrayOfint'/>\n" +
+  " </message>\n" +
+  " <message name='echoIntegerArrayResponse'>\n" +
+  "   <part name='return' type='types:ArrayOfint'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.11 echoBase64 rpc operation -->\n" +
+  " <message name='echoBase64Request'>\n" +
+  "   <part name='inputBase64' type='xsd:base64Binary'/>\n" +
+  " </message>\n" +
+  " <message name='echoBase64Response'>\n" +
+  "   <part name='return' type='xsd:base64Binary'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.12 echoBoolean rpc operation -->\n" +
+  " <message name='echoBooleanRequest'>\n" +
+  "   <part name='inputBoolean' type='xsd:boolean'/>\n" +
+  " </message>\n" +
+  " <message name='echoBooleanResponse'>\n" +
+  "   <part name='return' type='xsd:boolean'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.13 echoDate rpc operation -->\n" +
+  " <message name='echoDateRequest'>\n" +
+  "   <part name='inputDate' type='xsd:dateTime'/>\n" +
+  " </message>\n" +
+  " <message name='echoDateResponse'>\n" +
+  "   <part name='return' type='xsd:dateTime'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.14 echoDecimal rpc operation -->\n" +
+  " <message name='echoDecimalRequest'>\n" +
+  "   <part name='inputDecimal' type='xsd:decimal'/>\n" +
+  " </message>\n" +
+  " <message name='echoDecimalResponse'>\n" +
+  "   <part name='return' type='xsd:decimal'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.15 echoFloat rpc operation -->\n" +
+  " <message name='echoFloatRequest'>\n" +
+  "   <part name='inputFloat' type='xsd:float'/>\n" +
+  " </message>\n" +
+  " <message name='echoFloatResponse'>\n" +
+  "   <part name='return' type='xsd:float'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.16 echoString rpc operation -->\n" +
+  " <message name='echoStringRequest'>\n" +
+  "   <part name='inputString' type='xsd:string'/>\n" +
+  " </message>\n" +
+  " <message name='echoStringResponse'>\n" +
+  "   <part name='return' type='xsd:string'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.17 countItems rpc operation -->\n" +
+  " <message name='countItemsRequest'>\n" +
+  "   <part name='inputStringArray' type='types:ArrayOfstring'/>\n" +
+  " </message>\n" +
+  " <message name='countItemsResponse'>\n" +
+  "   <part name='return' type='xsd:int'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- 3.4.18 isNil rpc operation -->\n" +
+  " <message name='isNilRequest'>\n" +
+  "   <part name='inputString' type='xsd:string'/>\n" +
+  " </message>\n" +
+  " <message name='isNilResponse'>\n" +
+  "   <part name='return' type='xsd:boolean'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- DataHolder header block -->\n" +
+  " <message name='DataHolderRequest'>\n" +
+  "   <part name='DataHolder' type='test:DataHolder_t'/>\n" +
+  " </message>\n" +
+  " <message name='DataHolderResponse'>\n" +
+  "   <part name='DataHolder' type='test:DataHolder_t'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- empty message for doc/literal testing -->\n" +
+  " <message name='emptyBodyRequest'/>\n" +
+  " <message name='emptyBodyResponse'/>\n" +
+  "\n" +
+  " <!-- echoOk body/header block -->\n" +
+  " <message name='echoOkRequest'>\n" +
+  "   <part name='echoOk' element='test:echoOk'/>\n" +
+  " </message>\n" +
+  " <message name='echoOkResponse'>\n" +
+  "   <part name='responseOk' element='test:responseOk'/>\n" +
+  " </message>\n" +
+  "\n" +
+  "\n" +
+  "   <portType name='Soap12TestPortTypeDoc'>\n" +
+  "       <operation name='emptyBody'>\n" +
+  "           <input message='tns:emptyBodyRequest' />\n" +
+  "           <output message='tns:emptyBodyResponse' />\n" +
+  "       </operation>\n" +
+  "       <operation name='echoOk'>\n" +
+  "           <input message='tns:echoOkRequest' />\n" +
+  "           <output message='tns:echoOkResponse' />\n" +
+  "       </operation>\n" +
+  " </portType>\n" +
+  "\n" +
+  " <portType name='Soap12TestPortTypeRpc'>\n" +
+  "\n" +
+  "   <!-- 3.4.1 returnVoid rpc operation -->\n" +
+  "   <operation name='returnVoid'>\n" +
+  "     <input message='tns:returnVoidRequest' name='returnVoid'/>\n" +
+  "     <output message='tns:returnVoidResponse' name='returnVoidResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.2 echoStruct rpc operation -->\n" +
+  "   <operation name='echoStruct' parameterOrder='inputStruct'>\n" +
+  "     <input message='tns:echoStructRequest' name='echoStruct'/>\n" +
+  "     <output message='tns:echoStructResponse' name='echoStructResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.3 echoStructArray rpc operation -->\n" +
+  "   <operation name='echoStructArray' parameterOrder='inputStructArray'>\n" +
+  "     <input message='tns:echoStructArrayRequest' name='echoStructArray'/>\n" +
+  "     <output message='tns:echoStructArrayResponse' name='echoStructArrayResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.4 echoStructAsSimpleTypes rpc operation -->\n" +
+  "   <operation name='echoStructAsSimpleTypes' parameterOrder='inputStruct outputString outputInteger outputFloat'>\n" +
+  "     <input message='tns:echoStructAsSimpleTypesRequest'/>\n" +
+  "     <output message='tns:echoStructAsSimpleTypesResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.5 echoSimpleTypesAsStruct rpc operation -->\n" +
+  "   <operation name='echoSimpleTypesAsStruct' parameterOrder='inputString inputInteger inputFloat'>\n" +
+  "     <input message='tns:echoSimpleTypesAsStructRequest'/>\n" +
+  "     <output message='tns:echoSimpleTypesAsStructResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.6 echoNestedStruct rpc operation -->\n" +
+  "   <operation name='echoNestedStruct' parameterOrder='inputStruct'>\n" +
+  "     <input message='tns:echoNestedStructRequest'/>\n" +
+  "     <output message='tns:echoNestedStructResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.7 echoNestedArray rpc operation -->\n" +
+  "   <operation name='echoNestedArray' parameterOrder='inputStruct'>\n" +
+  "     <input message='tns:echoNestedArrayRequest'/>\n" +
+  "     <output message='tns:echoNestedArrayResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.8 echoFloatArray rpc operation -->\n" +
+  "   <operation name='echoFloatArray' parameterOrder='inputFloatArray'>\n" +
+  "     <input message='tns:echoFloatArrayRequest' name='echoFloatArray'/>\n" +
+  "     <output message='tns:echoFloatArrayResponse' name='echoFloatArrayResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.9 echoStringArray rpc operation -->\n" +
+  "   <operation name='echoStringArray' parameterOrder='inputStringArray'>\n" +
+  "     <input message='tns:echoStringArrayRequest' name='echoStringArray'/>\n" +
+  "     <output message='tns:echoStringArrayResponse' name='echoStringArrayResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.10 echoIntegerArray rpc operation -->\n" +
+  "   <operation name='echoIntegerArray' parameterOrder='inputIntegerArray'>\n" +
+  "     <input message='tns:echoIntegerArrayRequest' name='echoIntegerArray'/>\n" +
+  "     <output message='tns:echoIntegerArrayResponse' name='echoIntegerArrayResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.11 echoBase64 rpc operation -->\n" +
+  "   <operation name='echoBase64' parameterOrder='inputBase64'>\n" +
+  "     <input message='tns:echoBase64Request' name='echoBase64'/>\n" +
+  "     <output message='tns:echoBase64Response' name='echoBase64Response'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.12 echoBoolean rpc operation -->\n" +
+  "   <operation name='echoBoolean' parameterOrder='inputBoolean'>\n" +
+  "     <input message='tns:echoBooleanRequest' name='echoBoolean'/>\n" +
+  "     <output message='tns:echoBooleanResponse' name='echoBooleanResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.13 echoDate rpc operation -->\n" +
+  "   <operation name='echoDate' parameterOrder='inputDate'>\n" +
+  "     <input message='tns:echoDateRequest' name='echoDate'/>\n" +
+  "     <output message='tns:echoDateResponse' name='echoDateResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.14 echoDecimal rpc operation -->\n" +
+  "   <operation name='echoDecimal' parameterOrder='inputDecimal'>\n" +
+  "     <input message='tns:echoDecimalRequest' name='echoDecimal'/>\n" +
+  "     <output message='tns:echoDecimalResponse' name='echoDecimalResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.15 echoFloat rpc operation -->\n" +
+  "   <operation name='echoFloat' parameterOrder='inputFloat'>\n" +
+  "     <input message='tns:echoFloatRequest' name='echoFloat'/>\n" +
+  "     <output message='tns:echoFloatResponse' name='echoFloatResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.16 echoString rpc operation -->\n" +
+  "   <operation name='echoString' parameterOrder='inputString'>\n" +
+  "     <input message='tns:echoStringRequest' name='echoString'/>\n" +
+  "     <output message='tns:echoStringResponse' name='echoStringResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.17 countItems rpc operation -->\n" +
+  "   <operation name='countItems' parameterOrder='inputStringArray'>\n" +
+  "     <input message='tns:countItemsRequest' name='countItems'/>\n" +
+  "     <output message='tns:countItemsResponse' name='countItemsResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.18 isNil rpc operation -->\n" +
+  "   <operation name='isNil' parameterOrder='inputString'>\n" +
+  "     <input message='tns:isNilRequest' name='isNil'/>\n" +
+  "     <output message='tns:isNilResponse' name='isNilResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  " </portType>\n" +
+  "\n" +
+  "   <binding name='Soap12TestDocBinding' type='tns:Soap12TestPortTypeDoc'>\n" +
+  "       <soap12:binding style='document' transport='http://schemas.xmlsoap.org/soap/http' />\n" +
+  "       <operation name='emptyBody'>\n" +
+  "           <soap12:operation/>\n" +
+  "           <input>\n" +
+  "             <soap12:body use='literal' />\n" +
+  "             <soap12:header message='tns:echoOkRequest' part='echoOk' use='literal' />\n" +
+  "           </input>\n" +
+  "           <output>\n" +
+  "             <soap12:body use='literal' />\n" +
+  "             <soap12:header message='tns:echoOkResponse' part='responseOk' use='literal' />\n" +
+  "           </output>\n" +
+  "       </operation>\n" +
+  "       <operation name='echoOk'>\n" +
+  "           <soap12:operation/>\n" +
+  "           <input>\n" +
+  "             <soap12:body use='literal' />\n" +
+  "             <soap12:header message='tns:echoOkRequest' part='echoOk' use='literal' />\n" +
+  "           </input>\n" +
+  "           <output>\n" +
+  "             <soap12:body use='literal' />\n" +
+  "             <soap12:header message='tns:echoOkResponse' part='responseOk' use='literal' />\n" +
+  "           </output>\n" +
+  "       </operation>\n" +
+  " </binding>\n" +
+  "\n" +
+  " <binding name='Soap12TestRpcBinding' type='tns:Soap12TestPortTypeRpc'>\n" +
+  "   <soap12:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "\n" +
+  "   <!-- 3.4.1 returnVoid rpc operation -->\n" +
+  "   <operation name='returnVoid'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.2 echoStruct rpc operation -->\n" +
+  "   <operation name='echoStruct'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.3 echoStructArray rpc operation -->\n" +
+  "   <operation name='echoStructArray'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.4 echoStructAsSimpleTypes rpc operation -->\n" +
+  "   <operation name='echoStructAsSimpleTypes'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.5 echoSimpleTypesAsStruct rpc operation -->\n" +
+  "   <operation name='echoSimpleTypesAsStruct'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.6 echoNestedStruct rpc operation -->\n" +
+  "   <operation name='echoNestedStruct'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.7 echoNestedArray rpc operation -->\n" +
+  "   <operation name='echoNestedArray'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.8 echoFloatArray rpc operation -->\n" +
+  "   <operation name='echoFloatArray'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.9 echoStringArray rpc operation -->\n" +
+  "   <operation name='echoStringArray'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.10 echoIntegerArray rpc operation -->\n" +
+  "   <operation name='echoIntegerArray'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.11 echoBase64 rpc operation -->\n" +
+  "   <operation name='echoBase64'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.12 echoBoolean rpc operation -->\n" +
+  "   <operation name='echoBoolean'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.13 echoDate rpc operation -->\n" +
+  "   <operation name='echoDate'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.14 echoDecimal rpc operation -->\n" +
+  "   <operation name='echoDecimal'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.15 echoFloat rpc operation -->\n" +
+  "   <operation name='echoFloat'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.16 echoString rpc operation -->\n" +
+  "   <operation name='echoString'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "       <soap12:header use='encoded' message='tns:DataHolder_Request' part='DataHolder' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "       <soap12:header use='encoded' message='tns:DataHolder_Response' part='DataHolder' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.17 countItems rpc operation -->\n" +
+  "   <operation name='countItems'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- 3.4.18 isNil rpc operation -->\n" +
+  "   <operation name='isNil'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  " </binding>\n" +
+  "\n" +
+  "\n" +
+  " <service name='WhiteMesaSoap12TestSvc'>\n" +
+  "        <!--\n" +
+  "     <port name='Soap12TestDocPort' binding='tns:Soap12TestDocBinding'>\n" +
+  "         <soap12:address location='http://www.whitemesa.net/soap12/test-doc'/>\n" +
+  "     </port>\n" +
+  "     <port name='Soap12TestRpcPort' binding='tns:Soap12TestRpcBinding'>\n" +
+  "         <soap12:address location='http://www.whitemesa.net/soap12/test-rpc'/>\n" +
+  "     </port>\n" +
+  "        -->\n" +
+  "        <port name='Soap12TestDocPort' binding='tns:Soap12TestDocBinding'>\n" +
+  "              <soap12:address location='http://localhost:8080/axis/services/Soap12TestDocPort'/>\n" +
+  "        </port>\n" +
+  "        <port name='Soap12TestRpcPort' binding='tns:Soap12TestRpcBinding'>\n" +
+  "              <soap12:address location='http://localhost:8080/axis/services/Soap12TestRpcPort'/>\n" +
+  "        </port>\n" +
+  "\n" +
+  " </service>\n" +
+  "\n" +
+  "</definitions>\n" +
+  "\n";
+
+  public void testSoap12Test() throws Exception {
+    parseString(soap12Test, "soap12-test.wsdl");
+  }
+
+  private static final String soap12AddTest =
+  "<?xml version='1.0'?>\n" +
+  "\n" +
+  "<definitions name='SOAP-12-TestDefinitions'\n" +
+  " targetNamespace='http://whitemesa.net/wsdl/soap12-test'\n" +
+  " xmlns='http://schemas.xmlsoap.org/wsdl/'\n" +
+  " xmlns:soap12='http://schemas.xmlsoap.org/wsdl/soap12/'\n" +
+  " xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+  " xmlns:enc='http://www.w3.org/2003/05/soap-encoding'\n" +
+  " xmlns:tns='http://whitemesa.net/wsdl/soap12-test'\n" +
+  " xmlns:types='http://example.org/ts-tests/xsd'\n" +
+  " xmlns:test='http://example.org/ts-tests'\n" +
+  " xmlns:iop='http://soapinterop.org/'\n" +
+  " xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  " <types>\n" +
+  "\n" +
+  "   <schema xmlns='http://www.w3.org/2001/XMLSchema' targetNamespace='http://example.org/ts-tests/xsd'>\n" +
+  "\n" +
+  "     <complexType name='SOAPStruct'>\n" +
+  "       <all>\n" +
+  "         <element name='varString' type='xsd:string'/>\n" +
+  "         <element name='varInt' type='xsd:int'/>\n" +
+  "         <element name='varFloat' type='xsd:float'/>\n" +
+  "       </all>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "   </schema>\n" +
+  "\n" +
+  "   <schema xmlns='http://www.w3.org/2001/XMLSchema' targetNamespace='http://example.org/ts-tests/xsd'>\n" +
+  "\n" +
+  "     <!-- added to support test xmlp-10 -->\n" +
+  "     <complexType name='SOAPStructInputs'>\n" +
+  "       <sequence>\n" +
+  "         <element name='input1' type='anyType' />\n" +
+  "         <element name='input2' type='anyType' />\n" +
+  "         <element name='input3' type='anyType' />\n" +
+  "         <element name='input4' type='anyType' />\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='SOAPStructTypes'>\n" +
+  "       <sequence>\n" +
+  "         <element name='type1' type='QName' />\n" +
+  "         <element name='type2' type='QName' />\n" +
+  "         <element name='type3' type='QName' />\n" +
+  "         <element name='type4' type='QName' />\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "\n" +
+  "   </schema>\n" +
+  "\n" +
+  "   <schema xmlns='http://www.w3.org/2001/XMLSchema' elementFormDefault='qualified' targetNamespace='http://soapinterop.org/'>\n" +
+  "\n" +
+  "     <!-- xmlp-2 getTime -->\n" +
+  "     <element name='time' type='time'/>\n" +
+  "\n" +
+  "     <!-- xmlp-7 echoSenderFault -->\n" +
+  "     <element name='echoSenderFault' />\n" +
+  "\n" +
+  "     <!-- xmlp-8 echoReceiverFault -->\n" +
+  "     <element name='echoReceiverFault' />\n" +
+  "\n" +
+  "     <!-- xmlp-13 thru 19 echoString doc/lit operation -->\n" +
+  "     <element name='echoString'>\n" +
+  "       <complexType>\n" +
+  "         <sequence>\n" +
+  "           <element minOccurs='0' maxOccurs='1' name='inputString' type='string' />\n" +
+  "         </sequence>\n" +
+  "       </complexType>\n" +
+  "     </element>\n" +
+  "     <element name='echoStringResponse'>\n" +
+  "       <complexType>\n" +
+  "         <sequence>\n" +
+  "             <element minOccurs='0' maxOccurs='1' name='return' type='string' />\n" +
+  "         </sequence>\n" +
+  "       </complexType>\n" +
+  "     </element>\n" +
+  "\n" +
+  "   </schema>\n" +
+  "\n" +
+  " </types>\n" +
+  "\n" +
+  " <!-- xmlp-5, xmlp-6 echoVoid rpc operation -->\n" +
+  " <message name='echoVoidRequest' />\n" +
+  " <message name='echoVoidResponse' />\n" +
+  "\n" +
+  " <!-- xmlp-4 echoSimpleTypesAsStruct rpc operation -->\n" +
+  " <message name='echoSimpleTypesAsStructRequest'>\n" +
+  "   <part name='inputString' type='xsd:string'/>\n" +
+  "   <part name='inputInteger' type='xsd:int'/>\n" +
+  "   <part name='inputFloat' type='xsd:float'/>\n" +
+  " </message>\n" +
+  " <message name='echoSimpleTypesAsStructResponse'>\n" +
+  "   <part name='return' type='types:SOAPStruct'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-1, xmlp-9 echoString rpc operation -->\n" +
+  " <message name='echoStringRequest'>\n" +
+  "   <part name='inputString' type='xsd:string'/>\n" +
+  " </message>\n" +
+  " <message name='echoStringResponse'>\n" +
+  "   <part name='return' type='xsd:string'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-10 echoSimpleTypesAsStructOfSchemaTypesRequest rpc operation -->\n" +
+  " <message name='echoSimpleTypesAsStructOfSchemaTypesRequest'>\n" +
+  "   <part name='input1' type='xsd:anyType'/>\n" +
+  "   <part name='input2' type='xsd:anyType'/>\n" +
+  "   <part name='input3' type='xsd:anyType'/>\n" +
+  "   <part name='input4' type='xsd:anyType'/>\n" +
+  " </message>\n" +
+  " <message name='echoSimpleTypesAsStructOfSchemaTypesResponse'>\n" +
+  "   <part name='return' type='types:SOAPStructTypes'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-11 echoInteger rpc operation -->\n" +
+  " <message name='echoIntegerRequest'>\n" +
+  "   <part name='inputInteger' type='xsd:int'/>\n" +
+  " </message>\n" +
+  " <message name='echoIntegerResponse'>\n" +
+  "   <part name='return' type='xsd:int'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-3 getTime rpc operation -->\n" +
+  " <message name='getTimeRpcResponse'>\n" +
+  "   <part name='return' type='xsd:time'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-2 getTime doc/lit operation -->\n" +
+  " <message name='getTimeDocResponse'>\n" +
+  "   <part name='time' element='iop:time'/>\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-13 thru 19 echoString doc/lit operation -->\n" +
+  " <message name='echoStringDocRequest'>\n" +
+  "   <part name='inElement' element='iop:echoString' />\n" +
+  " </message>\n" +
+  " <message name='echoStringDocResponse'>\n" +
+  "   <part name='outElement' element='iop:echoStringResponse' />\n" +
+  " </message>\n" +
+  "\n" +
+  " <!-- xmlp-7 echoSenderFault operation -->\n" +
+  " <message name='echoSenderFaultRequest'>\n" +
+  "   <part name='inElement' element='iop:echoSenderFault' />\n" +
+  " </message>\n" +
+  " <message name='echoSenderFaultResponse' />\n" +
+  "\n" +
+  " <!-- xmlp-8 echoReceiverFault operation -->\n" +
+  " <message name='echoReceiverFaultRequest'>\n" +
+  "   <part name='inElement' element='iop:echoReceiverFault' />\n" +
+  " </message>\n" +
+  " <message name='echoReceiverFaultResponse' />\n" +
+  "\n" +
+  "   <portType name='Soap12AddTestPortTypeDoc'>\n" +
+  "   <!-- xmlp-2 getTime operation -->\n" +
+  "       <operation name='getTime'>\n" +
+  "             <output message='tns:getTimeDocResponse' />\n" +
+  "       </operation>\n" +
+  "   <!-- xmlp-13 thru xmlp-19 echoString doc/literal operation -->\n" +
+  "   <operation name='echoString'>\n" +
+  "     <input message='tns:echoStringDocRequest' />\n" +
+  "     <output message='tns:echoStringDocResponse' />\n" +
+  "   </operation>\n" +
+  "   <!-- xmlp-7 echoSenderFault doc/literal operation -->\n" +
+  "   <operation name='echoSenderFault'>\n" +
+  "     <input message='tns:echoSenderFaultRequest' />\n" +
+  "     <output message='tns:echoSenderFaultResponse' />\n" +
+  "   </operation>\n" +
+  "   <!-- xmlp-8 echoReceiverFault doc/literal operation -->\n" +
+  "   <operation name='echoReceiverFault'>\n" +
+  "     <input message='tns:echoReceiverFaultRequest' />\n" +
+  "     <output message='tns:echoReceiverFaultResponse' />\n" +
+  "   </operation>\n" +
+  " </portType>\n" +
+  "\n" +
+  " <portType name='Soap12AddTestPortTypeRpc'>\n" +
+  "\n" +
+  "   <!-- xmlp-5, xmlp-6 echoVoid rpc operation -->\n" +
+  "   <operation name='echoVoid'>\n" +
+  "     <input message='tns:echoVoidRequest' name='echoVoid'/>\n" +
+  "     <output message='tns:echoVoidResponse' name='echoVoidResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "\n" +
+  "   <!-- xmlp-4 echoSimpleTypesAsStruct rpc operation -->\n" +
+  "   <operation name='echoSimpleTypesAsStruct' parameterOrder='inputString inputInteger inputFloat'>\n" +
+  "     <input message='tns:echoSimpleTypesAsStructRequest'/>\n" +
+  "     <output message='tns:echoSimpleTypesAsStructResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "\n" +
+  "   <!-- xmlp-1, xmlp-9 echoString rpc operation -->\n" +
+  "   <operation name='echoString' parameterOrder='inputString'>\n" +
+  "     <input message='tns:echoStringRequest' name='echoString'/>\n" +
+  "     <output message='tns:echoStringResponse' name='echoStringResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-10 echoSimpleTypesAsStructOfSchemaTypes rpc operation -->\n" +
+  "   <operation name='echoSimpleTypesAsStructOfSchemaTypes' parameterOrder='input1 input2 input3 input4'>\n" +
+  "     <input message='tns:echoSimpleTypesAsStructOfSchemaTypesRequest'/>\n" +
+  "     <output message='tns:echoSimpleTypesAsStructOfSchemaTypesResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-11 echoInteger rpc operation -->\n" +
+  "   <operation name='echoInteger' parameterOrder='inputInteger'>\n" +
+  "     <input message='tns:echoIntegerRequest' name='echoInteger'/>\n" +
+  "     <output message='tns:echoIntegerResponse' name='echoIntegerResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-3 getTime rpc operation -->\n" +
+  "   <operation name='getTime'>\n" +
+  "     <output message='tns:getTimeRpcResponse' name='getTimeRpcResponse'/>\n" +
+  "   </operation>\n" +
+  "\n" +
+  " </portType>\n" +
+  "\n" +
+  "   <binding name='Soap12AddTestDocBinding' type='tns:Soap12AddTestPortTypeDoc'>\n" +
+  "       <soap12:binding style='document' transport='http://schemas.xmlsoap.org/soap/http' />\n" +
+  "       <operation name='getTime'>\n" +
+  "           <soap12:operation style='document' />\n" +
+  "           <output>\n" +
+  "             <soap12:body use='literal' />\n" +
+  "           </output>\n" +
+  "       </operation>\n" +
+  "   <operation name='echoString'>\n" +
+  "     <soap12:operation style='document' />\n" +
+  "     <input>\n" +
+  "       <soap12:body use='literal' />\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='literal' />\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "   <operation name='echoSenderFault'>\n" +
+  "     <soap12:operation style='document' />\n" +
+  "     <input>\n" +
+  "       <soap12:body use='literal' />\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='literal' />\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "   <operation name='echoReceiverFault'>\n" +
+  "     <soap12:operation style='document' />\n" +
+  "     <input>\n" +
+  "       <soap12:body use='literal' />\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='literal' />\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  " </binding>\n" +
+  "\n" +
+  " <binding name='Soap12AddTestRpcBinding' type='tns:Soap12AddTestPortTypeRpc'>\n" +
+  "   <soap12:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "\n" +
+  "   <!-- xmlp-5, xmlp-6 echoVoid rpc operation -->\n" +
+  "   <operation name='echoVoid'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-4 echoSimpleTypesAsStruct rpc operation -->\n" +
+  "   <operation name='echoSimpleTypesAsStruct'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-3 getTime rpc operation -->\n" +
+  "   <operation name='getTime'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-1, xmlp-9 echoString rpc operation -->\n" +
+  "   <operation name='echoString'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-10 echoSimpleTypesAsStructOfSchemaTypes rpc operation -->\n" +
+  "   <operation name='echoSimpleTypesAsStructOfSchemaTypes'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://example.org/ts-tests' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  "   <!-- xmlp-11 echoInteger rpc operation -->\n" +
+  "   <operation name='echoInteger'>\n" +
+  "     <soap12:operation/>\n" +
+  "     <input>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </input>\n" +
+  "     <output>\n" +
+  "       <soap12:body use='encoded' namespace='http://soapinterop.org/' encodingStyle='http://www.w3.org/2003/05/soap-encoding'/>\n" +
+  "     </output>\n" +
+  "   </operation>\n" +
+  "\n" +
+  " </binding>\n" +
+  "\n" +
+  "\n" +
+  " <service name='WhiteMesaSoap12AddTestSvc'>\n" +
+  "\n" +
+  "     <port name='Soap12AddTestDocPort' binding='tns:Soap12AddTestDocBinding'>\n" +
+  "         <soap12:address location='http://www.whitemesa.net/soap12/add-test-doc'/>\n" +
+  "     </port>\n" +
+  "     <port name='Soap12AddTestDocIntermediaryPort' binding='tns:Soap12AddTestDocBinding'>\n" +
+  "         <soap12:address location='http://www.whitemesa.net/soap12/add-test-doc-int'/>\n" +
+  "     </port>\n" +
+  "     <port name='Soap12AddTestDocUpperPort' binding='tns:Soap12AddTestDocBinding'>\n" +
+  "         <soap12:address location='http://www.whitemesa.net/soap12/add-test-doc-int-uc'/>\n" +
+  "     </port>\n" +
+  "     <port name='Soap12AddTestRpcPort' binding='tns:Soap12AddTestRpcBinding'>\n" +
+  "         <soap12:address location='http://www.whitemesa.net/soap12/add-test-rpc'/>\n" +
+  "     </port>\n" +
+  "\n" +
+  " </service>\n" +
+  "\n" +
+  "</definitions>\n" +
+  "\n";
+
+  public void testSoap12AddTest() throws Exception {
+    parseString(soap12AddTest, "soap12-add-test.wsdl");
+  }
+
+  private static final String round4XSD =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "<definitions xmlns:s1='http://soapinterop.org/xsd' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:s='http://www.w3.org/2001/XMLSchema' xmlns:s0='http://soapinterop.org/' xmlns:s3='http://soapinterop.org/echoheader/' xmlns:s2='http://soapinterop.org' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tm='http://microsoft.com/wsdl/mime/textMatching/' xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/' targetNamespace='http://soapinterop.org/' xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "  <types>\n" +
+  "    <s:schema elementFormDefault='qualified' targetNamespace='http://soapinterop.org/'>\n" +
+  "      <s:import namespace='http://soapinterop.org/xsd' />\n" +
+  "      <s:import namespace='http://soapinterop.org/echoheader/' />\n" +
+  "      <s:element name='echoVoid'>\n" +
+  "        <s:complexType />\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoVoidResponse'>\n" +
+  "        <s:complexType />\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoInteger'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputInteger' type='s:int' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoIntegerResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='return' type='s:int' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoFloat'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputFloat' type='s:float' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoFloatResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='return' type='s:float' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoString'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputString' type='s:string' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoStringResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s:string' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoBase64'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputBase64' type='s:base64Binary' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoBase64Response'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s:base64Binary' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoDate'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputDate' type='s:dateTime' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoDateResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='return' type='s:dateTime' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoComplexType'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputComplexType' type='s1:SOAPComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoComplexTypeResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s1:SOAPComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoIntegerMultiOccurs'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputIntegerMultiOccurs' type='s0:ArrayOfInt' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:complexType name='ArrayOfInt'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='unbounded' name='int' type='s:int' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:element name='echoIntegerMultiOccursResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='unbounded' name='return' type='s:int' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoFloatMultiOccurs'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputFloatMultiOccurs' type='s0:ArrayOfFloat' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:complexType name='ArrayOfFloat'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='unbounded' name='float' type='s:float' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:element name='echoFloatMultiOccursResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='unbounded' name='return' type='s:float' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoStringMultiOccurs'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputStringMultiOccurs' type='s0:ArrayOfString' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:complexType name='ArrayOfString'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='unbounded' name='string' nillable='true' type='s:string' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:element name='echoStringMultiOccursResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='unbounded' name='return' type='s:string' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoComplexTypeMultiOccurs'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputComplexTypeMultiOccurs' type='s1:ArrayOfSOAPComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='SOAPComplexType' nillable='true' type='s1:SOAPComplexType' />\n" +
+  "      <s:element name='echoComplexTypeMultiOccursResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='unbounded' name='return' type='s1:SOAPComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoDecimal'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputDecimal' type='s:decimal' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoDecimalResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='return' type='s:decimal' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoBoolean'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputBoolean' type='s:boolean' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoBooleanResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='return' type='s:boolean' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoHexBinary'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputHexBinary' type='s:hexBinary' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoHexBinaryResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s:hexBinary' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoComplexTypeAsSimpleTypes'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputComplexType' type='s1:SOAPComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoComplexTypeAsSimpleTypesResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='outputString' type='s:string' />\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='outputInteger' type='s:int' />\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='outputFloat' type='s:float' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoSimpleTypesAsComplexType'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputString' type='s:string' />\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputInteger' type='s:int' />\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputFloat' type='s:float' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoSimpleTypesAsComplexTypeResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s1:SOAPComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoNestedComplexType'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputComplexType' type='s1:SOAPComplexTypeComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoNestedComplexTypeResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s1:SOAPComplexTypeComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoNestedMultiOccurs'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputComplexType' type='s1:SOAPMultiOccursComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoNestedMultiOccursResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s1:SOAPMultiOccursComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoChoice'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputChoice' type='s1:ChoiceComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoChoiceResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' type='s1:ChoiceComplexType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoEnum'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='inputEnum' type='s1:Enum' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoEnumResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='1' maxOccurs='1' name='return' type='s1:Enum' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoAnyType'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputAnyType' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoAnyTypeResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return' />\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoAnyElement'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='inputAny'>\n" +
+  "              <s:complexType>\n" +
+  "                <s:sequence>\n" +
+  "                  <s:any />\n" +
+  "                </s:sequence>\n" +
+  "              </s:complexType>\n" +
+  "            </s:element>\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoAnyElementResponse'>\n" +
+  "        <s:complexType>\n" +
+  "          <s:sequence>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='return'>\n" +
+  "              <s:complexType>\n" +
+  "                <s:sequence>\n" +
+  "                  <s:any />\n" +
+  "                </s:sequence>\n" +
+  "              </s:complexType>\n" +
+  "            </s:element>\n" +
+  "          </s:sequence>\n" +
+  "        </s:complexType>\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoVoidSoapHeaderResponse'>\n" +
+  "        <s:complexType />\n" +
+  "      </s:element>\n" +
+  "      <s:element name='echoMeComplexTypeRequest' type='s3:echoMeComplexTypeRequest' />\n" +
+  "      <s:element name='echoMeStringRequest' type='s3:echoMeStringRequest' />\n" +
+  "      <s:element name='echoMeComplexTypeResponse' type='s3:echoMeComplexTypeResponse' />\n" +
+  "      <s:element name='echoMeStringResponse' type='s3:echoMeStringResponse' />\n" +
+  "    </s:schema>\n" +
+  "    <s:schema elementFormDefault='qualified' targetNamespace='http://soapinterop.org/xsd'>\n" +
+  "      <s:import namespace='http://soapinterop.org/' />\n" +
+  "      <s:complexType name='SOAPComplexType'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varInt' type='s:int' />\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varFloat' type='s:float' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='ArrayOfSOAPComplexType'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='unbounded' ref='s0:SOAPComplexType' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='SOAPComplexTypeComplexType'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varInt' type='s:int' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varFloat' type='s:float' />\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varComplexType' type='s1:SOAPComplexType' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='SOAPMultiOccursComplexType'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varInt' type='s:int' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varFloat' type='s:float' />\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varMultiOccurs' type='s1:ArrayOfString' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='ArrayOfString'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='unbounded' name='string' nillable='true' type='s:string' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='ChoiceComplexType'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:choice minOccurs='1' maxOccurs='1'>\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='name0' type='s:string' />\n" +
+  "            <s:element minOccurs='0' maxOccurs='1' name='name1' type='s:string' />\n" +
+  "          </s:choice>\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:simpleType name='Enum'>\n" +
+  "        <s:restriction base='s:string'>\n" +
+  "          <s:enumeration value='BitOne' />\n" +
+  "          <s:enumeration value='BitTwo' />\n" +
+  "          <s:enumeration value='BitThree' />\n" +
+  "          <s:enumeration value='BitFour' />\n" +
+  "          <s:enumeration value='BitFive' />\n" +
+  "        </s:restriction>\n" +
+  "      </s:simpleType>\n" +
+  "    </s:schema>\n" +
+  "    <s:schema elementFormDefault='qualified' targetNamespace='http://soapinterop.org'>\n" +
+  "      <s:element name='echoVoidSoapHeader'>\n" +
+  "        <s:complexType />\n" +
+  "      </s:element>\n" +
+  "    </s:schema>\n" +
+  "    <s:schema elementFormDefault='qualified' targetNamespace='http://soapinterop.org/echoheader/'>\n" +
+  "      <s:complexType name='echoMeComplexTypeRequest'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varInt' type='s:int' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varFloat' type='s:float' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='echoMeStringRequest'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='echoMeComplexTypeResponse'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varInt' type='s:int' />\n" +
+  "          <s:element minOccurs='1' maxOccurs='1' name='varFloat' type='s:float' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "      <s:complexType name='echoMeStringResponse'>\n" +
+  "        <s:sequence>\n" +
+  "          <s:element minOccurs='0' maxOccurs='1' name='varString' type='s:string' />\n" +
+  "        </s:sequence>\n" +
+  "      </s:complexType>\n" +
+  "    </s:schema>\n" +
+  "  </types>\n" +
+  "  <message name='echoVoidSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoVoid' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoVoidResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoIntegerSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoInteger' />\n" +
+  "  </message>\n" +
+  "  <message name='echoIntegerSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoIntegerResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoFloatSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoFloat' />\n" +
+  "  </message>\n" +
+  "  <message name='echoFloatSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoFloatResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoStringSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoString' />\n" +
+  "  </message>\n" +
+  "  <message name='echoStringSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoStringResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoBase64SoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoBase64' />\n" +
+  "  </message>\n" +
+  "  <message name='echoBase64SoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoBase64Response' />\n" +
+  "  </message>\n" +
+  "  <message name='echoDateSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoDate' />\n" +
+  "  </message>\n" +
+  "  <message name='echoDateSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoDateResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoComplexTypeSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoComplexType' />\n" +
+  "  </message>\n" +
+  "  <message name='echoComplexTypeSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoComplexTypeResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoIntegerMultiOccursSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoIntegerMultiOccurs' />\n" +
+  "  </message>\n" +
+  "  <message name='echoIntegerMultiOccursSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoIntegerMultiOccursResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoFloatMultiOccursSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoFloatMultiOccurs' />\n" +
+  "  </message>\n" +
+  "  <message name='echoFloatMultiOccursSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoFloatMultiOccursResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoStringMultiOccursSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoStringMultiOccurs' />\n" +
+  "  </message>\n" +
+  "  <message name='echoStringMultiOccursSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoStringMultiOccursResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoComplexTypeMultiOccursSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoComplexTypeMultiOccurs' />\n" +
+  "  </message>\n" +
+  "  <message name='echoComplexTypeMultiOccursSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoComplexTypeMultiOccursResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoDecimalSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoDecimal' />\n" +
+  "  </message>\n" +
+  "  <message name='echoDecimalSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoDecimalResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoBooleanSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoBoolean' />\n" +
+  "  </message>\n" +
+  "  <message name='echoBooleanSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoBooleanResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoHexBinarySoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoHexBinary' />\n" +
+  "  </message>\n" +
+  "  <message name='echoHexBinarySoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoHexBinaryResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoComplexTypeAsSimpleTypesSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoComplexTypeAsSimpleTypes' />\n" +
+  "  </message>\n" +
+  "  <message name='echoComplexTypeAsSimpleTypesSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoComplexTypeAsSimpleTypesResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoSimpleTypesAsComplexTypeSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoSimpleTypesAsComplexType' />\n" +
+  "  </message>\n" +
+  "  <message name='echoSimpleTypesAsComplexTypeSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoSimpleTypesAsComplexTypeResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoNestedComplexTypeSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoNestedComplexType' />\n" +
+  "  </message>\n" +
+  "  <message name='echoNestedComplexTypeSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoNestedComplexTypeResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoNestedMultiOccursSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoNestedMultiOccurs' />\n" +
+  "  </message>\n" +
+  "  <message name='echoNestedMultiOccursSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoNestedMultiOccursResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoChoiceSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoChoice' />\n" +
+  "  </message>\n" +
+  "  <message name='echoChoiceSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoChoiceResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoEnumSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoEnum' />\n" +
+  "  </message>\n" +
+  "  <message name='echoEnumSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoEnumResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoAnyTypeSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoAnyType' />\n" +
+  "  </message>\n" +
+  "  <message name='echoAnyTypeSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoAnyTypeResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoAnyElementSoapIn'>\n" +
+  "    <part name='parameters' element='s0:echoAnyElement' />\n" +
+  "  </message>\n" +
+  "  <message name='echoAnyElementSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoAnyElementResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapHeaderSoapIn'>\n" +
+  "    <part name='parameters' element='s2:echoVoidSoapHeader' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapHeaderSoapOut'>\n" +
+  "    <part name='parameters' element='s0:echoVoidSoapHeaderResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapHeaderechoMeComplexTypeRequest'>\n" +
+  "    <part name='echoMeComplexTypeRequest' element='s0:echoMeComplexTypeRequest' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapHeaderechoMeComplexTypeResponse'>\n" +
+  "    <part name='echoMeComplexTypeResponse' element='s0:echoMeComplexTypeResponse' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapHeaderechoMeStringRequest'>\n" +
+  "    <part name='echoMeStringRequest' element='s0:echoMeStringRequest' />\n" +
+  "  </message>\n" +
+  "  <message name='echoVoidSoapHeaderechoMeStringResponse'>\n" +
+  "    <part name='echoMeStringResponse' element='s0:echoMeStringResponse' />\n" +
+  "  </message>\n" +
+  "  <portType name='Round4XSDTestSoap'>\n" +
+  "    <operation name='echoVoid'>\n" +
+  "      <input message='s0:echoVoidSoapIn' />\n" +
+  "      <output message='s0:echoVoidSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoInteger'>\n" +
+  "      <input message='s0:echoIntegerSoapIn' />\n" +
+  "      <output message='s0:echoIntegerSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoFloat'>\n" +
+  "      <input message='s0:echoFloatSoapIn' />\n" +
+  "      <output message='s0:echoFloatSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoString'>\n" +
+  "      <input message='s0:echoStringSoapIn' />\n" +
+  "      <output message='s0:echoStringSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoBase64'>\n" +
+  "      <input message='s0:echoBase64SoapIn' />\n" +
+  "      <output message='s0:echoBase64SoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoDate'>\n" +
+  "      <input message='s0:echoDateSoapIn' />\n" +
+  "      <output message='s0:echoDateSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoComplexType'>\n" +
+  "      <input message='s0:echoComplexTypeSoapIn' />\n" +
+  "      <output message='s0:echoComplexTypeSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoIntegerMultiOccurs'>\n" +
+  "      <input message='s0:echoIntegerMultiOccursSoapIn' />\n" +
+  "      <output message='s0:echoIntegerMultiOccursSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoFloatMultiOccurs'>\n" +
+  "      <input message='s0:echoFloatMultiOccursSoapIn' />\n" +
+  "      <output message='s0:echoFloatMultiOccursSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoStringMultiOccurs'>\n" +
+  "      <input message='s0:echoStringMultiOccursSoapIn' />\n" +
+  "      <output message='s0:echoStringMultiOccursSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoComplexTypeMultiOccurs'>\n" +
+  "      <input message='s0:echoComplexTypeMultiOccursSoapIn' />\n" +
+  "      <output message='s0:echoComplexTypeMultiOccursSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoDecimal'>\n" +
+  "      <input message='s0:echoDecimalSoapIn' />\n" +
+  "      <output message='s0:echoDecimalSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoBoolean'>\n" +
+  "      <input message='s0:echoBooleanSoapIn' />\n" +
+  "      <output message='s0:echoBooleanSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoHexBinary'>\n" +
+  "      <input message='s0:echoHexBinarySoapIn' />\n" +
+  "      <output message='s0:echoHexBinarySoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoComplexTypeAsSimpleTypes'>\n" +
+  "      <input message='s0:echoComplexTypeAsSimpleTypesSoapIn' />\n" +
+  "      <output message='s0:echoComplexTypeAsSimpleTypesSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoSimpleTypesAsComplexType'>\n" +
+  "      <input message='s0:echoSimpleTypesAsComplexTypeSoapIn' />\n" +
+  "      <output message='s0:echoSimpleTypesAsComplexTypeSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoNestedComplexType'>\n" +
+  "      <input message='s0:echoNestedComplexTypeSoapIn' />\n" +
+  "      <output message='s0:echoNestedComplexTypeSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoNestedMultiOccurs'>\n" +
+  "      <input message='s0:echoNestedMultiOccursSoapIn' />\n" +
+  "      <output message='s0:echoNestedMultiOccursSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoChoice'>\n" +
+  "      <input message='s0:echoChoiceSoapIn' />\n" +
+  "      <output message='s0:echoChoiceSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoEnum'>\n" +
+  "      <input message='s0:echoEnumSoapIn' />\n" +
+  "      <output message='s0:echoEnumSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoAnyType'>\n" +
+  "      <input message='s0:echoAnyTypeSoapIn' />\n" +
+  "      <output message='s0:echoAnyTypeSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoAnyElement'>\n" +
+  "      <input message='s0:echoAnyElementSoapIn' />\n" +
+  "      <output message='s0:echoAnyElementSoapOut' />\n" +
+  "    </operation>\n" +
+  "    <operation name='echoVoidSoapHeader'>\n" +
+  "      <input message='s0:echoVoidSoapHeaderSoapIn' />\n" +
+  "      <output message='s0:echoVoidSoapHeaderSoapOut' />\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "  <binding name='Round4XSDTestSoap' type='s0:Round4XSDTestSoap'>\n" +
+  "    <soap:binding transport='http://schemas.xmlsoap.org/soap/http' style='document' />\n" +
+  "    <operation name='echoVoid'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoVoid' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoInteger'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoInteger' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoFloat'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoFloat' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoString'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoString' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoBase64'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoBase64' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoDate'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoDate' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoComplexType'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoComplexType' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoIntegerMultiOccurs'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoIntegerMultiOccurs' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoFloatMultiOccurs'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoFloatMultiOccurs' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoStringMultiOccurs'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoStringMultiOccurs' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoComplexTypeMultiOccurs'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoComplexTypeMultiOccurs' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoDecimal'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoDecimal' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoBoolean'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoBoolean' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoHexBinary'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoHexBinary' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoComplexTypeAsSimpleTypes'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoComplexTypeAsSimpleTypes' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoSimpleTypesAsComplexType'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoSimpleTypesAsComplexType' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoNestedComplexType'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoNestedComplexType' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoNestedMultiOccurs'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoNestedMultiOccurs' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoChoice'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoChoice' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoEnum'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoEnum' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoAnyType'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoAnyType' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoAnyElement'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org/echoAnyElement' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='echoVoidSoapHeader'>\n" +
+  "      <soap:operation soapAction='http://soapinterop.org' style='document' />\n" +
+  "      <input>\n" +
+  "        <soap:body use='literal' />\n" +
+  "        <soap:header message='s0:echoVoidSoapHeaderechoMeComplexTypeRequest' part='echoMeComplexTypeRequest' use='literal' />\n" +
+  "        <soap:header message='s0:echoVoidSoapHeaderechoMeStringRequest' part='echoMeStringRequest' use='literal' />\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='literal' />\n" +
+  "        <soap:header message='s0:echoVoidSoapHeaderechoMeComplexTypeResponse' part='echoMeComplexTypeResponse' use='literal' />\n" +
+  "        <soap:header message='s0:echoVoidSoapHeaderechoMeStringResponse' part='echoMeStringResponse' use='literal' />\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "  <service name='Round4XSDTest'>\n" +
+  "    <documentation>These operations implement DOC/LIT SOAP operations, for interop testing. Please email johnko at microsoft.com with any questions/coments.</documentation>\n" +
+  "    <port name='Round4XSDTestSoap' binding='s0:Round4XSDTestSoap'>\n" +
+  "      <!--\n" +
+  "      <soap:address location='http://mssoapinterop.org/asmx/xsd/round4xsd.asmx' />\n" +
+  "      -->\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/Round4XSDTestSoap' />\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "</definitions>\n";
+
+  public void testRound4XSD() throws Exception {
+    parseString(round4XSD, "round4XSD.wsdl");
+  }
+
+  private static final String ram =
+  "<?xml version='1.0' encoding='UTF-8'?>\n" +
+  "<wsdl:definitions targetNamespace='urn:ram' \n" +
+  "xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:impl='urn:Ram-impl' \n" +
+  "xmlns:intf='urn:ram' xmlns:tns1='http://ram.uspto.gov'\n" +
+  "xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' \n" +
+  "xmlns:wsdlsoap='http://schemas.xmlsoap.org/wsdl/soap/' \n" +
+  "xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+  " <types>\n" +
+  "  <schema targetNamespace='http://ram.uspto.gov' \n" +
+  "xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
+  "   <complexType name='RamData'>\n" +
+  "    <sequence>\n" +
+  "     <element name='mailRoomDate' nillable='true' type='xsd:date'/>\n" +
+  "     <element name='callingClientUserIdentifier' nillable='true' \n" +
+  "type='xsd:string'/>\n" +
+  "     <element name='bankInfoRequestType' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='callingClientPortNumber' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='salePostingReferenceText' nillable='true' \n" +
+  "type='xsd:string'/>\n" +
+  "     <element name='bankInfoPaymentType' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='saleOtherPaymentTotalAmount' type='xsd:double'/>\n" +
+  "     <element name='fees' nillable='true' type='intf:ArrayOf_tns1_Fee'/>\n" +
+  "     <element name='creditCard' nillable='true' type='tns1:CreditCard'/>\n" +
+  "    </sequence>\n" +
+  "   </complexType>\n" +
+  "   <complexType name='Fee'>\n" +
+  "    <sequence>\n" +
+  "     <element name='code' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='amount' type='xsd:double'/>\n" +
+  "     <element name='quantity' type='xsd:int'/>\n" +
+  "    </sequence>\n" +
+  "   </complexType>\n" +
+  "   <complexType name='CreditCard'>\n" +
+  "    <sequence>\n" +
+  "     <element name='name' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='expires' nillable='true' type='xsd:date'/>\n" +
+  "     <element name='number' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='postalCode' nillable='true' type='xsd:string'/>\n" +
+  "    </sequence>\n" +
+  "   </complexType>\n" +
+  "   <complexType name='Response'>\n" +
+  "    <sequence>\n" +
+  "     <element name='salePostingReferenceText' nillable='true' \n" +
+  "type='xsd:string'/>\n" +
+  "     <element name='authorization' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='hostResponseCode' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='hostResponseMessage' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='protoBaseResponseCode' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='protoBaseResponseMessage' nillable='true' \n" +
+  "type='xsd:string'/>\n" +
+  "     <element name='transactionReferenceNumber' nillable='true' \n" +
+  "type='xsd:string'/>\n" +
+  "     <element name='reasonCode' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='returnCode' nillable='true' type='xsd:string'/>\n" +
+  "     <element name='accountingDate' nillable='true' type='xsd:date'/>\n" +
+  "    </sequence>\n" +
+  "   </complexType>\n" +
+  "  </schema>\n" +
+  "  <schema targetNamespace='urn:ram' xmlns='http://www.w3.org/2001/XMLSchema'>\n" +
+  "   <complexType name='ArrayOf_tns1_Fee'>\n" +
+  "    <complexContent>\n" +
+  "     <restriction base='SOAP-ENC:Array'>\n" +
+  "      <attribute ref='SOAP-ENC:arrayType' wsdl:arrayType='tns1:Fee[]'/>\n" +
+  "     </restriction>\n" +
+  "    </complexContent>\n" +
+  "   </complexType>\n" +
+  "   <complexType name='ArrayOf_tns1_RamData'>\n" +
+  "    <complexContent>\n" +
+  "     <restriction base='SOAP-ENC:Array'>\n" +
+  "      <attribute ref='SOAP-ENC:arrayType' wsdl:arrayType='tns1:RamData[]'/>\n" +
+  "     </restriction>\n" +
+  "    </complexContent>\n" +
+  "   </complexType>\n" +
+  "   <element name='ArrayOf_tns1_RamData' nillable='true' \n" +
+  "type='intf:ArrayOf_tns1_RamData'/>\n" +
+  "   <complexType name='ArrayOf_tns1_Response'>\n" +
+  "    <complexContent>\n" +
+  "     <restriction base='SOAP-ENC:Array'>\n" +
+  "      <attribute ref='SOAP-ENC:arrayType' wsdl:arrayType='tns1:Response[]'/>\n" +
+  "     </restriction>\n" +
+  "    </complexContent>\n" +
+  "   </complexType>\n" +
+  "   <element name='ArrayOf_tns1_Response' nillable='true' \n" +
+  "type='intf:ArrayOf_tns1_Response'/>\n" +
+  "  </schema>\n" +
+  " </types>\n" +
+  "\n" +
+  "   <wsdl:message name='validateResponse'>\n" +
+  "\n" +
+  "      <wsdl:part name='return' type='intf:ArrayOf_tns1_Response'/>\n" +
+  "\n" +
+  "   </wsdl:message>\n" +
+  "\n" +
+  "   <wsdl:message name='validateRequest'>\n" +
+  "\n" +
+  "      <wsdl:part name='in0' type='intf:ArrayOf_tns1_RamData'/>\n" +
+  "\n" +
+  "   </wsdl:message>\n" +
+  "\n" +
+  "   <wsdl:portType name='Ram'>\n" +
+  "\n" +
+  "      <wsdl:operation name='validate' parameterOrder='in0'>\n" +
+  "\n" +
+  "         <wsdl:input message='intf:validateRequest'/>\n" +
+  "\n" +
+  "         <wsdl:output message='intf:validateResponse'/>\n" +
+  "\n" +
+  "      </wsdl:operation>\n" +
+  "\n" +
+  "   </wsdl:portType>\n" +
+  "\n" +
+  "   <wsdl:binding name='RamSoapBinding' type='intf:Ram'>\n" +
+  "\n" +
+  "      <wsdlsoap:binding style='rpc' \n" +
+  "transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "\n" +
+  "      <wsdl:operation name='validate'>\n" +
+  "\n" +
+  "         <wsdlsoap:operation soapAction=''/>\n" +
+  "\n" +
+  "         <wsdl:input>\n" +
+  "\n" +
+  "            <wsdlsoap:body \n" +
+  "encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' namespace='urn:ram' \n" +
+  "use='encoded'/>\n" +
+  "\n" +
+  "         </wsdl:input>\n" +
+  "\n" +
+  "         <wsdl:output>\n" +
+  "\n" +
+  "            <wsdlsoap:body \n" +
+  "encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' namespace='urn:ram' \n" +
+  "use='encoded'/>\n" +
+  "\n" +
+  "         </wsdl:output>\n" +
+  "\n" +
+  "      </wsdl:operation>\n" +
+  "\n" +
+  "   </wsdl:binding>\n" +
+  "\n" +
+  "   <wsdl:service name='RamService'>\n" +
+  "\n" +
+  "      <wsdl:port binding='intf:RamSoapBinding' name='Ram'>\n" +
+  "\n" +
+  "         <wsdlsoap:address location='http://localhost:8080/axis/services/Ram'/>\n" +
+  "\n" +
+  "      </wsdl:port>\n" +
+  "\n" +
+  "   </wsdl:service>\n" +
+  "\n" +
+  "</wsdl:definitions>\n";
+
+  public void testRam() throws Exception {
+    parseString(ram, "ram.wsdl");
+  }
+
+  private static final String multiRefTest =
+  "<?xml version='1.0' ?>\n" +
+  "\n" +
+  "<definitions name='urn:MultiRefTest'\n" +
+  "             targetNamespace='urn:MultiRefTest2'\n" +
+  "             xmlns:tns='urn:MultiRefTest2'\n" +
+  "             xmlns:typens='urn:MultiRefTest2'\n" +
+  "             xmlns:xsd='http://www.w3.org/1999/XMLSchema'\n" +
+  "             xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'\n" +
+  "             xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "\n" +
+  "  <!-- type defs -->\n" +
+  "  <types>\n" +
+  "    <xsd:schema targetNamespace='urn:MultiRefTest2'\n" +
+  "                xmlns:xsd='http://www.w3.org/1999/XMLSchema'>\n" +
+  "                \n" +
+  "              \n" +
+  "      <xsd:complexType name='nodebase'>\n" +
+  "        <xsd:all>\n" +
+  "            <xsd:element name='left' type='typens:node' xsd:nillable='true'/>\n" +
+  "            <xsd:element name='right' type='typens:node' xsd:nillable='true'/>\n" +
+  "        </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='node'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:extension base='typens:nodebase'>\n" +
+  "            <xsd:all>\n" +
+  "              <xsd:element name='data' type='xsd:int'/>\n" +
+  "            </xsd:all>\n" +
+  "          </xsd:extension>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "    </xsd:schema>\n" +
+  "  </types>\n" +
+  "\n" +
+  "  <!-- message declns -->\n" +
+  "  <message name='InNodes'>\n" +
+  "    <part name='root' type='typens:node'/>\n" +
+  "  </message>\n" +
+  "  <message name='OutNodes'>\n" +
+  "    <part name='root' type='typens:node'/>\n" +
+  "    <part name='rc' type='xsd:int'/>\n" +
+  "  </message>\n" +
+  "  <message name='InNodes2'>\n" +
+  "    <part name='root1' type='typens:node'/>\n" +
+  "    <part name='root2' type='typens:node'/>\n" +
+  "  </message>\n" +
+  "  <message name='OutNodes2'>\n" +
+  "    <part name='root1' type='typens:node'/>\n" +
+  "    <part name='root2' type='typens:node'/>\n" +
+  "    <part name='rc' type='xsd:int'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <!-- port type declns -->\n" +
+  "  <portType name='MultiRefTest'>\n" +
+  "    <operation name='testSimpleTree'>\n" +
+  "      <input  message='tns:InNodes'/>\n" +
+  "      <output message='tns:OutNodes'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='testDiamond'>\n" +
+  "      <input  message='tns:InNodes'/>\n" +
+  "      <output message='tns:OutNodes'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='testLoop'>\n" +
+  "      <input  message='tns:InNodes'/>\n" +
+  "      <output message='tns:OutNodes'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='testSelfRef'>\n" +
+  "      <input  message='tns:InNodes'/>\n" +
+  "      <output message='tns:OutNodes'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='testSameArgs'>\n" +
+  "      <input  message='tns:InNodes2'/>\n" +
+  "      <output message='tns:OutNodes2'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='testArgsRefSameNode'>\n" +
+  "      <input  message='tns:InNodes2'/>\n" +
+  "      <output message='tns:OutNodes2'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='testArgsRefEachOther'>\n" +
+  "      <input  message='tns:InNodes2'/>\n" +
+  "      <output message='tns:OutNodes2'/>\n" +
+  "    </operation>\n" +
+  "  </portType>\n" +
+  "\n" +
+  "  <!-- binding declns -->\n" +
+  "  <binding name='MultiRefTestSOAPBinding' type='tns:MultiRefTest'>\n" +
+  "    <soap:binding style='rpc'\n" +
+  "                  transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "    <operation name='testSimpleTree'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='testDiamond'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='testLoop'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "         <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='testSelfRef'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "         <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='testSameArgs'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "         <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='testArgsRefSameNode'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "         <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='testArgsRefEachOther'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "         <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body use='encoded'\n" +
+  "                   namespace='urn:MultiRefTest2'\n" +
+  "                   encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "  </binding>\n" +
+  "\n" +
+  "  <!-- service decln -->\n" +
+  "  <service name='MultiRefTestService'>\n" +
+  "    <port name='MultiRefTest' binding='tns:MultiRefTestSOAPBinding'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/MultiRefTest'/>\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "\n" +
+  "</definitions>\n";
+
+  public void testMultiRefTest() throws Exception {
+    parseString(multiRefTest, "MultiRefTest.wsdl");
+  }
+
+  private static final String header =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "\n" +
+  "<wsdl:definitions \n" +
+  " xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' \n" +
+  " xmlns:xsd='http://www.w3.org/2001/XMLSchema' \n" +
+  " xmlns:tns='urn:header.wsdl.test' \n" +
+  " targetNamespace='urn:header.wsdl.test' \n" +
+  " xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "\n" +
+  "  <wsdl:types>\n" +
+  "    <xsd:schema>\n" +
+  "\n" +
+  "      <xsd:element name='Header' type='tns:HeaderType'/>\n" +
+  "      <xsd:complexType name='HeaderType'>\n" +
+  "        <xsd:all>\n" +
+  "          <element name='e1' type='xsd:string'/>\n" +
+  "        </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "    </xsd:schema>\n" +
+  "  </wsdl:types>\n" +
+  "\n" +
+  "  <wsdl:message name='op1Request'>\n" +
+  "    <wsdl:part name='parm1' type='xsd:int'/>\n" +
+  "    <wsdl:part name='parm2' type='xsd:string'/>\n" +
+  "    <wsdl:part name='header' element='tns:Header'/>\n" +
+  "  </wsdl:message>\n" +
+  "\n" +
+  "  <wsdl:message name='op1Response'>\n" +
+  "<!--\n" +
+  "    <wsdl:part name='header' element='tns:Header'/>\n" +
+  "-->\n" +
+  "    <wsdl:part name='return' type='xsd:float'/>\n" +
+  "  </wsdl:message>\n" +
+  "\n" +
+  "  <wsdl:message name='op1Fault'>\n" +
+  "    <wsdl:part name='message' type='xsd:string'/>\n" +
+  "  </wsdl:message>\n" +
+  "\n" +
+  "  <wsdl:message name='op2Request'>\n" +
+  "    <wsdl:part name='parm' type='xsd:int'/>\n" +
+  "    <wsdl:part name='header' element='tns:Header'/>\n" +
+  "  </wsdl:message>\n" +
+  "\n" +
+  "  <wsdl:message name='op2Response'/>\n" +
+  "\n" +
+  "  <wsdl:message name='implicitFault'>\n" +
+  "    <wsdl:part name='message' type='xsd:string'/>\n" +
+  "  </wsdl:message>\n" +
+  "\n" +
+  "  <wsdl:portType name='PortType'>\n" +
+  "    <wsdl:operation name='op1'>\n" +
+  "      <wsdl:input message='tns:op1Request'/>\n" +
+  "      <wsdl:output message='tns:op1Response'/>\n" +
+  "      <wsdl:fault name='op1Fault' message='tns:op1Fault'/>\n" +
+  "    </wsdl:operation>\n" +
+  "    <wsdl:operation name='op2'>\n" +
+  "      <wsdl:input message='tns:op2Request'/>\n" +
+  "      <wsdl:output message='tns:op2Response'/>\n" +
+  "    </wsdl:operation>\n" +
+  "  </wsdl:portType>\n" +
+  "\n" +
+  "  <wsdl:binding name='Binding' type='tns:PortType'>\n" +
+  "    <soap:binding transport='http://schemas.xmlsoap.org/soap/http' style='rpc'/>\n" +
+  "    <wsdl:operation name='op1'>\n" +
+  "      <soap:operation/>\n" +
+  "      <wsdl:input>\n" +
+  "        <soap:body use='literal'\n" +
+  "                   namespace='urn:header.wsdl.test'\n" +
+  "                   parts='parm2'/>\n" +
+  "        <soap:header message='tns:op1Request'\n" +
+  "                     part='parm1'\n" +
+  "                     use='literal'\n" +
+  "                     namespace='urn:header.wsdl.test'>\n" +
+  "          <soap:headerfault message='tns:op1Fault'\n" +
+  "                            part='message'\n" +
+  "                            use='literal' \n" +
+  "                            namespace='urn:header.wsdl.test'/>\n" +
+  "        </soap:header>\n" +
+  "        <soap:header message='tns:op1Request'\n" +
+  "                     part='header'\n" +
+  "                     use='literal'\n" +
+  "                     namespace='urn:header.wsdl.test'>\n" +
+  "          <soap:headerfault message='tns:op1Fault'\n" +
+  "                            part='message'\n" +
+  "                            use='literal' \n" +
+  "                            namespace='urn:header.wsdl.test'/>\n" +
+  "        </soap:header>\n" +
+  "      </wsdl:input>\n" +
+  "      <wsdl:output>\n" +
+  "<!--\n" +
+  "        <soap:body use='literal'\n" +
+  "                   parts='header'\n" +
+  "                   namespace='urn:header.wsdl.test'/>\n" +
+  "-->\n" +
+  "        <soap:header message='tns:op1Response'\n" +
+  "                     part='return'\n" +
+  "                     use='literal'\n" +
+  "                     namespace='urn:header.wsdl.test'>\n" +
+  "        </soap:header>\n" +
+  "      </wsdl:output>\n" +
+  "    </wsdl:operation>\n" +
+  "    <wsdl:operation name='op2'>\n" +
+  "      <soap:operation/>\n" +
+  "      <wsdl:input>\n" +
+  "        <soap:body use='literal'\n" +
+  "                   namespace='urn:header.wsdl.test'\n" +
+  "                   parts='parm'/>\n" +
+  "        <soap:header message='tns:op2Request'\n" +
+  "                     part='header'\n" +
+  "                     use='literal'\n" +
+  "                     namespace='urn:header.wsdl.test'>\n" +
+  "          <soap:headerfault message='tns:implicitFault'\n" +
+  "                            part='message'\n" +
+  "                            use='literal' \n" +
+  "                            namespace='urn:header.wsdl.test'/>\n" +
+  "        </soap:header>\n" +
+  "      </wsdl:input>\n" +
+  "      <wsdl:output>\n" +
+  "        <soap:body use='literal'\n" +
+  "                   namespace='urn:header.wsdl.test'/>\n" +
+  "      </wsdl:output>\n" +
+  "    </wsdl:operation>\n" +
+  "  </wsdl:binding>\n" +
+  "\n" +
+  "  <wsdl:service name='HeaderService'>\n" +
+  "    <wsdl:port name='header' binding='tns:Binding'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/header'/>\n" +
+  "    </wsdl:port>\n" +
+  "  </wsdl:service>\n" +
+  "\n" +
+  "</wsdl:definitions>\n";
+
+  public void testHeader() throws Exception {
+    parseString(header, "header.wsdl");
+  }
+
+  private static final String dimeRpc =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "<wsdl:definitions name='SOAPBuilders' xmlns='http://soapinterop.org/attachments/wsdl' xmlns:types='http://soapinterop.org/attachments/xsd' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:dime='http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/' xmlns:content='http://schemas.xmlsoap.org/ws/2002/04/content-type/' targetNamespace='http://soapinterop.org/attachments/wsdl'>\n" +
+  " <wsdl:types>\n" +
+  "   <schema xmlns='http://www.w3.org/2001/XMLSchema' targetNamespace='http://soapinterop.org/attachments/xsd'>\n" +
+  "     <!-- <import namespace='http://schemas.xmlsoap.org/soap/encoding/' schemaLocation='http://schemas.xmlsoap.org/soap/encoding/' /> -->\n" +
+  "     <import namespace='http://schemas.xmlsoap.org/ws/2002/04/content-type/'/>\n" +
+  "     <import namespace='http://schemas.xmlsoap.org/ws/2002/04/reference/'/>\n" +
+  "     <complexType name='ReferencedBinary'>\n" +
+  "       <simpleContent>\n" +
+  "         <restriction base='soap-enc:base64Binary'>\n" +
+  "           <annotation>\n" +
+  "             <appinfo>\n" +
+  "               <content:mediaType value='application/octetstream'/>\n" +
+  "             </appinfo>\n" +
+  "           </annotation>\n" +
+  "           <attributeGroup ref='soap-enc:commonAttributes'/>\n" +
+  "         </restriction>\n" +
+  "       </simpleContent>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='ArrayOfBinary'>\n" +
+  "       <complexContent>\n" +
+  "         <restriction base='soap-enc:Array'>\n" +
+  "           <attribute ref='soap-enc:arrayType' wsdl:arrayType='types:ReferencedBinary[]'/>\n" +
+  "         </restriction>\n" +
+  "       </complexContent>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='ReferencedText'>\n" +
+  "       <simpleContent>\n" +
+  "         <restriction base='soap-enc:base64Binary'>\n" +
+  "           <annotation>\n" +
+  "             <appinfo>\n" +
+  "               <content:mediaType value='text/plain'/>\n" +
+  "             </appinfo>\n" +
+  "           </annotation>\n" +
+  "           <attributeGroup ref='soap-enc:commonAttributes'/>\n" +
+  "         </restriction>\n" +
+  "       </simpleContent>\n" +
+  "     </complexType>\n" +
+  "   </schema>\n" +
+  " </wsdl:types>\n" +
+  " <wsdl:message name='EchoAttachmentIn'>\n" +
+  "   <wsdl:part name='In' type='types:ReferencedBinary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentOut'>\n" +
+  "   <wsdl:part name='Out' type='types:ReferencedBinary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentsIn'>\n" +
+  "   <wsdl:part name='In' type='types:ArrayOfBinary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentsOut'>\n" +
+  "   <wsdl:part name='Out' type='types:ArrayOfBinary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsBase64In'>\n" +
+  "   <wsdl:part name='In' type='types:ReferencedBinary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsBase64Out'>\n" +
+  "   <wsdl:part name='Out' type='xsd:base64Binary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoBase64AsAttachmentIn'>\n" +
+  "   <wsdl:part name='In' type='xsd:base64Binary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoBase64AsAttachmentOut'>\n" +
+  "   <wsdl:part name='Out' type='types:ReferencedBinary'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoUnrefAttachmentsIn' />\n" +
+  " <wsdl:message name='EchoUnrefAttachmentsOut' />\n" +
+  " <wsdl:message name='EchoAttachmentAsStringIn'>\n" +
+  "   <wsdl:part name='In' type='types:ReferencedText'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsStringOut'>\n" +
+  "   <wsdl:part name='Out' type='xsd:string'/>\n" +
+  " </wsdl:message>\n" +
+  " \n" +
+  " <wsdl:portType name='AttachmentsPortType'>\n" +
+  "   <wsdl:operation name='EchoAttachment'>\n" +
+  "     <wsdl:input name='EchoAttachmentInput' message='EchoAttachmentIn'/>\n" +
+  "     <wsdl:output name='EchoAttachmentOutput' message='EchoAttachmentOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachments'>\n" +
+  "     <wsdl:input name='EchoAttachmentsInput' message='EchoAttachmentsIn'/>\n" +
+  "     <wsdl:output name='EchoAttachmentsOutput' message='EchoAttachmentsOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsBase64'>\n" +
+  "     <wsdl:input name='EchoAttachmentAsBase64Input' message='EchoAttachmentAsBase64In'/>\n" +
+  "     <wsdl:output name='EchoAttachmentAsBase64Output' message='EchoAttachmentAsBase64Out'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoBase64AsAttachment'>\n" +
+  "     <wsdl:input name='EchoBase64AsAttachmentInput' message='EchoBase64AsAttachmentIn'/>\n" +
+  "     <wsdl:output name='EchoBase64AsAttachmentOutput' message='EchoBase64AsAttachmentOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoUnrefAttachments'>\n" +
+  "     <wsdl:input name='EchoUnrefAttachmentsInput' message='EchoUnrefAttachmentsIn'/>\n" +
+  "     <wsdl:output name='EchoUnrefAttachmentsOutput' message='EchoUnrefAttachmentsOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsString'>\n" +
+  "     <wsdl:input  name='EchoAttachmentAsStringInput'  message='EchoAttachmentAsStringIn'/>\n" +
+  "     <wsdl:output name='EchoAttachmentAsStringOutput' message='EchoAttachmentAsStringOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  " </wsdl:portType>\n" +
+  " <wsdl:binding name='AttachmentsBinding' type='AttachmentsPortType'>\n" +
+  "   <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "   <wsdl:operation name='EchoAttachment'>\n" +
+  "     <soap:operation style='rpc' soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachments'>\n" +
+  "     <soap:operation style='rpc' soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentsInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentsOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsBase64'>\n" +
+  "     <soap:operation style='rpc' soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentAsBase64Input'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentAsBase64Output'>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoBase64AsAttachment'>\n" +
+  "     <soap:operation style='rpc' soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoBase64AsAttachmentInput'>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoBase64AsAttachmentOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoUnrefAttachments'>\n" +
+  "     <soap:operation style='rpc' soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoUnrefAttachmentsInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoUnrefAttachmentsOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsString'>\n" +
+  "     <soap:operation style='rpc' soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentAsStringInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentAsStringOutput'>\n" +
+  "       <soap:body use='encoded' namespace='http://soapinterop.org/attachments/' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  " </wsdl:binding>\n" +
+  "    <wsdl:service name='DimeRPCInterop'>\n" +
+  "     <wsdl:port name='DimeRPCSoapPort' binding='AttachmentsBinding'>\n" +
+  "            <soap:address location='http://localhost:8080/axis/services/DimeRPCSoapPort'/>\n" +
+  "        </wsdl:port>\n" +
+  "    </wsdl:service>\n" +
+  "</wsdl:definitions>\n";
+
+  public void testDimeRpc() throws Exception {
+    parseString(dimeRpc, "dime-rpc.wsdl");
+  }
+
+  private static final String dimeDoc =
+  "<?xml version='1.0' encoding='utf-8'?>\n" +
+  "<wsdl:definitions name='SOAPBuilders' xmlns='http://soapinterop.org/attachments/wsdl' xmlns:types='http://soapinterop.org/attachments/xsd' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:dime='http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/' xmlns:content='http://schemas.xmlsoap.org/ws/2002/04/content-type/' xmlns:ref='http://schemas.xmlsoap.org/ws/2002/04/reference/' targetNamespace='http://soapinterop.org/attachments/wsdl'>\n" +
+  " <wsdl:types>\n" +
+  "   <schema xmlns='http://www.w3.org/2001/XMLSchema' targetNamespace='http://soapinterop.org/attachments/xsd' elementFormDefault='qualified' attributeFormDefault='qualified'>\n" +
+  "     <import namespace='http://schemas.xmlsoap.org/ws/2002/04/reference/'/>\n" +
+  "     <import namespace='http://schemas.xmlsoap.org/ws/2002/04/content-type/'/>\n" +
+  "     <complexType name='ReferencedBinary'>\n" +
+  "       <simpleContent>\n" +
+  "         <restriction base='xsd:base64Binary'>\n" +
+  "           <annotation>\n" +
+  "             <appinfo>\n" +
+  "               <content:mediaType value='application/octetstream'/>\n" +
+  "             </appinfo>\n" +
+  "           </annotation>\n" +
+  "           <attribute ref='ref:location' use='optional'/>\n" +
+  "         </restriction>\n" +
+  "       </simpleContent>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='ReferencedText'>\n" +
+  "       <simpleContent>\n" +
+  "         <restriction base='xsd:base64Binary'>\n" +
+  "           <annotation>\n" +
+  "             <appinfo>\n" +
+  "               <content:mediaType value='text/plain'/>\n" +
+  "             </appinfo>\n" +
+  "           </annotation>\n" +
+  "           <attribute ref='ref:location' use='optional'/>\n" +
+  "         </restriction>\n" +
+  "       </simpleContent>\n" +
+  "     </complexType>\n" +
+  "     <element name='EchoAttachment' type='types:EchoAttachment'/>\n" +
+  "     <element name='EchoAttachmentResponse' type='types:EchoAttachmentResponse'/>\n" +
+  "     <complexType name='EchoAttachment'>\n" +
+  "       <sequence>\n" +
+  "         <element name='In' type='types:ReferencedBinary'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='EchoAttachmentResponse'>\n" +
+  "       <sequence>\n" +
+  "         <element name='Out' type='types:ReferencedBinary'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <element name='EchoAttachments' type='types:Attachments'/>\n" +
+  "     <element name='EchoAttachmentsResponse' type='types:Attachments'/>\n" +
+  "     <complexType name='Attachments'>\n" +
+  "       <sequence>\n" +
+  "         <element name='Item' minOccurs='0' maxOccurs='unbounded' type='types:ReferencedBinary'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <element name='EchoAttachmentAsBase64' type='types:EchoAttachment'/>\n" +
+  "     <element name='EchoAttachmentAsBase64Response' type='types:base64Out'/>\n" +
+  "     <element name='EchoBase64AsAttachment' type='types:base64In'/>\n" +
+  "     <element name='EchoBase64AsAttachmentResponse' type='types:EchoAttachmentResponse'/>\n" +
+  "     <complexType name='base64In'>\n" +
+  "       <sequence>\n" +
+  "         <element name='In' type='xsd:base64Binary'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='base64Out'>\n" +
+  "       <sequence>\n" +
+  "         <element name='Out' type='xsd:base64Binary'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <element name='EchoUnrefAttachments' type='types:emptyType'/>\n" +
+  "     <element name='EchoUnrefAttachmentsResponse' type='types:emptyType'/>\n" +
+  "     <complexType name='emptyType'>\n" +
+  "       <sequence/>\n" +
+  "     </complexType>\n" +
+  "     <element name='EchoAttachmentAsString' type='types:EchoAttachmentAsString'/>\n" +
+  "     <element name='EchoAttachmentAsStringResponse' type='types:EchoAttachmentAsStringResponse'/>\n" +
+  "     <complexType name='EchoAttachmentAsString'>\n" +
+  "       <sequence>\n" +
+  "         <element name='In' type='types:ReferencedText'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "     <complexType name='EchoAttachmentAsStringResponse'>\n" +
+  "       <sequence>\n" +
+  "         <element name='Out' type='xsd:string'/>\n" +
+  "       </sequence>\n" +
+  "     </complexType>\n" +
+  "   </schema>\n" +
+  " </wsdl:types>\n" +
+  " <wsdl:message name='EchoAttachmentIn'>\n" +
+  "   <wsdl:part name='In' element='types:EchoAttachment'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentOut'>\n" +
+  "   <wsdl:part name='Out' element='types:EchoAttachmentResponse'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentsIn'>\n" +
+  "   <wsdl:part name='In' element='types:EchoAttachments'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentsOut'>\n" +
+  "   <wsdl:part name='Out' element='types:EchoAttachmentsResponse'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsBase64In'>\n" +
+  "   <wsdl:part name='In' element='types:EchoAttachmentAsBase64'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsBase64Out'>\n" +
+  "   <wsdl:part name='Out' element='types:EchoAttachmentAsBase64Response'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoBase64AsAttachmentIn'>\n" +
+  "   <wsdl:part name='In' element='types:EchoBase64AsAttachment'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoBase64AsAttachmentOut'>\n" +
+  "   <wsdl:part name='Out' element='types:EchoBase64AsAttachmentResponse'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoUnrefAttachmentsIn'>\n" +
+  "   <wsdl:part name='In' element='types:EchoUnrefAttachments'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoUnrefAttachmentsOut'>\n" +
+  "   <wsdl:part name='Out' element='types:EchoUnrefAttachmentsResponse'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsStringIn'>\n" +
+  "   <wsdl:part name='In' element='types:EchoAttachmentAsString'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:message name='EchoAttachmentAsStringOut'>\n" +
+  "   <wsdl:part name='Out' element='types:EchoAttachmentAsStringResponse'/>\n" +
+  " </wsdl:message>\n" +
+  " <wsdl:portType name='AttachmentsPortType'>\n" +
+  "   <wsdl:operation name='EchoAttachment'>\n" +
+  "     <wsdl:input name='EchoAttachmentInput' message='EchoAttachmentIn'/>\n" +
+  "     <wsdl:output name='EchoAttachmentOutput' message='EchoAttachmentOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachments'>\n" +
+  "     <wsdl:input name='EchoAttachmentsInput' message='EchoAttachmentsIn'/>\n" +
+  "     <wsdl:output name='EchoAttachmentsOutput' message='EchoAttachmentsOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsBase64'>\n" +
+  "     <wsdl:input name='EchoAttachmentAsBase64Input' message='EchoAttachmentAsBase64In'/>\n" +
+  "     <wsdl:output name='EchoAttachmentAsBase64Output' message='EchoAttachmentAsBase64Out'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoBase64AsAttachment'>\n" +
+  "     <wsdl:input name='EchoBase64AsAttachmentInput' message='EchoBase64AsAttachmentIn'/>\n" +
+  "     <wsdl:output name='EchoBase64AsAttachmentOutput' message='EchoBase64AsAttachmentOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoUnrefAttachments'>\n" +
+  "     <wsdl:input name='EchoUnrefAttachmentsInput' message='EchoUnrefAttachmentsIn'/>\n" +
+  "     <wsdl:output name='EchoUnrefAttachmentsOutput' message='EchoUnrefAttachmentsOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsString'>\n" +
+  "     <wsdl:input name='EchoAttachmentAsStringInput' message='EchoAttachmentAsStringIn'/>\n" +
+  "     <wsdl:output name='EchoAttachmentAsStringOutput' message='EchoAttachmentAsStringOut'/>\n" +
+  "   </wsdl:operation>\n" +
+  " </wsdl:portType>\n" +
+  " <wsdl:binding name='AttachmentsBinding' type='AttachmentsPortType'>\n" +
+  "   <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "   <wsdl:operation name='EchoAttachment'>\n" +
+  "     <soap:operation soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachments'>\n" +
+  "     <soap:operation soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentsInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentsOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsBase64'>\n" +
+  "     <soap:operation soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentAsBase64Input'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentAsBase64Output'>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoBase64AsAttachment'>\n" +
+  "     <soap:operation soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoBase64AsAttachmentInput'>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoBase64AsAttachmentOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoUnrefAttachments'>\n" +
+  "     <soap:operation soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoUnrefAttachmentsInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoUnrefAttachmentsOutput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  "   <wsdl:operation name='EchoAttachmentAsString'>\n" +
+  "     <soap:operation soapAction='http://soapinterop.org/attachments/'/>\n" +
+  "     <wsdl:input name='EchoAttachmentAsStringInput'>\n" +
+  "       <dime:message layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout' wsdl:required='true'/>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:input>\n" +
+  "     <wsdl:output name='EchoAttachmentAsStringOutput'>\n" +
+  "       <soap:body use='literal'/>\n" +
+  "     </wsdl:output>\n" +
+  "   </wsdl:operation>\n" +
+  " </wsdl:binding>\n" +
+  "    <wsdl:service name='DimeDOCInterop'>\n" +
+  "     <wsdl:port name='DimeDOCSoapPort' binding='AttachmentsBinding'>\n" +
+  "            <soap:address location='http://localhost:8080/axis/services/DimeDOCSoapPort'/>\n" +
+  "        </wsdl:port>\n" +
+  "    </wsdl:service>\n" +
+  "</wsdl:definitions>\n";
+
+  public void testDimeDoc() throws Exception {
+    parseString(dimeDoc, "dime-doc.wsdl");
+  }
+
+  private final static String comprehensiveTypes1 =
+  "<?xml version='1.0' ?>\n" +
+  "\n" +
+  "<definitions \n" +
+  "    name='comprehensive types test'\n" +
+  "    targetNamespace='urn:comprehensive-service.types.wsdl.test'\n" +
+  "    xmlns:tns='urn:comprehensive-service.types.wsdl.test'\n" +
+  "    xmlns:typens='urn:comprehensive-types.types.wsdl.test'\n" +
+  "    xmlns:typens2='urn:comprehensive-types2.types.wsdl.test'\n" +
+  "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n" +
+  "    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'\n" +
+  "    xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'\n" +
+  "    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'\n" +
+  "    xmlns='http://schemas.xmlsoap.org/wsdl/'>\n" +
+  "\n" +
+  "  <!-- type defs -->\n" +
+  "  <types>\n" +
+  "    <xsd:schema \n" +
+  "        targetNamespace='urn:comprehensive-types.types.wsdl.test'\n" +
+  "        xmlns:xsd='http://www.w3.org/1999/XMLSchema'\n" +
+  "        xmlns:xsd2='http://www.w3.org/2001/XMLSchema'>\n" +
+  "\n" +
+  "      <xsd:simpleType name='simple'>\n" +
+  "        <xsd:restriction base='xsd:string' />\n" +
+  "      </xsd:simpleType>\n" +
+  "      \n" +
+  "      <xsd:simpleType name='simpleDate'>\n" +
+  "        <xsd:restriction base='xsd:date' />\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:simpleType name='simpleDateTime'>\n" +
+  "        <xsd:restriction base='xsd2:dateTime' />\n" +
+  "      </xsd:simpleType>\n" +
+  "      \n" +
+  "      <xsd:simpleType name='enum'>\n" +
+  "        <xsd:restriction base='xsd:string'>\n" +
+  "          <xsd:enumeration value='one'/>                      \n" +
+  "          <xsd:enumeration value='two'/>                    \n" +
+  "          <xsd:enumeration value='three'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:complexType name='array'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:restriction base='soapenc:Array'>\n" +
+  "            <xsd:attribute ref='soapenc:arrayType' wsdl:arrayType='xsd:string[]'/>\n" +
+  "          </xsd:restriction>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='array_of_base64'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:restriction base='soapenc:Array'>\n" +
+  "            <xsd:attribute ref='soapenc:arrayType' wsdl:arrayType='xsd:base64Binary[]'/>\n" +
+  "          </xsd:restriction>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='complexAll'>\n" +
+  "        <xsd:all>\n" +
+  "          <xsd:element name='areaCode' type='xsd:int'/>\n" +
+  "          <xsd:element name='exchange' type='xsd:string'/>\n" +
+  "          <xsd:element name='number' type='xsd:string'/>\n" +
+  "        </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='complexSequence'>\n" +
+  "        <xsd:sequence>\n" +
+  "          <xsd:element name='areaCode' type='xsd:int'/>\n" +
+  "          <xsd:element name='exchange' type='xsd:string'/>\n" +
+  "          <xsd:element name='number' type='xsd:string'/>\n" +
+  "        </xsd:sequence>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='complexChoice'>\n" +
+  "        <xsd:choice>\n" +
+  "          <xsd:element name='choiceA' type='xsd:int'/>\n" +
+  "          <xsd:element name='choiceB' type='xsd:string'/>\n" +
+  "          <xsd:element name='choiceC' type='xsd:string'/>\n" +
+  "        </xsd:choice>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <!-- Test proper construction of types with names that match common java.lang classes -->\n" +
+  "      <xsd:complexType name='Object'>\n" +
+  "        <xsd:sequence>\n" +
+  "           <xsd:element name='test' type='xsd:string' />\n" +
+  "        </xsd:sequence>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:complexType name='String'>\n" +
+  "        <xsd:sequence>\n" +
+  "           <xsd:element name='test' type='xsd:string' />\n" +
+  "        </xsd:sequence>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:complexType name='Class'>\n" +
+  "        <xsd:sequence>\n" +
+  "           <xsd:element name='test' type='xsd:string' />\n" +
+  "        </xsd:sequence>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:element name='elemWComplex'>\n" +
+  "        <xsd:complexType>\n" +
+  "          <xsd:all>\n" +
+  "            <xsd:element name='one' type='typens:simple'/> <!-- Ref to a simple type -->\n" +
+  "            <xsd:element name='dateone' type='typens:simpleDate'/>\n" +
+  "            <xsd:element name='datetwo' type='typens:simpleDateTime'/>\n" +
+  "            <xsd:element name='two' type='typens2:fwd'/> <!-- Forward type use to dif namespace -->\n" +
+  "            <xsd:element ref='typens2:three'/>           <!-- Forward ref use to a dif namespace -->\n" +
+  "            <xsd:element ref='typens:enumValue' maxOccurs='unbounded' /> <!-- ref & maxOccurs -->\n" +
+  "            <xsd:element name='enum1' type='typens:enumString'/>\n" +
+  "            <xsd:element name='enum2' type='typens:enumInt'/>\n" +
+  "            <xsd:element name='enum3' type='typens:enumLong'/>\n" +
+  "            <xsd:element name='enum4' type='typens:enumFloat'/>\n" +
+  "            <xsd:element name='enum5' type='typens:enumDouble'/>\n" +
+  "            <xsd:element name='enum6' type='typens:enumShort'/>\n" +
+  "            <xsd:element name='enum7' type='typens:enumByte'/>\n" +
+  "            <xsd:element name='enum8' type='typens:enumInteger'/>\n" +
+  "            <xsd:element name='enum9' type='typens:enumNMTOKEN'/>\n" +
+  "            <xsd:element name='soapint' type='soapenc:int'/>\n" +
+  "            <xsd:element name='nested' type='typens2:b'/>\n" +
+  "            <xsd:element name='D_TSENT' type='xsd:string'/> <!-- test strange name -->\n" +
+  "            <xsd:element name='optArray' minOccurs='0' maxOccurs='1' type='typens:array' />\n" +
+  "            <xsd:element name='byteArray' type='typens:array_of_base64' />\n" +
+  "            <xsd:element name='parm' type='typens:StringParameter' />\n" +
+  "\n" +
+  "            <!-- Test for types that are similarly named to common java lang classes -->\n" +
+  "            <xsd:element name='myObject' type='typens:Object' />\n" +
+  "            <xsd:element name='myString' type='typens:String' />\n" +
+  "            <xsd:element name='myClass' type='typens:Class' />\n" +
+  "\n" +
+  "            <!-- Test anonymous type with an element that has maxOccurs -->\n" +
+  "            <xsd:element name='logEntry' minOccurs='0' maxOccurs='unbounded'>\n" +
+  "              <xsd:complexType>\n" +
+  "                <xsd:sequence>\n" +
+  "                   <xsd:element name='name' type='xsd:string'/>\n" +
+  "                   <xsd:element name='value' type='xsd:string'/>\n" +
+  "                </xsd:sequence>\n" +
+  "              </xsd:complexType>\n" +
+  "            </xsd:element>\n" +
+  "          </xsd:all>\n" +
+  "          <xsd:attribute name='attr' type='typens:enum' />\n" +
+  "          <xsd:attribute name='parmAttr' type='typens:StringParameter' />\n" +
+  "          <xsd:attribute name='enumAttr'>\n" +
+  "            <xsd:simpleType>\n" +
+  "              <xsd:restriction base='xsd:string'>\n" +
+  "                <xsd:enumeration value='one'/>                      \n" +
+  "                <xsd:enumeration value='two'/>                    \n" +
+  "                <xsd:enumeration value='three'/>                    \n" +
+  "              </xsd:restriction>\n" +
+  "            </xsd:simpleType>\n" +
+  "          </xsd:attribute>\n" +
+  "        </xsd:complexType>\n" +
+  "      </xsd:element>\n" +
+  "\n" +
+  "      <xsd:element name='enumValue' type='typens:enum'/>\n" +
+  "\n" +
+  "      <xsd:complexType name='time'>\n" +
+  "        <xsd:simpleContent>\n" +
+  "          <xsd:extension base='xsd:string'>\n" +
+  "            <xsd:attribute name='DST' type='xsd:boolean' />\n" +
+  "          </xsd:extension>\n" +
+  "        </xsd:simpleContent>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='complexWComplex'>\n" +
+  "        <xsd:sequence>\n" +
+  "          <xsd:element name='stock_quote'>\n" +
+  "            <xsd:complexType>\n" +
+  "              <xsd:attribute name='symbol' type='xsd:string'/> \n" +
+  "              <xsd:sequence>\n" +
+  "                <!-- forward simple type ref -->\n" +
+  "                <xsd:element name='time' type='typens:time'/>\n" +
+  "                <xsd:element name='change' type='typens:simpleFwd'/>  \n" +
+  "                <xsd:element name='pctchange' type='xsd:string'/>\n" +
+  "                <xsd:element name='bid' type='xsd:string'/>\n" +
+  "                <xsd:element name='ask' type='xsd:string'/>\n" +
+  "                <xsd:element name='choice' type='typens:complexChoice'/>\n" +
+  "              </xsd:sequence>\n" +
+  "              <xsd:attribute name='last' type='xsd:string'/>\n" +
+  "            </xsd:complexType>\n" +
+  "          </xsd:element>\n" +
+  "          <xsd:element name='outside' type='xsd:int'/>\n" +
+  "        </xsd:sequence>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='emptyFault'>\n" +
+  "        <xsd:sequence />\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:element name='faultElement' type='typens:faultType' />\n" +
+  "      <xsd:complexType name='faultType'>\n" +
+  "        <xsd:sequence>\n" +
+  "           <xsd:element name='userData' type='xsd:string' />\n" +
+  "        </xsd:sequence>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:complexType name='emptyComplexType'>\n" +
+  "        <xsd:sequence />\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <xsd:simpleType name='simpleFwd'>\n" +
+  "        <xsd:restriction base='typens:simple' />\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <!-- The following definitions validate forward refs -->\n" +
+  "      <xsd:complexType name='arrayM'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:restriction base='soapenc:Array'>\n" +
+  "            <xsd:attribute ref='soapenc:arrayType' wsdl:arrayType='typens:arrayM2[]'/>\n" +
+  "          </xsd:restriction>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:complexType name='arrayM2'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:restriction base='soapenc:Array'>\n" +
+  "            <xsd:attribute ref='soapenc:arrayType' wsdl:arrayType='typens:arrayM3[]'/>\n" +
+  "          </xsd:restriction>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:complexType name='arrayM3'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:restriction base='soapenc:Array'>\n" +
+  "            <xsd:attribute ref='soapenc:arrayType' wsdl:arrayType='xsd:int[]'/>\n" +
+  "          </xsd:restriction>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "\n" +
+  "      <!-- The following is a simple test of inheritance with types -->\n" +
+  "      <xsd:complexType name='Animal'>\n" +
+  "        <xsd:all>\n" +
+  "          <xsd:element name='Name' nillable='true' type='xsd:string'/>\n" +
+  "        </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:element name='Animal' nillable='true' type='typens:Animal'/>\n" +
+  "      <xsd:complexType name='Cat'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:extension base='typens:Animal'>\n" +
+  "            <xsd:all>\n" +
+  "              <xsd:element name='Purr' nillable='true' type='xsd:string'/>\n" +
+  "            </xsd:all>\n" +
+  "          </xsd:extension>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "      <xsd:element name='Cat' nillable='true' type='typens:Cat'/>\n" +
+  "\n" +
+  "      <!-- Even though PersionCat is not directly referenced, it should\n" +
+  "      be generated and registered because its base class (Cat) is referenced -->\n" +
+  "      <xsd:complexType name='PersionCat'>\n" +
+  "        <xsd:complexContent>\n" +
+  "          <xsd:extension base='typens:Cat'>\n" +
+  "            <xsd:all>\n" +
+  "              <xsd:element name='Color' type='xsd:string'/>\n" +
+  "              <xsd:element name='Toy' /> <!-- Defaults to xsd:anyType -->\n" +
+  "            </xsd:all>\n" +
+  "          </xsd:extension>\n" +
+  "        </xsd:complexContent>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <!-- Even though Yarn is not directly referenced, it should\n" +
+  "      be generated and registered because the Toy above is an anyType -->\n" +
+  "      <xsd:complexType name='Yarn'>\n" +
+  "         <xsd:all>\n" +
+  "           <xsd:element name='Color' type='xsd:string'/>\n" +
+  "         </xsd:all>\n" +
+  "      </xsd:complexType>\n" +
+  "\n" +
+  "      <!-- The following test all of the valid enum basic types -->\n" +
+  "      <xsd:simpleType name='enumString'>\n" +
+  "        <xsd:restriction base='xsd:string'>\n" +
+  "          <xsd:enumeration value='Ho Ho Ho'/> <!-- Blanks should force value<1..n> names -->        \n" +
+  "          <xsd:enumeration value='He He He'/>                    \n" +
+  "          <xsd:enumeration value='Ha Ha Ha'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "      <xsd:simpleType name='enumInt'>\n" +
+  "        <xsd:restriction base='xsd:int'>\n" +
+  "          <xsd:enumeration value='1'/>\n" +
+  "          <xsd:enumeration value='2'/>                    \n" +
+  "          <xsd:enumeration value='3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "      <xsd:simpleType name='enumLong'>\n" +
+  "        <xsd:restriction base='xsd:long'>\n" +
+  "          <xsd:enumeration value='1'/>\n" +
+  "          <xsd:enumeration value='2'/>                    \n" +
+  "          <xsd:enumeration value='3'/>                    \n" +
+  "          <xsd:enumeration value='-9223372036854775808'/>                    \n" +
+  "          <xsd:enumeration value='9223372036854775807'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "      <xsd:simpleType name='enumShort'>\n" +
+  "        <xsd:restriction base='xsd:short'>\n" +
+  "          <xsd:enumeration value='1'/>\n" +
+  "          <xsd:enumeration value='2'/>                    \n" +
+  "          <xsd:enumeration value='3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "      <xsd:simpleType name='enumFloat'>\n" +
+  "        <xsd:restriction base='xsd:float'>\n" +
+  "          <xsd:enumeration value='1.1'/>\n" +
+  "          <xsd:enumeration value='2.2'/>                    \n" +
+  "          <xsd:enumeration value='3.3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "      <xsd:simpleType name='enumDouble'>\n" +
+  "        <xsd:restriction base='xsd:double'>\n" +
+  "          <xsd:enumeration value='1.1'/>\n" +
+  "          <xsd:enumeration value='2.2'/>                    \n" +
+  "          <xsd:enumeration value='3.3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "      <xsd:simpleType name='enumByte'>\n" +
+  "        <xsd:restriction base='xsd:byte'>\n" +
+  "          <xsd:enumeration value='1'/>\n" +
+  "          <xsd:enumeration value='2'/>                    \n" +
+  "          <xsd:enumeration value='3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:simpleType name='enumInteger'>\n" +
+  "        <xsd:restriction base='xsd:integer'>\n" +
+  "          <xsd:enumeration value='1'/>\n" +
+  "          <xsd:enumeration value='2'/>                    \n" +
+  "          <xsd:enumeration value='3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:simpleType name='flowDirectionType'>\n" +
+  "        <xsd:restriction base='xsd:string'>\n" +
+  "          <xsd:enumeration value='in'/>\n" +
+  "          <xsd:enumeration value='inOut'/>\n" +
+  "          <xsd:enumeration value='out'/>\n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:simpleType name='enumNMTOKEN'>\n" +
+  "        <xsd:restriction base='xsd:NMTOKEN'> <!-- axis provided simple type -->\n" +
+  "          <xsd:enumeration value='NameToken1'/>\n" +
+  "          <xsd:enumeration value='NameToken2'/>                    \n" +
+  "          <xsd:enumeration value='NameToken3'/>                    \n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "      <xsd:simpleType name='AIDType'>\n" +
+  "        <xsd:restriction base='xsd:hexBinary'>\n" +
+  "          <xsd:maxLength value='16'/>\n" +
+  "          <xsd:minLength value='5'/>\n" +
+  "        </xsd:restriction>\n" +
+  "      </xsd:simpleType>\n" +
+  "\n" +
+  "<xsd:simpleType name='passModeType'>\n" +
+  "    <xsd:restriction base='xsd:string'>\n" +
+  "        <xsd:enumeration value='passByValue'/>\n" +
+  "        <xsd:enumeration value='passByReference'/>\n" +
+  "     </xsd:restriction>\n" +
+  "</xsd:simpleType>\n" +
+  "\n" +
+  "\n" +
+  "<xsd:element name='StringParameter' type='typens:StringParameter' />\n" +
+  " <xsd:complexType name='StringParameter'>\n" +
+  "   <xsd:simpleContent>\n" +
+  "      <xsd:extension base='xsd:string'>\n" +
+  "        <xsd:attribute name='numBytes' type='soapenc:int'/>\n" +
+  "        <xsd:attribute name='storageEncoding' type='xsd:string'/>\n" +
+  "        <xsd:attribute name='direction' type='typens:flowDirectionType'/>  <!-- in, out, or inOut -->\n" +
+  "        <xsd:attribute name='passMode' type='typens:passModeType'/>  <!-- passByValue or passByReference -->\n" +
+  "        <xsd:attribute name='description' type='xsd:string'/>\n" +
+  "      </xsd:extension>\n" +
+  "   </xsd:simpleContent>\n" +
+  "</xsd:complexType>\n" +
+  "\n" +
+  "    </xsd:schema>\n" +
+  "\n" +
+  "\n" +
+  "    <xsd:schema \n" +
+  "        targetNamespace='urn:comprehensive-types2.types.wsdl.test'\n" +
+  "        xmlns:xsd='http://www.w3.org/1999/XMLSchema'>\n" +
+  "        <xsd:complexType name='fwd'>\n" +
+  "          <xsd:complexContent>\n" +
+  "            <xsd:restriction base='soapenc:Array'>\n" +
+  "              <xsd:attribute ref='soapenc:arrayType' wsdl:arrayType='xsd:QName[]'/>\n" +
+  "            </xsd:restriction>\n" +
+  "          </xsd:complexContent>\n" +
+  "        </xsd:complexType>\n" +
+  "\n" +
+  "        <!-- Collection of enums -->\n" +
+  "        <xsd:element name='three' type='typens:enum' maxOccurs='unbounded' />\n" +
+  "\n" +
+  "\n" +
+  "        <!-- Test for nested defined complexType -->\n" +
+  "        <xsd:element name='a' type='xsd:short' />\n" +
+  "        <xsd:complexType name='b'>\n" +
+  "          <xsd:sequence>\n" +
+  "            <xsd:complexType name='a'>\n" +
+  "              <xsd:sequence>\n" +
+  "                <xsd:element name='c' type='xsd:int' />\n" +
+  "              </xsd:sequence>\n" +
+  "            </xsd:complexType>\n" +
+  "            <xsd:element name='d' type='typens2:a' />\n" +
+  "          </xsd:sequence>\n" +
+  "        </xsd:complexType>\n" +
+  "\n" +
+  "  <!-- Test for a WS-I-like type that we used to fail on. -->\n" +
+  "        <xsd:complexType name='SimpleAnyURIType'>\n" +
+  "          <xsd:simpleContent>\n" +
+  "            <xsd:extension base='xsd:anyURI'>\n" +
+  "            </xsd:extension>\n" +
+  "          </xsd:simpleContent>\n" +
+  "        </xsd:complexType>\n" +
+  "\n" +
+  "    </xsd:schema>\n" +
+  "\n" +
+  "  </types>\n" +
+  "\n" +
+  "  <!-- message declns -->\n" +
+  "  <message name='empty'/>\n" +
+  "\n" +
+  "  <message name='allPrimitives'>\n" +
+  "    <part name='string' type='xsd:string'/>\n" +
+  "    <part name='integer' type='xsd:integer'/>\n" +
+  "    <part name='int' type='xsd:int'/>\n" +
+  "    <part name='long' type='xsd:long'/>\n" +
+  "    <part name='short' type='xsd:short'/>\n" +
+  "    <part name='decimal' type='xsd:decimal'/>\n" +
+  "    <part name='float' type='xsd:float'/>\n" +
+  "    <part name='double' type='xsd:double'/>\n" +
+  "    <part name='boolean' type='xsd:boolean'/>\n" +
+  "    <part name='byte' type='xsd:byte'/>\n" +
+  "    <part name='QName' type='xsd:QName'/>\n" +
+  "    <part name='dateTime' type='xsd:dateTime'/>\n" +
+  "    <part name='base64Binary' type='xsd:base64Binary'/>\n" +
+  "    <part name='hexBinary' type='xsd:hexBinary'/>\n" +
+  "    <part name='soapString' type='soapenc:string'/>\n" +
+  "    <part name='soapBoolean' type='soapenc:boolean'/>\n" +
+  "    <part name='soapFloat' type='soapenc:float'/>\n" +
+  "    <part name='soapDouble' type='soapenc:double'/>\n" +
+  "    <part name='soapDecimal' type='soapenc:decimal'/>\n" +
+  "    <part name='soapInt' type='soapenc:int'/>\n" +
+  "    <part name='soapShort' type='soapenc:short'/>\n" +
+  "    <part name='soapBase64' type='soapenc:base64'/>\n" +
+  "    <part name='time' type='xsd:time'/>\n" +
+  "    <part name='unsignedLong' type='xsd:unsignedLong'/>\n" +
+  "    <part name='unsignedInt' type='xsd:unsignedInt'/>\n" +
+  "    <part name='unsignedShort' type='xsd:unsignedShort'/>\n" +
+  "    <part name='unsignedByte' type='xsd:unsignedByte'/>\n" +
+  "    <part name='nonNegativeInteger' type='xsd:nonNegativeInteger'/>\n" +
+  "    <part name='positiveInteger' type='xsd:positiveInteger'/>\n" +
+  "    <part name='nonPositiveInteger' type='xsd:nonPositiveInteger'/>\n" +
+  "    <part name='negativeInteger' type='xsd:negativeInteger'/>\n" +
+  "    <part name='anyURI' type='xsd:anyURI'/>\n" +
+  "    <part name='gYear' type='xsd:gYear'/>\n" +
+  "    <part name='gMonth' type='xsd:gMonth'/>\n" +
+  "    <part name='gDay' type='xsd:gDay'/>\n" +
+  "    <part name='gYearMonth' type='xsd:gYearMonth'/>\n" +
+  "    <part name='gMonthDay' type='xsd:gMonthDay'/>\n" +
+  "  </message>\n" +
+  "  <message name='inputBoolean'>\n" +
+  "    <part name='inBoolean' type='xsd:boolean'/>\n" +
+  "    <part name='boolean' type='xsd:boolean'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputBoolean'>\n" +
+  "    <part name='outBoolean' type='xsd:boolean'/>\n" +
+  "    <part name='boolean' type='xsd:boolean'/>\n" +
+  "  </message> \n" +
+  "\n" +
+  "  <message name='inputByte'>\n" +
+  "    <part name='inByte' type='xsd:byte'/>\n" +
+  "    <part name='byte' type='xsd:byte'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputByte'>\n" +
+  "    <part name='outByte' type='xsd:byte'/>\n" +
+  "    <part name='byte' type='xsd:byte'/>\n" +
+  "  </message> \n" +
+  "\n" +
+  "  <message name='inputShort'>\n" +
+  "    <part name='inShort' type='xsd:short'/>\n" +
+  "    <part name='short' type='xsd:short'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputShort'>\n" +
+  "    <part name='outShort' type='xsd:short'/>\n" +
+  "    <part name='short' type='xsd:short'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputInt'>\n" +
+  "    <part name='inInt' type='xsd:int'/>\n" +
+  "    <part name='int' type='xsd:int'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputInt'>\n" +
+  "    <part name='outInt' type='xsd:int'/>\n" +
+  "    <part name='int' type='xsd:int'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputLong'>\n" +
+  "    <part name='inLong' type='xsd:long'/>\n" +
+  "    <part name='long' type='xsd:long'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputLong'>\n" +
+  "    <part name='outLong' type='xsd:long'/>\n" +
+  "    <part name='long' type='xsd:long'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputFloat'>\n" +
+  "    <part name='inFloat' type='xsd:float'/>\n" +
+  "    <part name='float' type='xsd:float'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputFloat'>\n" +
+  "    <part name='outFloat' type='xsd:float'/>\n" +
+  "    <part name='float' type='xsd:float'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputDouble'>\n" +
+  "    <part name='inDouble' type='xsd:double'/>\n" +
+  "    <part name='double' type='xsd:double'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputDouble'>\n" +
+  "    <part name='outDouble' type='xsd:double'/>\n" +
+  "    <part name='double' type='xsd:double'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputString'>\n" +
+  "    <part name='inString' type='xsd:string'/>\n" +
+  "    <part name='string' type='xsd:string'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputString'>\n" +
+  "    <part name='outString' type='xsd:string'/>\n" +
+  "    <part name='string' type='xsd:string'/>\n" +
+  "  </message> \n" +
+  "\n" +
+  "  <message name='inputInteger'>\n" +
+  "    <part name='inInteger' type='xsd:integer'/>\n" +
+  "    <part name='integer' type='xsd:integer'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputInteger'>\n" +
+  "    <part name='outInteger' type='xsd:integer'/>\n" +
+  "    <part name='integer' type='xsd:integer'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputDecimal'>\n" +
+  "    <part name='inDecimal' type='xsd:decimal'/>\n" +
+  "    <part name='decimal' type='xsd:decimal'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputDecimal'>\n" +
+  "    <part name='outDecimal' type='xsd:decimal'/>\n" +
+  "    <part name='decimal' type='xsd:decimal'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputDateTime'>\n" +
+  "    <part name='inDateTime' type='xsd:dateTime'/>\n" +
+  "    <part name='dateTime' type='xsd:dateTime'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputDateTime'>\n" +
+  "    <part name='outDateTime' type='xsd:dateTime'/>\n" +
+  "    <part name='dateTime' type='xsd:dateTime'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputBase64Binary'>\n" +
+  "    <part name='inBase64Binary' type='xsd:base64Binary'/>\n" +
+  "    <part name='base64Binary' type='xsd:base64Binary'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputBase64Binary'>\n" +
+  "    <part name='outBase64Binary' type='xsd:base64Binary'/>\n" +
+  "    <part name='base64Binary' type='xsd:base64Binary'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputQName'>\n" +
+  "    <part name='inQName' type='xsd:QName'/>\n" +
+  "    <part name='qName' type='xsd:QName'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputQName'>\n" +
+  "    <part name='outQName' type='xsd:QName'/>\n" +
+  "    <part name='qName' type='xsd:QName'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputHexBinary'>\n" +
+  "    <part name='inHexBinary' type='xsd:hexBinary'/>\n" +
+  "    <part name='hexBinary' type='xsd:hexBinary'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputHexBinary'>\n" +
+  "    <part name='outHexBinary' type='xsd:hexBinary'/>\n" +
+  "    <part name='hexBinary' type='xsd:hexBinary'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputTime'>\n" +
+  "    <part name='inTime' type='xsd:time'/>\n" +
+  "    <part name='time' type='xsd:time'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputTime'>\n" +
+  "    <part name='outTime' type='xsd:time'/>\n" +
+  "    <part name='time' type='xsd:time'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputUnsignedLong'>\n" +
+  "    <part name='inUnsignedLong' type='xsd:unsignedLong'/>\n" +
+  "    <part name='unsignedLong' type='xsd:unsignedLong'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputUnsignedLong'>\n" +
+  "    <part name='outUnsignedLong' type='xsd:unsignedLong'/>\n" +
+  "    <part name='unsignedLong' type='xsd:unsignedLong'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputUnsignedInt'>\n" +
+  "    <part name='inUnsignedInt' type='xsd:unsignedInt'/>\n" +
+  "    <part name='unsignedInt' type='xsd:unsignedInt'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputUnsignedInt'>\n" +
+  "    <part name='outUnsignedInt' type='xsd:unsignedInt'/>\n" +
+  "    <part name='unsignedInt' type='xsd:unsignedInt'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputUnsignedShort'>\n" +
+  "    <part name='inUnsignedShort' type='xsd:unsignedShort'/>\n" +
+  "    <part name='unsignedShort' type='xsd:unsignedShort'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputUnsignedShort'>\n" +
+  "    <part name='outUnsignedShort' type='xsd:unsignedShort'/>\n" +
+  "    <part name='unsignedShort' type='xsd:unsignedShort'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputUnsignedByte'>\n" +
+  "    <part name='inUnsignedByte' type='xsd:unsignedByte'/>\n" +
+  "    <part name='unsignedByte' type='xsd:unsignedByte'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputUnsignedByte'>\n" +
+  "    <part name='outUnsignedByte' type='xsd:unsignedByte'/>\n" +
+  "    <part name='unsignedByte' type='xsd:unsignedByte'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputNonNegativeInteger'>\n" +
+  "    <part name='inNonNegativeInteger' type='xsd:nonNegativeInteger'/>\n" +
+  "    <part name='NonNegativeInteger' type='xsd:nonNegativeInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputNonNegativeInteger'>\n" +
+  "    <part name='outNonNegativeInteger' type='xsd:nonNegativeInteger'/>\n" +
+  "    <part name='NonNegativeInteger' type='xsd:nonNegativeInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputPositiveInteger'>\n" +
+  "    <part name='inPositiveInteger' type='xsd:positiveInteger'/>\n" +
+  "    <part name='PositiveInteger' type='xsd:positiveInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputPositiveInteger'>\n" +
+  "    <part name='outPositiveInteger' type='xsd:positiveInteger'/>\n" +
+  "    <part name='PositiveInteger' type='xsd:positiveInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputNonPositiveInteger'>\n" +
+  "    <part name='inNonPositiveInteger' type='xsd:nonPositiveInteger'/>\n" +
+  "    <part name='NonPositiveInteger' type='xsd:nonPositiveInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputNonPositiveInteger'>\n" +
+  "    <part name='outNonPositiveInteger' type='xsd:nonPositiveInteger'/>\n" +
+  "    <part name='NonPositiveInteger' type='xsd:nonPositiveInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputNegativeInteger'>\n" +
+  "    <part name='inNegativeInteger' type='xsd:negativeInteger'/>\n" +
+  "    <part name='NegativeInteger' type='xsd:negativeInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputNegativeInteger'>\n" +
+  "    <part name='outNegativeInteger' type='xsd:negativeInteger'/>\n" +
+  "    <part name='NegativeInteger' type='xsd:negativeInteger'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputAnyURI'>\n" +
+  "    <part name='inAnyURI' type='xsd:anyURI'/>\n" +
+  "    <part name='anyURI' type='xsd:anyURI'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputAnyURI'>\n" +
+  "    <part name='outAnyURI' type='xsd:anyURI'/>\n" +
+  "    <part name='anyURI' type='xsd:anyURI'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSimpleAnyURI'>\n" +
+  "    <part name='inAnyURI' type='typens2:SimpleAnyURIType'/>\n" +
+  "    <part name='anyURI' type='typens2:SimpleAnyURIType'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSimpleAnyURI'>\n" +
+  "    <part name='outAnyURI' type='typens2:SimpleAnyURIType'/>\n" +
+  "    <part name='anyURI' type='typens2:SimpleAnyURIType'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputYear'>\n" +
+  "    <part name='inYear' type='xsd:gYear'/>\n" +
+  "    <part name='Year' type='xsd:gYear'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputYear'>\n" +
+  "    <part name='outYear' type='xsd:gYear'/>\n" +
+  "    <part name='Year' type='xsd:gYear'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputMonth'>\n" +
+  "    <part name='inMonth' type='xsd:gMonth'/>\n" +
+  "    <part name='Month' type='xsd:gMonth'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputMonth'>\n" +
+  "    <part name='outMonth' type='xsd:gMonth'/>\n" +
+  "    <part name='Month' type='xsd:gMonth'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputDay'>\n" +
+  "    <part name='inDay' type='xsd:gDay'/>\n" +
+  "    <part name='Day' type='xsd:gDay'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputDay'>\n" +
+  "    <part name='outDay' type='xsd:gDay'/>\n" +
+  "    <part name='Day' type='xsd:gDay'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputYearMonth'>\n" +
+  "    <part name='inYearMonth' type='xsd:gYearMonth'/>\n" +
+  "    <part name='YearMonth' type='xsd:gYearMonth'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputYearMonth'>\n" +
+  "    <part name='outYearMonth' type='xsd:gYearMonth'/>\n" +
+  "    <part name='YearMonth' type='xsd:gYearMonth'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputMonthDay'>\n" +
+  "    <part name='inMonthDay' type='xsd:gMonthDay'/>\n" +
+  "    <part name='MonthDay' type='xsd:gMonthDay'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputMonthDay'>\n" +
+  "    <part name='outMonthDay' type='xsd:gMonthDay'/>\n" +
+  "    <part name='MonthDay' type='xsd:gMonthDay'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapString'>\n" +
+  "    <part name='inSoapString' type='soapenc:string'/>\n" +
+  "    <part name='soapencString' type='soapenc:string'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapString'>\n" +
+  "    <part name='outSoapString' type='soapenc:string'/>\n" +
+  "    <part name='soapencString' type='soapenc:string'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapBoolean'>\n" +
+  "    <part name='inSoapBoolean' type='soapenc:boolean'/>\n" +
+  "    <part name='soapencBoolean' type='soapenc:boolean'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapBoolean'>\n" +
+  "    <part name='outSoapBoolean' type='soapenc:boolean'/>\n" +
+  "    <part name='soapencBoolean' type='soapenc:boolean'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapFloat'>\n" +
+  "    <part name='inSoapFloat' type='soapenc:float'/>\n" +
+  "    <part name='soapencFloat' type='soapenc:float'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapFloat'>\n" +
+  "    <part name='outSoapFloat' type='soapenc:float'/>\n" +
+  "    <part name='soapencFloat' type='soapenc:float'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapDouble'>\n" +
+  "    <part name='inSoapDouble' type='soapenc:double'/>\n" +
+  "    <part name='soapencDouble' type='soapenc:double'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapDouble'>\n" +
+  "    <part name='outSoapDouble' type='soapenc:double'/>\n" +
+  "    <part name='soapencDouble' type='soapenc:double'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapDecimal'>\n" +
+  "    <part name='inSoapDecimal' type='soapenc:decimal'/>\n" +
+  "    <part name='soapencDecimal' type='soapenc:decimal'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapDecimal'>\n" +
+  "    <part name='outSoapDecimal' type='soapenc:decimal'/>\n" +
+  "    <part name='soapencDecimal' type='soapenc:decimal'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapInt'>\n" +
+  "    <part name='inSoapInt' type='soapenc:int'/>\n" +
+  "    <part name='soapencInt' type='soapenc:int'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapInt'>\n" +
+  "    <part name='outSoapInt' type='soapenc:int'/>\n" +
+  "    <part name='soapencInt' type='soapenc:int'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapShort'>\n" +
+  "    <part name='inSoapShort' type='soapenc:short'/>\n" +
+  "    <part name='soapencShort' type='soapenc:short'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapShort'>\n" +
+  "    <part name='outSoapShort' type='soapenc:short'/>\n" +
+  "    <part name='soapencShort' type='soapenc:short'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='inputSoapBase64'>\n" +
+  "    <part name='inSoapBase64' type='soapenc:base64'/>\n" +
+  "    <part name='soapencBase64' type='soapenc:base64'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='outputSoapBase64'>\n" +
+  "    <part name='outSoapBase64' type='soapenc:base64'/>\n" +
+  "    <part name='soapencBase64' type='soapenc:base64'/>\n" +
+  "  </message>\n" +
+  "                     \n" +
+  "  <message name='enum'>\n" +
+  "    <part name='enum' type='typens:enum'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='enumInt'>\n" +
+  "    <part name='enumInt' type='typens:enumInt'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='array'>\n" +
+  "    <part name='array' type='typens:array'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='arrayM'>\n" +
+  "    <part name='arrayM' type='typens:arrayM'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='complexAll'>\n" +
+  "    <part name='complexAll' type='typens:complexAll'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='complexSequence'>\n" +
+  "    <part name='complexSequence' type='typens:complexSequence'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='elemWComplex'>\n" +
+  "    <part name='elemWComplex' element='typens:elemWComplex'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='complexWComplex'>\n" +
+  "    <part name='complexWComplex' type='typens:complexWComplex'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='any'>\n" +
+  "    <part name='any' type='xsd:anyType'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='animal'>\n" +
+  "    <part name='animal' type='typens:Animal'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='cat'>\n" +
+  "    <part name='cat' type='typens:Cat'/>\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='emptyFault'>\n" +
+  "    <part name='theFault' type='typens:emptyFault' />\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='faultWithElement'>\n" +
+  "    <part name='fault2' element='typens:faultElement' />\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <message name='emptyComplexType'>\n" +
+  "    <part name='emptyComplexType' type='typens:emptyComplexType' />\n" +
+  "  </message>\n" +
+  "\n" +
+  "  <!-- port type declns -->\n" +
+  "  <portType name='TypeTest'>\n" +
+  "    <operation name='allPrimitivesIn'>\n" +
+  "      <input message='tns:allPrimitives'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='allPrimitivesInout'>\n" +
+  "      <input message='tns:allPrimitives'/>\n" +
+  "      <output message='tns:allPrimitives'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='allPrimitivesOut'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:allPrimitives'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIn'>\n" +
+  "      <input message='tns:enum'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumInout'>\n" +
+  "      <input message='tns:enum'/>\n" +
+  "      <output message='tns:enum'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumOut' parameterOrder='enum'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:enum'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:enum'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntIn'>\n" +
+  "      <input message='tns:enumInt'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntInout'>\n" +
+  "      <input message='tns:enumInt'/>\n" +
+  "      <output message='tns:enumInt'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntOut' parameterOrder='enumInt'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:enumInt'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:enumInt'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayIn'>\n" +
+  "      <input message='tns:array'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayInout'>\n" +
+  "      <input message='tns:array'/>\n" +
+  "      <output message='tns:array'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayOut' parameterOrder='array'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:array'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:array'/>\n" +
+  "    </operation>\n" +
+  "\n" +
+  "    <operation name='arrayMIn'>\n" +
+  "      <input message='tns:arrayM'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayMInout'>\n" +
+  "      <input message='tns:arrayM'/>\n" +
+  "      <output message='tns:arrayM'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayMOut' parameterOrder='arrayM'>\n" +
+  "      <!-- BUG: type emptyM not defined ! Replacing by type empty\n" +
+  "       for the time being.\n" +
+  "      -->\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:arrayM'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayMReturn'>\n" +
+  "      <!-- BUG: type emptyM not defined ! Replacing by type empty\n" +
+  "       for the time being.\n" +
+  "      -->\n" +
+  "      <input message='tns:empty'/>      \n" +
+  "      <output message='tns:arrayM'/>\n" +
+  "    </operation>\n" +
+  "\n" +
+  "    <operation name='complexAllIn'>\n" +
+  "      <input message='tns:complexAll'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexAllInout'>\n" +
+  "      <input message='tns:complexAll'/>\n" +
+  "      <output message='tns:complexAll'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexAllOut' parameterOrder='complexAll'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:complexAll'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexAllReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:complexAll'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceIn'>\n" +
+  "      <input message='tns:complexSequence'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceInout'>\n" +
+  "      <input message='tns:complexSequence'/>\n" +
+  "      <output message='tns:complexSequence'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceOut' parameterOrder='complexSequence'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:complexSequence'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:complexSequence'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexIn'>\n" +
+  "      <input message='tns:elemWComplex'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexInout'>\n" +
+  "      <input message='tns:elemWComplex'/>\n" +
+  "      <output message='tns:elemWComplex'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexOut' parameterOrder='elemWComplex'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:elemWComplex'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:elemWComplex'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexIn'>\n" +
+  "      <input message='tns:complexWComplex'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexInout'>\n" +
+  "      <input message='tns:complexWComplex'/>\n" +
+  "      <output message='tns:complexWComplex'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexOut' parameterOrder='complexWComplex'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:complexWComplex'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:complexWComplex'/>\n" +
+  "    </operation>\n";
+
+  private static final String comprehensiveTypes2 =
+  "    <operation name='emptyComplexTypeIn' parameterOrder='emptyComplexType'>\n" +
+  "      <input message='tns:emptyComplexType'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "      <fault name='emptyFault' message='tns:emptyFault'/>\n" +
+  "        <!-- Can't have faults with <part element=''> in an RPC service...\n" +
+  "             Don't know what the intent was here, but since no one is actually\n" +
+  "             throwing this fault, commenting it out because it's now triggering\n" +
+  "             our more-draconian error checking.\n" +
+  "             \n" +
+  "      <fault name='faultWithElement' message='tns:faultWithElement'/>\n" +
+  "      -->\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeInout' parameterOrder='emptyComplexType'>\n" +
+  "      <input message='tns:emptyComplexType'/>\n" +
+  "      <output message='tns:emptyComplexType'/>\n" +
+  "      <fault name='emptyFault' message='tns:emptyFault'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeOut' parameterOrder='emptyComplexType'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:emptyComplexType'/>\n" +
+  "      <fault name='emptyFault' message='tns:emptyFault'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:emptyComplexType'/>\n" +
+  "      <fault name='emptyFault' message='tns:emptyFault'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyIn'>\n" +
+  "      <input message='tns:any'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyInout'>\n" +
+  "      <input message='tns:any'/>\n" +
+  "      <output message='tns:any'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyOut' parameterOrder='any'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:any'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:any'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalIn'>\n" +
+  "      <input message='tns:animal'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalInout'>\n" +
+  "      <input message='tns:animal'/>\n" +
+  "      <output message='tns:animal'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalOut' parameterOrder='animal'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:animal'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:animal'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='catIn'>\n" +
+  "      <input message='tns:cat'/>\n" +
+  "      <output message='tns:empty'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='catInout'>\n" +
+  "      <input message='tns:cat'/>\n" +
+  "      <output message='tns:cat'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='catOut' parameterOrder='cat'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:cat'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='catReturn'>\n" +
+  "      <input message='tns:empty'/>\n" +
+  "      <output message='tns:cat'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodBoolean'>\n" +
+  "      <input message='tns:inputBoolean'/>\n" +
+  "      <output message='tns:outputBoolean'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodByte'>\n" +
+  "      <input message='tns:inputByte'/>\n" +
+  "      <output message='tns:outputByte'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodShort'>\n" +
+  "      <input message='tns:inputShort'/>\n" +
+  "      <output message='tns:outputShort'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodInt'>\n" +
+  "      <input message='tns:inputInt'/>\n" +
+  "      <output message='tns:outputInt'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodLong'>\n" +
+  "      <input message='tns:inputLong'/>\n" +
+  "      <output message='tns:outputLong'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodFloat'>\n" +
+  "      <input message='tns:inputFloat'/>\n" +
+  "      <output message='tns:outputFloat'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodDouble'>\n" +
+  "      <input message='tns:inputDouble'/>\n" +
+  "      <output message='tns:outputDouble'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodString'>\n" +
+  "      <input message='tns:inputString'/>\n" +
+  "      <output message='tns:outputString'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodInteger'>\n" +
+  "      <input message='tns:inputInteger'/>\n" +
+  "      <output message='tns:outputInteger'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodDecimal'>\n" +
+  "      <input message='tns:inputDecimal'/>\n" +
+  "      <output message='tns:outputDecimal'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodDateTime'>\n" +
+  "      <input message='tns:inputDateTime'/>\n" +
+  "      <output message='tns:outputDateTime'/>\n" +
+  "    </operation>    \n" +
+  "    <!-- Comment out for now because causes compile errors\n" +
+  "    <operation name='methodBase64Binary'>\n" +
+  "      <input message='tns:inputBase64Binary'/>\n" +
+  "      <output message='tns:outputBase64Binary'/>\n" +
+  "    </operation>\n" +
+  "    -->\n" +
+  "    <operation name='methodQName'>\n" +
+  "      <input message='tns:inputQName'/>\n" +
+  "      <output message='tns:outputQName'/>\n" +
+  "    </operation>    \n" +
+  "    <!-- Comment out for now because causes compile errors\n" +
+  "    <operation name='methodHexBinary'>\n" +
+  "      <input message='tns:inputHexBinary'/>\n" +
+  "      <output message='tns:outputHexBinary'/>\n" +
+  "    </operation>\n" +
+  "    -->\n" +
+  "    <operation name='methodTime'>\n" +
+  "      <input message='tns:inputTime'/>\n" +
+  "      <output message='tns:outputTime'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedLong'>\n" +
+  "      <input message='tns:inputUnsignedLong'/>\n" +
+  "      <output message='tns:outputUnsignedLong'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedInt'>\n" +
+  "      <input message='tns:inputUnsignedInt'/>\n" +
+  "      <output message='tns:outputUnsignedInt'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedShort'>\n" +
+  "      <input message='tns:inputUnsignedShort'/>\n" +
+  "      <output message='tns:outputUnsignedShort'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedByte'>\n" +
+  "      <input message='tns:inputUnsignedByte'/>\n" +
+  "      <output message='tns:outputUnsignedByte'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodNonNegativeInteger'>\n" +
+  "      <input message='tns:inputNonNegativeInteger'/>\n" +
+  "      <output message='tns:outputNonNegativeInteger'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodPositiveInteger'>\n" +
+  "      <input message='tns:inputPositiveInteger'/>\n" +
+  "      <output message='tns:outputPositiveInteger'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodNonPositiveInteger'>\n" +
+  "      <input message='tns:inputNonPositiveInteger'/>\n" +
+  "      <output message='tns:outputNonPositiveInteger'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodNegativeInteger'>\n" +
+  "      <input message='tns:inputNegativeInteger'/>\n" +
+  "      <output message='tns:outputNegativeInteger'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodAnyURI'>\n" +
+  "      <input message='tns:inputAnyURI'/>\n" +
+  "      <output message='tns:outputAnyURI'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSimpleAnyURI'>\n" +
+  "      <input message='tns:inputSimpleAnyURI'/>\n" +
+  "      <output message='tns:outputSimpleAnyURI'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodYear'>\n" +
+  "      <input message='tns:inputYear'/>\n" +
+  "      <output message='tns:outputYear'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodMonth'>\n" +
+  "      <input message='tns:inputMonth'/>\n" +
+  "      <output message='tns:outputMonth'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodDay'>\n" +
+  "      <input message='tns:inputDay'/>\n" +
+  "      <output message='tns:outputDay'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodYearMonth'>\n" +
+  "      <input message='tns:inputYearMonth'/>\n" +
+  "      <output message='tns:outputYearMonth'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodMonthDay'>\n" +
+  "      <input message='tns:inputMonthDay'/>\n" +
+  "      <output message='tns:outputMonthDay'/>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodSoapString'>\n" +
+  "      <input message='tns:inputSoapString'/>\n" +
+  "      <output message='tns:outputSoapString'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapBoolean'>\n" +
+  "      <input message='tns:inputSoapBoolean'/>\n" +
+  "      <output message='tns:outputSoapBoolean'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapFloat'>\n" +
+  "      <input message='tns:inputSoapFloat'/>\n" +
+  "      <output message='tns:outputSoapFloat'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapDouble'>\n" +
+  "      <input message='tns:inputSoapDouble'/>\n" +
+  "      <output message='tns:outputSoapDouble'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapDecimal'>\n" +
+  "      <input message='tns:inputSoapDecimal'/>\n" +
+  "      <output message='tns:outputSoapDecimal'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapInt'>\n" +
+  "      <input message='tns:inputSoapInt'/>\n" +
+  "      <output message='tns:outputSoapInt'/>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapShort'>\n" +
+  "      <input message='tns:inputSoapShort'/>\n" +
+  "      <output message='tns:outputSoapShort'/>\n" +
+  "    </operation>    \n" +
+  "    <!-- Comment out for now because causes compile errors \n" +
+  "    <operation name='methodSoapBase64'>\n" +
+  "      <input message='tns:inputSoapBase64'/>\n" +
+  "      <output message='tns:outputSoapBase64'/>\n" +
+  "    </operation>\n" +
+  "    -->\n" +
+  "  </portType>\n" +
+  "\n" +
+  "  <!-- binding declns -->\n" +
+  "  <binding name='TypeTestBinding' type='tns:TypeTest'>\n" +
+  "    <soap:binding\n" +
+  "        style='rpc'\n" +
+  "        transport='http://schemas.xmlsoap.org/soap/http'/>\n" +
+  "    <operation name='allPrimitivesIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='allPrimitivesInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='allPrimitivesOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='enumIntReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "\n" +
+  "    <operation name='arrayMIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayMInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayMOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='arrayMReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "\n" +
+  "    <operation name='complexAllIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexAllInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexAllOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexAllReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexSequenceReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='elemWComplexReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='complexWComplexReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "      <fault name='emptyFault'>\n" +
+  "          <soap:fault name='emptyFault' use='encoded'/>\n" +
+  "      </fault>\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "      <fault name='emptyFault'>\n" +
+  "        <soap:fault name='emptyFault' use='encoded'/>\n" +
+  "      </fault>\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "      <fault name='emptyFault'>\n" +
+  "        <soap:fault name='emptyFault' use='encoded'/>\n" +
+  "      </fault>\n" +
+  "    </operation>\n" +
+  "    <operation name='emptyComplexTypeReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "      <fault name='emptyFault'>\n" +
+  "        <soap:fault name='emptyFault' use='encoded'/>\n" +
+  "      </fault>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='anyReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='animalReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='catIn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='catInout'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='catOut'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='catReturn'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodBoolean'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodByte'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodShort'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodInt'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodLong'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodFloat'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodDouble'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodString'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodInteger'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodDecimal'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodDateTime'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <!-- Comment out for now because causes compile errors\n" +
+  "    <operation name='methodBase64Binary'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    -->\n" +
+  "    <operation name='methodQName'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <!-- Comment out for now because causes compile errors\n" +
+  "    <operation name='methodHexBinary'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    -->\n" +
+  "    <operation name='methodTime'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedLong'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedInt'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedShort'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodUnsignedByte'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodNonNegativeInteger'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodPositiveInteger'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodNonPositiveInteger'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodNegativeInteger'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    \n" +
+  "    <operation name='methodAnyURI'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodSimpleAnyURI'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodYear'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodMonth'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodDay'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodYearMonth'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodMonthDay'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>    \n" +
+  "    <operation name='methodSoapString'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapBoolean'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapFloat'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapDouble'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapDecimal'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapInt'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    <operation name='methodSoapShort'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>  \n" +
+  "    <!-- Comment out for now because causes compile errors\n" +
+  "    <operation name='methodSoapBase64'>\n" +
+  "      <soap:operation soapAction=''/>\n" +
+  "      <input>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </input>\n" +
+  "      <output>\n" +
+  "        <soap:body\n" +
+  "            use='encoded'\n" +
+  "            namespace=''\n" +
+  "            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>\n" +
+  "      </output>\n" +
+  "    </operation>\n" +
+  "    -->\n" +
+  "  </binding>\n" +
+  "\n" +
+  "  <!-- service decln -->\n" +
+  "  <service name='TypeTestService'>\n" +
+  "    <port name='TypeTest' binding='tns:TypeTestBinding'>\n" +
+  "      <soap:address location='http://localhost:8080/axis/services/TypeTest'/>\n" +
+  "    </port>\n" +
+  "  </service>\n" +
+  "\n" +
+  "</definitions>\n";
+
+  public void testComprehensiveTypes() throws Exception {
+      StringBuffer comprehensiveTypesText = new StringBuffer(comprehensiveTypes1);
+      comprehensiveTypesText.append(comprehensiveTypes2);
+      parseString(comprehensiveTypesText.toString(), "ComprehensiveTypes.wsdl");
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains <a href='http://ws.apache.org/jaxme/xs/'>JaxMeXS</a>: the <code>JaxMe</code>
+parser for XML Schema.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/AttributeSetter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/AttributeSetter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/AttributeSetter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>The attribute setter is used by the {@link org.apache.ws.jaxme.xs.parser.XsSAXParser}
+ * to pass an attributes value to the bean. The main purpose of this
+ * interface is the ability to choose a custom attribtue setter.</p>
+ * <p>The default attribute setter is
+ * {@link org.apache.ws.jaxme.xs.parser.impl.AttributeSetterImpl}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface AttributeSetter {
+  /** <p>Sets the attribute with the given namespace URI and local
+   * name to the given value.</p>
+   */
+  public void setAttribute(String pQName,
+                            String pNamespaceURI, String pLocalName, String pValue)
+    throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/ChildSetter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/ChildSetter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/ChildSetter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/** <p>Implementations of this interface are responsible for the handling
+ * of child elements.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface ChildSetter {
+  /** <p>Returns a ContentHandler, which is able to handle the given child
+   * element.</p>
+   *
+   * @param pNamespaceURI The child elements namespace URI
+   * @param pLocalName The child elements local name
+   * @param pQName The child elements fully qualified name
+   * @see org.apache.ws.jaxme.xs.XSParser#getContext()
+   */
+  public ContentHandler getChildHandler(String pQName, String pNamespaceURI,
+                                         String pLocalName) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/DOMBuilder.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/DOMBuilder.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/DOMBuilder.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Converts a stream of SAX events into a DOM node.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: DOMBuilder.java 231785 2004-02-16 23:39:59Z jochen $
+ */
+public class DOMBuilder implements ContentHandler {
+  private Node currentNode;
+  private Element result;
+  private Locator locator;
+  private Document factory;
+
+  /** <p>Creates a new instance of DOMBuilder, which creates
+   * a new document. The document is available via
+   * {@link #getDocument()}.</p>
+   */
+  public DOMBuilder() throws ParserConfigurationException {
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    dbf.setValidating(false);
+    dbf.setNamespaceAware(true);
+    DocumentBuilder db = dbf.newDocumentBuilder();
+    currentNode = factory = db.newDocument();
+  }
+
+  /** <p>Creates a new instance of DOMBuilder, which creates
+   * a new element node in the given node. The created node
+   * is available via {@link #getResult()}.</p>
+   */
+  public DOMBuilder(Node pTarget) {
+    if (pTarget == null) {
+      throw new NullPointerException("Target node must not be null.");
+    }
+    factory = pTarget.getOwnerDocument();
+    currentNode = pTarget;
+  }
+
+  /** <p>Returns the document being used as object factory. In the case
+   * of the empty constructor, this is a new document. Otherwise it is
+   * the target nodes owner document.</p>
+   */
+  public Document getDocument() {
+    return factory;
+  }
+
+  /** <p>Returns the result element. In the case of the default constructor,
+   * this is the document element. Otherwise it is added to the target node
+   * via {@link org.w3c.dom.Node#appendChild(org.w3c.dom.Node)}.<(p>
+   */
+  public Element getResult() {
+    return result;
+  }
+
+  /** <p>Sets the Locator.</p>
+   */
+  public void setDocumentLocator(Locator pLocator) {
+    locator = pLocator;
+  }
+
+  /** <p>Returns the Locator.</p>
+   */
+  public Locator getDocumentLocator() {
+    return locator;
+  }
+
+  /**
+   * @see org.xml.sax.ContentHandler#startDocument()
+   */
+  public void startDocument() throws SAXException {
+  }
+
+  /**
+   * @see org.xml.sax.ContentHandler#endDocument()
+   */
+  public void endDocument() throws SAXException {
+  }
+
+  public void startPrefixMapping(String prefix, String uri)
+    throws SAXException {
+  }
+
+  public void endPrefixMapping(String prefix) throws SAXException {
+  }
+
+  public void startElement(String pNamespaceURI, String pLocalName,
+                            String pQName, Attributes pAttr) throws SAXException {
+    Document doc = getDocument();
+    Element element;
+    if (pNamespaceURI == null  ||  pNamespaceURI.length() == 0) {
+      element = doc.createElement(pQName);
+    } else {
+      element = doc.createElementNS(pNamespaceURI, pQName);
+    }
+    if (pAttr != null) {
+      for (int i = 0;  i < pAttr.getLength();  i++) {
+        String uri = pAttr.getURI(i);
+        String qName = pAttr.getQName(i);
+        String value = pAttr.getValue(i);
+        if (uri == null  ||  uri.length() == 0) {
+          element.setAttribute(qName, value);
+        } else {
+          element.setAttributeNS(uri, qName, value);
+        }
+      }
+    }
+
+    currentNode.appendChild(element);
+    currentNode = element;
+    if (result == null) {
+      result = element;
+    }
+  }
+
+  public void endElement(String namespaceURI, String localName, String qName)
+      throws SAXException {
+    currentNode = currentNode.getParentNode();
+  }
+
+  public void characters(char[] ch, int start, int length)
+      throws SAXException {
+    Node node = currentNode.getLastChild();
+    String s = new String(ch, start, length);
+    if (node != null  &&  node.getNodeType() == Node.TEXT_NODE) {
+      ((Text) node).appendData(s);
+    } else {
+      Text text = getDocument().createTextNode(s);
+      currentNode.appendChild(text);
+    }
+  }
+
+  public void ignorableWhitespace(char[] ch, int start, int length)
+      throws SAXException {
+    characters(ch, start, length);
+  }
+
+  public void processingInstruction(String pTarget, String pData)
+      throws SAXException {
+    ProcessingInstruction pi = getDocument().createProcessingInstruction(pTarget, pData);
+    currentNode.appendChild(pi);
+  }
+
+  public void skippedEntity(String pName) throws SAXException {
+    EntityReference entity = getDocument().createEntityReference(pName);
+    currentNode.appendChild(entity);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/TextSetter.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/TextSetter.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/TextSetter.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import org.xml.sax.SAXException;
+
+/** <p>Interface of an object which is setting character data as
+ * a bean property. The default implementation,
+ * {@link org.apache.ws.jaxme.xs.parser.impl.TextSetterImpl}, is converting any
+ * SAX event of type {@link org.xml.sax.ContentHandler#characters(char[], int, int)}
+ * into a call of the method <code>addText(String)</code> on the
+ * bean.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface TextSetter {
+  /** <p>Called for any {@link org.xml.sax.ContentHandler#characters(char[], int, int)}
+   * event. Note, that this implies in particular, that the method may be called
+   * multiple times, even for a single block of text.</p>
+   *
+   * @param pText The text being set.
+   */
+  public void addText(String pText) throws SAXException; 
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XSContext.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XSContext.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XSContext.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import org.apache.ws.jaxme.xs.*;
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.helpers.NamespaceSupport;
+
+/** <p>This interface provides access to the parsers context.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSContext {
+  /** <p>Returns the parsers object factory for syntax elements.</p>
+   */
+  public XsObjectFactory getXsObjectFactory();
+  /** <p>Sets the parsers object factory for syntax elements.</p>
+   */
+  public void setXsObjectFactory(XsObjectFactory pFactory);
+
+  /** <p>Returns the parsers object factory for logical elements.</p>
+   */
+  public XSObjectFactory getXSObjectFactory();
+  /** <p>Sets the parsers object factory for logical elements.</p>
+   */
+  public void setXSObjectFactory(XSObjectFactory pFactory);
+
+  /** <p>Returns the {@link AttributeSetter}, which is used to
+   * configure properties.</p>
+   */
+  public AttributeSetter getAttributeSetter();
+  /** <p>Sets the AttributeSetter, which is used to
+   * configure properties.</p>
+   */
+  public void setAttributeSetter(AttributeSetter pSetter);
+
+  /** <p>Returns the {@link ChildSetter}, which is used to create
+   * child elements.</p>
+   */
+  public ChildSetter getChildSetter();
+  /** <p>Sets the ChildSetter, which is used to create
+   * child elements.</p>
+   */
+  public void setChildSetter(ChildSetter pSetter);
+
+  /** <p>Returns the {@link TextSetter}, used to add text sections.</p>
+   */
+  public TextSetter getTextSetter();
+  /** <p>Sets the TextSetter, used to add text sections.</p>
+   */
+  public void setTextSetter(TextSetter pSetter);
+
+  /** <p>Returns the currently running {@link XSParser} or null,
+   * if no such instance is available.</p>
+   */
+  public XSLogicalParser getXSLogicalParser();
+  /** <p>Sets the currently active instance of {@link XSParser}, if any.
+   * Returns null, if no such instance is available.</p>
+   */
+  public void setXSLogicalParser(XSLogicalParser pParser);
+
+  /** <p>Returns the {@link XSSchema}, which is currently being parsed,
+   * if any.</p>
+   */
+  public XSSchema getXSSchema();
+
+  /** <p>Returns the locator, used for error messages.</p>
+   */
+  public Locator getLocator();    
+  /** <p>Sets the locator, used for error messages.</p>
+   */
+  public void setLocator(Locator pLocator);
+
+  /** <p>Returns the namespace handler.</p>
+   */
+  public NamespaceSupport getNamespaceSupport();
+  /** <p>Sets the namespace handler.</p>
+   */
+  public void setNamespaceSupport(NamespaceSupport pNamespaceSupport);
+
+  /** <p>Sets the currently active instance of {@link XsSAXParser}.</p>
+   */
+  public ContentHandler getCurrentContentHandler();
+  /** <p>Sets the currently active instance of {@link XsSAXParser}.</p>
+   */
+  public void setCurrentContentHandler(ContentHandler pParser);
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsObjectCreator.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsObjectCreator.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsObjectCreator.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a an object creating beans.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsObjectCreator {
+  /** <p>Asks the bean creator whether he is willing to create a bean
+   * for the given namespace URI and local name. The bean creator
+   * may do either of the following:
+   * <ol>
+   *   <li>Return a new bean.</li>
+   *   <li>Return null in order to indicate, that the bean creator
+   *     delegates the decision to the next bean creator.</li>
+   *   <li>Throw a SAX Exception in order to indicate that the
+   *     combination of namespace URI and local name is invalid.</p>
+   * </ol>
+   */
+  public XsObject newBean(XsObject pParent, Locator pLocator, XsQName pQName) throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsSAXParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsSAXParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/XsSAXParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser;
+
+import org.xml.sax.ContentHandler;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsSAXParser extends ContentHandler {
+  /** <p>Returns the bean configured by the XsSAXParser.</p>
+   */
+  public Object getBean();
+
+  /** <p>Returns the current elements fully qualified name.</p>
+   */
+  public String getQName();
+
+  /** <p>Returns the current elements namespace URI.</p>
+   */
+  public String getNamespaceURI();
+
+  /** <p>Returns the current elements local name.</p>
+   */
+  public String getLocalName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AbstractXsSAXParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AbstractXsSAXParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AbstractXsSAXParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,322 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import org.apache.ws.jaxme.xs.parser.AttributeSetter;
+import org.apache.ws.jaxme.xs.parser.ChildSetter;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractXsSAXParser implements ContentHandler, XsSAXParser {
+  private final static Class[] ZERO_CLASSES = new Class[0];
+  private final static Object[] ZERO_OBJECTS = new Object[0];
+  
+  private Object bean;
+  private int level;
+  private String qName, namespaceURI, localName;
+  private ContentHandler childHandler;
+
+  protected abstract XSContext getData();
+
+  public AbstractXsSAXParser(Object pBean) {
+    bean = pBean;
+  }
+
+  public Object getBean() {
+    return bean;
+  }
+
+  public void setQName(String pQName) {
+    qName = pQName;
+  }
+
+  public void setNamespaceURI(String pNamespaceURI) {
+    namespaceURI = pNamespaceURI;
+  }
+
+  public String getNamespaceURI() {
+    return namespaceURI;
+  }
+
+  public void setLocalName(String pLocalName) {
+    localName = pLocalName;
+  }
+
+  public String getLocalName() {
+    return localName;
+  }
+
+  public String getQName() {
+    return qName;
+  }
+
+  public ContentHandler getChildHandler() {
+    return childHandler;
+  }
+
+  public void startPrefixMapping(String pPrefix, String pURI)
+      throws SAXException {
+    if (childHandler == null) {
+      getData().getNamespaceSupport().declarePrefix(pPrefix, pURI);
+    } else {
+      childHandler.startPrefixMapping(pPrefix, pURI);
+    }
+  }
+
+  public void endPrefixMapping(String pPrefix) throws SAXException {
+    if (childHandler != null) {
+      childHandler.endPrefixMapping(pPrefix);
+    }
+  }
+
+  public void startDocument() throws SAXException {
+    getData().getNamespaceSupport().pushContext();
+  }
+
+  public void endDocument() throws SAXException {
+    getData().getNamespaceSupport().popContext();
+  }
+
+  public void characters(char[] pBuffer, int pOffset, int pLen) throws SAXException {
+    if (childHandler == null) {
+      try {
+        getData().getTextSetter().addText(new String(pBuffer, pOffset, pLen));
+      } catch (SAXException e) {
+        throw e;
+      } catch (RuntimeException e) {
+        Exception ex = e;
+        for (;;) {
+          UndeclaredThrowableException te = null;
+          Throwable t;
+          if (ex instanceof UndeclaredThrowableException) {
+            te = ((UndeclaredThrowableException) ex);
+            t = te.getUndeclaredThrowable();
+          } else if (ex instanceof InvocationTargetException) {
+            t = ((InvocationTargetException) ex).getTargetException();
+          } else {
+            break;
+          }
+          if (t instanceof Exception) {
+            ex = (Exception) t;
+          } else {
+            if (te == null) {
+              te = new UndeclaredThrowableException(t);
+            }
+            t.printStackTrace();
+            throw te;
+          }
+        }
+        throw new LocSAXException(ex.getClass().getName() + ": " + ex.getMessage(),
+                                   getData().getLocator(), ex);
+      }
+    } else {
+      childHandler.characters(pBuffer, pOffset, pLen);
+    }
+  }
+
+  public void ignorableWhitespace(char[] pBuffer, int pOffset, int pLen)
+      throws SAXException {
+    if (childHandler == null) {
+      characters(pBuffer, pOffset, pLen);
+    } else {
+      childHandler.ignorableWhitespace(pBuffer, pOffset, pLen);
+    }
+  }
+
+  public void skippedEntity(String pEntity) throws SAXException {
+    if (childHandler == null) {
+      throw new LocSAXException("Unable to skip entities: " + pEntity,
+                                 getData().getLocator());
+    } else {
+      skippedEntity(pEntity);
+    }
+  }
+
+  public void processingInstruction(String pTarget, String pData)
+      throws SAXException {
+    if (childHandler != null) {
+      childHandler.processingInstruction(pTarget, pData);
+    }
+  }
+
+  public void startElement(String pNamespaceURI, String pLocalName, String pQName, Attributes pAttr)
+      throws SAXException {
+    switch (++level) {
+      case 1:
+        setQName(pQName);
+        setNamespaceURI(pNamespaceURI);
+        setLocalName(pLocalName);
+        if (pAttr != null) {
+          for (int i = 0;  i < pAttr.getLength();  i++) {
+            try {
+              AttributeSetter attrSetter = getData().getAttributeSetter();
+              attrSetter.setAttribute(pAttr.getQName(i), pAttr.getURI(i),
+                                      pAttr.getLocalName(i), pAttr.getValue(i));
+            } catch (SAXException e) {
+              throw e;
+            } catch (RuntimeException e) {
+              Exception ex = e;
+              for (;;) {
+                UndeclaredThrowableException te = null;
+                Throwable t;
+                if (ex instanceof UndeclaredThrowableException) {
+                  te = ((UndeclaredThrowableException) ex);
+                  t = te.getUndeclaredThrowable();
+                } else if (ex instanceof InvocationTargetException) {
+                  t = ((InvocationTargetException) ex).getTargetException();
+                } else {
+                  break;
+                }
+                if (t instanceof Exception) {
+                  ex = (Exception) t;
+                } else {
+                  if (te == null) {
+                    te = new UndeclaredThrowableException(t);
+                  }
+                  t.printStackTrace();
+                  throw te;
+                }
+              }
+              throw new LocSAXException(ex.getClass().getName() + ": " + ex.getMessage(),
+                                         getData().getLocator(), ex);
+            }
+          }
+        }
+        break;
+      case 2:
+        try {
+          ChildSetter childSetter = getData().getChildSetter();
+          childHandler = childSetter.getChildHandler(pQName, pNamespaceURI, pLocalName);
+        } catch (SAXException e) {
+          throw e;
+        } catch (RuntimeException e) {
+          Exception ex = e;
+          for (;;) {
+            UndeclaredThrowableException te = null;
+            Throwable t;
+            if (ex instanceof UndeclaredThrowableException) {
+              te = ((UndeclaredThrowableException) ex);
+              t = te.getUndeclaredThrowable();
+            } else if (ex instanceof InvocationTargetException) {
+              t = ((InvocationTargetException) ex).getTargetException();
+            } else {
+              break;
+            }
+            if (t instanceof Exception) {
+              ex = (Exception) t;
+            } else {
+              if (te == null) {
+                te = new UndeclaredThrowableException(t);
+              }
+              t.printStackTrace();
+              throw te;
+            }
+          }
+          throw new LocSAXException(ex.getClass().getName() + ": " + ex.getMessage(),
+                                     getData().getLocator(), ex);
+        }
+        getData().setCurrentContentHandler(childHandler);
+        childHandler.startDocument();
+        childHandler.startElement(pNamespaceURI, pLocalName, pQName, pAttr);
+        break;
+      default:
+        childHandler.startElement(pNamespaceURI, pLocalName, pQName, pAttr);
+        break;
+    }
+  }
+
+  public void endElement(String pNamespaceURI, String pLocalName, String pQName)
+      throws SAXException {
+    switch (level--) {
+      case 1:
+        Object o = getBean();
+        if (o != null) {
+          Method m = null;
+          try {
+            m = o.getClass().getMethod("validate", ZERO_CLASSES);
+          } catch (NoSuchMethodException e) {
+          }
+          if (m != null) {
+            try {
+              m.invoke(o, ZERO_OBJECTS);
+            } catch (RuntimeException e) {
+              throw new LocSAXException(e.getClass().getName() + ": " + e.getMessage(),
+                                         getData().getLocator(), e);
+            } catch (InvocationTargetException e) {
+              Throwable t = e.getTargetException();
+              if (t instanceof SAXException) {
+                throw (SAXException) t;
+              } else if (t instanceof RuntimeException) {
+                throw new LocSAXException(t.getClass().getName() + ": " + t.getMessage(),
+                                           getData().getLocator(),
+                                           (RuntimeException) t);
+              } else if (t instanceof Exception) {
+                throw new LocSAXException("Failed to invoke method validate() " +
+                                           " of class " + m.getDeclaringClass() +
+                                           " with argument " + o.getClass().getName() + ": " +
+                                           t.getClass().getName() + ", " + t.getMessage(),
+                                           getData().getLocator(),
+                                           (Exception) t);
+              } else {
+                throw new LocSAXException("Failed to invoke method validate() " +
+                                           " of class " + m.getDeclaringClass() +
+                                           " with argument " + o.getClass().getName() + ": " +
+                                           t.getClass().getName() + ", " + t.getMessage(),
+                                           getData().getLocator(), e);
+              }
+            } catch (IllegalAccessException e) {
+              throw new LocSAXException("Failed to invoke method validate() " +
+                                           " of class " + m.getDeclaringClass() +
+                                           " with argument " + o.getClass().getName() + ": IllegalAccessException, " +
+                                           e.getMessage(),
+                                           getData().getLocator(), e); 
+
+            }
+          }
+        }
+        break;
+      case 2:
+        childHandler.endElement(pNamespaceURI, pLocalName, pQName);
+        childHandler.endDocument();
+        getData().setCurrentContentHandler(this);
+        childHandler = null;
+        break;
+      default:
+        childHandler.endElement(pNamespaceURI, pLocalName, pQName);
+        break;
+    }
+  }
+
+  public void setDocumentLocator(Locator pLocator) {
+    getData().setLocator(pLocator);
+    if (childHandler != null) {
+      childHandler.setDocumentLocator(pLocator);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AttributeSetterImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AttributeSetterImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/AttributeSetterImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,345 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Default implementation of the {@link org.apache.ws.jaxme.xs.parser.AttributeSetter}
+ * interface.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class AttributeSetterImpl implements AttributeSetter {
+  static final Class[] ONE_STRING_CLASS = new Class[]{String.class};
+  private static final Class[] FOUR_STRING_CLASSES =
+    new Class[]{String.class, String.class, String.class, String.class};
+
+  protected XSContext getData() {
+    XSContext result = XSParser.getRunningInstance().getContext();
+    if (result == null) {
+      throw new IllegalStateException("Parser data is not set.");
+    }
+    return result;
+  }
+
+  /** <p>This method configures the bean <code>pBean</code> as follows:
+   * <ol>
+   *    <li>If the bean has a method
+   *      <code>setAttribute(String, String, String)</code>, it is invoked
+   *      with the following arguments:
+   *      <ul>
+   *        <li>The attributes namespace URI (empty string for the default
+   *          namespace),</li>
+   *        <li>the attributes local name,</li>
+   *        <li>and the property value</li>
+   *      </ul>
+   *    </li>
+   *    <li>Otherwise invokes its own method {@link #setProperty(Object, String, String, String)}.</li>
+   * </ol>
+   */
+  public void setAttribute(String pQName, String pNamespaceURI, String pLocalName, String pValue)
+      throws SAXException {
+    XsSAXParser handler = ((XsSAXParser) getData().getCurrentContentHandler());
+    if (handler == null) {
+      throw new IllegalStateException("Current XsSAXParser is null.");
+    }
+    Object bean = ((XsSAXParser) getData().getCurrentContentHandler()).getBean();
+    try {
+      Method m = bean.getClass().getMethod("setAttribute", FOUR_STRING_CLASSES);
+      if (Modifier.isPublic(m.getModifiers())) {
+        Object[] o = new Object[]{pQName, pNamespaceURI, pLocalName, pValue};
+        Object result = invokeMethod(bean, m, pQName, o);
+        if (!boolean.class.equals(m.getReturnType())  ||  ((Boolean) result).booleanValue()) {
+          return;
+        }
+      }
+    } catch (NoSuchMethodException e) {
+    }
+
+    if (!setProperty(bean, pQName, pLocalName, pValue)) {
+      throw new IllegalStateException("Unknown attribute of " + bean.getClass().getName() + ": " + pQName);
+    }
+  }
+
+
+  /** <p>This method invokes the beans <code>pBean</code> method <code>pMethod</code>,
+   * setting the attribute <code>pName</code> to the value <code>pArgs</code>.</p>
+   */
+  protected Object invokeMethod(Object pBean, Method pMethod, String pName, Object[] pArgs) throws SAXException {
+    try {
+      return pMethod.invoke(pBean, pArgs);
+    } catch (InvocationTargetException e) {
+      Throwable t = e.getTargetException();
+      if (t instanceof SAXException) {
+        throw (SAXException) t;
+      } else if (t instanceof RuntimeException) {
+        throw (RuntimeException) t;
+      } else {
+        throw new UndeclaredThrowableException(t);
+      }
+    } catch (IllegalAccessException e) {
+      StringBuffer sb = new StringBuffer("Failed to invoke method ");
+      sb.append(pMethod.getName()).append(" of class ").append(pBean.getClass().getName());
+      sb.append(" with argument ");
+      for (int i = 0;  i < pArgs.length;  i++) {
+        if (i > 0) {
+          sb.append(", ");
+        }
+        sb.append(pArgs[i]);
+      }
+      sb.append(": ").append(e.getClass().getName()).append(", ").append(e.getMessage());
+      throw new IllegalStateException(sb.toString());
+    }
+  }
+
+  private interface ParameterClass {
+    public Object matches(Class pClass);
+    public void invoke(AttributeSetterImpl pAttributeSetter, Object pBean, String pValue,
+                        Method pMethod, Object pMethodObject, String pQName)
+      throws SAXException;
+  }
+
+  private static class StringClass implements ParameterClass {
+    public Object matches(Class pClass) {
+      return String.class.equals(pClass) ? Boolean.TRUE : null;
+    }
+    public void invoke(AttributeSetterImpl pAttributeSetter, Object pBean, String pValue,
+                        Method pMethod, Object pMethodObject, String pQName) throws SAXException {
+      pAttributeSetter.invokeMethod(pBean, pMethod, pQName, new Object[]{pValue});
+    }
+  }
+
+  private static class ValueOfParameterClass implements ParameterClass {
+    public Object matches(Class pClass) {
+      try {
+        Method valueOfMethod = pClass.getMethod("valueOf", ONE_STRING_CLASS);
+        if (Modifier.isPublic(valueOfMethod.getModifiers())  &&  !void.class.equals(valueOfMethod.getReturnType())) {
+          return valueOfMethod;
+        }
+      } catch (NoSuchMethodException e) {
+      }
+      return null;
+    }
+    public void invoke(AttributeSetterImpl pAttributeSetter, Object pBean, String pValue,
+                        Method pMethod, Object pMethodObject, String pQName) throws SAXException {
+      Method m = (Method) pMethodObject; 
+      Object o;
+      try {
+        o = m.invoke(null, new Object[]{pValue});
+      } catch (InvocationTargetException e) {
+        throw new IllegalArgumentException("Illegal argument for attribute '" + pQName + "': " + pValue +
+                                            "; " + e.getTargetException().getClass().getName() +
+                                            ", " + e.getTargetException().getMessage());
+      } catch (IllegalAccessException e) {
+        throw new IllegalStateException("Invalid access to method " + m.getName() + " of class " +
+                                         pBean.getClass() + ": IllegalAccessException, " + e.getMessage());
+      }
+      pAttributeSetter.invokeMethod(pBean, pMethod, pQName, new Object[]{o});
+    }
+  }
+
+  private static class StringConstructorClass implements ParameterClass {
+    public Object matches(Class pClass) {
+      try {
+        Constructor con = pClass.getConstructor(ONE_STRING_CLASS);
+        if (Modifier.isPublic(con.getModifiers())) {
+          return con;
+        }
+      } catch (NoSuchMethodException e) {
+      }
+      return null;
+    }
+    public void invoke(AttributeSetterImpl pAttributeSetter, Object pBean, String pValue,
+                        Method pMethod, Object pMethodObject, String pQName) throws SAXException {
+      Constructor con = (Constructor) pMethodObject; 
+      Object o;
+      try {
+        o = con.newInstance(new Object[]{pValue});
+      } catch (InvocationTargetException e) {
+        throw new IllegalArgumentException("Illegal argument for attribute '" + pQName + "': " + pValue +
+                                            "; " + e.getTargetException().getClass().getName() +
+                                            ", " + e.getTargetException().getMessage());
+      } catch (InstantiationException e) {
+        throw new IllegalStateException("Invalid access to constructor " + pBean.getClass().getName() +
+                                         "(): " + e.getClass().getName() + ", " + e.getMessage());
+      } catch (IllegalAccessException e) {
+        throw new IllegalStateException("Invalid access to constructor " + pBean.getClass().getName() +
+                                         "(): " + e.getClass().getName() + ", " + e.getMessage());
+      }
+      pAttributeSetter.invokeMethod(pBean, pMethod, pQName, new Object[]{o});
+    }
+  }
+
+  private static class PrimitiveParameterClass extends StringConstructorClass {
+    private final Class primitiveClass;
+    private final Class nonPrimitiveClass;
+    private final Constructor stringConstructor;
+    private PrimitiveParameterClass(Class pPrimitiveClass, Class pNonPrimitiveClass) {
+      primitiveClass = pPrimitiveClass;
+      nonPrimitiveClass = pNonPrimitiveClass;
+      try {
+        stringConstructor = pNonPrimitiveClass.getConstructor(ONE_STRING_CLASS);
+      } catch (NoSuchMethodException e) {
+        throw new IllegalStateException("The primitive class " + pNonPrimitiveClass.getName() +
+                                         " doesn't have a string valued constructor!");
+      }
+    }
+    public Object matches(Class pClass) {
+      return (primitiveClass.equals(pClass) || nonPrimitiveClass.equals(pClass)) ? stringConstructor : null;
+    }
+  }
+
+  private static class CharacterClass implements ParameterClass {
+    public Object matches(Class pClass) {
+      return (Character.TYPE.equals(pClass)  ||  Character.class.equals(pClass)) ? Boolean.TRUE : null;
+    }
+
+    public void invoke(AttributeSetterImpl pAttributeSetter, Object pBean, String pValue, Method pMethod, Object pMethodObject, String pQName) throws SAXException {
+      if (pValue.length() != 1) {
+        throw new IllegalArgumentException("Invalid value for '" + pQName +"': " + pValue +
+                                            "; must have exactly one character.");
+      }
+      pAttributeSetter.invokeMethod(pBean, pMethod, pQName, new Object[]{new Character(pValue.charAt(0))});
+    }
+  }
+
+  private static class BooleanClass implements ParameterClass {
+    public Object matches(Class pClass) {
+      return (Boolean.TYPE.equals(pClass)  ||  Boolean.class.equals(pClass)) ? Boolean.TRUE : null;
+    }
+
+    public void invoke(AttributeSetterImpl pAttributeSetter, Object pBean, String pValue, Method pMethod, Object pMethodObject, String pQName) throws SAXException {
+      Boolean b = ("true".equals(pValue) || "1".equals(pValue)) ? Boolean.TRUE : Boolean.FALSE;
+      pAttributeSetter.invokeMethod(pBean, pMethod, pQName, new Object[]{b});
+    }
+  }
+
+  private static final ParameterClass[] knownClasses = new ParameterClass[]{
+    new BooleanClass(),
+    new StringClass(),
+    new ValueOfParameterClass(),
+    new StringConstructorClass(),
+    new CharacterClass(),
+    new PrimitiveParameterClass(long.class, Long.class),
+    new PrimitiveParameterClass(int.class, Integer.class),
+    new PrimitiveParameterClass(short.class, Short.class),
+    new PrimitiveParameterClass(byte.class, Byte.class),
+    new PrimitiveParameterClass(double.class, Double.class),
+    new PrimitiveParameterClass(float.class, Float.class),
+    new CharacterClass(),
+  };
+
+  /** <p>This method is invoked from within {@link #setAttribute(String, String, String, String)}.
+   * It configures the bean <code>pBean</code> as follows;
+   * <ol>
+   *    <li>If the bean has a method <code>setProperty(String)</code>
+   *      this method is invoked with the attribute value.</li>
+   *   <li>If the bean has a method <code>setProperty(T)</code>, and
+   *     the class <code>T</code> has either of a method
+   *     <code>public static T valueOf(String)</code> or a constructor
+   *     <code>public T(String)</code> (in that order), then the method
+   *     <code>setProperty(T)</code> is invoked with the value obtained
+   *     by an invocation of the method <code>valueOf()</code>, or
+   *     the constructor, respectively. Note, that this applies in
+   *     particular to the classes {@link Long}, {@link Integer},
+   *     {@link Short}, {@link Byte}, {@link Double}, {@link Float},
+   *     <code>java.math.BigInteger</code>, <code>java.math.BigDecimal</code>,
+   *     {@link java.io.File}, and {@link java.lang.StringBuffer}.</li>
+   *    <li>If the bean has a method <code>setProperty(boolean)</code>,
+   *      the method will be invoked with the value <i>true</i>
+   *      (the value specified in the XML file is either of
+   *      <code>true</code>, or <code>1</code>, otherwise with the
+   *      value <code>false</code>.</li>
+   *   <li>If the bean has a method <code>setProperty(char)</code>,
+   *     or <code>setProperty(Character)</code>, the method will be
+   *     invoked with the first character of the value specified in
+   *     the XML file. If the value contains zero or multiple characters,
+   *     an {@link IllegalArgumentException} is thrown.</li>
+   *   <li>If the bean has either of the following methods, in that order:
+   *     <ul>
+   *       <li><code>setProperty(long)</code></li>
+   *       <li><code>setProperty(int)</code></li>
+   *       <li><code>setProperty(short)</code></li>
+   *       <li><code>setProperty(byte)</code></li>
+   *       <li><code>setProperty(double)</code></li>
+   *       <li><code>setProperty(float)</code></li>
+   *     </ul>
+   *     then the property value is converted into the respective type
+   *     and the method is invoked. An {@link IllegalArgumentException}
+   *     is thrown, if the conversion fails.</li>
+   *   <li>If the bean has a method <code>java.lang.Class</code>, the
+   *     <code>XsSAXParser</code> will interpret the value given in the
+   *     XML file as a Java class name and load the named class from its
+   *     class loader. If the class cannot be loaded, it will also try
+   *     to use the current threads context class loader. An
+   *     exception is thrown, if neither of the class loaders can
+   *     load the class.</li>
+   * </ol>
+   * </p>
+   *
+   * @return True, if a method for setting the property was found. Otherwise
+   *   false.
+   */
+  protected boolean setProperty(Object pBean, String pQName, String pName, String pValue)
+      throws SAXException {
+    Class c = pBean.getClass();
+    String s = "set" + Character.toUpperCase(pName.charAt(0)) + pName.substring(1);
+    int parameterClassNum = knownClasses.length;
+    Method[] methods = c.getMethods();
+    Method method = null;
+    Object methodObject = null;
+    for (int i = 0;  i < methods.length;  i++) {
+      Method m = methods[i];
+      if (!s.equals(m.getName())  ||  !Modifier.isPublic(m.getModifiers())) {
+        continue;
+      }
+
+      Class[] params = m.getParameterTypes();
+      if (params.length != 1) {
+        continue;
+      }
+
+      Class paramsClass = params[0];
+      for (int j = 0;  j < parameterClassNum;  j++) {
+        ParameterClass parameterClass = knownClasses[j];
+        Object o = parameterClass.matches(paramsClass);
+        if (o != null) {
+          parameterClassNum = j;
+          method = m;
+          methodObject = o;
+          break;
+        }
+      }
+    }
+
+    if (method == null) {
+      return false;
+    } else {
+      knownClasses[parameterClassNum].invoke(this, pBean, pValue, method, methodObject, pQName);
+      return true;
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/ChildSetterImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/ChildSetterImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/ChildSetterImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.*;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/** <p>Default implementation of a {@link org.apache.ws.jaxme.xs.parser.ChildSetter}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class ChildSetterImpl implements ChildSetter {
+  private static final Class[] GETCHILDHANDLER_CLASSES = new Class[]{String.class, String.class, String.class};
+  private static final Class[] ZERO_CLASSES = new Class[]{};
+  private static final Object[] ZERO_OBJECTS = new Object[]{};
+
+  private XSContext getData() {
+    return XSParser.getRunningInstance().getContext();
+  }
+
+  /** <p>This method invokes the beans <code>pBean</code> method <code>pMethod</code> with
+   * the argument array pArgs, returning a child handler for the element <code>pQName</code>.</p>
+   */
+  protected Object invokeMethod(Object pBean, Method pMethod, String pName, Object[] pArgs) throws SAXException {
+    try {
+      return pMethod.invoke(pBean, pArgs);
+    } catch (InvocationTargetException e) {
+      Throwable t = e.getTargetException();
+      if (t instanceof RuntimeException) {
+        throw (RuntimeException) t;
+      } else if (t instanceof SAXException) {
+        throw (SAXException) t;
+      } else {
+        throw new UndeclaredThrowableException(t);
+      }
+    } catch (IllegalAccessException e) {
+      throw new IllegalStateException("Failed to invoke method " + pMethod.getName() +
+                                       " of class " + pMethod.getDeclaringClass() +
+                                       " with argument " + pBean + ": IllegalAccessException, " +
+                                       e.getMessage()); 
+    }
+  }
+
+
+  public ContentHandler getChildHandler(String pQName,
+                                         String pNamespaceURI, String pLocalName) throws SAXException {
+    final XsSAXParser xsSAXParser = (XsSAXParser) getData().getCurrentContentHandler();
+    if (xsSAXParser == null) {
+      throw new NullPointerException("No XsSAXParser registered.");
+    }
+    final Object bean = xsSAXParser.getBean();
+    final Class beanClass = bean.getClass();
+    try {
+      Method m = beanClass.getMethod("getChildHandler", GETCHILDHANDLER_CLASSES);
+      if (Modifier.isPublic(m.getModifiers())  &&
+          ContentHandler.class.isAssignableFrom(m.getReturnType())) {
+        Object result = (ContentHandler) invokeMethod(bean, m, pQName, new Object[]{pQName, pNamespaceURI, pLocalName});
+        if (result != null) {
+          return (ContentHandler) result;
+        }
+      }
+    } catch (NoSuchMethodException e) {
+    }
+
+    final ContentHandler result = getChildHandler(xsSAXParser, pQName, pLocalName);
+    if (result == null) {
+      throw new LocSAXException("Unknown child element '" + pQName + "' for bean " + bean.getClass().getName(),
+                                 getData().getLocator());
+    }
+    return result;
+  }
+
+  /** <p>Creates a new instance of {@link XsSAXParser}, inheriting most properties from
+   * its parent parser.</p>
+   */
+  protected ContentHandler newXsSAXParser(XsSAXParser pParent, Object pBean) {
+    return getData().getXsObjectFactory().newXsSAXParser(pBean);
+  }
+
+  protected ContentHandler getChildHandler(ContentHandler pParent, String pQName, String pLocalName)
+      throws SAXException {
+    final XsSAXParser xsSAXParser = (XsSAXParser) pParent;
+    final Object bean = xsSAXParser.getBean();
+    final Class beanClass = bean.getClass();
+    final String s = Character.toUpperCase(pLocalName.charAt(0)) + pLocalName.substring(1);
+    try {
+      Method m = beanClass.getMethod("create" + s, ZERO_CLASSES);
+      if (Modifier.isPublic(m.getModifiers())  &&
+         !void.class.equals(m.getReturnType())) {
+        Object result = invokeMethod(bean, m, pQName, ZERO_OBJECTS);
+        return newXsSAXParser(xsSAXParser, result);
+      }
+    } catch (NoSuchMethodException e) {
+    } catch (SAXException e) {
+      throw e;
+    }
+
+    return null;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/LocSAXException.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/LocSAXException.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/LocSAXException.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/** <p>The <code>locatable SAXException</code>, a subclass of the SAXParseException,
+ * provides a human readable representation of the location.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class LocSAXException extends SAXParseException {
+  public static String formatMsg(String pMsg, String pPublicId, String pSystemId, int pLineNumber, int pColNumber) {
+    StringBuffer sb = new StringBuffer();
+    if (pSystemId != null) {
+      sb.append(pSystemId);
+    }
+    if (pLineNumber != -1) {
+      if (sb.length() > 0) {
+        sb.append(", ");
+      }
+      sb.append("line ").append(pLineNumber);
+    }
+    if (pColNumber != -1) {
+      if (sb.length() > 0) {
+        sb.append(", ");
+      }
+      sb.append("column ").append(pColNumber);
+    }
+    if (sb.length() == 0) {
+      return "" + pMsg;
+    } else {
+      return "At " + sb + ": " + pMsg;
+    }
+  }
+
+  private static String formatMsg(String pMsg, Locator pLocator) {
+    if (pLocator == null) {
+      return pMsg;
+    } else {
+      return formatMsg(pMsg, pLocator.getPublicId(), pLocator.getSystemId(), pLocator.getLineNumber(), pLocator.getColumnNumber());
+    }
+  }
+
+  public LocSAXException(String pMsg, String pPublicId, String pSystemId,
+                                int pLineNumber, int pColumnNumber, Exception pException) {
+    super(formatMsg(pMsg, pPublicId, pSystemId, pLineNumber, pColumnNumber),
+           pPublicId, pSystemId, pLineNumber, pColumnNumber, pException);
+  }
+
+  public LocSAXException(String pMsg, String pPublicId, String pSystemId,
+                                int pLineNumber, int pColumnNumber) {
+    super(formatMsg(pMsg, pPublicId, pSystemId, pLineNumber, pColumnNumber),
+           pPublicId, pSystemId, pLineNumber, pColumnNumber);
+  }
+
+  public LocSAXException(String pMsg, Locator pLocator, Exception pException) {
+    super(formatMsg(pMsg, pLocator), pLocator, pException);
+  }
+
+  public LocSAXException(String pMsg, Locator pLocator) {
+    super(formatMsg(pMsg, pLocator), pLocator);
+  }
+
+  public void printStackTrace(PrintStream pStream) {
+    super.printStackTrace(pStream);
+    Exception e = getException();
+    while (e != null) {
+      pStream.println("Caused by:");
+      e.printStackTrace(pStream);
+      if (e instanceof SAXException) {
+        e = ((SAXException) e).getException();
+      } else {
+        e = null;
+      }
+    }
+  }
+
+  public void printStackTrace(PrintWriter pWriter) {
+    super.printStackTrace(pWriter);
+    Exception e = getException();
+    while (e != null) {
+      pWriter.println("Caused by:");
+      e.printStackTrace(pWriter);
+      if (e instanceof SAXException) {
+        e = ((SAXException) e).getException();
+      } else {
+        e = null;
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/TextSetterImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/TextSetterImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/TextSetterImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.TextSetter;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class TextSetterImpl implements TextSetter {
+  private static final Class[] ONE_STRING_CLASS = new Class[]{String.class};
+
+  protected XSContext getData() {
+    return XSParser.getRunningInstance().getContext();
+  }
+
+  protected boolean isIgnorable(String pText) {
+    for (int i = 0;  i < pText.length();  i++) {
+      if (!Character.isWhitespace(pText.charAt(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  public void addText(String pText) throws SAXException {
+    XsSAXParser handler = (XsSAXParser) getData().getCurrentContentHandler();
+    Object bean = handler.getBean();
+    try {
+      Method m = bean.getClass().getMethod("addText", ONE_STRING_CLASS);
+      m.invoke(bean, new Object[]{pText});
+    } catch (NoSuchMethodException f) {
+      if (isIgnorable(pText)) {
+        return;
+      }
+      throw new IllegalStateException("Embedded text is not supported in the '" + handler.getQName() + "' element:" + pText);
+    } catch (IllegalAccessException e) {
+      throw new IllegalStateException("Embedded text is not supported in the '" + handler.getQName() + "' element:" + pText);
+    } catch (InvocationTargetException e) {
+      Throwable t = e.getTargetException();
+      if (t instanceof RuntimeException) {
+        throw (RuntimeException) t;
+      } else if (t instanceof SAXException) {
+        throw (SAXException) t;
+      } else {
+        throw new UndeclaredThrowableException(t);
+      }
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XSContextImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XSContextImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XSContextImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import org.apache.ws.jaxme.xs.*;
+import org.apache.ws.jaxme.xs.impl.*;
+import org.apache.ws.jaxme.xs.parser.*;
+import org.apache.ws.jaxme.xs.parser.AttributeSetter;
+import org.apache.ws.jaxme.xs.parser.ChildSetter;
+import org.apache.ws.jaxme.xs.parser.TextSetter;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectFactoryImpl;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.helpers.NamespaceSupport;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+/** <p>This class provides access to the parsers internal data. The
+ * <code>Context</code> instance is stored as a thread local element, thus
+ * accessible via a static method.</p>
+ */
+public class XSContextImpl implements XSContext {
+  public static final XsObjectFactory DEFAULT_OBJECT_FACTORY = new XsObjectFactoryImpl();
+  public static final XSObjectFactory DEFAULT_XS_OBJECT_FACTORY = new XSObjectFactoryImpl();
+  public static final AttributeSetter DEFAULT_ATTRIBUTE_SETTER = new AttributeSetterImpl();
+  public static final ChildSetter DEFAULT_CHILD_SETTER = new ChildSetterImpl();
+  public static final TextSetter DEFAULT_TEXT_SETTER = new TextSetterImpl();
+
+  private XsObjectFactory objectFactory = DEFAULT_OBJECT_FACTORY;
+  private XSObjectFactory xSObjectFactory = DEFAULT_XS_OBJECT_FACTORY;
+  private AttributeSetter attributeSetter = DEFAULT_ATTRIBUTE_SETTER;
+  private ChildSetter childSetter = DEFAULT_CHILD_SETTER;
+  private TextSetter textSetter = DEFAULT_TEXT_SETTER;
+  private XSLogicalParser xsParser;
+  private Locator locator;
+  private NamespaceSupport namespaceSupport = new NamespaceSupport();
+  private ContentHandler currentContentHandler;
+
+  public XsObjectFactory getXsObjectFactory() { return objectFactory; }
+  public void setXsObjectFactory(XsObjectFactory pFactory) { objectFactory = pFactory; }
+  public XSObjectFactory getXSObjectFactory() { return xSObjectFactory; }
+  public void setXSObjectFactory(XSObjectFactory pFactory) { xSObjectFactory = pFactory; }
+  public AttributeSetter getAttributeSetter() { return attributeSetter; }
+  public void setAttributeSetter(AttributeSetter pAttributeSetter) { attributeSetter = pAttributeSetter; }
+  public ChildSetter getChildSetter() { return childSetter; }
+  public void setChildSetter(ChildSetter pChildSetter) { childSetter = pChildSetter; }
+  public TextSetter getTextSetter() { return textSetter; }
+  public void setTextSetter(TextSetter pTextSetter) { textSetter = pTextSetter; }
+  public XSLogicalParser getXSLogicalParser() { return xsParser; }
+  public void setXSLogicalParser(XSLogicalParser pParser) { xsParser = pParser; }
+  public XSSchema getXSSchema() { return getXSLogicalParser().getSchema(); }
+  public Locator getLocator() { return locator; }
+  public void setLocator(Locator pLocator) { locator = pLocator; }
+  public void setNamespaceSupport(NamespaceSupport pNamespaceSupport) { namespaceSupport = pNamespaceSupport; }
+  public NamespaceSupport getNamespaceSupport() { return namespaceSupport; }
+
+  public void setCurrentContentHandler(ContentHandler pHandler) { currentContentHandler = pHandler; }
+  public ContentHandler getCurrentContentHandler() { return currentContentHandler; }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XsSAXParserImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XsSAXParserImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/XsSAXParserImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.parser.impl;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsSAXParserImpl extends AbstractXsSAXParser {
+  private final XSContext data = new XSContextImpl();
+
+  /** <p>Creates a new instance of XsSAXParserImpl.java.</p>
+   */
+  public XsSAXParserImpl(Object pBean) {
+    super(pBean);
+  }
+
+  protected XSContext getData() { return data; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.parser.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Implementations of adapters from xml parser mechanisms to the 
+generic schema construction framework.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/parser/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.parser Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Adapters from xml parser mechanisms to the generic schema construction framework.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractAtomicType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractAtomicType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractAtomicType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractAtomicType extends AbstractSimpleType implements XSAtomicType {
+  public boolean isAtomic() { return true; }
+
+  public XSAtomicType getAtomicType() { return this; }
+
+  public Long getFractionDigits() { return null; }
+  public Long getLength() { return null; }
+  public String getMaxExclusive() { return null; }
+  public String getMaxInclusive() { return null; }
+  public Long getMaxLength() { return null; }
+  public String getMinExclusive() { return null; }
+  public String getMinInclusive() { return null; }
+  public Long getMinLength() { return null; }
+  public Long getTotalDigits() { return null; }
+  public boolean isReplacing() { return false; }
+  public boolean isCollapsing() { return false; }
+  public boolean isBuiltin() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractBuiltinType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractBuiltinType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractBuiltinType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/** <p>An abstract type, to be extended by the builtin types.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractBuiltinType implements XSType {
+  private static final Attributes openAttrs = new AttributesImpl();
+  private static final XSAnnotation[] annotations = new XSAnnotation[0];
+  
+  public Attributes getOpenAttributes() { return openAttrs; }
+  public XSAnnotation[] getAnnotations() { return annotations; }
+  public boolean isGlobal() { return true; }
+  public XSSchema getXSSchema() { return null; }
+  
+  public void setGlobal(boolean pGlobal) {
+    if (pGlobal == false) {
+      throw new IllegalStateException("A builtin type cannot be local.");
+    }
+  }
+
+  public Locator getLocator() {
+    throw new IllegalStateException("The builtin type " + getName() + " does not have a location.");
+  }
+
+  public void validate() throws SAXException {}
+public XsSchemaHeader getSchemaHeader() {
+	return null;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractListType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractListType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractListType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSType;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractListType extends AbstractSimpleType implements XSListType {
+  public boolean isList() { return true; }
+  public Long getLength() { return null; }
+  public Long getMinLength() { return null; }
+  public Long getMaxLength() { return null; }
+  public boolean isRestriction() { return false; }
+  public XSType getRestrictedType() {
+    throw new IllegalStateException("This is a basic list type and no restriction of another simple type.");
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractSimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractSimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/AbstractSimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSAtomicType;
+import org.apache.ws.jaxme.xs.XSEnumeration;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSObjectFactory;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSUnionType;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class AbstractSimpleType extends AbstractBuiltinType implements XSSimpleType {
+  public boolean isSimple() { return true; }
+  public boolean isAtomic() { return false; }
+  public boolean isList() { return false; }
+  public boolean isUnion() { return false; }
+  public XSSimpleType getSimpleType() { return this; }
+  public String[][] getPattern() { return null; }
+  public XSEnumeration[] getEnumerations() { return new XSEnumeration[0]; }
+  public XSObject getParentObject() {
+    throw new IllegalStateException("The " + getName() +
+                                     " type is declared outside of any schema and doesn't have a parent.");
+  }
+  public boolean isTopLevelObject() { return true; }
+
+  public XSComplexType getComplexType() {
+    throw new IllegalStateException("This is a complex type.");
+  }
+
+  public XSAtomicType getAtomicType() {
+    throw new IllegalStateException("The type " + getName() + " is not atomic.");
+  }
+
+  public XSListType getListType() {
+    throw new IllegalStateException("The global type " + getName() + " is no list type.");
+  }
+
+  public XSUnionType getUnionType() {
+    throw new IllegalStateException("The global type " + getName() + " is no union type.");
+  }
+
+  public XSObjectFactory getXSObjectFactory() {
+    throw new IllegalStateException("The global type " + getName() + " does not have an object factory.");
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnySimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnySimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnySimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:anySimpleType.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnySimpleType extends AbstractAtomicType {
+  private static final XSAnySimpleType theInstance = new XSAnySimpleType();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "anySimpleType", null);
+
+  protected XSAnySimpleType() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return false; }
+  public XSType getRestrictedType() {
+    throw new IllegalStateException("The type " + name +
+                                     " is the simple ur type and no restriction of another simple type.");
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSAttributable;
+import org.apache.ws.jaxme.xs.XSComplexType;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSParticle;
+import org.apache.ws.jaxme.xs.XSSimpleContentType;
+import org.apache.ws.jaxme.xs.XSSimpleType;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsComplexContentType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+
+/** <p>The "anyType" is a type with arbitrary content.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnyType extends AbstractBuiltinType
+    implements XSComplexType {
+  private static final XsQName qName = new XsQName(XSParser.XML_SCHEMA_URI, "anyType", null);
+  private static final XSAttributable[] attributes = new XSAttributable[0];
+  private static final XSAnyType theInstance = new XSAnyType();
+
+  private XSAnyType() {
+  }
+
+  public static final XSAnyType getInstance() {
+    return theInstance;
+  }
+
+  public boolean isSimple() { return false; }
+  public XSSimpleType getSimpleType() throws SAXException {
+    throw new IllegalStateException("The anyType is a complex type.");
+  }
+  public XSComplexType getComplexType() throws SAXException { return this; }
+  public XsQName getName() { return qName; }
+  public boolean isTopLevelObject() { return true; }
+  public XSObject getParentObject() { return null; }
+  public boolean hasSimpleContent() { return false; }
+  public boolean isEmpty() { return false; }
+  public boolean isElementOnly() { return false; }
+  public boolean isMixed() { return true; }
+  public XSParticle getParticle() { return null; }
+  public XSAttributable[] getAttributes() { return attributes; }
+  public boolean isExtension() { return false; }
+  public XSType getExtendedType() { return null; }
+  public boolean isRestriction() { return false; }
+  public XSType getRestrictedType() { return null; }
+    
+  public XsComplexContentType getComplexContentType() {
+    throw new IllegalStateException("The builtin type " + getName() + " does not have an inner instance of XsComplexContentType.");
+  }
+
+  public XSSimpleContentType getSimpleContent() {
+    throw new IllegalStateException("The builtin type " + getName() + " does not have simple content.");
+  }
+
+  public boolean isBuiltin() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyURI.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyURI.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSAnyURI.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:anyURI.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnyURI extends AbstractAtomicType {
+  private static final XSAnyURI theInstance = new XSAnyURI();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "anyURI", null);
+
+  protected XSAnyURI() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSAnyURI getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBase64Binary.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBase64Binary.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBase64Binary.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:base64Binary.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSBase64Binary extends AbstractAtomicType {
+  private static final XSBase64Binary theInstance = new XSBase64Binary();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "base64Binary", null);
+
+  protected XSBase64Binary() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSBase64Binary getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBoolean.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBoolean.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSBoolean.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:boolean.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSBoolean extends AbstractAtomicType {
+  private static final XSBoolean theInstance = new XSBoolean();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "boolean", null);
+
+  protected XSBoolean() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSBoolean getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSByte.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSByte.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSByte.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:byte type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSByte extends XSShort {
+  private static final XSByte theInstance = new XSByte();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "byte", null);
+
+  protected XSByte() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "127"; }
+
+  public String getMinInclusive() { return "-128"; }
+
+  public static XSType getInstance() { return theInstance; }
+  public XSType getRestrictedType() { return XSShort.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDate.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDate.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDate.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:gYearMonth.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSDate extends AbstractAtomicType {
+  private static final XSDate theInstance = new XSDate();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "date", null);
+
+  protected XSDate() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSDate getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDateTime.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDateTime.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDateTime.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:dateTime.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSDateTime extends AbstractAtomicType {
+  private static final XSDateTime theInstance = new XSDateTime();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "dateTime", null);
+
+  protected XSDateTime() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDecimal.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDecimal.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDecimal.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:decimal.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSDecimal extends AbstractAtomicType {
+  private static final XSDecimal theInstance = new XSDecimal();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "decimal", null);
+
+  protected XSDecimal() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDouble.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDouble.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDouble.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:double.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSDouble extends AbstractAtomicType {
+  private static final XSDouble theInstance = new XSDouble();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "double", null);
+
+  protected XSDouble() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDuration.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDuration.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSDuration.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:dateTime.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSDuration extends AbstractAtomicType {
+  private static final XSDuration theInstance = new XSDuration();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "duration", null);
+
+  protected XSDuration() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static final XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntities.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntities.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntities.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSEntities extends AbstractListType {
+  private static final XSEntities theInstance = new XSEntities();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "ENTITIES", null);
+  private static final Long MIN_LENGTH = new Long(1);
+
+  protected XSEntities() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public XSType getItemType() {
+    return XSEntity.getInstance();
+  }
+
+  public Long getMinLength() { return MIN_LENGTH; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isBuiltin() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntity.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntity.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSEntity.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:NCName type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSEntity extends XSNCName {
+  private static final XSEntity theInstance = new XSEntity();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "ENTITY", null);
+
+  protected XSEntity() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNCName.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSFloat.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSFloat.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSFloat.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:float.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSFloat extends AbstractAtomicType {
+  private static final XSFloat theInstance = new XSFloat();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "float", null);
+
+  protected XSFloat() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGDay.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGDay.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGDay.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:gDay.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSGDay extends AbstractAtomicType {
+  private static final XSGDay theInstance = new XSGDay();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "gDay", null);
+
+  protected XSGDay() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonth.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonth.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonth.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:gMonth.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSGMonth extends AbstractAtomicType {
+  private static final XSGMonth theInstance = new XSGMonth();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "gMonth", null);
+
+  protected XSGMonth() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonthDay.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonthDay.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGMonthDay.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:gMonthDay.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSGMonthDay extends AbstractAtomicType {
+  private static final XSGMonthDay theInstance = new XSGMonthDay();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "gMonthDay", null);
+
+  protected XSGMonthDay() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYear.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYear.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYear.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:gYear.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSGYear extends AbstractAtomicType {
+  private static final XSGYear theInstance = new XSGYear();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "gYear", null);
+
+  protected XSGYear() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYearMonth.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYearMonth.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSGYearMonth.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:gYearMonth.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSGYearMonth extends AbstractAtomicType {
+  private static final XSGYearMonth theInstance = new XSGYearMonth();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "gYearMonth", null);
+
+  protected XSGYearMonth() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSHexBinary.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSHexBinary.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSHexBinary.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:hexBinary.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSHexBinary extends AbstractAtomicType {
+  private static final XSHexBinary theInstance = new XSHexBinary();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "hexBinary", null);
+
+  protected XSHexBinary() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSID.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSID.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSID.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:ID type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSID extends XSNCName {
+  private static final XSID theInstance = new XSID();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "ID", null);
+
+  protected XSID() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNCName.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREF.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREF.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREF.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:IDREF type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSIDREF extends XSNCName {
+  private static final XSIDREF theInstance = new XSIDREF();
+
+  protected XSIDREF() {
+  }
+
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "IDREF", null);
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNCName.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREFs.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREFs.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSIDREFs.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSIDREFs extends AbstractListType {
+  private static final XSIDREFs theInstance = new XSIDREFs();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "IDREFS", null);
+  private static final Long MIN_LENGTH = new Long(1);
+
+  protected XSIDREFs() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public XSType getItemType() {
+    return XSIDREF.getInstance();
+  }
+
+  public Long getMinLength() { return MIN_LENGTH; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isBuiltin() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInt.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInt.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInt.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:int type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSInt extends XSLong {
+  private static final XSInt theInstance = new XSInt();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "int", null);
+
+  protected XSInt() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "2147483647"; }
+
+  public String getMinInclusive() { return "-2147483648"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSLong.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInteger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInteger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSInteger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:integer type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSInteger extends XSDecimal {
+  private static final XSInteger theInstance = new XSInteger();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "integer", null);
+  private static final Long ZERO = new Long(0);
+
+  protected XSInteger() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public Long getFractionDigits() { return ZERO; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSDecimal.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLanguage.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLanguage.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLanguage.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:language type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSLanguage extends XSToken {
+  private static final XSLanguage theInstance = new XSLanguage();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "language", null);
+
+  protected XSLanguage() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSToken.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLong.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLong.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSLong.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:long type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSLong extends XSInteger {
+  private static final XSLong theInstance = new XSLong();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "long", null);
+
+  protected XSLong() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "9223372036854775807"; }
+
+  public String getMinInclusive() { return "-9223372036854775808"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSInteger.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNCName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNCName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNCName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:NCName type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNCName extends XSName {
+  private static final XSNCName theInstance = new XSNCName();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "NCName", null);
+
+  protected XSNCName() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSName.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMToken.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMToken.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMToken.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:NMTOKEN type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNMToken extends XSToken {
+  private static final XSNMToken theInstance = new XSNMToken();
+
+  protected XSNMToken() {
+  }
+
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "NMTOKEN", null);
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSToken.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMTokens.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMTokens.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNMTokens.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSListType;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNMTokens extends AbstractListType implements XSListType {
+  private static final XSNMTokens theInstance = new XSNMTokens();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "NMTOKENS", null);
+  private static final Long MIN_LENGTH = new Long(1);
+
+  protected XSNMTokens() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public XSType getItemType() {
+    return XSNMToken.getInstance();
+  }
+
+  public Long getMinLength() { return MIN_LENGTH; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSListType getListType() { return this; }
+
+  public boolean isBuiltin() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSName extends XSToken {
+  private static final XSName theInstance = new XSName();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "Name", null);
+
+  protected XSName() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSToken.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNegativeInteger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNegativeInteger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNegativeInteger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:integer type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNegativeInteger extends XSNonPositiveInteger {
+  private static final XSNegativeInteger theInstance = new XSNegativeInteger();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "negativeInteger", null);
+
+  protected XSNegativeInteger() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "-1"; }
+
+  public String getMaxExclusive() { return "0"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNonPositiveInteger.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonNegativeInteger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonNegativeInteger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonNegativeInteger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:nonNegativeInteger type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNonNegativeInteger extends XSInteger {
+  private static final XSNonNegativeInteger theInstance = new XSNonNegativeInteger();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "nonNegativeInteger", null);
+
+  protected XSNonNegativeInteger() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMinInclusive() { return "0"; }
+
+  public String getMinExclusive() { return "-1"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSInteger.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonPositiveInteger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonPositiveInteger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNonPositiveInteger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:nonPositiveInteger type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNonPositiveInteger extends XSInteger {
+  private static final XSNonPositiveInteger theInstance = new XSNonPositiveInteger();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "nonPositiveInteger", null);
+
+  protected XSNonPositiveInteger() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "0"; }
+
+  public String getMaxExclusive() { return "1"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSInteger.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNormalizedString.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNormalizedString.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNormalizedString.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:normalizedString type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNormalizedString extends XSString {
+  private static final XSNormalizedString theInstance = new XSNormalizedString();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "normalizedString", null);
+
+  protected XSNormalizedString() {
+  }
+
+  public XsQName getName() { return name; }
+  public boolean isReplacing() { return true; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSString.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNotation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNotation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSNotation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:NOTATION.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSNotation extends AbstractAtomicType {
+  private static final XSNotation theInstance = new XSNotation();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "NOTATION", null);
+
+  protected XSNotation() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSPositiveInteger.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSPositiveInteger.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSPositiveInteger.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:positiveInteger type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSPositiveInteger extends XSNonNegativeInteger {
+  private static final XSPositiveInteger theInstance = new XSPositiveInteger();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "positiveInteger", null);
+
+  protected XSPositiveInteger() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMinInclusive() { return "1"; }
+
+  public String getMinExclusive() { return "0"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNonNegativeInteger.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSQName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSQName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSQName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:QName.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSQName extends AbstractAtomicType {
+  private static final XSQName theInstance = new XSQName();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "QName", null);
+
+  protected XSQName() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSShort.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSShort.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSShort.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:short type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSShort extends XSInt {
+  private static final XSShort theInstance = new XSShort();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "short", null);
+
+  protected XSShort() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "32767"; }
+
+  public String getMinInclusive() { return "-32768"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSInt.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSString.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSString.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSString.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:string.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSString extends AbstractAtomicType {
+  private static final XSString theInstance = new XSString();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "string", null);
+
+  protected XSString() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSTime.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSTime.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSTime.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The type xs:time.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSTime extends AbstractAtomicType {
+  private static final XSTime theInstance = new XSTime();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "time", null);
+
+  protected XSTime() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public boolean isRestriction() { return true; }
+  public XSType getRestrictedType() { return XSAnySimpleType.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSToken.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSToken.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSToken.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>The xs:token type.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSToken extends XSNormalizedString {
+  private static final XSToken theInstance = new XSToken();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "token", null);
+
+  protected XSToken() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public boolean isCollapsing() { return true; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNormalizedString.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedByte.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedByte.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedByte.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:unsignedByte type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUnsignedByte extends XSUnsignedShort {
+  private static final XSUnsignedByte theInstance = new XSUnsignedByte();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "unsignedByte", null);
+
+  protected XSUnsignedByte() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "255"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSUnsignedShort.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedInt.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedInt.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedInt.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:unsignedInt type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUnsignedInt extends XSUnsignedLong {
+  private static final XSUnsignedInt theInstance = new XSUnsignedInt();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "unsignedInt", null);
+
+  protected XSUnsignedInt() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "4294967295"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSUnsignedLong.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedLong.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedLong.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedLong.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:unsignedLong type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUnsignedLong extends XSNonNegativeInteger {
+  private static final XSUnsignedLong theInstance = new XSUnsignedLong();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "unsignedLong", null);
+
+  protected XSUnsignedLong() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "18446744073709551615"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSNonNegativeInteger.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedShort.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedShort.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/XSUnsignedShort.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.types;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.XSType;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>The xs:unsignedShort type</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSUnsignedShort extends XSUnsignedInt {
+  private static final XSUnsignedShort theInstance = new XSUnsignedShort();
+  private static final XsQName name = new XsQName(XSParser.XML_SCHEMA_URI, "unsignedShort", null);
+
+  protected XSUnsignedShort() {
+  }
+
+  public XsQName getName() { return name; }
+
+  public String getMaxInclusive() { return "65535"; }
+
+  public static XSType getInstance() { return theInstance; }
+
+  public XSType getRestrictedType() { return XSUnsignedInt.getInstance(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/types/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.types Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+XML schema data type models.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/DTDParser.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/DTDParser.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/DTDParser.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,798 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.xs.util;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.ws.jaxme.xs.XSSchema;
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.impl.XSContextImpl;
+import org.apache.ws.jaxme.xs.types.XSAnyType;
+import org.apache.ws.jaxme.xs.types.XSEntities;
+import org.apache.ws.jaxme.xs.types.XSEntity;
+import org.apache.ws.jaxme.xs.types.XSID;
+import org.apache.ws.jaxme.xs.types.XSIDREF;
+import org.apache.ws.jaxme.xs.types.XSIDREFs;
+import org.apache.ws.jaxme.xs.types.XSNMToken;
+import org.apache.ws.jaxme.xs.types.XSNMTokens;
+import org.apache.ws.jaxme.xs.types.XSNotation;
+import org.apache.ws.jaxme.xs.types.XSString;
+import org.apache.ws.jaxme.xs.xml.XsAGOccurs;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsEChoice;
+import org.apache.ws.jaxme.xs.xml.XsEComplexContent;
+import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
+import org.apache.ws.jaxme.xs.xml.XsERestriction;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsESimpleContent;
+import org.apache.ws.jaxme.xs.xml.XsGAttrDecls;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTAttribute;
+import org.apache.ws.jaxme.xs.xml.XsTComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTExplicitGroup;
+import org.apache.ws.jaxme.xs.xml.XsTExtensionType;
+import org.apache.ws.jaxme.xs.xml.XsTLocalComplexType;
+import org.apache.ws.jaxme.xs.xml.XsTLocalElement;
+import org.apache.ws.jaxme.xs.xml.XsTLocalSimpleType;
+import org.apache.ws.jaxme.xs.xml.XsTSimpleExtensionType;
+import org.apache.ws.jaxme.xs.xml.XsTTopLevelElement;
+import org.apache.ws.jaxme.xs.xml.impl.XsESchemaImpl;
+import org.apache.ws.jaxme.xs.xml.impl.XsObjectFactoryImpl;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.LocatorImpl;
+
+
+/** A SAX parser converting a DTD into an instance of XML Schema.
+ */
+public class DTDParser extends XSLogicalParser {
+	/** This class is used to collect the attributes in the
+     * DTD temporarily.
+	 */
+    public class DTDAttribute {
+    	private final String name, type, mode, value;
+        private final Locator loc;
+    	/** Sets the attributes name.
+    	 */
+        public DTDAttribute(String pName, String pType, String pMode, String pValue) {
+        	name = pName;
+            type = pType;
+            mode = pMode;
+            value = pValue;
+            Locator l = DTDParser.this.getLocator();
+            if (l == null) {
+            	loc = null;
+            } else {
+            	loc = new LocatorImpl(l);
+            }
+        }
+        /** Returns the attributes name.
+         */
+        public String getName() {
+        	return name;
+        }
+        /** Returns the attributes type.
+         */
+        public String getType() {
+            return type;
+        }
+        /** Returns the attributes mode.
+         */
+        public String getMode() {
+            return mode;
+        }
+        /** Returns the attributes value.
+         */
+        public String getValue() {
+            return value;
+        }
+        /** Returns the attributes locator.
+         */
+        public Locator getLocator() {
+        	return loc;
+        }
+    }
+
+    /** This class is used to collect the elements in the
+     * DTD temporarily.
+     */
+    public class DTDElement {
+    	private final String name;
+        private Locator loc;
+        private String model;
+        private Map attributes = new HashMap();
+        /** Creates a new element declaration with the given name.
+         */
+        public DTDElement(String pName) {
+        	name = pName;
+        }
+        /** Sets the elements content model.
+         */
+        public void setModel(String pModel) {
+            Locator l = DTDParser.this.getLocator();
+        	if (l == null) {
+        		loc = null;
+            } else {
+            	loc = new LocatorImpl(l);
+            }
+            model = pModel;
+        }
+        /** Returns the elements content model.
+         */
+        public String getModel() {
+        	return model;
+        }
+        /** Returns the elements name.
+         */
+        public String getName() {
+        	return name;
+        }
+        /** Adds a new attribute to the element.
+         */
+        public void addAttribute(DTDAttribute pAttribute) throws SAXException {
+        	if (attributes.put(pAttribute.getName(), pAttribute) != null) {
+        		throw new SAXParseException("Duplicate attribute " + pAttribute.getName()
+                                            + " in element " + getName(),
+                                            pAttribute.getLocator());
+            }
+        }
+        /** Returns the elements attributes.
+         */
+        public DTDAttribute[] getAttributes() {
+        	return (DTDAttribute[]) attributes.values().toArray(new DTDAttribute[attributes.size()]);
+        }
+        /** Returns the elements locator.
+         */
+        public Locator getLocator() {
+        	return loc;
+        }
+    }
+
+    protected static class ChildToken {
+        /** Type of a NAME token; see
+         * {@link DTDParser#parseChildren(XsTTopLevelElement, String, Locator)}
+         * for the definition of SEQUENCE.
+         */
+        public final static int SEQUENCE = 1;
+        /** Type of a NAME token; see
+         * {@link DTDParser#parseChildren(XsTTopLevelElement, String, Locator)}
+         * for the definition of CHOICE.
+         */
+        public final static int CHOICE = 2;
+        private final int type;
+        private final List tokens = new ArrayList();
+        private final String multiplicity;
+        protected ChildToken(int pType, String pMultiplicity) {
+        	type = pType;
+            multiplicity = pMultiplicity;
+        }
+        /** Returns the token type; either of
+         * {@link #SEQUENCE}, or {@link #CHOICE}.
+         */
+        public int getType() { return type; }
+        /** Adds a token to the list of tokens.
+         */
+        public void add(ChildToken pToken) {
+        	tokens.add(pToken);
+        }
+        /** Adds a name to the list of tokens.
+         */
+        public void add(String pName) {
+        	tokens.add(pName);
+        }
+        /** Returns the tokens childs.
+         */
+        public Object[] getChilds() {
+        	return tokens.toArray();
+        }
+        /** Returns the tokens multiplicity.
+         */
+        public String getMultiplicity() {
+        	return multiplicity;
+        }
+    }
+    
+    /** This class is similar to a StringReader, except that
+     * it allows to extend the input dynamically.
+     */
+    public static class StringBufferReader extends Reader {
+    	private final StringBuffer sb = new StringBuffer();
+
+    	/** Appends the given string to the input.
+    	 */
+        public void append(String pString) {
+        	sb.append(pString);
+        }
+
+        /** Invoked, if the internal buffer is empty.
+         * Subclasses may override this to query for more
+         * input.
+         */
+        public String requestInput() {
+            return null;
+        }
+
+        public int read(char[] pBuffer, int pOffset, int pLen) throws IOException {
+        	if (sb.length() == 0) {
+        		String s = requestInput();
+                if (s != null  &&  s.length() > 0) {
+                	append(s);
+                }
+                if (sb.length() == 0) {
+                	return -1;
+                }
+            }
+        	if (pLen >= sb.length()) {
+        		pLen = sb.length();
+        	}
+        	for (int i = 0;  i < pLen;  i++) {
+        		pBuffer[pOffset+i] = sb.charAt(i);
+        	}
+        	sb.delete(0, pLen);
+        	return pLen;
+        }
+
+		public void close() throws IOException {
+		}        
+    }
+
+    /** Implementation of a {@link DeclHandler} for reading
+     * the element and attribute declarations.
+     */
+    public class DtdDeclHandler extends DefaultHandler implements DeclHandler {
+        public void setDocumentLocator(Locator pLocator) {
+        	setLocator(pLocator);
+        }
+
+        public void elementDecl(String pName, String pModel) throws SAXException {
+            DTDElement element = (DTDElement) elements.get(pName);
+            if (element == null) {
+                element = new DTDElement(pName);
+            	elements.put(pName, element);
+            } else {
+            	if (element.getModel() != null) {
+            		throw new SAXParseException("Element " + pName
+                                                + " declared twice", getLocator());
+                }
+            }
+            element.setModel(pModel);
+		}
+
+		public void attributeDecl(String pElementName, String pAttributeName,
+                                  String pType, String pMode, String pValue) throws SAXException {
+            DTDElement element = (DTDElement) elements.get(pElementName);
+            if (element == null) {
+            	element = new DTDElement(pElementName);
+                elements.put(pElementName, element);
+            }
+            DTDAttribute attr = new DTDAttribute(pAttributeName, pType, pMode, pValue);
+            element.addAttribute(attr);
+		}
+
+		public void internalEntityDecl(String pName, String pValue) throws SAXException {
+        }
+
+		public void externalEntityDecl(String pName, String publicId, String pSystemId) throws SAXException {
+		}
+    }
+
+    private Locator locator;
+    private final Map elements = new HashMap();
+    private String dummyElementName;
+    private XsAnyURI targetNamespace;
+    private XSContext context;
+
+    public XSContext getData() {
+    	return context;
+    }
+
+    /** Returns the document locator.
+     */
+    public Locator getLocator() {
+    	return locator;
+    }
+
+    /** Sets the document locator.
+     */
+    public void setLocator(Locator pLocator) {
+    	locator = pLocator;
+        XSContext context = getData();
+        if (context != null) {
+        	context.setLocator(pLocator);
+        }
+    }
+
+    protected String getDummyElementName() {
+    	if (dummyElementName == null) {
+            for (int i = 0;  ;  i++) {
+            	String name = "dummyElement" + i;
+                if (!elements.containsKey(name)) {
+                	dummyElementName = name;
+                    break;
+                }
+            }
+        }
+        return dummyElementName;
+    }
+
+    /** Parses the given DTD, filling the parsers
+     * temporary map of elements.
+     */
+    protected void runXMLReader(final InputSource pSource)
+            throws ParserConfigurationException, IOException, SAXException {
+    	/* We cannot parse the DTD directly. Instead, we create
+         * a dummy XML document, which references the DTD as
+         * an external entity, and parse the XML document.
+         */
+        String s = "<!DOCTYPE a SYSTEM 'uri:dtd'><a/>";
+        InputSource isource = new InputSource(new StringReader(s));
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setValidating(false);
+        XMLReader xr = spf.newSAXParser().getXMLReader();
+        xr.setEntityResolver(new EntityResolver(){
+			public InputSource resolveEntity(String publicId, String pSystemId) throws SAXException, IOException {
+				return "uri:dtd".equals(pSystemId) ? pSource : null;
+            }
+        });
+        DtdDeclHandler handler = new DtdDeclHandler();
+        xr.setContentHandler(handler);
+        xr.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+        xr.parse(isource);
+    }
+
+    private ChildToken addToChildToken(ChildToken pToken, String pTokenValue,
+                                       String pMultiplicity, int pType,
+									   Locator pLocator)
+            throws SAXException {
+        if ("".equals(pTokenValue)) {
+        	throw new SAXParseException("Expected name, choice, or sequence, found empty string", pLocator);
+        }
+        if (pToken == null) {
+        	pToken = new ChildToken(pType, pMultiplicity);
+        } else {
+        	if (pType != pToken.getType()) {
+        		throw new SAXParseException("Mixed use of ',' and '|' in a choice or sequence", pLocator);
+            }
+        }
+        if (pTokenValue.startsWith("(")) {
+            pToken.add(parseChildren(pTokenValue, pLocator));
+        } else {
+            pToken.add(pTokenValue);
+        }
+        return pToken;
+    }
+
+    /** Returns a tokens multiplicity.
+     */
+    protected String getMultiplicity(String pToken) {
+    	if (pToken.endsWith("*")) {
+    		return "*";
+        } else if (pToken.endsWith("?")) {
+        	return "?";
+        } else if (pToken.endsWith("+")) {
+        	return "+";
+        } else {
+        	return "";
+        }
+    }
+
+    /** Converts a list of children into its tokens.
+     */
+    protected ChildToken parseChildren(String pModel, Locator pLocator)
+            throws SAXException {
+    	String model = pModel;
+        if (model.startsWith("(")) {
+        	model = model.substring(1).trim();
+        } else {
+        	throw new SAXParseException("A choice or sequence must start with '('",
+                                        pLocator);
+        }
+        String multiplicity = getMultiplicity(model);
+        model = model.substring(0, model.length() - multiplicity.length()).trim();
+        if (model.endsWith(")")) {
+        	model = model.substring(0, model.length()-1);
+        } else {
+        	throw new SAXParseException("A choice or sequence must end with ')', ')?', ')*', or ')+'",
+                                        pLocator);
+        }
+        ChildToken ct = null;
+        int level = 0;
+        int offset = 0;
+        for (int i = 0;  i < model.length();  i++) {
+        	char c = model.charAt(i);
+            switch (c) {
+                case '(': ++level; break;
+                case ')': --level; break;
+                case '|':
+                case ',':
+                    if (level == 0) {
+                    	String t = model.substring(offset, i).trim();
+                        ct = addToChildToken(ct, t, multiplicity,
+                                             (c == '|' ? ChildToken.CHOICE : ChildToken.SEQUENCE),
+											 pLocator);
+                        offset = i+1;
+                    }
+            }
+        }
+        String t = model.substring(offset).trim();
+        return addToChildToken(ct, t, multiplicity,
+        		               ct == null ? ChildToken.SEQUENCE : ct.getType(),
+        		               pLocator);
+    }
+
+    /** Sets the objects multiplicity.
+     */
+    protected void setMultiplicity(XsAGOccurs pOccurs, String pMultiplicity) {
+        if ("?".equals(pMultiplicity)) {
+            pOccurs.setMinOccurs(0);
+        } else if ("*".equals(pMultiplicity)) {
+            pOccurs.setMinOccurs(0);
+            pOccurs.setMaxOccurs("unbounded");
+        } else if ("+".equals(pMultiplicity)) {
+            pOccurs.setMaxOccurs("unbounded");
+        } else if (!"".equals(pMultiplicity)) {
+            throw new IllegalArgumentException("Invalid multiplicity: " + pMultiplicity);
+        }
+    }
+
+    /** Adds the childs to a group.
+     */
+    protected void addChildren(XsTTopLevelElement pElement,
+                               XsTExplicitGroup pGroup, ChildToken pToken,
+                               Locator pLocator)
+            throws SAXException {
+        setMultiplicity(pGroup, pToken.getMultiplicity());
+        Object[] tokens = pToken.getChilds();
+        for (int i = 0;  i < tokens.length;  i++) {
+        	Object o = tokens[i];
+            if (o instanceof String) {
+        		String name = (String) o;
+                String multiplicity = getMultiplicity(name);
+                name = name.substring(0, name.length()-multiplicity.length()).trim();
+                if (!elements.containsKey(name)) {
+                	throw new SAXParseException("Element " + pElement.getName()
+                                                + " references an undeclared element " + name,
+                                                pLocator);
+                }
+                XsTLocalElement e = pGroup.createElement();
+                e.setRef(new XsQName(getTargetNamespace(), getLocalPart(name)));
+                setMultiplicity(e, multiplicity);
+            } else if (o instanceof ChildToken) {
+                ChildToken ct = (ChildToken) o;
+                XsTExplicitGroup group;
+                if (ct.type == ChildToken.SEQUENCE) {
+                	group = pGroup.createSequence();
+                } else {
+                	group = pGroup.createChoice();
+                }
+                addChildren(pElement, group, ct, pLocator);
+            } else {
+            	throw new IllegalStateException("Unknown token type: " + tokens[i].getClass().getName());
+            }
+        }
+    }
+
+    /** Parses a content model with children. This content
+     * model is specified as follows:
+     * <pre>
+     *   children ::= (choice | seq) ('?' | '*' | '+')?
+     *   cp ::= (Name | choice | seq) ('?' | '*' | '+')?
+     *   choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'
+     *   seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
+     * </pre>
+     */
+    protected XsGAttrDecls parseChildren(XsTTopLevelElement pElement, String pModel,
+                                 Locator pLocator) throws SAXException {
+        ChildToken ct = parseChildren(pModel, pLocator);
+        XsTLocalComplexType complexType = pElement.createComplexType();
+        XsTExplicitGroup group;
+        if (ct.getType() == ChildToken.SEQUENCE) {
+        	group = complexType.createSequence();
+        } else {
+            group = complexType.createChoice();
+        }
+        addChildren(pElement, group, ct, pLocator);
+        return complexType;
+    }
+
+    /** Parses a mixed content model. The mixed content model
+     * is specified as follows:
+     * <pre>
+     *   Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*'
+     *       | '(' S? '#PCDATA' S? ')' 
+     * </pre>
+     */
+    protected XsGAttrDecls parseMixed(XsTTopLevelElement pElement, String pModel,
+                                      Locator pLocator, boolean pHasAttributes)
+            throws SAXException {
+        if (!pModel.startsWith("(")) {
+        	throw new SAXParseException("Mixed content model must start with '(#PCDATA'",
+                                        pLocator);
+        }
+        pModel = pModel.substring(1).trim();
+        if (!pModel.startsWith("#PCDATA")) {
+            throw new SAXParseException("Mixed content model must start with '(#PCDATA'",
+                    pLocator);
+        }
+        pModel = pModel.substring("#PCDATA".length()).trim();
+        boolean unbounded;
+        if (pModel.endsWith("*")) {
+            pModel = pModel.substring(0, pModel.length()-1).trim();
+            unbounded = true;
+        } else {
+        	unbounded = false;
+        }
+        if (!pModel.endsWith(")")) {
+            throw new SAXParseException("Mixed content model must end with ')' or ')*'",
+            		                    pLocator);
+        }
+        pModel = pModel.substring(0, pModel.length()-1);
+        if ("".equals(pModel)) {
+            XsQName qName = XSString.getInstance().getName();
+            qName = new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs");
+            if (pHasAttributes) {
+                XsTLocalComplexType complexType = pElement.createComplexType();
+                XsESimpleContent simpleContent = complexType.createSimpleContent();
+                XsTSimpleExtensionType ext = simpleContent.createExtension();
+                ext.setBase(qName);
+                return ext;
+            } else {
+            	pElement.setType(qName);
+                return null;
+            }
+        } else if (!unbounded) {
+        	throw new SAXParseException("Mixed content must be either #PCDATA or have multiplicity '*'",
+                                        pLocator);
+        } else {
+        	XsTLocalComplexType complexType = pElement.createComplexType();
+            complexType.setMixed(true);
+            XsEChoice choice = complexType.createChoice();
+            choice.setMinOccurs(0);
+            choice.setMaxOccurs("unbounded");
+            while (!"".equals(pModel)) {
+            	if (pModel.startsWith("|")) {
+            		pModel = pModel.substring(1).trim();
+                } else {
+                	throw new SAXParseException("Expected '|' while parsing mixed content", pLocator);
+                }
+                int offset = pModel.indexOf('|');
+                String name;
+                if (offset == -1) {
+                    name = pModel.trim();
+                    pModel = "";
+                } else {
+                	name = pModel.substring(0, offset).trim();
+                    pModel = pModel.substring(offset);
+                }
+                if (elements.containsKey(name)) {
+                	XsTLocalElement e = choice.createElement();
+                    e.setRef(new XsQName(getTargetNamespace(), getLocalPart(name)));
+                } else {
+                	throw new SAXParseException("Element " + pElement.getName()
+                                                + " references element " + name
+                                                + ", which is not declared",
+                                                pLocator);
+                }
+            }
+            return complexType;
+        }
+    }
+
+    /** Creates a new attribute.
+     */
+    protected void createAttribute(XsGAttrDecls pAttrDecls, DTDAttribute pAttribute)
+            throws SAXException {
+        XsTAttribute attr = pAttrDecls.createAttribute();
+        attr.setName(new XsNCName(getLocalPart(pAttribute.getName())));
+        String type = pAttribute.getType();
+        XsQName qName;
+        if ("CDATA".equals(type)) {
+        	qName = XSString.getInstance().getName();
+        } else if ("ID".equals(type)) {
+        	qName = XSID.getInstance().getName();
+        } else if ("IDREF".equals(type)) {
+            qName = XSIDREF.getInstance().getName();
+        } else if ("IDREFS".equals(type)) {
+            qName = XSIDREFs.getInstance().getName();
+        } else if ("ENTITY".equals(type)) {
+            qName = XSEntity.getInstance().getName();
+        } else if ("ENTITIES".equals(type)) {
+            qName = XSEntities.getInstance().getName();
+        } else if ("NMTOKEN".equals(type)) {
+            qName = XSNMToken.getInstance().getName();
+        } else if ("NMTOKENS".equals(type)) {
+            qName = XSNMTokens.getInstance().getName();
+        } else {
+            if (type.startsWith("NOTATION")  &&
+                Character.isWhitespace(type.charAt("NOTATION".length()))) {
+            	qName = XSNotation.getInstance().getName();
+            } else {
+            	qName = XSNMToken.getInstance().getName();
+            }
+            XsTLocalSimpleType simpleType = attr.createSimpleType();
+            XsERestriction restriction = simpleType.createRestriction();
+            restriction.setBase(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
+            if (type.startsWith("(")) {
+            	type = type.substring(1).trim();
+            } else {
+            	throw new SAXParseException("The enumeration in the type of attribute "
+                                            + pAttribute.getName()
+                                            + " must begin with an '('.",
+                                            pAttribute.getLocator());
+            }
+            if (type.endsWith(")")) {
+                type = type.substring(0, type.length()-1).trim();
+            } else {
+                throw new SAXParseException("The enumeration in the type of attribute "
+                                            + pAttribute.getName()
+                                            + " must begin with an '('.",
+                                            pAttribute.getLocator());
+            }
+            StringTokenizer st = new StringTokenizer(type, "|");
+            if (!st.hasMoreTokens()) {
+            	throw new SAXParseException("The enumeration in the type of attribute "
+                                            + pAttribute.getName()
+                                            + " contains no tokens.",
+                                            pAttribute.getLocator());
+            }
+            while (st.hasMoreTokens()) {
+                String token = st.nextToken().trim();
+                if ("".equals(token)) {
+                	throw new SAXParseException("The enumeration in the type of attribute "
+                                                + pAttribute.getName()
+                                                + " contains an empty token.",
+                                                pAttribute.getLocator());
+                }
+                XsEEnumeration enumeration = restriction.createEnumeration();
+                enumeration.setValue(token);
+            }
+            qName = null;
+        }
+        if (qName != null) {
+            attr.setType(new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs"));
+        }
+    }
+
+    private String getLocalPart(String pName) {
+        int offset = pName.indexOf(':');
+        if (offset >= 0) {
+            return pName.substring(offset+1);
+        } else {
+        	return pName;
+        }
+    }
+
+    /** Creates an element named <code>pName</code> with the
+     * content model <code>pModel</code> and the attribute
+     * list <code>pAttrs</code> in the schema <code>pSchema</code>.
+     */
+    protected XsTTopLevelElement createElement(XsESchema pSchema, String pName,
+                                               String pModel,
+                                               DTDAttribute[] pAttributes,
+                                               Locator pLocator)
+            throws SAXException {
+        XsTTopLevelElement result = pSchema.createElement();
+        result.setName(new XsNCName(getLocalPart(pName)));
+        final XsGAttrDecls attrDecls;
+        if ("EMPTY".equals(pModel)) {
+        	attrDecls = result.createComplexType();
+        } else if ("ANY".equals(pModel)) {
+            XsQName qName = XSAnyType.getInstance().getName();
+            qName = new XsQName(qName.getNamespaceURI(), qName.getLocalName(), "xs");
+        	if (pAttributes.length == 0) {
+                result.setType(qName);
+                attrDecls = null;
+            } else {
+                XsTComplexType complexType = result.createComplexType();
+                XsEComplexContent complexContent = complexType.createComplexContent();
+                XsTExtensionType extensionType = complexContent.createExtension();
+                extensionType.setBase(qName);
+                attrDecls = extensionType;
+            }
+        } else if (pModel.startsWith("(")) {
+            String pcData = pModel.substring(1).trim();
+            if (pcData.startsWith("#PCDATA")) {
+            	attrDecls = parseMixed(result, pModel, pLocator, pAttributes.length > 0);
+            } else {
+            	attrDecls = parseChildren(result, pModel, pLocator);
+            }
+        } else {
+        	throw new SAXParseException("Invalid content model in element " + pName
+                                        + ", expected EMPTY|ANY|(...",
+                                        pLocator);
+        }
+        for (int i = 0;  i < pAttributes.length;  i++) {
+        	createAttribute(attrDecls, pAttributes[i]);
+        }
+        return result;
+    }
+
+    /** Parses the given {@link org.xml.sax.InputSource} and
+     * converts it into an instance of
+     * {@link org.apache.ws.jaxme.xs.xml.XsESchema}.
+     */
+    protected void parse(XsESchema pSchema, InputSource pSource)
+            throws ParserConfigurationException, IOException, SAXException {
+    	runXMLReader(pSource);
+        for (Iterator iter = elements.values().iterator();  iter.hasNext();  ) {
+        	DTDElement element = (DTDElement) iter.next();
+        	String name = element.getName();
+            String model = element.getModel();
+            DTDAttribute[] attrs = element.getAttributes();
+            if (attrs.length > 0  &&  model == null) {
+            	throw new SAXParseException("The element " + name
+                                            + " is referred by attribute "
+                                            + attrs[0].getName()
+                                            + ", but never declared.",
+                                            attrs[0].getLocator());
+            }
+            createElement(pSchema, name, model, element.getAttributes(),
+                          element.getLocator());
+        }
+    }
+
+    public XSSchema parse(InputSource pInputSource)
+            throws ParserConfigurationException, IOException, SAXException {
+    	XsObjectFactoryImpl xsObjectFactory = new XsObjectFactoryImpl(){
+    		public XSContext getContext() {
+    			return getData();
+            }
+        };
+        context = new XSContextImpl();
+        context.setXSLogicalParser(this);
+        context.setXsObjectFactory(xsObjectFactory);
+        clearSyntaxSchemas();
+        XsESchema syntaxSchema = new XsESchemaImpl(context){
+        };
+        parse(syntaxSchema, pInputSource);
+        XSSchema schema = context.getXSObjectFactory().newXSSchema(context, syntaxSchema);
+        setSchema(schema);
+		parse(syntaxSchema, pInputSource.getSystemId());
+		schema.validate();
+        return schema;
+    }
+
+    /** Sets the created schemas target namespace.
+     */
+    public void setTargetNamespace(XsAnyURI pTargetNamespace) {
+    	targetNamespace = pTargetNamespace;
+    }
+
+    /** Returns the created schemas target namespace.
+     */
+    public XsAnyURI getTargetNamespace() {
+        return targetNamespace;
+    }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateFormat.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateFormat.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateFormat.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.jaxme.xs.util;
+
+
+/** <p>An instance of {@link java.text.Format}, which may be used to parse
+ * and format <code>xs:dateTime</code> values.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsDateFormat extends XsDateTimeFormat {
+    /** Creates a new instance.
+     */
+    public XsDateFormat() {
+        super(true, false);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateTimeFormat.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateTimeFormat.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsDateTimeFormat.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,291 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.util;
+
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+
+/** <p>An instance of {@link java.text.Format}, which may be used
+ * to parse and format <code>xs:dateTime</code> values.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsDateTimeFormat extends Format {
+    final boolean parseDate;
+    final boolean parseTime;
+
+    XsDateTimeFormat(boolean pParseDate, boolean pParseTime) {
+        parseDate = pParseDate;
+        parseTime = pParseTime;
+    }
+
+    /** Creates a new instance.
+     */
+    public XsDateTimeFormat() {
+        this(true, true);
+    }
+
+    private int parseInt(String pString, int pOffset, StringBuffer pDigits) {
+        int length = pString.length();
+        pDigits.setLength(0);
+        while (pOffset < length) {
+            char c = pString.charAt(pOffset);
+            if (Character.isDigit(c)) {
+                pDigits.append(c);
+                ++pOffset;
+            } else {
+                break;
+            }
+        }
+        return pOffset;
+    }
+
+    public Object parseObject(String pString, ParsePosition pParsePosition) {
+        if (pString == null) {
+            throw new NullPointerException("The String argument must not be null.");
+        }
+        if (pParsePosition == null) {
+            throw new NullPointerException("The ParsePosition argument must not be null.");
+        }
+        int offset = pParsePosition.getIndex();
+        int length = pString.length();
+
+        boolean isMinus = false;
+        StringBuffer digits = new StringBuffer();
+        int year, month, mday;
+        if (parseDate) {
+            // Sign
+            if (offset < length) {
+                char c = pString.charAt(offset);
+                if (c == '+') {
+                    ++offset;
+                } else if (c == '-') {
+                    ++offset;
+                    isMinus = true;
+                }
+            }
+
+	        offset = parseInt(pString, offset, digits);
+	        if (digits.length() < 4) {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	        year = Integer.parseInt(digits.toString());
+	
+	        if (offset < length  &&  pString.charAt(offset) == '-') {
+	            ++offset;
+	        } else {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	
+	        offset = parseInt(pString, offset, digits);
+	        if (digits.length() != 2) {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	        month = Integer.parseInt(digits.toString());
+	
+	        if (offset < length &&  pString.charAt(offset) == '-') {
+	            ++offset;
+	        } else {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	
+	        offset = parseInt(pString, offset, digits);
+	        if (digits.length() != 2) {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	        mday = Integer.parseInt(digits.toString());
+
+	        if (parseTime) {
+	            if (offset < length  &&  pString.charAt(offset) == 'T') {
+	                ++offset;
+	            } else {
+	                pParsePosition.setErrorIndex(offset);
+	                return null;
+	            }
+	        }
+        } else {
+            year = month = mday = 0;
+        }
+
+        int hour, minute, second, millis;
+        if (parseTime) {
+	        offset = parseInt(pString, offset, digits);
+	        if (digits.length() != 2) {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	        hour = Integer.parseInt(digits.toString());
+	
+	        if (offset < length  &&  pString.charAt(offset) == ':') {
+	            ++offset;
+	        } else {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	
+	        offset = parseInt(pString, offset, digits);
+	        if (digits.length() != 2) {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	        minute = Integer.parseInt(digits.toString());
+	
+	        if (offset < length  &&  pString.charAt(offset) == ':') {
+	            ++offset;
+	        } else {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	
+	        offset = parseInt(pString, offset, digits);
+	        if (digits.length() != 2) {
+	            pParsePosition.setErrorIndex(offset);
+	            return null;
+	        }
+	        second = Integer.parseInt(digits.toString());
+	
+	        if (offset < length  &&  pString.charAt(offset) == '.') {
+	            ++offset;
+	            offset = parseInt(pString, offset, digits);
+	            if (digits.length() > 0) {
+	                millis = Integer.parseInt(digits.toString());
+	            } else {
+	                millis = 0;
+	            }
+	        } else {
+	            millis = 0;
+	        }
+        } else {
+            hour = minute = second = millis = 0;
+        }
+
+        digits.setLength(0);
+        digits.append("GMT");
+        if (offset < length) {
+            char c = pString.charAt(offset);
+            if (c == 'Z') {
+                // Ignore UTC, it is the default
+                ++offset;
+            } else if (c == '+' || c == '-') {
+                digits.append(c);
+                ++offset;
+                for (int i = 0;  i < 5;  i++) {
+                    if (offset >= length) {
+                        pParsePosition.setErrorIndex(offset);
+                        return null;
+                    }
+                    c = pString.charAt(offset);
+                    if ((i != 2  &&  Character.isDigit(c))  ||
+                        (i == 2  &&  c == ':')) {
+                        digits.append(c);
+                    } else {
+                        pParsePosition.setErrorIndex(offset);
+                        return null;
+                    }
+                    ++offset;
+                }
+            }
+        }
+
+        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(digits.toString()));
+        cal.set(isMinus ? -year : year, parseDate ? month-1 : month, mday, hour, minute, second);
+        cal.set(Calendar.MILLISECOND, millis);
+        pParsePosition.setIndex(offset);
+        return cal;
+    }
+
+    private void append(StringBuffer pBuffer, int pNum, int pMinLen) {
+        String s = Integer.toString(pNum);
+        for (int i = s.length();  i < pMinLen;  i++) {
+            pBuffer.append('0');
+        }
+        pBuffer.append(s);
+    }
+
+    public StringBuffer format(Object pCalendar, StringBuffer pBuffer, FieldPosition pPos) {
+        if (pCalendar == null) {
+            throw new NullPointerException("The Calendar argument must not be null.");
+        }
+        if (pBuffer == null) {
+            throw new NullPointerException("The StringBuffer argument must not be null.");
+        }
+        if (pPos == null) {
+            throw new NullPointerException("The FieldPosition argument must not be null.");
+        }
+
+        Calendar cal = (Calendar) pCalendar;
+        if (parseDate) {
+	        int year = cal.get(Calendar.YEAR);
+	        if (year < 0) {
+	            pBuffer.append('-');
+	            year = -year;
+	        }
+	        append(pBuffer, year, 4);
+	        pBuffer.append('-');
+	        append(pBuffer, cal.get(Calendar.MONTH)+1, 2);
+	        pBuffer.append('-');
+	        append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2);
+	        if (parseTime) {
+	            pBuffer.append('T');
+	        }
+        }
+        if (parseTime) {
+	        append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2);
+	        pBuffer.append(':');
+	        append(pBuffer, cal.get(Calendar.MINUTE), 2);
+	        pBuffer.append(':');
+	        append(pBuffer, cal.get(Calendar.SECOND), 2);
+	        int millis = cal.get(Calendar.MILLISECOND);
+	        if (millis > 0) {
+	            pBuffer.append('.');
+	            append(pBuffer, millis, 3);
+	        }
+        }
+        TimeZone tz = cal.getTimeZone();
+        // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
+        int offset = cal.get(Calendar.ZONE_OFFSET);
+        if (tz.inDaylightTime(cal.getTime())) {
+        	offset += cal.get(Calendar.DST_OFFSET);
+        }
+        if (offset == 0) {
+            pBuffer.append('Z');
+        } else {
+            if (offset < 0) {
+                pBuffer.append('-');
+                offset = -offset;
+            } else {
+                pBuffer.append('+');
+            }
+            int minutes = offset / (60*1000);
+            int hours = minutes / 60;
+            minutes -= hours * 60;
+            append(pBuffer, hours, 2);
+            pBuffer.append(':');
+            append(pBuffer, minutes, 2);
+        }
+        return pBuffer;
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsTimeFormat.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsTimeFormat.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/XsTimeFormat.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.util;
+
+
+/** <p>An instance of {@link java.text.Format}, which may be used to parse
+ * and format <code>xs:dateTime</code> values.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTimeFormat extends XsDateTimeFormat {
+    /** Creates a new instance.
+     */
+    public XsTimeFormat() {
+        super(false, true);
+    }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/util/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.util Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Utility classes used by JaxMeXS.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XmlLang.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XmlLang.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XmlLang.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of <code>xml:lang</code>.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XmlLang {
+  private String lang;
+
+  public XmlLang(String pLang) {
+    if (pLang == null) {
+      throw new NullPointerException("An URI must not be null");
+    }
+    lang = pLang;
+  }
+
+  public boolean equals(Object o) {
+    return o != null  &&  o instanceof XmlLang  &&  lang.equals(((XmlLang) o).lang);
+  }
+
+  public int hashCode() {
+    return lang.hashCode();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGDefRef.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGDefRef.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGDefRef.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+/** <p>Interface of the attribute group <code>xs:defRef</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:attributeGroup name="defRef"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        for element, group and attributeGroup,
+ *        which both define and reference
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:attribute name="name" type="xs:NCName"/&gt;
+ *    &lt;xs:attribute name="ref" type="xs:QName"/&gt;
+ *  &lt;/xs:attributeGroup&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> The 'name' and 'ref' attributes
+ * are mutually exclusive. This is checked by the 'validate' method.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsAGDefRef {
+  public void setName(XsNCName pName);
+  public XsNCName getName();
+  public void setRef(XsQName pRef);
+  public XsQName getRef();
+
+  /** <p>Validates whether the attribute groups constraints are met.</p>
+   */
+  public void validate() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGOccurs.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGOccurs.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAGOccurs.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+/** <p>Interface of the attribute group <code>xs:occurs</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:attributeGroup name="occurs"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        for all particles
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:attribute name="minOccurs" type="xs:nonNegativeInteger"
+ *      use="optional" default="1"/&gt;
+ *    &lt;xs:attribute name="maxOccurs" type="xs:allNNI"
+ *      use="optional" default="1"/&gt;
+ *  &lt;/xs:attributeGroup&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> The implementation must ensure
+ * that either 'maxOccurs' is unbounded or 'minOccurs' <= 'maxOccurs'.
+ * This is checked by the <code>validate</code> method.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsAGOccurs {
+  /** <p>Either of 'unbounded' or a nonnegative integer value.</p>
+   */
+  public void setMaxOccurs(String pMaxOccurs);
+  /** <p>-1 for 'unbounded'</p>
+   */
+  public int getMaxOccurs();
+
+  public void setMinOccurs(int pMinOccurs);
+  public int getMinOccurs();
+
+  /** <p>Verifies whether the attribute group constraints are met.</p>
+   */
+  public void validate() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAnyURI.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAnyURI.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsAnyURI.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of <code>xs:anyURI</code>.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsAnyURI {
+  private String uri;
+
+  public XsAnyURI(String pURI) {
+    if (pURI == null) {
+      throw new NullPointerException("An URI must not be null");
+    }
+    uri = pURI;
+  }
+
+  public boolean equals(Object o) {
+    return o != null  &&  o instanceof XsAnyURI  &&  uri.equals(((XsAnyURI) o).uri);
+  }
+
+  public int hashCode() {
+    return uri.hashCode();
+  }
+
+  public String toString() {
+    return uri;
+  }
+
+  public String getURI() {
+    return uri;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsBlockSet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsBlockSet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsBlockSet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import java.util.StringTokenizer;
+
+/** <p>Implementation of <code>xs:derivationset</code>.
+ * Follows this specification:
+ * <pre>
+ *   &lt;xs:simpleType name="blockSet"&gt;
+ *     &lt;xs:annotation&gt;
+ *       &lt;xs:documentation&gt;
+ *         A utility type, not for public use
+ *       &lt;/xs:documentation&gt;
+ *       &lt;xs:documentation&gt;
+ *         #all or (possibly empty) subset of {substitution, extension,
+ *         restriction}
+ *       &lt;/xs:documentation&gt;
+ *     &lt;/xs:annotation&gt;
+ *     &lt;xs:union&gt;
+ *       &lt;xs:simpleType&gt;
+ *         &lt;xs:restriction base="xs:token"&gt;
+ *           &lt;xs:enumeration value="#all"/&gt;
+ *         &lt;/xs:restriction&gt;
+ *       &lt;/xs:simpleType&gt;
+ *       &lt;xs:simpleType&gt;
+ *         &lt;xs:list&gt;
+ *           &lt;xs:simpleType&gt;
+ *             &lt;xs:restriction base="xs:derivationControl"&gt;
+ *               &lt;xs:enumeration value="extension"/&gt;
+ *               &lt;xs:enumeration value="restriction"/&gt;
+ *               &lt;xs:enumeration value="substitution"/&gt;
+ *             &lt;/xs:restriction&gt;
+ *           &lt;/xs:simpleType&gt;
+ *         &lt;/xs:list&gt;
+ *       &lt;/xs:simpleType&gt;
+ *     &lt;/xs:union&gt;
+ *   &lt;/xs:simpleType&gt;
+ * </pre>
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsBlockSet {
+  boolean extensionAllowed, restrictionAllowed, substitutionAllowed;
+
+  /** <p>Returns whether extension is allowed.</p>
+   */
+  public boolean isExtensionAllowed() {
+    return extensionAllowed;
+  }
+
+  /** <p>Sets whether extension is allowed.</p>
+   */
+  public void setExtensionAllowed(boolean pExtensionAllowed) {
+    extensionAllowed = pExtensionAllowed;
+  }
+
+  /** <p>Returns whether restriction is allowed.</p>
+   */
+  public boolean isRestrictionAllowed() {
+    return restrictionAllowed;
+  }
+
+  /** <p>Sets whether restriction is allowed.</p>
+   */
+  public void setRestrictionAllowed(boolean pRestrictionAllowed) {
+    restrictionAllowed = pRestrictionAllowed;
+  }
+
+  /** <p>Returns whether restriction is allowed.</p>
+   */
+  public boolean isSubstitutionAllowed() {
+    return substitutionAllowed;
+  }
+
+  /** <p>Sets whether restriction is allowed.</p>
+   */
+  public void setSubstitutionAllowed(boolean pSubstitutionAllowed) {
+    substitutionAllowed = pSubstitutionAllowed;
+  }
+
+  /** <p>Returns a <code>DerivationSet</code> matching the given
+   * value.</p>
+   */
+  public static XsBlockSet valueOf(String pValue) {
+    return new XsBlockSet(pValue);
+  }
+
+  /** <p>Creates a new DerivationSet with the given value.</p>
+   */
+  public XsBlockSet(String pValue) {
+    if ("#all".equals(pValue)) {
+      setExtensionAllowed(true);
+      setRestrictionAllowed(true);
+      setSubstitutionAllowed(true);
+    } else {
+      for (StringTokenizer st = new StringTokenizer(pValue, " ");  st.hasMoreTokens();  ) {
+        String s = st.nextToken();
+        if ("extension".equals(s)) {
+          setExtensionAllowed(true);
+        } else if ("restriction".equals(s)) {
+          setRestrictionAllowed(true);
+        } else if ("substitution".equals(s)) {
+          setSubstitutionAllowed(true);
+        } else {
+          throw new IllegalArgumentException("Invalid block set value: " + pValue + "; the token " + s + " did not resolve to either of 'extension', 'restriction', or 'substitution'.");
+        }
+      }
+    }
+  }
+
+  public String toString() {
+    StringBuffer sb = new StringBuffer();
+    if (extensionAllowed) {
+      sb.append("extension");
+    }
+    if (restrictionAllowed) {
+      if (sb.length() > 0) {
+        sb.append(" ");
+      }
+      sb.append("restriction");
+    }
+    if (substitutionAllowed) {
+      if (sb.length() > 0) {
+        sb.append(" ");
+      }
+      sb.append("substitution");
+    }
+    return sb.toString();
+  }
+
+  public boolean equals(Object o) {
+    if (o == null  ||  !(XsBlockSet.class.equals(o.getClass()))) {
+      return false;
+    }
+    XsBlockSet bs = (XsBlockSet) o;
+    return bs.extensionAllowed == extensionAllowed  &&
+            bs.restrictionAllowed == restrictionAllowed  &&
+            bs.substitutionAllowed == substitutionAllowed;
+  }
+
+  public int hashCode() {
+    int result = 0;
+    if (extensionAllowed) { result += 1; }
+    if (restrictionAllowed) { result += 2; }
+    if (substitutionAllowed) { result += 4; }
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsComplexContentType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsComplexContentType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsComplexContentType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsComplexContentType {
+  private final String name;
+  private XsComplexContentType(String pName) {
+    name = pName;
+  }
+  public String toString() { return name; }
+  public boolean equals(Object o) {
+    return o != null  &&  (o instanceof XsComplexContentType)  &&  ((XsComplexContentType) o).name.equals(name);
+  }
+  public int hashCode() { return name.hashCode(); }
+
+  /** <p>For elements with 'complexContent' model: The content type empty.</p>
+   * @see org.apache.ws.jaxme.xs.XSComplexType#isEmpty()
+   * @see org.apache.ws.jaxme.xs.XSComplexType#getComplexContentType()
+   */
+  public static final XsComplexContentType EMPTY = new XsComplexContentType("empty");
+
+  /** <p>For elements with 'complexContent' model: The content type elementOnly.</p>
+   * @see org.apache.ws.jaxme.xs.XSComplexType#isElementOnly()
+   * @see org.apache.ws.jaxme.xs.XSComplexType#getComplexContentType()
+   */
+  public static final XsComplexContentType ELEMENT_ONLY = new XsComplexContentType("elementOnly");
+
+  /** <p>For elements with 'complexContent' model: The content type mixed.</p>
+   * @see org.apache.ws.jaxme.xs.XSComplexType#isMixed()
+   * @see org.apache.ws.jaxme.xs.XSComplexType#getComplexContentType()
+   */
+  public static final XsComplexContentType MIXED = new XsComplexContentType("mixed");
+
+  private static final XsComplexContentType[] instances = new XsComplexContentType[]{ EMPTY, ELEMENT_ONLY, MIXED };
+
+  public static XsComplexContentType valueOf(String pValue) {
+    for (int i = 0;  i < instances.length;  i++) {
+      if (instances[i].toString().equals(pValue)) {
+        return instances[i];
+      }
+    }
+    throw new IllegalArgumentException("Invalid complexContent type: " + pValue);
+  }
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsDerivationSet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsDerivationSet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsDerivationSet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import java.util.StringTokenizer;
+
+/** <p>Implementation of <code>xs:derivationset</code>.
+ * Follows this specification:
+ * <pre>
+ *  &lt;xs:simpleType name="derivationSet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        A utility type, not for public use
+ *      &lt;/xs:documentation&gt;
+ *      &lt;xs:documentation&gt;
+ *        #all or (possibly empty) subset of {extension, restriction}
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:union&gt;
+ *      &lt;xs:simpleType&gt;
+ *        &lt;xs:restriction base="xs:token"&gt;
+ *          &lt;xs:enumeration value="#all"/&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:simpleType&gt;
+ *      &lt;xs:simpleType&gt;
+ *        &lt;xs:list itemType="xs:reducedDerivationControl"/&gt;
+ *      &lt;/xs:simpleType&gt;
+ *    &lt;/xs:union&gt;
+ *  &lt;/xs:simpleType&gt;
+ * </pre>
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsDerivationSet {
+  boolean extensionAllowed, restrictionAllowed;
+
+  /** <p>Returns whether extension is allowed.</p>
+   */
+  public boolean isExtensionAllowed() {
+    return extensionAllowed;
+  }
+
+  /** <p>Sets whether extension is allowed.</p>
+   */
+  public void setExtensionAllowed(boolean pExtensionAllowed) {
+    extensionAllowed = pExtensionAllowed;
+  }
+
+  /** <p>Returns whether restriction is allowed.</p>
+   */
+  public boolean isRestrictionAllowed() {
+    return restrictionAllowed;
+  }
+
+  /** <p>Sets whether restriction is allowed.</p>
+   */
+  public void setRestrictionAllowed(boolean pRestrictionAllowed) {
+    restrictionAllowed = pRestrictionAllowed;
+  }
+
+  /** <p>Returns a <code>DerivationSet</code> matching the given
+   * value.</p>
+   */
+  public static XsDerivationSet valueOf(String pValue) {
+    return new XsDerivationSet(pValue);
+  }
+
+  /** <p>Creates a new DerivationSet with the given value.</p>
+   */
+  public XsDerivationSet(String pValue) {
+    if ("#all".equals(pValue)) {
+      setExtensionAllowed(true);
+      setRestrictionAllowed(true);
+    } else {
+      for (StringTokenizer st = new StringTokenizer(pValue, " ");  st.hasMoreTokens();  ) {
+        String s = st.nextToken();
+        if ("extension".equals(s)) {
+          setExtensionAllowed(true);
+        } else if ("restriction".equals(s)) {
+          setRestrictionAllowed(true);
+        } else {
+          throw new IllegalArgumentException("Invalid derivation set value: " + pValue + "; the token " + s + " did not resolve to either of 'extension' or 'restriction'");
+        }
+      }
+    }
+  }
+
+  public String toString() {
+    if (isExtensionAllowed()) {
+      if (isRestrictionAllowed()) {
+        return "extension restriction";
+      } else {
+        return "extension";
+      }
+    } else {
+      if (isRestrictionAllowed()) {
+        return "restriction";
+      } else {
+        return "";
+      }
+    }
+  }
+
+  public boolean equals(Object o) {
+    if (o == null  ||  !(XsDerivationSet.class.equals(o.getClass()))) {
+      return false;
+    }
+    XsDerivationSet ds = (XsDerivationSet) o;
+    return ds.extensionAllowed == extensionAllowed  &&
+            ds.restrictionAllowed == restrictionAllowed;
+  }
+
+  public int hashCode() {
+    int result = 0;
+    if (extensionAllowed) { result += 1; }
+    if (restrictionAllowed) { result += 2; }
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAnnotation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAnnotation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAnnotation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:annotation</code>, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:element name="annotation" id="annotation"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:openAttrs"&gt;
+ *          &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *            &lt;xs:element ref="xs:appinfo"/&gt;
+ *            &lt;xs:element ref="xs:documentation"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEAnnotation extends XsTOpenAttrs {
+  public void setId(XsID pId);
+  public XsID getId();
+
+  /** <p>Creates a new 'appinfo' child element.</p>
+   */
+  public XsEAppinfo createAppinfo();
+  /** <p>Returns all the 'appinfo' child elements in the
+   * order of creation by {@link #createAppinfo()}.</p>
+   */
+  public XsEAppinfo[] getAppinfos();
+
+  /** <p>Creates a new 'documentation' child element.</p>
+   */
+  public XsEDocumentation createDocumentation();
+  /** <p>Returns all the 'documentation' child elements in
+   * the order of creation by {@link #createDocumentation()}.</p>
+   */
+  public XsEDocumentation[] getDocumentations();
+
+  /** <p>Returns all the annotations child elements in the
+   * order of creation.</p>
+   */
+  public Object[] getChilds();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAny.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAny.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAny.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of the <code>xs:any</code> element, as
+ * specified by the following:
+ * <pre>
+ *  &lt;xs:element name="any" id="any"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:wildcard"&gt;
+ *          &lt;xs:attributeGroup ref="xs:occurs"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEAny extends XsTWildcard, XsAGOccurs, XsTNestedParticle {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAppinfo.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAppinfo.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEAppinfo.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:appinfo</code>, as specified by the
+ * following:
+ * <pre>
+ *  &lt;xs:element name="appinfo" id="appinfo"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType mixed="true"&gt;
+ *      &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:any processContents="lax"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *      &lt;xs:attribute name="source" type="xs:anyURI"/&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEAppinfo extends XsObject {
+  public void setSource(XsAnyURI pSource);
+  public XsAnyURI getSource();
+
+  public Object[] getChilds();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEChoice.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEChoice.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEChoice.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:choice</code> element, with the following
+ * specification:
+ * <pre>
+ *  &lt;xs:element name="choice" type="xs:explicitGroup" id="choice"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEChoice extends XsTExplicitGroup, XsTTypeDefParticle, XsTNestedParticle {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEComplexContent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEComplexContent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEComplexContent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the element <code>xs:complexContent</code>,
+ * as specified by:
+ * <pre>
+ *  &lt;xs:element name="complexContent" id="complexContent"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *          source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:choice&gt;
+ *            &lt;xs:element name="restriction" type="xs:complexRestrictionType"/&gt;
+ *            &lt;xs:element name="extension" type="xs:extensionType"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:attribute name="mixed" type="xs:boolean"&gt;
+ *            &lt;xs:annotation&gt;
+ *              &lt;xs:documentation&gt;
+ *                Overrides any setting on complexType parent.
+ *              &lt;/xs:documentation&gt;
+ *            &lt;/xs:annotation&gt;
+ *          &lt;/xs:attribute&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEComplexContent extends XsTAnnotated {
+  public void setMixed(boolean pMixed);
+  public Boolean isMixed();
+
+  public XsTComplexRestrictionType createRestriction();
+  public XsTComplexRestrictionType getRestriction();
+
+  public XsTExtensionType createExtension();
+  public XsTExtensionType getExtension();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEDocumentation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEDocumentation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEDocumentation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:documentation</code>, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:element name="documentation" id="documentation"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType mixed="true"&gt;
+ *      &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:any processContents="lax"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *      &lt;xs:attribute name="source" type="xs:anyURI"/&gt;
+ *      &lt;xs:attribute ref="xml:lang"/&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEDocumentation extends XsObject {
+	/** <p>Sets the documentation elements language. Defaults to
+     * null.</p>
+	 * @param pLang The language abbreviation, for example "en".
+	 */
+    public void setLang(XmlLang pLang);
+
+    /** <p>Returns the documentation elements language. Defaults to
+     * null.</p>
+     * @return The language abbreviation, for example "en".
+     */
+    public XmlLang getLang();
+
+    /** <p>Sets the URI to read for the documentations contents.
+     * Defaults to null.</p>
+     * @param pSource Source URI
+     */
+    public void setSource(XsAnyURI pSource);
+
+    /** <p>Returns the URI to read for the documentations contents.
+     * Defaults to null.</p>
+     * @return Source URI
+     */
+	public XsAnyURI getSource();
+	
+	/** <p>Returns the embedded text. The embedded text is specified as the
+	 * concatenation of all text nodes. Child elements, if any, are ignored.</p>
+	 */
+	public String getText();
+	
+	/** <p>Returns whether the documentation is simple. In other words, whether
+	 * it consists of text only. If not, you should use {@link #getChilds()}
+	 * rather than {@link #getText()}.</p>
+	 */
+	public boolean isTextOnly();
+	
+	/** <p>Returns the array of all child objects. Child objects may either
+	 * be Strings or DOM nodes.</p>
+	 */
+	public Object[] getChilds();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEEnumeration.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEEnumeration.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEEnumeration.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of an <code>xs:enumeration</code> element,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEEnumeration extends XsTFacetBase {
+  public void setValue(String pValue);
+  public String getValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEField.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEField.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEField.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:field</code> element, with the
+ * following specification:
+ * <pre>
+ *   <xs:element name="field" id="field">
+ *     <xs:annotation>
+ *       <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ *     </xs:annotation>
+ *     <xs:complexType>
+ *       <xs:complexContent>
+ *         <xs:extension base="xs:annotated">
+ *           <xs:attribute name="xpath" use="required">
+ *             <xs:simpleType>
+ *               <xs:annotation>
+ *                 <xs:documentation>
+ *                   A subset of XPath expressions for use in fields
+ *                 </xs:documentation>
+ *                 <xs:documentation>
+ *                   A utility type, not for public use
+ *                 </xs:documentation>
+ *               </xs:annotation>
+ *               <xs:restriction base="xs:token">
+ *                 <xs:annotation>
+ *                   <xs:documentation>
+ *                     The following pattern is intended to allow XPath
+ *                     expressions per the same EBNF as for selector,
+ *                     with the following change:
+ *                       Path    ::=    ('.//')? ( Step '/' )* ( Step | '@' NameTest ) 
+ *                   </xs:documentation>
+ *                 </xs:annotation>
+ *                 <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+ *                 </xs:pattern>
+ *               </xs:restriction>
+ *             </xs:simpleType>
+ *           </xs:attribute>
+ *         </xs:extension>
+ *       </xs:complexContent>
+ *     </xs:complexType>
+ *   </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEField extends XsTAnnotated {
+  public void setXpath(XsToken pXpath);
+  public XsToken getXpath();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEFractionDigits.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEFractionDigits.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEFractionDigits.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:fractionDigits</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEFractionDigits extends XsTNumFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEImport.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEImport.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEImport.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:import</code>, as specified by
+ * the following:
+ * <pre>
+ *  &lt;xs:element name="import" id="import"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:attribute name="namespace" type="xs:anyURI"/&gt;
+ *          &lt;xs:attribute name="schemaLocation" type="xs:anyURI"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEImport extends XsTAnnotated {
+  public void setNamespace(XsAnyURI pNamespace);
+
+  public XsAnyURI getNamespace();
+
+  public void setSchemaLocation(XsAnyURI pSchemaLocation);
+
+  public XsAnyURI getSchemaLocation();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEInclude.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEInclude.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEInclude.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:include</code>, as specified
+ * by the following declaration:
+ * <pre>
+ *  &lt;xs:element name="include" id="include"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEInclude extends XsTAnnotated {
+  public void setSchemaLocation(XsAnyURI pSchemaLocation);
+  public XsAnyURI getSchemaLocation();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKey.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKey.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKey.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of the <code>xs:key</code> element, specified
+ * as follows:
+ * <pre>
+ *  &lt;xs:element name="key" type="xs:keybase" id="key"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEKey extends XsTKeybase, XsTIdentityConstraint {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKeyref.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKeyref.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEKeyref.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:keyref</code> element, with the
+ * following specification:
+ * <pre>
+ *  <xs:element name="keyref" id="keyref">
+ *    <xs:annotation>
+ *      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ *    </xs:annotation>
+ *    <xs:complexType>
+ *      <xs:complexContent>
+ *        <xs:extension base="xs:keybase">
+ *          <xs:attribute name="refer" type="xs:QName" use="required"/>
+ *        </xs:extension>
+ *      </xs:complexContent>
+ *    </xs:complexType>
+ *  </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEKeyref extends XsTKeybase, XsTIdentityConstraint {
+  public void setRefer(XsQName pRefer);
+  public XsQName getRefer();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsELength.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsELength.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsELength.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:length</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="length" id="length" type="xs:numFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-length"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsELength extends XsTNumFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEList.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEList.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEList.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of <code>xs:list</code>, following
+ * the specification below:
+ * <pre>
+ *  &lt;xs:element name="list" id="list"&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:annotation&gt;
+ *        &lt;xs:documentation
+ *            source="http://www.w3.org/TR/xmlschema-2/#element-list"&gt;
+ *          itemType attribute and simpleType child are mutually
+ *          exclusive, but one or other is required
+ *        &lt;/xs:documentation&gt;
+ *      &lt;/xs:annotation&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element name="simpleType" type="xs:localSimpleType"
+ *                minOccurs="0"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="itemType" type="xs:QName" use="optional"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEList extends XsTAnnotated {
+  public void setItemType(XsQName pName);
+
+  public XsQName getItemType();
+
+  public XsTLocalSimpleType createSimpleType();
+
+  public XsTLocalSimpleType getSimpleType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxExclusive.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxExclusive.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxExclusive.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:maxExclusive</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="maxExclusive" id="maxExclusive" type="xs:facet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEMaxExclusive extends XsTFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxInclusive.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxInclusive.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxInclusive.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:maxInclusive</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="maxInclusive" id="maxInclusive" type="xs:facet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEMaxInclusive extends XsTFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxLength.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxLength.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMaxLength.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Iinterface of <code>xs:maxLength</code>,
+ * following this specification:
+ * <pre>
+ *  <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ *    <xs:annotation>
+ *      <xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ *    </xs:annotation>
+ *  </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEMaxLength extends XsTNumFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinExclusive.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinExclusive.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinExclusive.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:minExclusive</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="minExclusive" id="minExclusive" type="xs:facet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEMinExclusive extends XsTFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinInclusive.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinInclusive.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinInclusive.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:minInclusive</code>,
+ * following this specification:
+ * <pre>
+ *  <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ *    <xs:annotation>
+ *      <xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ *    </xs:annotation>
+ *  </xs:element>
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEMinInclusive extends XsTFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinLength.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinLength.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEMinLength.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:minLength</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="minLength" id="minLength" type="xs:numFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEMinLength extends XsTNumFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsENotation.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsENotation.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsENotation.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:notation</code> element, with
+ * the following specification:
+ * <pre>
+ *  <xs:element name="notation" id="notation">
+ *    <xs:annotation>
+ *      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ *    </xs:annotation>
+ *    <xs:complexType>
+ *      <xs:complexContent>
+ *        <xs:extension base="xs:annotated">
+ *          <xs:attribute name="name" type="xs:NCName" use="required"/>
+ *          <xs:attribute name="public" type="xs:public" use="required"/>
+ *          <xs:attribute name="system" type="xs:anyURI"/>
+ *        </xs:extension>
+ *      </xs:complexContent>
+ *    </xs:complexType>
+ *  </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsENotation extends XsTAnnotated {
+  public void setName(XsNCName pName);
+  public XsNCName getName();
+
+  public void setPublic(XsToken pPublic);
+  public XsToken getPublic();
+
+  public void setSystem(XsAnyURI pSystem);
+  public XsAnyURI getSystem();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEPattern.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEPattern.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEPattern.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:pattern</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="pattern" id="pattern" type="xs:noFixedFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEPattern extends XsTFacetBase {
+  public void setValue(String pValue);
+  public String getValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERedefine.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERedefine.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERedefine.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of <code>xs:redefine</code>, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:element name="redefine" id="redefine"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:openAttrs"&gt;
+ *          &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *            &lt;xs:element ref="xs:annotation"/&gt;
+ *            &lt;xs:group ref="xs:redefinable"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/&gt;
+ *          &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsERedefine extends XsTOpenAttrs {
+  public void setId(XsID pID);
+  public XsID getId();
+
+  public void setSchemaLocation(XsAnyURI pSchemaLocation);
+  public XsAnyURI getSchemaLocation();
+
+  public XsEAnnotation createAnnotation();
+
+  public XsETopLevelSimpleType createSimpleType();
+
+  public XsTComplexType createComplexType();
+
+  public XsTGroup createGroup();
+
+  public XsTAttributeGroup createAttributeGroup();
+
+  /** <p>Returns the child elemens. Any element in the object array is an instance of
+   * {@link XsETopLevelSimpleType}, {@link XsTComplexType}, {@link XsTGroup}, or
+   * {@link XsTAttributeGroup}.</p>
+   */
+  public Object[] getChilds();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERestriction.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERestriction.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsERestriction.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:restriction</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="restriction" id="restriction"&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:annotation&gt;
+ *        &lt;xs:documentation
+ *            source="http://www.w3.org/TR/xmlschema-2/#element-restriction"&gt;
+ *          base attribute and simpleType child are mutually
+ *          exclusive, but one or other is required
+ *        &lt;/xs:documentation&gt;
+ *      &lt;/xs:annotation&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:group ref="xs:simpleRestrictionModel"/&gt;
+ *          &lt;xs:attribute name="base" type="xs:QName" use="optional"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ *
+ *  &lt;xs:group name="simpleRestrictionModel"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/&gt;
+ *      &lt;xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ *
+ *  &lt;xs:group name="facets"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        We should use a substitution group for facets, but
+ *        that's ruled out because it would allow users to
+ *        add their own, which we're not ready for yet.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:minExclusive"/&gt;
+ *      &lt;xs:element ref="xs:minInclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxExclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxInclusive"/&gt;
+ *      &lt;xs:element ref="xs:totalDigits"/&gt;
+ *      &lt;xs:element ref="xs:fractionDigits"/&gt;
+ *      &lt;xs:element ref="xs:length"/&gt;
+ *      &lt;xs:element ref="xs:minLength"/&gt;
+ *      &lt;xs:element ref="xs:maxLength"/&gt;
+ *      &lt;xs:element ref="xs:enumeration"/&gt;
+ *      &lt;xs:element ref="xs:whiteSpace"/&gt;
+ *      &lt;xs:element ref="xs:pattern"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsERestriction extends XsTAnnotated, XsGSimpleRestrictionModel {
+  public void setBase(XsQName pBase);
+
+  public XsQName getBase();
+
+  public XsTLocalSimpleType createSimpleType() throws SAXException;
+
+  public XsTLocalSimpleType getSimpleType();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESchema.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESchema.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESchema.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2003,2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+
+
+/** <p>Implementation of xs:schema. Follows this specification:
+ * <pre>
+ *  &lt;xs:element name="schema" id="schema"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:openAttrs"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *              &lt;xs:element ref="xs:include"/&gt;
+ *              &lt;xs:element ref="xs:import"/&gt;
+ *              &lt;xs:element ref="xs:redefine"/&gt;
+ *              &lt;xs:element ref="xs:annotation"/&gt;
+ *            &lt;/xs:choice&gt;
+ *            &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
+ *              &lt;xs:group ref="xs:schemaTop"/&gt;
+ *              &lt;xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *            &lt;/xs:sequence&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="targetNamespace" type="xs:anyURI"/&gt;
+ *          &lt;xs:attribute name="version" type="xs:token"/&gt;
+ *          &lt;xs:attribute name="finalDefault" type="xs:derivationSet" use="optional" default=""/&gt;
+ *          &lt;xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/&gt;
+ *          &lt;xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/&gt;
+ *          &lt;xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/&gt;
+ *          &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *          &lt;xs:attribute ref="xml:lang"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *
+ *    &lt;xs:key name="element"&gt;
+ *      &lt;xs:selector xpath="xs:element"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="attribute"&gt;
+ *      &lt;xs:selector xpath="xs:attribute"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="type"&gt;
+ *      &lt;xs:selector xpath="xs:complexType|xs:simpleType"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="group"&gt;
+ *      &lt;xs:selector xpath="xs:group"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="attributeGroup"&gt;
+ *      &lt;xs:selector xpath="xs:attributeGroup"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="notation"&gt;
+ *      &lt;xs:selector xpath="xs:notation"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="identityConstraint"&gt;
+ *      &lt;xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *  &lt;/xs:element&gt;
+ *
+ *  &lt;xs:group name="schemaTop"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        This group is for the
+ *        elements which occur freely at the top level of schemas.
+ *        All of their types are based on the "annotated" type by extension.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:group ref="xs:redefinable"/&gt;
+ *      &lt;xs:element ref="xs:element"/&gt;
+ *      &lt;xs:element ref="xs:attribute"/&gt;
+ *      &lt;xs:element ref="xs:notation"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre>
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsESchema extends XsTOpenAttrs, XsSchemaHeader {
+  public XsEInclude createInclude();
+
+  public XsEImport createImport();
+
+  public XsERedefine createRedefine();
+
+  public XsEAnnotation createAnnotation();
+
+  public XsETopLevelSimpleType createSimpleType();
+
+  public XsTComplexType createComplexType();
+
+  public XsTNamedGroup createGroup();
+
+  public XsTAttributeGroup createAttributeGroup();
+
+  public XsTTopLevelElement createElement();
+
+  public XsTAttribute createAttribute();
+
+  public XsENotation createNotation();
+
+  /** <p>Returns the schema's childs. These are instances of
+   * {@link XsEInclude}, {@link XsEImport}, {@link XsERedefine},
+   * {@link XsEAnnotation}, {@link XsETopLevelSimpleType},
+   * {@link XsTComplexType}, {@link XsTGroup},
+   * {@link XsTAttributeGroup}, {@link XsTTopLevelElement}, or
+   * {@link XsENotation}, in the order of the document. This
+   * order is the same order than by invocation of the
+   * corresponding {@link #createInclude()}, {@link #createImport()},
+   * ... method calls.</p>
+   * <p>Be aware, that a subclass of XsESchema may very well include
+   * other objects.</p>
+   */
+  public Object[] getChilds();
+
+  public void setTargetNamespace(XsAnyURI pAnyURI);
+  public void setVersion(XsToken pToken);
+  public void setId(XsID pId);
+  public void setFinalDefault(XsDerivationSet pSet);
+  public void setElementFormDefault(XsFormChoice pChoice);
+  public void setBlockDefault(XsBlockSet pSet);
+  public void setAttributeFormDefault(XsFormChoice pChoice);
+  
+  /** <p>Returns the schema context.</p>
+   */
+  public XSContext getContext();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESelector.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESelector.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESelector.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:selector</code> element, specified
+ * by the following:
+ * <pre>
+ *   <xs:element name="selector" id="selector">
+ *     <xs:annotation>
+ *       <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ *     </xs:annotation>
+ *     <xs:complexType>
+ *       <xs:complexContent>
+ *         <xs:extension base="xs:annotated">
+ *           <xs:attribute name="xpath" use="required">
+ *             <xs:simpleType>
+ *               <xs:annotation>
+ *                 <xs:documentation>
+ *                   A subset of XPath expressions for use
+ *                   in selectors
+ *                 </xs:documentation>
+ *                 <xs:documentation>
+ *                   A utility type, not for public use
+ *                 </xs:documentation>
+ *               </xs:annotation>
+ *               <xs:restriction base="xs:token">
+ *                 <xs:annotation>
+ *                   <xs:documentation>
+ *                     The following pattern is intended to allow XPath
+ *                     expressions per the following EBNF:
+ *                       Selector    ::=    Path ( '|' Path )*
+ *                       Path        ::=    ('.//')? Step ( '/' Step )*
+ *                       Step    ::=    '.' | NameTest
+ *                       NameTest    ::=    QName | '*' | NCName ':' '*'
+ *                                          child:: is also allowed
+ *                   </xs:documentation>
+ *                 </xs:annotation>
+ *                 <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ *                 </xs:pattern>
+ *               </xs:restriction>
+ *             </xs:simpleType>
+ *           </xs:attribute>
+ *         </xs:extension>
+ *       </xs:complexContent>
+ *     </xs:complexType>
+ *   </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsESelector extends XsTAnnotated {
+  public void setXpath(XsToken pXpath);
+  public XsToken getXpath();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESequence.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESequence.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESequence.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:sequence</code> element, with the following
+ * specification:
+ * <pre>
+ *  &lt;xs:element name="sequence" type="xs:explicitGroup" id="sequence"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsESequence extends XsTExplicitGroup, XsTTypeDefParticle, XsTNestedParticle {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESimpleContent.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESimpleContent.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsESimpleContent.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of <code>xs:simpleContent</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:element name="simpleContent" id="simpleContent"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:choice&gt;
+ *            &lt;xs:element name="restriction" type="xs:simpleRestrictionType"/&gt;
+ *            &lt;xs:element name="extension" type="xs:simpleExtensionType"/&gt;
+ *          &lt;/xs:choice&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsESimpleContent extends XsTAnnotated {
+  public XsTSimpleRestrictionType createRestriction();
+
+  public XsTSimpleRestrictionType getRestriction();
+
+  public XsTSimpleExtensionType createExtension();
+
+  public XsTSimpleExtensionType getExtension();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETopLevelSimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETopLevelSimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETopLevelSimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:simpleType>, as specified by the following:
+ * <pre>
+ *  &lt;xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ *
+ *  &lt;xs:complexType name="topLevelSimpleType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:simpleType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:simpleDerivation"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" use="required" type="xs:NCName"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Required at the top level
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsETopLevelSimpleType extends XsTSimpleType, XsRedefinable {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETotalDigits.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETotalDigits.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsETotalDigits.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:totalDigits</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="totalDigits" id="totalDigits"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:restriction base="xs:numFacet"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="value" type="xs:positiveInteger" use="required"/&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsETotalDigits extends XsTNumFacet {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnion.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnion.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnion.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:union</code>, following the
+ * specification below:
+ * <pre>
+ *  &lt;xs:element name="union" id="union"&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:annotation&gt;
+ *        &lt;xs:documentation
+ *            source="http://www.w3.org/TR/xmlschema-2/#element-union"&gt;
+ *          memberTypes attribute must be non-empty or there must be
+ *          at least one simpleType child
+ *        &lt;/xs:documentation&gt;
+ *      &lt;/xs:annotation&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element name="simpleType" type="xs:localSimpleType"
+ *                minOccurs="0" maxOccurs="unbounded"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="memberTypes" use="optional"&gt;
+ *            &lt;xs:simpleType&gt;
+ *              &lt;xs:list itemType="xs:QName"/&gt;
+ *            &lt;/xs:simpleType&gt;
+ *          &lt;/xs:attribute&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEUnion extends XsTAnnotated {
+  /** <p>Creates a new, local simple type as a member type of the union.</p>
+   */
+  public XsTLocalSimpleType createSimpleType();
+
+  /** <p>Returns an array of member types which have been
+   * created using {@link #createSimpleType()}.</p>
+   */
+  public XsTLocalSimpleType[] getSimpleTypes();
+
+  /** <p>Sets the qualified names of simple types being used as member
+   * types of the union.</p>
+   */
+  public void setMemberTypes(XsQName[] pTypes);
+
+  /** <p>Returns an array of member types which have been added
+   * using {@link #setMemberTypes(XsQName[])}. This array may be null,
+   * if the method {@link #setMemberTypes(XsQName[])} wasn't invoked
+   * at all, or it may be the empty array, if an empty string was
+   * passed as argument to the method.</p>
+   */
+  public XsQName[] getMemberTypes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnique.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnique.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEUnique.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:unique</code> element, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:element name="unique" type="xs:keybase" id="unique"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEUnique extends XsTKeybase, XsTIdentityConstraint {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEWhiteSpace.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEWhiteSpace.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsEWhiteSpace.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:whiteSpace</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="whiteSpace" id="whiteSpace"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:restriction base="xs:facet"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="value" use="required"&gt;
+ *            &lt;xs:simpleType&gt;
+ *              &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *                &lt;xs:enumeration value="preserve"/&gt;
+ *                &lt;xs:enumeration value="replace"/&gt;
+ *                &lt;xs:enumeration value="collapse"/&gt;
+ *              &lt;/xs:restriction&gt;
+ *            &lt;/xs:simpleType&gt;
+ *          &lt;/xs:attribute&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsEWhiteSpace extends XsTFacet {
+  public boolean isPreserving();
+  public boolean isReplacing();
+  public boolean isCollapsing();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsFormChoice.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsFormChoice.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsFormChoice.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of the following simple type:
+ * <pre>
+ *  &lt;xs:simpleType name="formChoice"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        A utility type, not for public use
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *      &lt;xs:enumeration value="qualified"/&gt;
+ *      &lt;xs:enumeration value="unqualified"/&gt;
+ *    &lt;/xs:restriction&gt;
+ *  &lt;/xs:simpleType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsFormChoice {
+  public static final XsFormChoice QUALIFIED = new XsFormChoice("qualified");
+  public static final XsFormChoice UNQUALIFIED = new XsFormChoice("unqualified");
+  private final String value;
+  private XsFormChoice(String pValue) {
+    value = pValue;
+  }
+  public String toString() { return value; }
+  public String getValue() { return value; }
+  public int hashCode() {
+    return value.hashCode();
+  }
+  public boolean equals(Object o) {
+    return o != null  &&  XsFormChoice.class.equals(o.getClass())  &&
+      value.equals(((XsFormChoice) o).value);
+  }
+  public static XsFormChoice valueOf(String pValue) {
+    if ("qualified".equals(pValue)) {
+      return QUALIFIED;
+    } else if ("unqualified".equals(pValue)) {
+      return UNQUALIFIED;
+    } else {
+      throw new IllegalArgumentException("Invalid form value: " + pValue + ", expected either of 'qualified' or 'unqualified'" );
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAllModel.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAllModel.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAllModel.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of <code>xs:allModel</code>, as specified by
+ * the following:
+ * <pre>
+ *  &lt;xs:group name="allModel"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *      &lt;xs:element name="element" minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:complexType&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;restricted max/min&lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *          &lt;xs:complexContent&gt;
+ *            &lt;xs:restriction base="xs:localElement"&gt;
+ *              &lt;xs:sequence&gt;
+ *                &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *                &lt;xs:choice minOccurs="0"&gt;
+ *                  &lt;xs:element name="simpleType" type="xs:localSimpleType"/&gt;
+ *                  &lt;xs:element name="complexType" type="xs:localComplexType"/&gt;
+ *                &lt;/xs:choice&gt;
+ *                &lt;xs:group ref="xs:identityConstraint" minOccurs="0"
+ *                    maxOccurs="unbounded"/&gt;
+ *              &lt;/xs:sequence&gt;
+ *              &lt;xs:attribute name="minOccurs" use="optional" default="1"&gt;
+ *                &lt;xs:simpleType&gt;
+ *                  &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
+ *                    &lt;xs:enumeration value="0"/&gt;
+ *                    &lt;xs:enumeration value="1"/&gt;
+ *                  &lt;/xs:restriction&gt;
+ *                &lt;/xs:simpleType&gt;
+ *              &lt;/xs:attribute&gt;
+ *              &lt;xs:attribute name="maxOccurs" use="optional" default="1"&gt;
+ *                &lt;xs:simpleType&gt;
+ *                  &lt;xs:restriction base="xs:allNNI"&gt;
+ *                    &lt;xs:enumeration value="0"/&gt;
+ *                    &lt;xs:enumeration value="1"/&gt;
+ *                  &lt;/xs:restriction&gt;
+ *                &lt;/xs:simpleType&gt;
+ *              &lt;/xs:attribute&gt;
+ *            &lt;/xs:restriction&gt;
+ *          &lt;/xs:complexContent&gt;
+ *        &lt;/xs:complexType&gt;
+ *       &lt;/xs:element&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ * <p><em>Implementation note: The above restriction of a {@link XsTLocalElement}
+ * is interpreted as a usual local element, except that the <code>minOccurs</code>
+ * and <code>maxOccurs</code> attributes must be 0 or 1.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGAllModel {
+  public XsEAnnotation createAnnotation();
+  public XsEAnnotation getAnnotation();
+  public XsTLocalElement createElement();
+  public XsTLocalElement[] getElements();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAttrDecls.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAttrDecls.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGAttrDecls.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:attrDecls</code>, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:group name="attrDecls"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:element name="attribute" type="xs:attribute"/&gt;
+ *        &lt;xs:element name="attributeGroup" type="xs:attributeGroupRef"/&gt;
+ *      &lt;/xs:choice&gt;
+ *      &lt;xs:element ref="xs:anyAttribute" minOccurs="0"/&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGAttrDecls {
+  /** <p>Creates a new instance of {@link XsTAttribute}.</p>
+   */
+  public XsTAttribute createAttribute();
+
+  /** <p>Returns an array of all attributes created by
+   * {@link #createAttribute()}.</p>
+   */
+  public XsTAttribute[] getAttributes();
+
+  /** <p>Creates a new instance of {@link XsTAttributeGroup}.</p>
+   */
+  public XsTAttributeGroupRef createAttributeGroup();
+
+  /** <p>Returns an array of all attribute groups created by
+   * {@link #createAttributeGroup()};
+   */
+  public XsTAttributeGroupRef[] getAttributeGroups();
+
+  /** <p>Creates a new instance of {@link XsTWildcard}.</p>
+   */
+  public XsTWildcard createAnyAttribute();
+
+  /** <p>Returns the instance created by {@link #createAnyAttribute()},
+   * or null, if the method wasn't called.</p>
+   */
+  public XsTWildcard getAnyAttribute();
+
+  /** <p>Returns all objects created by {@link #createAttribute()},
+   * {@link #createAttributeGroup()}, or {@link #createAnyAttribute()},
+   * in the order of the corresponding method calls.</p>
+   */
+  public Object[] getAllAttributes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGComplexTypeModel.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGComplexTypeModel.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGComplexTypeModel.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the group <code>xs:complexTypeModel</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:group name="complexTypeModel"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:simpleContent"/&gt;
+ *      &lt;xs:element ref="xs:complexContent"/&gt;
+ *      &lt;xs:sequence&gt;
+ *        &lt;xs:annotation&gt;
+ *          &lt;xs:documentation&gt;
+ *            This branch is short for &amp;lt;complexContent&amp;gt;
+ *            &amp;lt;restriction base="xs:anyType"&amp;gt;
+ *            ...
+ *            &amp;lt;/restriction&amp;gt;
+ *            &amp;lt;/complexContent&amp;gt;
+ *          &lt;/xs:documentation&gt;
+ *        &lt;/xs:annotation&gt;
+ *        &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *        &lt;xs:group ref="xs:attrDecls"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGComplexTypeModel extends XsGTypeDefParticle, XsGAttrDecls {
+  public XsESimpleContent createSimpleContent();
+  public XsESimpleContent getSimpleContent();
+
+  public XsEComplexContent createComplexContent();
+  public XsEComplexContent getComplexContent();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGIdentityConstraint.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGIdentityConstraint.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGIdentityConstraint.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of the group <code>xs:identityConstraint</code>,
+ * specified as follows:
+ * <pre>
+ *  <xs:group name="identityConstraint">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        The three kinds of identity constraints, all with
+ *        type of or derived from 'keybase'.
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:choice>
+ *      <xs:element ref="xs:unique"/>
+ *      <xs:element ref="xs:key"/>
+ *      <xs:element ref="xs:keyref"/>
+ *    </xs:choice>
+ *  </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGIdentityConstraint {
+  public XsEUnique createUnique();
+
+  public XsEKey createKey();
+
+  public XsEKeyref createKeyref();
+
+  public XsTIdentityConstraint[] getIdentityConstraints();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGNestedParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGNestedParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGNestedParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:nestedParticle</code> group,
+ * as specified by the following:
+ * <pre>
+ *  <xs:group name="nestedParticle">
+ *    <xs:choice>
+ *      <xs:element name="element" type="xs:localElement"/>
+ *      <xs:element name="group" type="xs:groupRef"/>
+ *      <xs:element ref="xs:choice"/>
+ *      <xs:element ref="xs:sequence"/>
+ *      <xs:element ref="xs:any"/>
+ *    </xs:choice>
+ *  </xs:group>
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGNestedParticle {
+  public XsTLocalElement createElement();
+  public XsTLocalElement getElement();
+
+  public XsTGroupRef createGroupRef();
+  public XsTGroupRef getGroupRef();
+
+  public XsEChoice createChoice();
+  public XsEChoice getChoice();
+
+  public XsESequence createSequence();
+  public XsESequence getSequence();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of the <code>xs:particle</code> group,
+ * with the following specification:
+ * <pre>
+ *  &lt;xs:group name="particle"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element name="element" type="xs:localElement"/&gt;
+ *      &lt;xs:element name="group" type="xs:groupRef"/&gt;
+ *      &lt;xs:element ref="xs:all"/&gt;
+ *      &lt;xs:element ref="xs:choice"/&gt;
+ *      &lt;xs:element ref="xs:sequence"/&gt;
+ *      &lt;xs:element ref="xs:any"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGParticle {
+  public XsTLocalElement createElement();
+
+  public XsTGroupRef createGroup();
+
+  public XsTAll createAll();
+
+  public XsESequence createSequence();
+
+  public XsEChoice createChoice();
+
+  public XsEAny createAny();
+
+  public XsTParticle[] getParticles();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGSimpleRestrictionModel.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGSimpleRestrictionModel.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGSimpleRestrictionModel.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of <code>xs:simpleRestrictionModel</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:group name="simpleRestrictionModel"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/&gt;
+ *      &lt;xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ *
+ *  &lt;xs:group name="facets"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        We should use a substitution group for facets, but
+ *        that's ruled out because it would allow users to
+ *        add their own, which we're not ready for yet.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:minExclusive"/&gt;
+ *      &lt;xs:element ref="xs:minInclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxExclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxInclusive"/&gt;
+ *      &lt;xs:element ref="xs:totalDigits"/&gt;
+ *      &lt;xs:element ref="xs:fractionDigits"/&gt;
+ *      &lt;xs:element ref="xs:length"/&gt;
+ *      &lt;xs:element ref="xs:minLength"/&gt;
+ *      &lt;xs:element ref="xs:maxLength"/&gt;
+ *      &lt;xs:element ref="xs:enumeration"/&gt;
+ *      &lt;xs:element ref="xs:whiteSpace"/&gt;
+ *      &lt;xs:element ref="xs:pattern"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGSimpleRestrictionModel {
+  public XsTLocalSimpleType createSimpleType() throws SAXException;
+  public XsTLocalSimpleType getSimpleType();
+
+  public XsEMinExclusive createMinExclusive() throws SAXException;
+  public XsEMinExclusive getMinExclusive();
+
+  public XsEMinInclusive createMinInclusive() throws SAXException;
+  public XsEMinInclusive getMinInclusive();
+
+  public XsEMaxExclusive createMaxExclusive() throws SAXException;
+  public XsEMaxExclusive getMaxExclusive();
+
+  public XsEMaxInclusive createMaxInclusive() throws SAXException;
+  public XsEMaxInclusive getMaxInclusive();
+
+  public XsETotalDigits createTotalDigits() throws SAXException;
+  public XsETotalDigits getTotalDigits();
+
+  public XsEFractionDigits createFractionDigits() throws SAXException;
+  public XsEFractionDigits getFractionDigits();
+
+  public XsELength createLength() throws SAXException;
+  public XsELength getLength();
+
+  public XsEMinLength createMinLength() throws SAXException;
+  public XsEMinLength getMinLength();
+
+  public XsEMaxLength createMaxLength() throws SAXException;
+  public XsEMaxLength getMaxLength();
+
+  public XsEWhiteSpace createWhiteSpace() throws SAXException;
+  public XsEWhiteSpace getWhiteSpace();
+
+  public XsEPattern createPattern() throws SAXException;
+  public XsEPattern[] getPatterns();
+
+  public XsEEnumeration createEnumeration() throws SAXException;
+  public XsEEnumeration[] getEnumerations();
+
+  /** <p>Returns whether any facet has been defined.</p>
+   */
+  public boolean hasFacets();
+
+  /** <p>Returns an array of all facets.</p>
+   */
+  public XsTFacetBase[] getFacets();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGTypeDefParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGTypeDefParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsGTypeDefParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of the <code>xs:typeDefParticle</code> group,
+ * as specified by the following:
+ * <pre>
+ *  <xs:group name="typeDefParticle">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        'complexType' uses this
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:choice>
+ *      <xs:element name="group" type="xs:groupRef"/>
+ *      <xs:element ref="xs:all"/>
+ *      <xs:element ref="xs:choice"/>
+ *      <xs:element ref="xs:sequence"/>
+ *    </xs:choice>
+ *  </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsGTypeDefParticle {
+  public XsTGroupRef createGroup();
+
+  public XsTAll createAll();
+
+  public XsESequence createSequence();
+
+  public XsEChoice createChoice();
+
+  public XsTTypeDefParticle getTypeDefParticle();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsID.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsID.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsID.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of <code>xs:ID</code></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsID {
+  private String id;
+
+  public XsID(String pId) {
+    if (pId == null) {
+      throw new NullPointerException("An ID must not be null");
+    }
+    id = pId;
+  }
+
+  public boolean equals(Object o) {
+    return o != null  &&  o instanceof XsID  &&  id.equals(((XsID) o).id);
+  }
+
+  public int hashCode() {
+    return id.hashCode();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNCName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNCName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNCName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of <code>xs:NCName</code>.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsNCName {
+  private final String value;
+
+  public XsNCName(String pValue) {
+    if (pValue == null  ||  pValue.length() == 0) {
+      throw new NullPointerException("An NCName cannot be null or empty.");
+    }
+    if (pValue.indexOf(':') >= 0) {
+    	throw new IllegalArgumentException("NCName " + pValue + " is invalid, because it contains a namespace prefix");
+    }
+    value = pValue;
+  }
+
+  public String toString() { return value; }
+  public String getValue() { return value; }
+  public int hashCode() { return value.hashCode(); }
+  public boolean equals(Object o) {
+    return o != null  &&  o instanceof XsNCName   &&  value.equals(((XsNCName) o).value);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsNamespaceList.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+
+/** <p>Implementation of the <code>xs:namespaceList</code> type,
+ * specified like this:
+ * <pre>
+ *  &lt;xs:simpleType name="namespaceList"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        A utility type, not for public use
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:union&gt;
+ *      &lt;xs:simpleType&gt;
+ *        &lt;xs:restriction base="xs:token"&gt;
+ *          &lt;xs:enumeration value="##any"/&gt;
+ *          &lt;xs:enumeration value="##other"/&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:simpleType&gt;
+ *      &lt;xs:simpleType&gt;
+ *        &lt;xs:list&gt;
+ *          &lt;xs:simpleType&gt;
+ *            &lt;xs:union memberTypes="xs:anyURI"&gt;
+ *              &lt;xs:simpleType&gt;
+ *                &lt;xs:restriction base="xs:token"&gt;
+ *                  &lt;xs:enumeration value="##targetNamespace"/&gt;
+ *                   &lt;xs:enumeration value="##local"/&gt;
+ *                &lt;/xs:restriction&gt;
+ *              &lt;/xs:simpleType&gt;
+ *            &lt;/xs:union&gt;
+ *          &lt;/xs:simpleType&gt;
+ *        &lt;/xs:list&gt;
+ *      &lt;/xs:simpleType&gt;
+ *    &lt;/xs:union&gt;
+ *  &lt;/xs:simpleType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XsNamespaceList {
+	/** <p>The namespace list matching "##any".</p>
+	 */
+    public static final XsNamespaceList ANY = new XsNamespaceList(){
+    	/** @return true
+    	 */
+        public boolean isAny() { return true; }
+        /** @return false
+         */
+        public boolean isOther() { return false; }
+        /** @return null
+         */
+        public XsAnyURI[] getUris() { return null; }
+        /** @return The string "##any"
+         */
+        public String toString() { return "##any"; }
+    };
+
+    /** <p>A namespace list matching "##other" with the given
+     * target namespace <code>pTargetNamespace</code>.</p>
+     */
+    public static class Other extends XsNamespaceList {
+    	private final XsAnyURI[] uris;
+    	protected Other(XsAnyURI pTargetNamespace) {
+    		if (pTargetNamespace == null) {
+                pTargetNamespace = new XsAnyURI("");
+            }
+    		uris = new XsAnyURI[]{pTargetNamespace};
+        }
+        /** @return false
+         */
+    	public boolean isAny() { return false; }
+    	/** @return true
+    	 */
+        public boolean isOther() { return true; }
+        /** @return An array with a single element (the target namespace or "")
+         */
+        public XsAnyURI[] getUris() { return uris; }
+        /** @return The string "##other".
+         */
+        public String toString() { return "##other"; }
+        /** <p>Returns getUris()[0].hashCode().</p>
+         */
+        public int hashCode() { return getUris()[0].hashCode(); }
+        /** <p>Returns, whether this is an instance of
+         * {@link Other} with the same target namespace.</p>
+         */
+        public boolean equals(Object pOther) {
+        	return pOther != null
+                && (pOther instanceof Other)
+                && getUris()[0].equals(((Other) pOther).getUris()[0]);
+        }
+    }
+
+    public static class Basic extends XsNamespaceList {
+    	private final XsAnyURI targetNamespace;
+        private final XsAnyURI[] uris;
+        private final String toStr;
+        protected Basic(String pValue, XsAnyURI pTargetNamespace) {
+            targetNamespace = pTargetNamespace;
+            toStr = pValue;
+            Set set = new HashSet();
+            if (pTargetNamespace == null) {
+            	pTargetNamespace = new XsAnyURI("");
+            }
+            for (StringTokenizer st = new StringTokenizer(pValue);  st.hasMoreTokens();  ) {
+            	String s = st.nextToken();
+                if ("##targetNamespace".equals(s)) {
+                	set.add(pTargetNamespace);
+                } else if ("##local".equals(pTargetNamespace)) {
+                	set.add(new XsAnyURI(""));
+                } else {
+                	set.add(new XsAnyURI(s));
+                }
+            }
+            uris = (XsAnyURI[]) set.toArray(new XsAnyURI[set.size()]);
+        }
+        /** @return false
+         */
+        public boolean isAny() { return false; }
+        /** @return false
+         */
+        public boolean isOther() { return false; }
+        /** @return An array with the URI's specified in the
+         * 'namespace' attribute.
+         */
+        public XsAnyURI[] getUris() { return uris; }
+        /** @return The unmodified value of the 'namespace' attribute.
+         */
+        public String toString() { return toStr; }
+        /** @return An hash code suitable for applying
+         * {@link Arrays#equals(Object[], Object[])} on
+         * the result of {@link #getUris()}.</p>
+         */
+        public int hashCode() {
+            XsAnyURI[] uris = getUris();
+            int hash = uris.length;
+            for (int i = 0;  i < uris.length;  i++) {
+                hash += uris[i].hashCode();
+            }
+            return hash;
+        }
+        /** <p>Implemented with {@link Arrays#equals(Object[], Object[])}
+         * and the result of {@link #getUris()}.</p>
+         */
+        public boolean equals(Object pOther) {
+        	return pOther != null
+                &&  pOther instanceof Basic
+                &&  Arrays.equals(getUris(), ((Basic) pOther).getUris());
+        }
+    }
+
+    /** <p>Returns a namespace list, matching the 'namespace' attribute
+     * given by <code>pValue</code>. The given target namespace is used,
+     * if required.</p>
+     */
+    public static XsNamespaceList valueOf(String pValue, XsAnyURI pTargetNamespace) {
+		if ("##any".equals(pValue)) {
+			return ANY;
+        } else if ("##other".equals(pValue)) {
+            return new Other(pTargetNamespace);
+        } else {
+            return new Basic(pValue, pTargetNamespace);
+        }
+	}
+
+  /** <p>Returns whether the namespace list matches <code>##any</code>.
+   * If this is the case, then {@link #isOther()} returns false
+   * and {@link #getUris()} returns null.</p>
+   */
+  public abstract boolean isAny();
+
+  /** <p>Returns whether the namespace list matches <code>##other</code>.
+   * If the result is true, then {@link #getUris()} may be used to
+   * obtain an array with a single element, the target namespace.</p>
+   */
+  public abstract boolean isOther();
+
+  /** <p>Returns the array of URI's specified in the namespace list.
+   * If {@link #isAny()} returns true, then the result is null.
+   * If {@link #isOther()} returns true, then the result is an
+   * array with a single element: The target namespace or "" for
+   * an absent namespace.</p>
+   */
+  public abstract XsAnyURI[] getUris();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObject.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObject.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObject.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** Base interface for type, attribute, element, or whatever object.
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsObject {
+  /** Returns the objects syntactical schema.
+   */
+  public XsESchema getXsESchema();
+
+  /** Returns whether the object is a top-level object. This is
+   * the case for the XsESchema itself and for all its childs only.
+   */
+  public boolean isTopLevelObject();
+
+  /** Returns information on the parent object.<br>
+   * More precisely, returns either of the following:
+   * <ul>
+   *   <li>If the object is the schema itself, returns null. The
+   *     schema doesn't have a parent object.</p>
+   *   <li>If the object is a top-level object, returns the
+   *     schema.</p>
+   *   <li>Otherwise returns the object in which the given object
+   *     is embedded.</li>
+   * </ul>
+   */
+  public XsObject getParentObject();
+
+  /** Returns the {@link XsObjectFactory object factory}, that
+   * created this instance.
+   */ 
+  public XsObjectFactory getObjectFactory();
+
+  /** Returns the SAX {@link Locator} with the instances
+   * location.
+   */
+  public Locator getLocator();
+
+  /** Validates the internal state of the type, attribute, element,
+   * or whatever object.
+   */
+  public void validate() throws SAXException;
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObjectFactory.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObjectFactory.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsObjectFactory.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsObjectFactory {
+  public Locator getLocator();
+  public XMLReader newXMLReader(boolean pValidating) throws ParserConfigurationException, SAXException;
+  public XsAGDefRef newXsAGDefRef(XsObject pOwner);
+  public XsAGOccurs newXsAGOccurs(XsObject pOwner);
+  public XsEAnnotation newXsEAnnotation(XsObject pParent);
+  public XsEAny newXsEAny(XsObject pParent);
+  public XsEAppinfo newXsEAppinfo(XsObject pParent);
+  public XsEComplexContent newXsEComplexContent(XsObject pParent);
+  public XsEChoice newXsEChoice(XsObject pParent);
+  public XsEDocumentation newXsEDocumentation(XsObject pParent);
+  public XsEEnumeration newXsEEnumeration(XsObject pParent);
+  public XsEField newXsEField(XsObject pParent);
+  public XsEFractionDigits newXsEFractionDigits(XsObject pParent);
+  public XsEKey newXsEKey(XsObject pParent);
+  public XsEImport newXsEImport(XsObject pParent);
+  public XsEInclude newXsEInclude(XsObject pParent);
+  public XsEKeyref newXsEKeyref(XsObject pParent);
+  public XsELength newXsELength(XsObject pParent);
+  public XsEList newXsEList(XsObject pParent);
+  public XsEMaxExclusive newXsEMaxExclusive(XsObject pParent);
+  public XsEMaxInclusive newXsEMaxInclusive(XsObject pParent);
+  public XsEMaxLength newXsEMaxLength(XsObject pParent);
+  public XsEMinExclusive newXsEMinExclusive(XsObject pParent);
+  public XsEMinInclusive newXsEMinInclusive(XsObject pParent);
+  public XsEMinLength newXsEMinLength(XsObject pParent);
+  public XsENotation newXsENotation(XsObject pParent);
+  public XsEPattern newXsEPattern(XsObject pParent);
+  public XsERedefine newXsERedefine(XsObject pParent);
+  public XsERestriction newXsERestriction(XsObject pParent);
+  public XsESchema newXsESchema();
+  public XsESelector newXsESelector(XsObject pParent);
+  public XsESequence newXsESequence(XsObject pParent);
+  public XsESimpleContent newXsESimpleContent(XsObject pParent);
+  public XsETopLevelSimpleType newXsETopLevelSimpleType(XsObject pParent);
+  public XsETotalDigits newXsETotalDigits(XsObject pParent);
+  public XsEUnion newXsEUnion(XsObject pParent);
+  public XsEUnique newXsEUnique(XsObject pParent);
+  public XsEWhiteSpace newXsEWhiteSpace(XsObject pParent);
+  public XsGAllModel newXsGAllModel(XsObject pParent);
+  public XsGAttrDecls newXsGAttrDecls(XsObject pOwner);
+  public XsGIdentityConstraint newXsGIdentityConstraint(XsObject pOwner);
+  public XsGParticle newXsGParticle(XsObject pOwner);
+  public XsGComplexTypeModel newXsGComplexTypeModel(XsObject pOwner);
+  public XsGSimpleRestrictionModel newXsGSimpleRestrictionModel(XsObject pOwner);
+  public XsGTypeDefParticle newXsGTypeDefParticle(XsObject pOwner);
+  public XsSAXParser newXsSAXParser();
+  public XsSAXParser newXsSAXParser(Object pBean);
+  public XsTAll newXsTAll(XsObject pParent);
+  public XsTAnnotated newXsTAnnotated(XsObject pParent);
+  public XsTAttribute newXsTAttribute(XsObject pParent);
+  public XsTAttributeGroup newXsTAttributeGroup(XsObject pParent);
+  public XsTAttributeGroupRef newXsTAttributeGroupRef(XsObject pParent);
+  public XsTComplexRestrictionType newXsTComplexRestrictionType(XsObject pParent);
+  public XsTComplexType newXsTComplexType(XsObject pParent);
+  public XsTExtensionType newXsTExtensionType(XsObject pParent);
+  public XsTLocalElement newXsTLocalElement(XsObject pParent);
+  /** <p>Creates a new instance of {@link XsTLocalElement}, which
+   * is located inside of an <code>xs:all</code> group. The
+   * element ensures that its <code>minOccurs</code> and
+   * <code>maxOccurs</code> values are 0 or 1.</p>
+   */
+  public XsTLocalElement newXsTLocalAllElement(XsObject pParent);
+  public XsTLocalComplexType newXsTLocalComplexType(XsObject pParent);
+  public XsTLocalSimpleType newXsTLocalSimpleType(XsObject pParent);
+  public XsTNamedGroup newXsTNamedGroup(XsObject pParent);
+  public XsTGroup newXsTGroup(XsObject pParent);
+  public XsTGroupRef newXsTGroupRef(XsObject pParent);
+  public XsTSimpleExplicitGroup newXsTSimpleExplicitGroup(XsObject pParent);
+  public XsTSimpleExtensionType newXsTSimpleExtensionType(XsObject pParent);
+  public XsTSimpleRestrictionType newXsTSimpleRestrictionType(XsObject pParent);
+  public XsTTopLevelElement newXsTTopLevelElement(XsObject pParent);
+  public XsTWildcard newXsTWildcard(XsObject pParent);
+}
\ No newline at end of file

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsQName.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsQName.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsQName.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of <code>xs:qName</code>.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsQName {
+  private final String namespaceURI;
+  private final String localName;
+  private final String prefix;
+
+  public XsQName(XsAnyURI pNamespaceURI, String pLocalName) {
+    this(pNamespaceURI == null ? null : pNamespaceURI.getURI(), pLocalName, null);
+  }
+
+  public XsQName(XsAnyURI pNamespaceURI, String pLocalName, String pPrefix) {
+    this(pNamespaceURI == null ? null : pNamespaceURI.getURI(), pLocalName, pPrefix);
+  }
+
+  public XsQName(String pNamespaceURI, String pLocalName) {
+    this(pNamespaceURI, pLocalName, null);
+  }
+
+  public XsQName(String pNamespaceURI, String pLocalName, String pPrefix) {
+    namespaceURI = (pNamespaceURI == null) ? "" : pNamespaceURI;
+    if (pLocalName == null) {
+      throw new NullPointerException("The localName must not be null.");
+    }
+    int offset = pLocalName.indexOf(':');
+    if (offset >= 0) {
+    	throw new IllegalArgumentException("The localName " + pLocalName +
+                                           " is invalid, because it contains a namespace prefix.");
+    }
+    localName = pLocalName;
+    prefix = pPrefix;
+  }
+
+  public String getNamespaceURI() { return namespaceURI; }
+  public String getLocalName() { return localName; }
+  public String getPrefix() { return prefix; }
+
+  public boolean equals(Object pObject) {
+    if (pObject == null  ||  !(pObject instanceof XsQName)) {
+      return false;
+    }
+    XsQName name = (XsQName) pObject;
+    return name.getNamespaceURI().equals(getNamespaceURI())
+    	&&  name.getLocalName().equals(getLocalName());
+  }
+
+  public int hashCode() {
+      return getNamespaceURI().hashCode() + getLocalName().hashCode();
+  }
+
+  public String toString() {
+    if ("".equals(namespaceURI)) { return localName; }
+    return "{" + namespaceURI + "}" + localName;
+  }
+
+  public static String prefixOf(String pQName) {
+    int offset = pQName.indexOf(':');
+    if (offset > 0) {
+      return pQName.substring(0, offset);
+    } else {
+      return "";
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsRedefinable.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsRedefinable.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsRedefinable.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>A common base interface for {@link org.apache.ws.jaxme.xs.xml.XsETopLevelSimpleType},
+ * {@link org.apache.ws.jaxme.xs.xml.XsTComplexType}, {@link org.apache.ws.jaxme.xs.xml.XsTGroup},
+ * and {@link org.apache.ws.jaxme.xs.xml.XsTAttributeGroup}.
+ * <pre>
+ *  &lt;xs:group name="redefinable"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        This group is for the elements which can self-redefine
+ *        (see &lt;redefine&gt; below).
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:simpleType"/&gt;
+ *      &lt;xs:element ref="xs:complexType"/&gt;
+ *      &lt;xs:element ref="xs:group"/&gt;
+ *      &lt;xs:element ref="xs:attributeGroup"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsRedefinable {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSchemaHeader.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSchemaHeader.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSchemaHeader.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>This interface contains the data contained in the schemas
+ * root element.</p>
+ */
+public interface XsSchemaHeader {
+	/** <p>Returns the "form" attributes default value for attributes.</p>
+	 */
+	public XsFormChoice getAttributeFormDefault();
+
+	/** <p>Returns the "block" attributes default value.</p>
+	 */
+	public XsBlockSet getBlockDefault();
+
+	/** <p>Returns the "form" attributes default value for elements.</p>
+	 */
+	public XsFormChoice getElementFormDefault();
+
+	/** <p>Returns the "final" attributes default value.</p>
+	 */
+	public XsDerivationSet getFinalDefault();
+
+	/** <p>Returns the schemas ID.</p>
+	 */
+	public XsID getId();
+
+	/** <p>Returns the target namespace.</p>
+	 */
+	public XsAnyURI getTargetNamespace();
+
+	/** <p>Returns the schema version.</p>
+	 */
+	public XsToken getVersion();
+
+	/** <p>Returns a prefix associated with the target namespace or null, if
+	 * no such prefix is available.</p>
+	 */
+	String getTargetNamespacePrefix();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSimpleDerivationSet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSimpleDerivationSet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsSimpleDerivationSet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import java.util.StringTokenizer;
+
+/** <p>Implementation of <code>xs:derivationset</code>.
+ * Follows this specification:
+ * <pre>
+ *  &lt;xs:simpleType name="simpleDerivationSet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        #all or (possibly empty) subset of {restriction, union, list}
+ *      &lt;/xs:documentation&gt;
+ *      &lt;xs:documentation&gt;
+ *        A utility type, not for public use
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:union&gt;
+ *      &lt;xs:simpleType&gt;
+ *        &lt;xs:restriction base="xs:token"&gt;
+ *          &lt;xs:enumeration value="#all"/&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:simpleType&gt;
+ *      &lt;xs:simpleType&gt;
+ *        &lt;xs:restriction base="xs:derivationControl"&gt;
+ *          &lt;xs:enumeration value="list"/&gt;
+ *          &lt;xs:enumeration value="union"/&gt;
+ *          &lt;xs:enumeration value="restriction"/&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:simpleType&gt;
+ *    &lt;/xs:union&gt;
+ *  &lt;/xs:simpleType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsSimpleDerivationSet {
+  final boolean listAllowed, unionAllowed, restrictionAllowed;
+
+  /** <p>Returns whether derivation of lists is allowed.</p>
+   */
+  public boolean isListAllowed() {
+    return listAllowed;
+  }
+
+  /** <p>Returns whether derivation of unions is allowed.</p>
+   */
+  public boolean isUnionAllowed() {
+    return unionAllowed;
+  }
+
+  /** <p>Returns whether derivation of restrictions is allowed.</p>
+   */
+  public boolean isRestrictionAllowed() {
+    return restrictionAllowed;
+  }
+
+  /** <p>Returns a <code>DerivationSet</code> matching the given
+   * value.</p>
+   */
+  public static XsSimpleDerivationSet valueOf(String pValue) {
+    return new XsSimpleDerivationSet(pValue);
+  }
+
+  /** <p>Creates a new DerivationSet with the given value.</p>
+   */
+  public XsSimpleDerivationSet(String pValue) {
+    if ("#all".equals(pValue)) {
+      listAllowed = true;
+      unionAllowed = true;
+      restrictionAllowed = true;
+    } else {
+      boolean acceptList = false;
+      boolean acceptUnion = false;
+      boolean acceptRestriction = false;
+      for (StringTokenizer st = new StringTokenizer(pValue, " ");  st.hasMoreTokens();  ) {
+        String s = st.nextToken();
+        if ("list".equals(s)) {
+          acceptList = true;
+        } else if ("union".equals(s)) {
+          acceptUnion = true;
+        } else if ("restriction".equals(s)) {
+          acceptRestriction = true;
+        } else {
+          throw new IllegalArgumentException("Invalid derivation set value: " + pValue + "; the token " + s + " did not resolve to either of 'extension' or 'restriction'");
+        }
+      }
+      listAllowed = acceptList;
+      unionAllowed = acceptUnion;
+      restrictionAllowed = acceptRestriction;
+    }
+  }
+
+  public String toString() {
+    final StringBuffer sb = new StringBuffer();
+    if (listAllowed) {
+      sb.append("list");
+    }
+    if (unionAllowed) {
+      if (sb.length() > 0) {
+        sb.append(" ");
+      }
+      sb.append("union");
+    }
+    if (restrictionAllowed) {
+      if (sb.length() > 0) {
+        sb.append(" ");
+      }
+      sb.append("restriction");
+    }
+    return sb.toString();
+  }
+
+  public boolean equals(Object o) {
+    if (o == null  ||  !(XsSimpleDerivationSet.class.equals(o.getClass()))) {
+      return false;
+    }
+    XsSimpleDerivationSet ds = (XsSimpleDerivationSet) o;
+    return ds.listAllowed == listAllowed  &&
+            ds.unionAllowed == unionAllowed  &&
+            ds.restrictionAllowed == restrictionAllowed;
+  }
+
+  public int hashCode() {
+    int result = 0;
+    if (listAllowed) { result += 1; }
+    if (unionAllowed) { result += 2; }
+    if (restrictionAllowed) { result += 4; }
+    return result;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAll.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAll.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAll.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of the following type:
+ * <pre>
+ *   &lt;xs:complexType name="all"&gt;
+ *     &lt;xs:annotation&gt;
+ *       &lt;xs:documentation&gt;
+ *         Only elements allowed inside
+ *       &lt;/xs:documentation&gt;
+ *     &lt;/xs:annotation&gt;
+ *     &lt;xs:complexContent&gt;
+ *       &lt;xs:restriction base="xs:explicitGroup"&gt;
+ *         &lt;xs:group ref="xs:allModel"/&gt;
+ *         &lt;xs:attribute name="minOccurs" use="optional" default="1"&gt;
+ *           &lt;xs:simpleType&gt;
+ *             &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
+ *               &lt;xs:enumeration value="0"/&gt;
+ *               &lt;xs:enumeration value="1"/&gt;
+ *             &lt;/xs:restriction&gt;
+ *           &lt;/xs:simpleType&gt;
+ *         &lt;/xs:attribute&gt;
+ *         &lt;xs:attribute name="maxOccurs" use="optional" default="1"&gt;
+ *           &lt;xs:simpleType&gt;
+ *             &lt;xs:restriction base="xs:allNNI"&gt;
+ *               &lt;xs:enumeration value="1"/&gt;
+ *             &lt;/xs:restriction&gt;
+ *           &lt;/xs:simpleType&gt;
+ *         &lt;/xs:attribute&gt;
+ *       &lt;/xs:restriction&gt;
+ *     &lt;/xs:complexContent&gt;
+ *   &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTAll extends XsTExplicitGroup, XsTTypeDefParticle {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAnnotated.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAnnotated.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAnnotated.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of an annotated element, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:complexType name="annotated"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        This type is extended by all types which allow annotation
+ *        other than &lt;schema&gt; itself.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:openAttrs"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTAnnotated extends XsTOpenAttrs {
+  public XsEAnnotation createAnnotation();
+  public XsEAnnotation getAnnotation();
+  public void setId(XsID pId);
+  public XsID getId();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttribute.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttribute.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttribute.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of <code>xs:attribute</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:complexType name="attribute"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *        &lt;xs:attribute name="type" type="xs:QName"/&gt;
+ *        &lt;xs:attribute name="use" use="optional" default="optional"&gt;
+ *          &lt;xs:simpleType&gt;
+ *            &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *              &lt;xs:enumeration value="prohibited"/&gt;
+ *              &lt;xs:enumeration value="optional"/&gt;
+ *              &lt;xs:enumeration value="required"/&gt;
+ *            &lt;/xs:restriction&gt;
+ *          &lt;/xs:simpleType&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="default" type="xs:string"/&gt;
+ *        &lt;xs:attribute name="fixed" type="xs:string"/&gt;
+ *        &lt;xs:attribute name="form" type="xs:formChoice"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTAttribute extends XsTAnnotated {
+  public static class Use {
+    private String value;
+    Use(String pValue) { value = pValue; }
+    public String toString() { return value; }
+    public String getValue() { return value; }
+    public static Use valueOf(String pValue) {
+      if ("prohibited".equals(pValue)) {
+        return PROHIBITED;
+      } else if ("optional".equals(pValue)) {
+        return OPTIONAL;
+      } else if ("required".equals(pValue)) {
+        return REQUIRED;
+      } else {
+        throw new IllegalArgumentException("Invalid value for Use: " + pValue + ", expected 'prohibited', 'optional', or 'use'");
+      }
+    }
+  }
+
+  public static final Use PROHIBITED = new Use("prohibited");
+  public static final Use OPTIONAL = new Use("optional");
+  public static final Use REQUIRED = new Use("required");
+
+  public XsTLocalSimpleType createSimpleType();
+
+  public XsTLocalSimpleType getSimpleType();
+
+  public void setType(XsQName pType);
+
+  public XsQName getType();
+
+  public void setUse(Use pUse);
+
+  public Use getUse();
+
+  public void setDefault(String pDefault);
+
+  public String getDefault();
+
+  public void setFixed(String pFixed);
+
+  public String getFixed();
+
+  public void setForm(XsFormChoice pForm) throws SAXException;
+
+  public XsFormChoice getForm();
+
+  public void setName(XsNCName pName);
+
+  public XsNCName getName();
+
+  public void setRef(XsQName pRef);
+
+  public XsQName getRef();
+
+  public boolean isGlobal();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of an <code>xs:attributeGroup</code>,
+ * with the following specification:
+ * <pre>
+ *  &lt;xs:complexType name="attributeGroup" abstract="true"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTAttributeGroup extends XsTAnnotated, XsAGDefRef, XsGAttrDecls, XsRedefinable {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroupRef.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroupRef.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTAttributeGroupRef.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:attributeGroupRef</code>
+ * type, specified as follows:
+ * <pre>
+ *  &lt;xs:complexType name="attributeGroupRef"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:attributeGroup"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="ref" use="required" type="xs:QName"/&gt;
+ *        &lt;xs:attribute name="name" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTAttributeGroupRef extends XsTAnnotated {
+  public void setRef(XsQName pRef);
+  public XsQName getRef();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexRestrictionType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexRestrictionType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexRestrictionType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of <code>xs:complexRestrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="complexRestrictionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:restrictionType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTComplexRestrictionType extends XsTRestrictionType {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTComplexType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of a complex type, to be shared
+ * by {@link org.apache.ws.jaxme.xs.xml.XsTLocalComplexType} and
+ * {@link XsTComplexType}.
+ * Follows this specification:
+ * <pre>
+ *  &lt;xs:complexType name="complexType" abstract="true"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:complexTypeModel"/&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Will be restricted to required or forbidden
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="mixed" type="xs:boolean" use="optional" default="false"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Not allowed if simpleContent child is chosen.
+ *              May be overriden by setting on complexContent child.
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/&gt;
+ *        &lt;xs:attribute name="final" type="xs:derivationSet"/&gt;
+ *        &lt;xs:attribute name="block" type="xs:derivationSet"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ *
+ *  &lt;xs:group name="complexTypeModel"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:simpleContent"/&gt;
+ *      &lt;xs:element ref="xs:complexContent"/&gt;
+ *      &lt;xs:sequence&gt;
+ *        &lt;xs:annotation&gt;
+ *          &lt;xs:documentation&gt;
+ *            This branch is short for &amp;lt;complexContent&amp;gt;
+ *            &amp;lt;restriction base="xs:anyType"&amp;gt;
+ *            ...
+ *            &amp;lt;/restriction&amp;gt;
+ *            &amp;lt;/complexContent&amp;gt;
+ *          &lt;/xs:documentation&gt;
+ *        &lt;/xs:annotation&gt;
+ *        &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *        &lt;xs:group ref="xs:attrDecls"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ *
+ *  &lt;xs:group name="typeDefParticle"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        'complexType' uses this
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element name="group" type="xs:groupRef"/&gt;
+ *      &lt;xs:element ref="xs:all"/&gt;
+ *      &lt;xs:element ref="xs:choice"/&gt;
+ *      &lt;xs:element ref="xs:sequence"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTComplexType extends XsTAnnotated, XsGTypeDefParticle, XsGAttrDecls, XsRedefinable {
+  public void setMixed(boolean pMixed);
+  public boolean isMixed();
+
+  public void setAbstract(boolean pAbstract);
+  public boolean isAbstract();
+
+  public XsESimpleContent createSimpleContent();
+
+  public XsESimpleContent getSimpleContent();
+
+  public XsEComplexContent createComplexContent();
+
+  public XsEComplexContent getComplexContent();
+
+  public void setName(XsNCName pName);
+
+  public XsNCName getName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:element</code> type,
+ * as specified by the following:
+ * <pre>
+ *  <xs:complexType name="element" abstract="true">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        The element element can be used either
+ *        at the top level to define an element-type binding globally,
+ *        or within a content model to either reference a globally-defined
+ *        element or type or declare an element-type binding locally.
+ *        The ref form is not allowed at the top level.
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:complexContent>
+ *      <xs:extension base="xs:annotated">
+ *        <xs:sequence>
+ *          <xs:choice minOccurs="0">
+ *            <xs:element name="simpleType" type="xs:localSimpleType"/>
+ *            <xs:element name="complexType" type="xs:localComplexType"/>
+ *          </xs:choice>
+ *          <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ *        </xs:sequence>
+ *        <xs:attributeGroup ref="xs:defRef"/>
+ *        <xs:attribute name="type" type="xs:QName"/>
+ *        <xs:attribute name="substitutionGroup" type="xs:QName"/>
+ *        <xs:attributeGroup ref="xs:occurs"/>
+ *        <xs:attribute name="default" type="xs:string"/>
+ *        <xs:attribute name="fixed" type="xs:string"/>
+ *        <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+ *        <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+ *        <xs:attribute name="final" type="xs:derivationSet"/>
+ *        <xs:attribute name="block" type="xs:blockSet"/>
+ *        <xs:attribute name="form" type="xs:formChoice"/>
+ *      </xs:extension>
+ *    </xs:complexContent>
+ *  </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTElement extends XsTAnnotated, XsAGDefRef, XsAGOccurs, XsGIdentityConstraint {
+  public XsTLocalSimpleType createSimpleType() throws SAXException;
+  public XsTLocalSimpleType getSimpleType();
+
+  public XsTLocalComplexType createComplexType() throws SAXException;
+  public XsTLocalComplexType getComplexType();
+
+  public void setType(XsQName pType) throws SAXException;
+  public XsQName getType();
+
+  public void setSubstitutionGroup(XsQName pSubstitutionGroup) throws SAXException;
+  public XsQName getSubstitutionGroup();
+
+  public void setDefault(String pDefault);
+  public String getDefault();
+
+  public void setFixed(String pFixed);
+  public String getFixed();
+
+  public void setNillable(boolean pNillable);
+  public boolean getNillable();
+
+  public void setAbstract(boolean pAbstract);
+  public boolean getAbstract();
+
+  public void setFinal(XsDerivationSet pFinal);
+  public XsDerivationSet getFinal();
+
+  public void setBlock(XsBlockSet pBlock);
+  public XsBlockSet getBlock();
+
+  public void setForm(XsFormChoice pForm);
+  public XsFormChoice getForm();
+
+  public boolean isGlobal();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExplicitGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExplicitGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExplicitGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:explicitGroup</code>
+ * type, as specified by the following:
+ * <pre>
+ *  <xs:complexType name="explicitGroup">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        group type for the three kinds of group
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:group">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ *        <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ *  </xs:complexType>
+ * </pre></p>
+ * <p><em>Implementation note:</em> This interface doesn't specify
+ * any additional methods. However, the implementations <code>validate()</code>
+ * method must ensure that
+ * <ol>
+ *   <li>neither of the 'name' or 'ref' attributes are set</li>
+ *   <li>Either of the 'all', 'choice', 'sequence', 'any', or 'group'
+ *     child elements is set, but not the 'all' element.</li>
+ * </ol>
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTExplicitGroup extends XsTGroup {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExtensionType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExtensionType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTExtensionType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:extensionType</code> type, as
+ * specified by:
+ * <pre>
+ *  &lt;xs:complexType name="extensionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="base" type="xs:QName" use="required"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTExtensionType extends XsTAnnotated, XsGTypeDefParticle, XsGAttrDecls {
+  public void setBase(XsQName pBase);
+  public XsQName getBase();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of a facet, following this specification:
+ * <pre>
+ *  &lt;xs:complexType name="facet"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:attribute name="value" use="required"/&gt;
+ *        &lt;xs:attribute name="fixed" type="xs:boolean" use="optional"
+ *                    default="false"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTFacet extends XsTFixedFacet {
+  public void setValue(String pValue);
+  public String getValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacetBase.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacetBase.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFacetBase.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTFacetBase extends XsTAnnotated {
+  public String getFacetName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFixedFacet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFixedFacet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTFixedFacet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>A common base interface for {@link org.apache.ws.jaxme.xs.xml.XsTFacet} and
+ * {@link org.apache.ws.jaxme.xs.xml.XsTNumFacet}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTFixedFacet extends XsTFacetBase {
+  public void setFixed(boolean pFixed);
+  public boolean isFixed();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:group</code>, type, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="group" abstract="true"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        group type for explicit groups, named top-level groups and
+ *        group references
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:occurs"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTGroup extends XsTAnnotated, XsAGDefRef, XsAGOccurs, XsGParticle {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroupRef.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroupRef.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTGroupRef.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of the <code>xs:groupRef</code> type,
+ * with the following specification:
+ * <pre>
+ *  <xs:complexType name="groupRef">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:realGroup">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="ref" use="required" type="xs:QName"/>
+ *        <xs:attribute name="name" use="prohibited"/>
+ *      </xs:restriction>
+ *   </xs:complexContent>
+ * </xs:complexType>
+ * <pre></p>
+ * <p><em>Implementation note:</em> This interface does not define
+ * any additional methods. However, the <code>validate()</code>
+ * method must ensure that the 'ref' attribute is set and the
+ * 'name' attribute is not set.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTGroupRef extends XsTRealGroup, XsTTypeDefParticle, XsTNestedParticle {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTIdentityConstraint.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTIdentityConstraint.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTIdentityConstraint.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>A common base interface for the elements which are part of an
+ * <code>xs:identityConstraint</code> group.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTIdentityConstraint {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTKeybase.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTKeybase.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTKeybase.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:keybase</code> type, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="keybase"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:selector"/&gt;
+ *          &lt;xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName" use="required"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTKeybase extends XsTAnnotated {
+  public XsESelector createSelector();
+  public XsESelector getSelector();
+
+  public XsEField createField();
+  public XsEField[] getFields();
+
+  public void setName(XsNCName pName);
+  public XsNCName getName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalComplexType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalComplexType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalComplexType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of a local <code>xs:complexType</code>,
+ * following the specification below:
+ * <pre>
+ *  &lt;xs:complexType name="localComplexType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:complexType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:complexTypeModel"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="abstract" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="final" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="block" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTLocalComplexType  extends XsTComplexType {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:localElement</code> type, as
+ * specified by:
+ * <pre>
+ *  <xs:complexType name="localElement">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:element">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:choice minOccurs="0">
+ *            <xs:element name="simpleType" type="xs:localSimpleType"/>
+ *            <xs:element name="complexType" type="xs:localComplexType"/>
+ *          </xs:choice>
+ *          <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="substitutionGroup" use="prohibited"/>
+ *        <xs:attribute name="final" use="prohibited"/>
+ *        <xs:attribute name="abstract" use="prohibited"/>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ *  </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTLocalElement extends XsTElement, XsTNestedParticle {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalSimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalSimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTLocalSimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of the <code>xs:localSimpleType</code> type,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="localSimpleType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:simpleType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:simpleDerivation"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" use="prohibited"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Forbidden when nested
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="final" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> The implementation must ensure,
+ * that the 'final' and 'name' attributes aren't set.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTLocalSimpleType extends XsTSimpleType {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNamedGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNamedGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNamedGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of a named top-level group, with the following
+ * specification:
+ * <pre>
+ *  &lt;xs:complexType name="namedGroup"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        Should derive this from realGroup, but too complicated for now
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *      &lt;xs:choice minOccurs="1" maxOccurs="1"&gt;
+ *        &lt;xs:element name="all"&gt;
+ *          &lt;xs:complexType&gt;
+ *            &lt;xs:complexContent&gt;
+ *              &lt;xs:restriction base="xs:all"&gt;
+ *                &lt;xs:group ref="xs:allModel"/&gt;
+ *                &lt;xs:attribute name="minOccurs" use="prohibited"/&gt;
+ *                &lt;xs:attribute name="maxOccurs" use="prohibited"/&gt;
+ *              &lt;/xs:restriction&gt;
+ *            &lt;/xs:complexContent&gt;
+ *          &lt;/xs:complexType&gt;
+ *        &lt;/xs:element&gt;
+ *        &lt;xs:element name="choice" type="xs:simpleExplicitGroup"/&gt;
+ *        &lt;xs:element name="sequence" type="xs:simpleExplicitGroup"/&gt;
+ *      &lt;/xs:choice&gt;
+ *    &lt;/xs:sequence&gt;
+ *    &lt;xs:attribute name="name" use="required" type="xs:NCName"/&gt;
+ *    &lt;xs:attribute name="ref" use="prohibited"/&gt;
+ *    &lt;xs:attribute name="minOccurs" use="prohibited"/&gt;
+ *    &lt;xs:attribute name="maxOccurs" use="prohibited"/&gt;
+ *  &lt;/xs:complexType&gt;
+ * &lt;/pre>&lt;/p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTNamedGroup extends XsTAnnotated, XsRedefinable {
+  public void setName(XsNCName pName);
+  public XsNCName getName();
+  public XsGAllModel createAll();
+  public XsGAllModel getAll();
+  public XsTSimpleExplicitGroup createSequence();
+  public XsTSimpleExplicitGroup getSequence();
+  public XsTSimpleExplicitGroup createChoice();
+  public XsTSimpleExplicitGroup getChoice();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNestedParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNestedParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNestedParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTNestedParticle extends XsTParticle {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNumFacet.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNumFacet.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTNumFacet.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of <code>xs:numFacet</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:complexType name="numFacet"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:facet"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTNumFacet extends XsTFixedFacet {
+  public void setValue(long pValue) throws SAXException;
+  public long getValue();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTOpenAttrs.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTOpenAttrs.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTOpenAttrs.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.Attributes;
+
+
+/** <p>A common base type for most of the schema elements.
+ * Implements the following specification:
+ * <pre>
+ *  &lt;xs:complexType name="openAttrs">
+ *    &lt;xs:annotation>
+ *      &lt;xs:documentation>
+ *        This type is extended by almost all schema types
+ *        to allow attributes from other namespaces to be
+ *        added to user schemas.
+ *      &lt;/xs:documentation>
+ *    &lt;/xs:annotation>
+ *    &lt;xs:complexContent>
+ *      &lt;xs:restriction base="xs:anyType">
+ *        &lt;xs:anyAttribute namespace="##other" processContents="lax"/>
+ *      &lt;/xs:restriction>
+ *    &lt;/xs:complexContent>
+ *  &lt;/xs:complexType&gt;
+ * </pre>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTOpenAttrs extends XsObject {
+  /** <p>Returns the attributes having other namespaces.</p>
+   */
+  public Attributes getOpenAttributes();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of a particle. A particle is defined as either
+ * of the elements in the particle group.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTParticle {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRealGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRealGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRealGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:realGroup</code> type, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:complexType name="realGroup"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:group"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:choice minOccurs="0" maxOccurs="1"&gt;
+ *            &lt;xs:element ref="xs:all"/&gt;
+ *            &lt;xs:element ref="xs:choice"/&gt;
+ *            &lt;xs:element ref="xs:sequence"/&gt;
+ *          &lt;/xs:choice&gt;
+ *        &lt;/xs:sequence&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> This interface does not define
+ * any additional methods. However, the <code>validate()</code>
+ * method must ensure, that either of <code>xs:all</code>,
+ * <code>xs:choice</code>, or <code>xs:sequence</code> is set.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTRealGroup extends XsTGroup {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRestrictionType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRestrictionType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTRestrictionType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of <code>xs:restrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="restrictionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:choice&gt;
+ *            &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *            &lt;xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="base" type="xs:QName" use="required"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTRestrictionType extends XsTAnnotated, XsGTypeDefParticle, XsGSimpleRestrictionModel, XsGAttrDecls {
+  public void setBase(XsQName pBase);
+  public XsQName getBase();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExplicitGroup.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExplicitGroup.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExplicitGroup.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of the xs:simpleExplicitGroup type, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="simpleExplicitGroup"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:explicitGroup"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="minOccurs" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="maxOccurs" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTSimpleExplicitGroup extends XsTAnnotated {
+  public XsTLocalElement createElement();
+  public XsTGroupRef createGroup();
+  public XsEChoice createChoice();
+  public XsESequence createSequence();
+  public XsEAny createAny();
+  public XsTNestedParticle[] getParticles();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExtensionType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExtensionType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleExtensionType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of the <code>xs:simpleExtensionType</code>, as
+ * specified by:
+ * <pre>
+ *  <xs:complexType name="simpleExtensionType">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:extensionType">
+ *        <xs:sequence>
+ *          <xs:annotation>
+ *            <xs:documentation>
+ *              No typeDefParticle group reference
+ *            </xs:documentation>
+ *          </xs:annotation>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:group ref="xs:attrDecls"/>
+ *        </xs:sequence>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ *  </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTSimpleExtensionType extends XsTAnnotated, XsGAttrDecls {
+  public void setBase(XsQName pBase);
+
+  public XsQName getBase();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleRestrictionType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleRestrictionType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleRestrictionType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of <code>xs:simpleRestrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="simpleRestrictionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:restrictionType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTSimpleRestrictionType extends XsTRestrictionType, XsGSimpleRestrictionModel, XsGAttrDecls {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTSimpleType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of the following specification for
+ * <code>xs:simpleType</code>:
+ * <pre>
+ *  &lt;xs:complexType name="simpleType" abstract="true"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:simpleDerivation"/&gt;
+ *        &lt;xs:attribute name="final" type="xs:simpleDerivationSet"/&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Can be restricted to required or forbidden
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ *
+ *  &lt;xs:group name="simpleDerivation"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:restriction"/&gt;
+ *      &lt;xs:element ref="xs:list"/&gt;
+ *      &lt;xs:element ref="xs:union"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTSimpleType extends XsTAnnotated {
+  public XsERestriction createRestriction() throws SAXException;
+  public XsERestriction getRestriction();
+
+  public XsEList createList() throws SAXException;
+  public XsEList getList();
+
+  public XsEUnion createUnion() throws SAXException;
+  public XsEUnion getUnion();
+
+  public void setFinal(XsSimpleDerivationSet pSet) throws SAXException;
+  public XsSimpleDerivationSet getFinal();
+
+  public void setName(XsNCName pName) throws SAXException;
+  public XsNCName getName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelComplexType.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelComplexType.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelComplexType.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Implementation of a top level <code>xs:complexType</code>,
+ * following the specification below:
+ * <pre>
+ *  &lt;xs:complexType name="topLevelComplexType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:complexType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:complexTypeModel"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName" use="required"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTTopLevelComplexType extends XsTComplexType {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelElement.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelElement.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTopLevelElement.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Interface of the <code>xs:topLevelElement</code> type, with
+ * the following specification:
+ * <pre>
+ *  <xs:complexType name="topLevelElement">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:element">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:choice minOccurs="0">
+ *            <xs:element name="simpleType" type="xs:localSimpleType"/>
+ *            <xs:element name="complexType" type="xs:localComplexType"/>
+ *          </xs:choice>
+ *          <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="ref" use="prohibited"/>
+ *        <xs:attribute name="form" use="prohibited"/>
+ *        <xs:attribute name="minOccurs" use="prohibited"/>
+ *        <xs:attribute name="maxOccurs" use="prohibited"/>
+ *        <xs:attribute name="name" use="required" type="xs:NCName"/>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ * </xs:complexType>
+ *</pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTTopLevelElement extends XsTElement {
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTypeDefParticle.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTypeDefParticle.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTTypeDefParticle.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>A common interface for the types used in the
+ * <code>xs:typeDefParticle</code> group.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTTypeDefParticle extends XsTParticle {
+
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTWildcard.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTWildcard.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsTWildcard.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+
+/** <p>Interface of <code>xs:wildcard</code>, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="wildcard"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/&gt;
+ *        &lt;xs:attribute name="processContents" use="optional" default="strict"
+ *          &lt;xs:simpleType&gt;
+ *            &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *              &lt;xs:enumeration value="skip"/&gt;
+ *              &lt;xs:enumeration value="lax"/&gt;
+ *              &lt;xs:enumeration value="strict"/&gt;
+ *            &lt;/xs:restriction&gt;
+ *          &lt;/xs:simpleType&gt;
+ *        &lt;/xs:attribute&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XsTWildcard extends XsTAnnotated {
+  public static class ProcessContents {
+    final private String value;
+    ProcessContents(String pValue) {
+      value = pValue;
+    }
+    public String toString() { return value; }
+    public String getValue() { return value; }
+    public static ProcessContents valueOf(String pValue) {
+      if ("skip".equals(pValue)) {
+        return SKIP;
+      } else if ("lax".equals(pValue)) {
+        return LAX;
+      } else if ("strict".equals(pValue)) {
+        return STRICT;
+      } else {
+        throw new IllegalArgumentException("Invalid value for ProcessContents: " + pValue + "; expected either of 'skip', 'lax', or 'strict'");
+      }
+    }
+  }
+
+  public static final ProcessContents SKIP = new ProcessContents("skip");
+  public static final ProcessContents LAX = new ProcessContents("lax");
+  public static final ProcessContents STRICT = new ProcessContents("strict");
+
+  public void setNamespace(String pList);
+  public XsNamespaceList getNamespace();
+
+  public void setProcessContents(ProcessContents pProcessContents);
+  public ProcessContents getProcessContents();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsToken.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsToken.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/XsToken.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml;
+
+/** <p>Implementation of xs:token</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsToken {
+  private String token;
+
+  public XsToken(String pToken) {
+    if (pToken == null) {
+      throw new NullPointerException("A Token must not be null");
+    }
+    token = pToken;
+  }
+
+  public String getToken() {
+    return token;
+  }
+
+  public boolean equals(Object o) {
+    return o != null  &&  o instanceof XsToken  &&  token.equals(((XsToken) o).token);
+  }
+  public int hashCode() {
+    return token.hashCode();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGDefRefImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGDefRefImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGDefRefImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsAGDefRef;
+import org.apache.ws.jaxme.xs.xml.XsNCName;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the attribute group <code>xs:defRef</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:attributeGroup name="defRef"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        for element, group and attributeGroup,
+ *        which both define and reference
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:attribute name="name" type="xs:NCName"/&gt;
+ *    &lt;xs:attribute name="ref" type="xs:QName"/&gt;
+ *  &lt;/xs:attributeGroup&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> The 'name' and 'ref' attributes
+ * are mutually exclusive.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsAGDefRefImpl implements XsAGDefRef {
+    private final XsObject owner;
+    private XsNCName name;
+    private XsQName ref;
+
+  	/** <p>Creates a new instance with the given parent object.</p>
+  	 */
+  	public XsAGDefRefImpl(XsObject pOwner) {
+  	    owner = pOwner;
+  	}
+
+  	public void setName(XsNCName pName) {
+  	    if (ref != null) {
+  	        throw new IllegalStateException("The 'name' and 'ref' attributes are mutually exclusive.");
+  	    }
+  	    name = pName;
+  	}
+  	
+  	public XsNCName getName() {
+  	    return name;
+  	}
+  	
+  	public void setRef(XsQName pRef) {
+  	    if (name != null) {
+  	        throw new IllegalStateException("The 'name' and 'ref' attributes are mutually exclusive.");
+  	    }
+  	    ref = pRef;
+  	}
+
+  	public void setRef(String pRef) throws SAXException {
+  	    setRef(((XsObjectImpl) owner).asXsQName(pRef));
+  	}
+  	
+  	public XsQName getRef() {
+  	    return ref;
+  	}
+  	
+  	public void validate() throws SAXException {
+  	    if (name == null  &&  ref == null) {
+  	        throw new LocSAXException("You must set either of the attributes 'name' or 'ref'.", owner.getLocator());
+  	    }
+  	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGOccursImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGOccursImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsAGOccursImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsAGOccurs;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the attribute group <code>xs:occurs</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:attributeGroup name="occurs"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        for all particles
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:attribute name="minOccurs" type="xs:nonNegativeInteger"
+ *      use="optional" default="1"/&gt;
+ *    &lt;xs:attribute name="maxOccurs" type="xs:allNNI"
+ *      use="optional" default="1"/&gt;
+ *  &lt;/xs:attributeGroup&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> The implementation must ensure
+ * that either 'maxOccurs' is unbounded or 'minOccurs' <= 'maxOccurs'.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsAGOccursImpl implements XsAGOccurs {
+  private final XsObject owner;
+  private int minOccurs = 1, maxOccurs = 1;
+
+  public XsAGOccursImpl(XsObject pOwner) {
+    owner = pOwner;
+  }
+
+  public void setMaxOccurs(String pMaxOccurs) {
+    if ("unbounded".equals(pMaxOccurs)) {
+      maxOccurs = -1;
+    } else {
+      try {
+        maxOccurs = Integer.parseInt(pMaxOccurs);
+        if (maxOccurs < 0) {
+          throw new IllegalArgumentException();
+        }
+      } catch (Exception e) {
+        throw new IllegalArgumentException("Invalid value for maxOccurs: " +
+                                            pMaxOccurs +
+                                            "; expected 'unbounded' or a nonnegative integer value.");
+      }
+    }
+  }
+
+  public int getMaxOccurs() {
+    return maxOccurs;
+  }
+
+  public void setMinOccurs(int pMinOccurs) {
+    if (pMinOccurs < 0) {
+      throw new IllegalArgumentException("Invalid value for minOccurs: " +
+                                          pMinOccurs +
+                                          "; expected a nonnegative integer value.");      
+    }
+    minOccurs = pMinOccurs;
+  }
+
+  public int getMinOccurs() {
+    return minOccurs;
+  }
+
+  public void validate() throws SAXException {
+    if (maxOccurs != -1  &&  minOccurs > maxOccurs) {
+      throw new LocSAXException("The 'minOccurs' attribute value (" +
+                                 minOccurs +
+                                 ") is greater than the 'maxOccurs' attribute value (" +
+                                 maxOccurs + ")", owner.getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnnotationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnnotationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnnotationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.DOMBuilder;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:annotation</code>, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:element name="annotation" id="annotation"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:openAttrs"&gt;
+ *          &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *            &lt;xs:element ref="xs:appinfo"/&gt;
+ *            &lt;xs:element ref="xs:documentation"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEAnnotationImpl extends XsTOpenAttrsImpl implements XsEAnnotation {
+  private XsID id;
+  private List childs;
+
+  protected XsEAnnotationImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setId(XsID pId) {
+    id = pId;
+  }
+
+  public XsID getId() {
+    return id;
+  }
+
+  protected void addChild(Object pChild) {
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(pChild);
+  }
+
+  public XsEAppinfo createAppinfo() {
+    XsEAppinfo appinfo = getObjectFactory().newXsEAppinfo(this);
+    addChild(appinfo);
+    return appinfo;
+  }
+
+  public XsEDocumentation createDocumentation() {
+    XsEDocumentation documentation = getObjectFactory().newXsEDocumentation(this);
+    addChild(documentation);
+    return documentation;
+  }
+
+  public XsEAppinfo[] getAppinfos() {
+    if (childs == null) {
+      return new XsEAppinfo[0];
+    } else {
+      List result = new ArrayList();
+      for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+        Object o = iter.next();
+        if (o instanceof XsEAppinfo) {
+          result.add(o);
+        }
+      }
+      return (XsEAppinfo[]) result.toArray(new XsEAppinfo[result.size()]);
+    }
+  }
+
+  public XsEDocumentation[] getDocumentations() {
+    if (childs == null) {
+      return new XsEDocumentation[0];
+    } else {
+      List result = new ArrayList();
+      for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+        Object o = iter.next();
+        if (o instanceof XsEDocumentation) {
+          result.add(o);
+        }
+      }
+      return (XsEDocumentation[]) result.toArray(new XsEDocumentation[result.size()]);
+    }
+  }
+
+  public Object[] getChilds() {
+    if (childs == null) {
+      return new Object[0];
+    } else {
+      return childs.toArray();
+    }
+  }
+
+  public ContentHandler getChildHandler(String pQName,
+                                         String pNamespaceURI, String pLocalName) throws SAXException {
+    if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)) {
+      return null;  // Let the parser handle this element
+    }
+
+    try {
+      DOMBuilder db = new DOMBuilder();
+      addChild(db.getDocument());
+      return db;
+    } catch (ParserConfigurationException e) {
+      throw new SAXException(e);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnyImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnyImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAnyImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsAGOccurs;
+import org.apache.ws.jaxme.xs.xml.XsEAny;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of the <code>xs:any</code> element, as
+ * specified by the following:
+ * <pre>
+ *  &lt;xs:element name="any" id="any"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:wildcard"&gt;
+ *          &lt;xs:attributeGroup ref="xs:occurs"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEAnyImpl extends XsTWildcardImpl implements XsEAny {
+  private XsAGOccurs occurs = getObjectFactory().newXsAGOccurs(this);
+
+  protected XsEAnyImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setMaxOccurs(String pMaxOccurs) {
+    occurs.setMaxOccurs(pMaxOccurs);
+  }
+
+  public int getMaxOccurs() {
+    return occurs.getMaxOccurs();
+  }
+
+  public void setMinOccurs(int pMinOccurs) {
+    occurs.setMinOccurs(pMinOccurs);
+  }
+
+  public int getMinOccurs() {
+    return occurs.getMinOccurs();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAppinfoImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAppinfoImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEAppinfoImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.DOMBuilder;
+import org.apache.ws.jaxme.xs.parser.XsObjectCreator;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:appinfo</code>, as specified by the
+ * following:
+ * <pre>
+ *  &lt;xs:element name="appinfo" id="appinfo"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType mixed="true"&gt;
+ *      &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:any processContents="lax"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *      &lt;xs:attribute name="source" type="xs:anyURI"/&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEAppinfoImpl extends XsObjectImpl implements XsEAppinfo {
+  private List childs;
+  private XsAnyURI source;
+
+  protected XsEAppinfoImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  protected void addChild(Object pChild) {
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(pChild);
+  }
+
+  protected XsObjectCreator[] getXsObjectCreators() {
+    return null;
+  }
+
+  public Object[] getChilds() {
+    if (childs == null) {
+      return new Object[0];
+    } else {
+      return childs.toArray();
+    }
+  }
+
+  public void setSource(XsAnyURI pSource) {
+    source = pSource;
+  }
+
+  public XsAnyURI getSource() {
+    return source;
+  }
+
+  public ContentHandler getChildHandler(String pQName, String pNamespaceURI, String pLocalName) throws SAXException {
+    XsObjectCreator[] objectCreators = getXsObjectCreators();
+    if (objectCreators != null) {
+      XsQName qName = new XsQName(pNamespaceURI, pLocalName, XsQName.prefixOf(pQName));
+      for (int i = 0;  i < objectCreators.length;  i++) {
+        XsObject result = objectCreators[i].newBean(this, getObjectFactory().getLocator(), qName);
+        if (result != null) {
+          addChild(result);
+          return getObjectFactory().newXsSAXParser(result);
+        }
+      }
+    }
+
+    if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)) {
+      return null;  // Let the parser handle this element
+    }
+
+    try {
+      DOMBuilder db = new DOMBuilder();
+      addChild(db.getDocument());
+      return db;
+    } catch (ParserConfigurationException e) {
+      throw new SAXException(e);
+    }
+  }
+
+  /** <p>Adds text to the appinfo contents.</p>
+   */
+  public void addText(String pText) {
+      addChild(pText);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEChoiceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEChoiceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEChoiceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:choice</code> element, with the following
+ * specification:
+ * <pre>
+ *  &lt;xs:element name="choice" type="xs:explicitGroup" id="choice"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEChoiceImpl extends XsTExplicitGroupImpl implements XsEChoice {
+  protected XsEChoiceImpl(XsObject pParent) {
+    super(pParent);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEComplexContentImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEComplexContentImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEComplexContentImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the element <code>xs:complexContent</code>,
+ * as specified by:
+ * <pre>
+ *  &lt;xs:element name="complexContent" id="complexContent"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *          source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:choice&gt;
+ *            &lt;xs:element name="restriction" type="xs:complexRestrictionType"/&gt;
+ *            &lt;xs:element name="extension" type="xs:extensionType"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:attribute name="mixed" type="xs:boolean"&gt;
+ *            &lt;xs:annotation&gt;
+ *              &lt;xs:documentation&gt;
+ *                Overrides any setting on complexType parent.
+ *              &lt;/xs:documentation&gt;
+ *            &lt;/xs:annotation&gt;
+ *          &lt;/xs:attribute&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEComplexContentImpl extends XsTAnnotatedImpl implements XsEComplexContent {
+  private XsTComplexRestrictionType restriction;
+  private XsTExtensionType extension;
+  private Boolean isMixed;
+
+  protected XsEComplexContentImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTComplexRestrictionType createRestriction() {
+    if (restriction != null) {
+      throw new IllegalStateException("Multiple 'restriction' child elements are forbidden.");
+    }
+    if (extension != null) {
+      throw new IllegalStateException("The 'extension' and 'restriction' child elements are mutually exclusive.");
+    }
+    return restriction = getObjectFactory().newXsTComplexRestrictionType(this);
+  }
+
+  public XsTComplexRestrictionType getRestriction() {
+    return restriction;
+  }
+
+  public XsTExtensionType createExtension() {
+    if (extension != null) {
+      throw new IllegalStateException("Multiple 'extension' child elements are forbidden.");
+    }
+    if (restriction != null) {
+      throw new IllegalStateException("The 'extension' and 'restriction' child elements are mutually exclusive.");
+    }
+    return extension = getObjectFactory().newXsTExtensionType(this);
+  }
+
+  public XsTExtensionType getExtension() {
+    return extension;
+  }
+
+  public void setMixed(boolean pMixed) {
+    isMixed = pMixed ? Boolean.TRUE : Boolean.FALSE;
+  }
+
+  public Boolean isMixed() { return isMixed; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEDocumentationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEDocumentationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEDocumentationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ 
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.DOMBuilder;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:documentation</code>, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:element name="documentation" id="documentation"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType mixed="true"&gt;
+ *      &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:any processContents="lax"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *      &lt;xs:attribute name="source" type="xs:anyURI"/&gt;
+ *      &lt;xs:attribute ref="xml:lang"/&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEDocumentationImpl extends XsObjectImpl implements XsEDocumentation {
+	private XmlLang lang;
+	private XsAnyURI source;
+	private List childs = new ArrayList();
+    private boolean isSimple;
+
+    protected XsEDocumentationImpl(XsObject pParent) {
+		super(pParent);
+	}
+
+    protected void addChild(Object pObject) {
+        childs.add(pObject);
+    }
+
+	public void setLang(XmlLang pLang) {
+		lang = pLang;
+	}
+	
+	public XmlLang getLang() {
+		return lang;
+	}
+	
+	public void setSource(XsAnyURI pSource) {
+		source = pSource;
+	}
+	
+	public XsAnyURI getSource() {
+		return source;
+	}
+	
+	public void addText(String pText) {
+		childs.add(pText);
+	}
+	
+	public String getText() {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0;  i < childs.size();  i++) {
+        	Object o = childs.get(i);
+            if (o instanceof String) {
+            	sb.append(o);
+            }
+        }
+		return sb.toString();
+	}
+
+    public boolean isTextOnly() {
+    	for (int i = 0;  i < childs.size();  i++) {
+    		if (!(childs.get(i) instanceof String)) {
+    			return false;
+            }
+        }
+        return true;
+    }
+
+    public Object[] getChilds() {
+    	return childs.toArray();
+    }
+
+	public boolean setAttribute(String pQName, String pNamespaceURI, String pLocalName, String pValue) {
+		if (XMLConstants.XML_NS_URI.equals(pNamespaceURI)  &&  "lang".equals(pLocalName)) {
+			setLang(new XmlLang(pValue));
+			return true;
+		} else {
+			return false;
+		}
+	}
+	
+	public ContentHandler getChildHandler(String pQName, String pNamespaceURI, String pLocalName)
+            throws SAXException {
+		isSimple = false;
+        try {
+			DOMBuilder db = new DOMBuilder();
+			addChild(db.getDocument());
+			return db;
+		} catch (ParserConfigurationException e) {
+			throw new SAXException(e);
+		}
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEEnumerationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEEnumerationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEEnumerationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEEnumeration;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:enumeration</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEEnumerationImpl extends XsTFacetBaseImpl
+    implements XsEEnumeration {
+  private String value;
+
+  protected XsEEnumerationImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setValue(String pValue) {
+    value = pValue;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public String getFacetName() {
+    return "enumeration";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFieldImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFieldImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFieldImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Interface of the <code>xs:field</code> element, with the
+ * following specification:
+ * <pre>
+ *   <xs:element name="field" id="field">
+ *     <xs:annotation>
+ *       <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+ *     </xs:annotation>
+ *     <xs:complexType>
+ *       <xs:complexContent>
+ *         <xs:extension base="xs:annotated">
+ *           <xs:attribute name="xpath" use="required">
+ *             <xs:simpleType>
+ *               <xs:annotation>
+ *                 <xs:documentation>
+ *                   A subset of XPath expressions for use in fields
+ *                 </xs:documentation>
+ *                 <xs:documentation>
+ *                   A utility type, not for public use
+ *                 </xs:documentation>
+ *               </xs:annotation>
+ *               <xs:restriction base="xs:token">
+ *                 <xs:annotation>
+ *                   <xs:documentation>
+ *                     The following pattern is intended to allow XPath
+ *                     expressions per the same EBNF as for selector,
+ *                     with the following change:
+ *                       Path    ::=    ('.//')? ( Step '/' )* ( Step | '@' NameTest ) 
+ *                   </xs:documentation>
+ *                 </xs:annotation>
+ *                 <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+ *                 </xs:pattern>
+ *               </xs:restriction>
+ *             </xs:simpleType>
+ *           </xs:attribute>
+ *         </xs:extension>
+ *       </xs:complexContent>
+ *     </xs:complexType>
+ *   </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEFieldImpl extends XsTAnnotatedImpl implements XsEField {
+  private XsToken xpath;
+
+  protected XsEFieldImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setXpath(XsToken pXpath) {
+    xpath = pXpath;
+  }
+
+  public XsToken getXpath() {
+    return xpath;
+  }
+
+  public void validate() {
+    if (getXpath() == null) {
+      throw new NullPointerException("Missing attribute: xpath");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFractionDigitsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFractionDigitsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEFractionDigitsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEFractionDigits;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:fractionDigits</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEFractionDigitsImpl extends XsTNumFacetImpl
+    implements XsEFractionDigits {
+  protected XsEFractionDigitsImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "fractionDigits";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEImportImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEImportImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEImportImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:import</code>, as specified by
+ * the following:
+ * <pre>
+ *  &lt;xs:element name="import" id="import"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:attribute name="namespace" type="xs:anyURI"/&gt;
+ *          &lt;xs:attribute name="schemaLocation" type="xs:anyURI"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEImportImpl extends XsTAnnotatedImpl implements XsEImport {
+  private XsAnyURI namespace;
+  private XsAnyURI schemaLocation;
+
+  protected XsEImportImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setNamespace(XsAnyURI pNamespace) {
+    namespace = pNamespace;
+  }
+
+  public XsAnyURI getNamespace() {
+    return namespace;
+  }
+
+  public void setSchemaLocation(XsAnyURI pSchemaLocation) {
+    schemaLocation = pSchemaLocation;
+  }
+
+  public XsAnyURI getSchemaLocation() {
+    return schemaLocation;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEIncludeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEIncludeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEIncludeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:include</code>, as specified
+ * by the following declaration:
+ * <pre>
+ *  &lt;xs:element name="include" id="include"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEIncludeImpl extends XsTAnnotatedImpl implements XsEInclude {
+  private XsAnyURI schemaLocation;
+
+  protected XsEIncludeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setSchemaLocation(XsAnyURI pSchemaLocation) {
+    schemaLocation = pSchemaLocation;
+  }
+
+  public XsAnyURI getSchemaLocation() {
+    return schemaLocation;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (schemaLocation == null) {
+      throw new LocSAXException("Missing attribute: 'schemaLocation'", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:key</code> element, specified
+ * as follows:
+ * <pre>
+ *  &lt;xs:element name="key" type="xs:keybase" id="key"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEKeyImpl extends XsTKeybaseImpl implements XsEKey {
+  protected XsEKeyImpl(XsObject pParent) {
+    super(pParent);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyrefImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyrefImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEKeyrefImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:keyref</code> element, with the
+ * following specification:
+ * <pre>
+ *  <xs:element name="keyref" id="keyref">
+ *    <xs:annotation>
+ *      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+ *    </xs:annotation>
+ *    <xs:complexType>
+ *      <xs:complexContent>
+ *        <xs:extension base="xs:keybase">
+ *          <xs:attribute name="refer" type="xs:QName" use="required"/>
+ *        </xs:extension>
+ *      </xs:complexContent>
+ *    </xs:complexType>
+ *  </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEKeyrefImpl extends XsTKeybaseImpl implements XsEKeyref {
+  private XsQName refer;
+
+  protected XsEKeyrefImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setRefer(XsQName pRefer) {
+    refer = pRefer;
+  }
+
+  public void setRefer(String pRefer) throws SAXException {
+    setRefer(asXsQName(pRefer));
+  }
+
+  public XsQName getRefer() {
+    return refer;
+  }
+
+  public void validate() {
+    super.validate();
+    if (getRefer() == null) {
+      throw new NullPointerException("Missing attribute: 'refer'");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsELengthImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsELengthImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsELengthImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsELength;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:length</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="length" id="length" type="xs:numFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-length"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsELengthImpl extends XsTNumFacetImpl implements XsELength {
+  protected XsELengthImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "length";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEListImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEListImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEListImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:list</code>, following
+ * the specification below:
+ * <pre>
+ *  &lt;xs:element name="list" id="list"&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:annotation&gt;
+ *        &lt;xs:documentation
+ *            source="http://www.w3.org/TR/xmlschema-2/#element-list"&gt;
+ *          itemType attribute and simpleType child are mutually
+ *          exclusive, but one or other is required
+ *        &lt;/xs:documentation&gt;
+ *      &lt;/xs:annotation&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element name="simpleType" type="xs:localSimpleType"
+ *                minOccurs="0"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="itemType" type="xs:QName" use="optional"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEListImpl extends XsTAnnotatedImpl implements XsEList {
+  private XsQName itemType;
+  private XsTLocalSimpleType simpleType;
+
+  protected XsEListImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setItemType(XsQName pItemType) {
+    if (simpleType != null) {
+      throw new IllegalStateException("The 'itemType' attribute and the 'simpleType' child element are mutually exclusive.");
+    }
+    itemType = pItemType;
+  }
+
+  public void setItemType(String pItemType) throws SAXException {
+    setItemType(asXsQName(pItemType));
+  }
+
+  public XsQName getItemType() {
+    return itemType;
+  }
+
+  public XsTLocalSimpleType createSimpleType() {
+    if (itemType != null) {
+      throw new IllegalStateException("The 'itemType' attribute and the 'simpleType' child element are mutually exclusive.");
+    }
+    if (simpleType != null) {
+      throw new IllegalStateException("Multiple 'simpleType' child elements are forbidden.");
+    }
+    return simpleType = getObjectFactory().newXsTLocalSimpleType(this);
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return simpleType;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (itemType == null  &&  simpleType == null) {
+      throw new LocSAXException("Either the 'itemType' attribute must be set or a 'simpleType' child element must be present.",
+                                 getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxExclusiveImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxExclusiveImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxExclusiveImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEMaxExclusive;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:maxExclusive</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="maxExclusive" id="maxExclusive" type="xs:facet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEMaxExclusiveImpl extends XsTFacetImpl implements XsEMaxExclusive {
+  protected XsEMaxExclusiveImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "maxExclusive";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxInclusiveImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxInclusiveImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxInclusiveImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEMaxInclusive;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:maxInclusive</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="maxInclusive" id="maxInclusive" type="xs:facet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEMaxInclusiveImpl extends XsTFacetImpl implements XsEMaxInclusive {
+  protected XsEMaxInclusiveImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "maxInclusive";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxLengthImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxLengthImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMaxLengthImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEMaxLength;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:maxLength</code>,
+ * following this specification:
+ * <pre>
+ *  <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+ *    <xs:annotation>
+ *      <xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+ *    </xs:annotation>
+ *  </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEMaxLengthImpl extends XsTNumFacetImpl implements XsEMaxLength {
+  protected XsEMaxLengthImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "maxLength";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinExclusiveImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinExclusiveImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinExclusiveImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEMinExclusive;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:minExclusive</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="minExclusive" id="minExclusive" type="xs:facet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEMinExclusiveImpl extends XsTFacetImpl implements XsEMinExclusive {
+  protected XsEMinExclusiveImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "minExclusive";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinInclusiveImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinInclusiveImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinInclusiveImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEMinInclusive;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:minInclusive</code>,
+ * following this specification:
+ * <pre>
+ *  <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+ *    <xs:annotation>
+ *      <xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+ *    </xs:annotation>
+ *  </xs:element>
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEMinInclusiveImpl extends XsTFacetImpl implements XsEMinInclusive {
+  protected XsEMinInclusiveImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "minInclusive";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinLengthImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinLengthImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEMinLengthImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEMinLength;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:minLength</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="minLength" id="minLength" type="xs:numFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEMinLengthImpl extends XsTNumFacetImpl implements XsEMinLength {
+  protected XsEMinLengthImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public String getFacetName() {
+    return "minLength";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsENotationImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsENotationImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsENotationImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of the <code>xs:notation</code> element, with
+ * the following specification:
+ * <pre>
+ *  <xs:element name="notation" id="notation">
+ *    <xs:annotation>
+ *      <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+ *    </xs:annotation>
+ *    <xs:complexType>
+ *      <xs:complexContent>
+ *        <xs:extension base="xs:annotated">
+ *          <xs:attribute name="name" type="xs:NCName" use="required"/>
+ *          <xs:attribute name="public" type="xs:public" use="required"/>
+ *          <xs:attribute name="system" type="xs:anyURI"/>
+ *        </xs:extension>
+ *      </xs:complexContent>
+ *    </xs:complexType>
+ *  </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsENotationImpl extends XsTAnnotatedImpl implements XsENotation {
+  protected XsENotationImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  private XsNCName name;
+  private XsToken publicId;
+  private XsAnyURI systemId;
+
+  public void setName(XsNCName pName) {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public void setPublic(XsToken pPublic) {
+    publicId = pPublic;
+  }
+
+  public XsToken getPublic() {
+    return publicId;
+  }
+
+  public void setSystem(XsAnyURI pSystem) {
+    systemId = pSystem;
+  }
+
+  public XsAnyURI getSystem() {
+    return systemId;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (getName() == null) {
+      throw new LocSAXException("Missing attribute: 'name'", getLocator());
+    }
+    if (getPublic() == null) {
+      throw new LocSAXException("Missing attribute: 'public'", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEPatternImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEPatternImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEPatternImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEPattern;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of <code>xs:pattern</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="pattern" id="pattern" type="xs:noFixedFacet"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEPatternImpl extends XsTFacetBaseImpl implements XsEPattern {
+  private String value;
+
+  protected XsEPatternImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setValue(String pValue) {
+    value = pValue;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public String getFacetName() {
+    return "pattern";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERedefineImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERedefineImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERedefineImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:redefine</code>, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:element name="redefine" id="redefine"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:openAttrs"&gt;
+ *          &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *            &lt;xs:element ref="xs:annotation"/&gt;
+ *            &lt;xs:group ref="xs:redefinable"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/&gt;
+ *          &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsERedefineImpl extends XsTAnnotatedImpl implements XsERedefine {
+  protected XsERedefineImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  private List childs;
+  private XsAnyURI schemaLocation;
+
+  public void setSchemaLocation(XsAnyURI pSchemaLocation) {
+    schemaLocation = pSchemaLocation;
+  }
+
+  public XsAnyURI getSchemaLocation() {
+    return schemaLocation;
+  }
+
+  public XsEAnnotation createAnnotation() {
+    XsEAnnotation annotation = getObjectFactory().newXsEAnnotation(this);
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(annotation);
+    return annotation;
+  }
+
+  public XsETopLevelSimpleType createSimpleType() {
+    XsETopLevelSimpleType simpleType = getObjectFactory().newXsETopLevelSimpleType(this);
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(simpleType);
+    return simpleType;
+  }
+
+  public XsTComplexType createComplexType() {
+    XsTComplexType complexType = getObjectFactory().newXsTComplexType(this);
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(complexType);
+    return complexType;
+  }
+
+  public XsTGroup createGroup() {
+    XsTGroup group = getObjectFactory().newXsTGroup(this);
+    if (childs == null)  {
+      childs = new ArrayList();
+    }
+    childs.add(group);
+    return group;
+  }
+
+  public XsTAttributeGroup createAttributeGroup() {
+    XsTAttributeGroup attributeGroup = getObjectFactory().newXsTAttributeGroup(this);
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(attributeGroup);
+    return attributeGroup;
+  }
+
+  public Object[] getChilds() {
+    if (childs == null) {
+      return new Object[0];
+    }
+    return childs.toArray();
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (getSchemaLocation() == null) {
+      throw new LocSAXException("Missing attribute: 'schemaLocation'", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERestrictionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERestrictionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsERestrictionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:restriction</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="restriction" id="restriction"&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:annotation&gt;
+ *        &lt;xs:documentation
+ *            source="http://www.w3.org/TR/xmlschema-2/#element-restriction"&gt;
+ *          base attribute and simpleType child are mutually
+ *          exclusive, but one or other is required
+ *        &lt;/xs:documentation&gt;
+ *      &lt;/xs:annotation&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:group ref="xs:simpleRestrictionModel"/&gt;
+ *          &lt;xs:attribute name="base" type="xs:QName" use="optional"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ *
+ *  &lt;xs:group name="simpleRestrictionModel"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/&gt;
+ *      &lt;xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ *
+ *  &lt;xs:group name="facets"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        We should use a substitution group for facets, but
+ *        that's ruled out because it would allow users to
+ *        add their own, which we're not ready for yet.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:minExclusive"/&gt;
+ *      &lt;xs:element ref="xs:minInclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxExclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxInclusive"/&gt;
+ *      &lt;xs:element ref="xs:totalDigits"/&gt;
+ *      &lt;xs:element ref="xs:fractionDigits"/&gt;
+ *      &lt;xs:element ref="xs:length"/&gt;
+ *      &lt;xs:element ref="xs:minLength"/&gt;
+ *      &lt;xs:element ref="xs:maxLength"/&gt;
+ *      &lt;xs:element ref="xs:enumeration"/&gt;
+ *      &lt;xs:element ref="xs:whiteSpace"/&gt;
+ *      &lt;xs:element ref="xs:pattern"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsERestrictionImpl extends XsTAnnotatedImpl implements XsERestriction {
+  private XsQName base;
+
+  protected XsERestrictionImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  private XsGSimpleRestrictionModel impl = getObjectFactory().newXsGSimpleRestrictionModel(this);
+
+  public void setBase(XsQName pBase) {
+    if (getSimpleType() != null) {
+      throw new IllegalStateException("The 'base' attribute and the inner 'simpleType' child element are mutually exclusive,");
+    }
+    base = pBase;
+  }
+
+  public void setBase(String pBase) throws SAXException {
+    setBase(asXsQName(pBase));
+  }
+
+  public XsQName getBase() {
+    return base;
+  }
+
+  public XsTLocalSimpleType createSimpleType() throws SAXException {
+    if (base != null) {
+      throw new IllegalStateException("The 'base' attribute and the inner 'simpleType' child element are mutually exclusive,");
+    }
+    return impl.createSimpleType();
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return impl.getSimpleType();
+  }
+
+  public XsEMinExclusive createMinExclusive() throws SAXException {
+    return impl.createMinExclusive();
+  }
+
+  public XsEMinExclusive getMinExclusive() {
+    return impl.getMinExclusive();
+  }
+
+  public XsEMinInclusive createMinInclusive() throws SAXException {
+    return impl.createMinInclusive();
+  }
+
+  public XsEMinInclusive getMinInclusive() {
+    return impl.getMinInclusive();
+  }
+
+  public XsEMaxExclusive createMaxExclusive() throws SAXException {
+    return impl.createMaxExclusive();
+  }
+
+  public XsEMaxExclusive getMaxExclusive() {
+    return impl.getMaxExclusive();
+  }
+
+  public XsEMaxInclusive createMaxInclusive() throws SAXException {
+    return impl.createMaxInclusive();
+  }
+
+  public XsEMaxInclusive getMaxInclusive() {
+    return impl.getMaxInclusive();
+  }
+
+  public XsETotalDigits createTotalDigits() throws SAXException {
+    return impl.createTotalDigits();
+  }
+
+  public XsETotalDigits getTotalDigits() {
+    return impl.getTotalDigits();
+  }
+
+  public XsEFractionDigits createFractionDigits() throws SAXException {
+    return impl.createFractionDigits();
+  }
+
+  public XsEFractionDigits getFractionDigits() {
+    return impl.getFractionDigits();
+  }
+
+  public XsELength createLength() throws SAXException {
+    return impl.createLength();
+  }
+
+  public XsELength getLength() {
+    return impl.getLength();
+  }
+
+  public XsEMinLength createMinLength() throws SAXException {
+    return impl.createMinLength();
+  }
+
+  public XsEMinLength getMinLength() {
+    return impl.getMinLength();
+  }
+
+  public XsEMaxLength createMaxLength() throws SAXException {
+    return impl.createMaxLength();
+  }
+
+  public XsEMaxLength getMaxLength() {
+    return impl.getMaxLength();
+  }
+
+  public XsEWhiteSpace createWhiteSpace() throws SAXException {
+    return impl.createWhiteSpace();
+  }
+
+  public XsEWhiteSpace getWhiteSpace() {
+    return impl.getWhiteSpace();
+  }
+
+  public XsEPattern createPattern() throws SAXException {
+    return impl.createPattern();
+  }
+
+  public XsEPattern[] getPatterns() {
+    return impl.getPatterns();
+  }
+
+  public XsEEnumeration createEnumeration() throws SAXException {
+    return impl.createEnumeration();
+  }
+
+  public XsEEnumeration[] getEnumerations() {
+    return impl.getEnumerations();
+  }
+
+  public boolean hasFacets() {
+    return impl.hasFacets();
+  }
+
+  public XsTFacetBase[] getFacets() {
+    return impl.getFacets();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.NamespaceSupport;
+
+
+/** <p>Implementation of xs:schema. Follows this specification:
+ * <pre>
+ *  &lt;xs:element name="schema" id="schema"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:openAttrs"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *              &lt;xs:element ref="xs:include"/&gt;
+ *              &lt;xs:element ref="xs:import"/&gt;
+ *              &lt;xs:element ref="xs:redefine"/&gt;
+ *              &lt;xs:element ref="xs:annotation"/&gt;
+ *            &lt;/xs:choice&gt;
+ *            &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
+ *              &lt;xs:group ref="xs:schemaTop"/&gt;
+ *              &lt;xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *            &lt;/xs:sequence&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="targetNamespace" type="xs:anyURI"/&gt;
+ *          &lt;xs:attribute name="version" type="xs:token"/&gt;
+ *          &lt;xs:attribute name="finalDefault" type="xs:derivationSet" use="optional" default=""/&gt;
+ *          &lt;xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/&gt;
+ *          &lt;xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/&gt;
+ *          &lt;xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/&gt;
+ *          &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *          &lt;xs:attribute ref="xml:lang"/&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *
+ *    &lt;xs:key name="element"&gt;
+ *      &lt;xs:selector xpath="xs:element"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="attribute"&gt;
+ *      &lt;xs:selector xpath="xs:attribute"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="type"&gt;
+ *      &lt;xs:selector xpath="xs:complexType|xs:simpleType"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="group"&gt;
+ *      &lt;xs:selector xpath="xs:group"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="attributeGroup"&gt;
+ *      &lt;xs:selector xpath="xs:attributeGroup"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="notation"&gt;
+ *      &lt;xs:selector xpath="xs:notation"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *    &lt;xs:key name="identityConstraint"&gt;
+ *      &lt;xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/&gt;
+ *      &lt;xs:field xpath="@name"/&gt;
+ *    &lt;/xs:key&gt;
+ *  &lt;/xs:element&gt;
+ *
+ *  &lt;xs:group name="schemaTop"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        This group is for the
+ *        elements which occur freely at the top level of schemas.
+ *        All of their types are based on the "annotated" type by extension.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:group ref="xs:redefinable"/&gt;
+ *      &lt;xs:element ref="xs:element"/&gt;
+ *      &lt;xs:element ref="xs:attribute"/&gt;
+ *      &lt;xs:element ref="xs:notation"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre>
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsESchemaImpl extends XsTOpenAttrsImpl implements XsESchema {
+  private final XSContext context;
+  private XsAnyURI targetNamespace;
+  private String targetNamespacePrefix;
+  private XsToken version;
+  private XsDerivationSet finalDefault = new XsDerivationSet("");
+  private XsBlockSet blockDefault = new XsBlockSet("#all");
+  private XsFormChoice attributeFormDefault = XsFormChoice.UNQUALIFIED;
+  private XsFormChoice elementFormDefault = XsFormChoice.UNQUALIFIED;
+  private XsID id;
+  private XmlLang language;
+  private List childs = new ArrayList();
+  boolean schemaTopSeen = false;
+
+  protected XsESchemaImpl(XSContext pContext) {
+    super(null);
+    context = pContext;
+  }
+
+  public XSContext getContext() { return context; }
+
+  public XsEInclude createInclude() {
+    if (schemaTopSeen) {
+      throw new IllegalStateException("xs:include is not allowed after xs:simpleType, xs:complexType, xs:group, xs:attributeGroup, xs:element. xs:attribute, or xs:notation have been seen.");
+    }
+    XsEInclude xsInclude = getObjectFactory().newXsEInclude(this);
+    childs.add(xsInclude);
+    return xsInclude;
+  }
+
+  public XsEImport createImport() {
+    if (schemaTopSeen) {
+      throw new IllegalStateException("xs:include is not allowed after xs:simpleType, xs:complexType, xs:group, xs:attributeGroup, xs:element. xs:attribute, or xs:notation have been seen.");
+    }
+    XsEImport xsImport = getObjectFactory().newXsEImport(this);
+    childs.add(xsImport);
+    return xsImport;
+  }
+
+  public XsERedefine createRedefine() {
+    if (schemaTopSeen) {
+      throw new IllegalStateException("xs:include is not allowed after xs:simpleType, xs:complexType, xs:group, xs:attributeGroup, xs:element. xs:attribute, or xs:notation have been seen.");
+    }
+    XsERedefine xsRedefine = getObjectFactory().newXsERedefine(this);
+    childs.add(xsRedefine);
+    return xsRedefine;
+  }
+
+  public XsEAnnotation createAnnotation() {
+    XsEAnnotation xsAnnotation = getObjectFactory().newXsEAnnotation(this);
+    childs.add(xsAnnotation);
+    return xsAnnotation;
+  }
+
+  public XsETopLevelSimpleType createSimpleType() {
+    schemaTopSeen = true;
+    XsETopLevelSimpleType xsSimpleType = getObjectFactory().newXsETopLevelSimpleType(this);
+    childs.add(xsSimpleType);
+    return xsSimpleType;
+  }
+
+  public XsTComplexType createComplexType() {
+    schemaTopSeen = true;
+    XsTComplexType xsComplexType = getObjectFactory().newXsTComplexType(this);
+    childs.add(xsComplexType);
+    return xsComplexType;
+  }
+
+  public XsTNamedGroup createGroup() {
+    schemaTopSeen = true;
+    XsTNamedGroup xsGroup = getObjectFactory().newXsTNamedGroup(this);
+    childs.add(xsGroup);
+    return xsGroup;
+  }
+
+  public XsTAttributeGroup createAttributeGroup() {
+    schemaTopSeen = true;
+    XsTAttributeGroup xsAttributeGroup = getObjectFactory().newXsTAttributeGroup(this);
+    childs.add(xsAttributeGroup);
+    return xsAttributeGroup;
+  }
+
+  public XsTTopLevelElement createElement() {
+    schemaTopSeen = true;
+    XsTTopLevelElement xsElement = getObjectFactory().newXsTTopLevelElement(this);
+    childs.add(xsElement);
+    return xsElement;
+  }
+
+  public XsTAttribute createAttribute() {
+    schemaTopSeen = true;
+    XsTAttribute xsAttribute = getObjectFactory().newXsTAttribute(this);
+    childs.add(xsAttribute);
+    return xsAttribute;
+  }
+
+  public XsENotation createNotation() {
+    schemaTopSeen = true;
+    XsENotation xsNotation = getObjectFactory().newXsENotation(this);
+    childs.add(xsNotation);
+    return xsNotation;
+  }
+
+  public XsFormChoice getAttributeFormDefault() { return attributeFormDefault; }
+  public void setAttributeFormDefault(XsFormChoice pChoice) { attributeFormDefault = pChoice; }
+  public XsBlockSet getBlockDefault() { return blockDefault; }
+  public void setBlockDefault(XsBlockSet pSet) { blockDefault = pSet; }
+  public XsFormChoice getElementFormDefault() { return elementFormDefault; }
+  public void setElementFormDefault(XsFormChoice pChoice) { elementFormDefault = pChoice; }
+  public XsDerivationSet getFinalDefault() { return finalDefault; }
+  public void setFinalDefault(XsDerivationSet pSet) { finalDefault = pSet; }
+  public XsID getId() { return id; }
+  public void setId(XsID pId) { id = pId; }
+  public XsAnyURI getTargetNamespace() { return targetNamespace; }
+  public String getTargetNamespacePrefix() { return targetNamespacePrefix; }
+  public void setTargetNamespace(XsAnyURI pAnyURI) {
+    targetNamespace = pAnyURI;
+    if (targetNamespace == null) {
+      targetNamespacePrefix = null;
+    } else {
+      NamespaceSupport nss = getNamespaceSupport();
+      targetNamespacePrefix = nss.getPrefix(targetNamespace.toString());
+    }
+  }
+  public XsToken getVersion() { return version; }
+  public void setVersion(XsToken pToken) { version = pToken; }
+  public XmlLang getLang() { return language; }
+  public void setLang(XmlLang pLanguage) { language = pLanguage; }
+
+  public boolean setAttribute(String pQName, String pNamespaceURI,
+                                String pLocalName, String pValue) throws SAXException {
+    if (XMLConstants.XML_NS_URI.equals(pNamespaceURI)  &&  "lang".equals(pLocalName)) {
+      setLang(new XmlLang(pValue));
+      return true;
+    }
+    return super.setAttribute(pQName, pNamespaceURI, pLocalName, pValue);
+  }
+
+  public Object[] getChilds() {
+    return childs.toArray();
+  }
+
+  	/** <p>Creates a new {@link XsQName}, which is mutable and
+  	 * has the schemas target namespace as a namespace URI:
+  	 * If the target namespace changes, then the names URI
+  	 * does as well.</p>
+  	 */
+  	public XsQName newXsQName(String pLocalName, String pPrefix) {
+  	    return new XsQName(getTargetNamespace(), pLocalName, pPrefix){  	        
+  	        public String getNamespaceURI() {
+  	            XsAnyURI uri = getTargetNamespace();
+  	            if (uri != null) {
+  	                return uri.toString();
+  	            } else {
+  	                return "";
+  	            }
+  	        }
+  	        public String toString() {
+  	            XsAnyURI uri = getTargetNamespace();
+  	            if (uri == null) {
+  	                return super.toString();
+  	            } else {
+  	                return "{" + uri + "}" + getLocalName() + " (<= " + super.toString() + ")";
+  	            }
+  	        }
+  	    };
+  	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESelectorImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESelectorImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESelectorImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Interface of the <code>xs:selector</code> element, specified
+ * by the following:
+ * <pre>
+ *   <xs:element name="selector" id="selector">
+ *     <xs:annotation>
+ *       <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+ *     </xs:annotation>
+ *     <xs:complexType>
+ *       <xs:complexContent>
+ *         <xs:extension base="xs:annotated">
+ *           <xs:attribute name="xpath" use="required">
+ *             <xs:simpleType>
+ *               <xs:annotation>
+ *                 <xs:documentation>
+ *                   A subset of XPath expressions for use
+ *                   in selectors
+ *                 </xs:documentation>
+ *                 <xs:documentation>
+ *                   A utility type, not for public use
+ *                 </xs:documentation>
+ *               </xs:annotation>
+ *               <xs:restriction base="xs:token">
+ *                 <xs:annotation>
+ *                   <xs:documentation>
+ *                     The following pattern is intended to allow XPath
+ *                     expressions per the following EBNF:
+ *                       Selector    ::=    Path ( '|' Path )*
+ *                       Path        ::=    ('.//')? Step ( '/' Step )*
+ *                       Step    ::=    '.' | NameTest
+ *                       NameTest    ::=    QName | '*' | NCName ':' '*'
+ *                                          child:: is also allowed
+ *                   </xs:documentation>
+ *                 </xs:annotation>
+ *                 <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+ *                 </xs:pattern>
+ *               </xs:restriction>
+ *             </xs:simpleType>
+ *           </xs:attribute>
+ *         </xs:extension>
+ *       </xs:complexContent>
+ *     </xs:complexType>
+ *   </xs:element>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsESelectorImpl extends XsTAnnotatedImpl implements XsESelector {
+  private XsToken xpath;
+
+  protected XsESelectorImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setXpath(XsToken pXpath) {
+    xpath = pXpath;
+  }
+
+  public XsToken getXpath() {
+    return xpath;
+  }
+
+  public void validate() {
+    if (getXpath() == null) {
+      throw new NullPointerException("Missing attribute: xpath");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESequenceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESequenceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESequenceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:sequence</code> element, with the following
+ * specification:
+ * <pre>
+ *  &lt;xs:element name="sequence" type="xs:explicitGroup" id="sequence"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsESequenceImpl extends XsTExplicitGroupImpl implements XsESequence {
+  protected XsESequenceImpl(XsObject pParent) {
+    super(pParent);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESimpleContentImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESimpleContentImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsESimpleContentImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:simpleContent</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:element name="simpleContent" id="simpleContent"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:choice&gt;
+ *            &lt;xs:element name="restriction" type="xs:simpleRestrictionType"/&gt;
+ *            &lt;xs:element name="extension" type="xs:simpleExtensionType"/&gt;
+ *          &lt;/xs:choice&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsESimpleContentImpl extends XsTAnnotatedImpl implements XsESimpleContent {
+  private XsTSimpleRestrictionType restriction;
+  private XsTSimpleExtensionType extension;
+
+  protected XsESimpleContentImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTSimpleRestrictionType createRestriction() {
+    if (restriction != null) {
+      throw new IllegalStateException("Multiple 'restriction' elements are forbidden.");
+    }
+    if (extension != null) {
+      throw new IllegalStateException("The 'restriction' and 'extension' child elements are mutually exclusive.");
+    }
+    return restriction = getObjectFactory().newXsTSimpleRestrictionType(this);
+  }
+
+  public XsTSimpleRestrictionType getRestriction() {
+    return restriction;
+  }
+
+  public XsTSimpleExtensionType createExtension() {
+    if (extension != null) {
+      throw new IllegalStateException("Multiple 'extension' elements are forbidden.");
+    }
+    if (restriction != null) {
+      throw new IllegalStateException("The 'restriction' and 'extension' child elements are mutually exclusive.");
+    }
+    return extension = getObjectFactory().newXsTSimpleExtensionType(this);
+  }
+
+  public XsTSimpleExtensionType getExtension() {
+    return extension;
+  }
+
+  public void validate() {
+    if (extension == null  &&  restriction == null) {
+      throw new IllegalStateException("You must set either of the 'extension' or 'restriction' child elements.");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETopLevelSimpleTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETopLevelSimpleTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETopLevelSimpleTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:simpleType>, as specified by the following:
+ * <pre>
+ *  &lt;xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ *
+ *  &lt;xs:complexType name="topLevelSimpleType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:simpleType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:simpleDerivation"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" use="required" type="xs:NCName"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Required at the top level
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsETopLevelSimpleTypeImpl extends XsTSimpleTypeImpl implements XsETopLevelSimpleType {
+  protected XsETopLevelSimpleTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void validate() throws SAXException {
+     super.validate();
+     if (getName() == null) {
+       throw new LocSAXException("Missing 'name' attribute", getLocator());
+     }
+   }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETotalDigitsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETotalDigitsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsETotalDigitsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsETotalDigits;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:totalDigits</code>,
+ * following this specification:
+ * <pre>
+ *  &lt;xs:element name="totalDigits" id="totalDigits"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:restriction base="xs:numFacet"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="value" type="xs:positiveInteger" use="required"/&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsETotalDigitsImpl extends XsTNumFacetImpl implements XsETotalDigits {
+  protected XsETotalDigitsImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setValue(long pValue) throws SAXException {
+    if (pValue <= 0) {
+      throw new LocSAXException("The 'value' attribute must be > 0.", getLocator());
+    }
+    super.setValue(pValue);
+  }
+
+  public String getFacetName() {
+    return "totalDigits";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUnionImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUnionImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUnionImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:union</code>, following the
+ * specification below:
+ * <pre>
+ *  &lt;xs:element name="union" id="union"&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:annotation&gt;
+ *        &lt;xs:documentation
+ *            source="http://www.w3.org/TR/xmlschema-2/#element-union"&gt;
+ *          memberTypes attribute must be non-empty or there must be
+ *          at least one simpleType child
+ *        &lt;/xs:documentation&gt;
+ *      &lt;/xs:annotation&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:extension base="xs:annotated"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element name="simpleType" type="xs:localSimpleType"
+ *                minOccurs="0" maxOccurs="unbounded"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="memberTypes" use="optional"&gt;
+ *            &lt;xs:simpleType&gt;
+ *              &lt;xs:list itemType="xs:QName"/&gt;
+ *            &lt;/xs:simpleType&gt;
+ *          &lt;/xs:attribute&gt;
+ *        &lt;/xs:extension&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEUnionImpl extends XsTAnnotatedImpl implements XsEUnion {
+  public List simpleTypes;
+  public List memberTypes;
+
+  protected XsEUnionImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTLocalSimpleType createSimpleType() {
+    XsTLocalSimpleType simpleType = getObjectFactory().newXsTLocalSimpleType(this);
+    if (simpleTypes == null) {
+      simpleTypes = new ArrayList();
+    }
+    simpleTypes.add(simpleType);
+    return simpleType;
+  }
+
+  public XsTLocalSimpleType[] getSimpleTypes() {
+    if (simpleTypes == null) {
+      return new XsTLocalSimpleType[0];
+    }
+    return (XsTLocalSimpleType[]) simpleTypes.toArray(new XsTLocalSimpleType[simpleTypes.size()]);
+  }
+
+  public void setMemberTypes(XsQName[] pTypes) {
+    if (pTypes == null) {
+      memberTypes = null;
+    } else {
+      memberTypes = new ArrayList();
+      for (int i = 0;  i < pTypes.length;  i++) {
+        memberTypes.add(pTypes[i]);
+      }
+    }
+  }
+
+  public void setMemberTypes(String pTypes) throws SAXException {
+    if (pTypes == null) {
+      setMemberTypes((XsQName[]) null);
+    } else {
+      List myMemberTypes = new ArrayList();
+      for (StringTokenizer st = new StringTokenizer(pTypes);  st.hasMoreTokens();  ) {
+        String s = st.nextToken();
+        XsQName qName = asXsQName(s);
+        myMemberTypes.add(qName);
+      }
+      setMemberTypes((XsQName[]) myMemberTypes.toArray(new XsQName[myMemberTypes.size()]));
+    }
+  }
+
+  public XsQName[] getMemberTypes() {
+    if (memberTypes == null) {
+      return null;
+    }
+    return (XsQName[]) memberTypes.toArray(new XsQName[memberTypes.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUniqueImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUniqueImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEUniqueImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsEUnique;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/** <p>Implementation of the <code>xs:unique</code> element, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:element name="unique" type="xs:keybase" id="unique"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEUniqueImpl extends XsTKeybaseImpl implements XsEUnique {
+  protected XsEUniqueImpl(XsObject pParent) {
+    super(pParent);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEWhiteSpaceImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEWhiteSpaceImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsEWhiteSpaceImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:whiteSpace</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:element name="whiteSpace" id="whiteSpace"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation
+ *        source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexType&gt;
+ *      &lt;xs:complexContent&gt;
+ *        &lt;xs:restriction base="xs:facet"&gt;
+ *          &lt;xs:sequence&gt;
+ *            &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;/xs:sequence&gt;
+ *          &lt;xs:attribute name="value" use="required"&gt;
+ *            &lt;xs:simpleType&gt;
+ *              &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *                &lt;xs:enumeration value="preserve"/&gt;
+ *                &lt;xs:enumeration value="replace"/&gt;
+ *                &lt;xs:enumeration value="collapse"/&gt;
+ *              &lt;/xs:restriction&gt;
+ *            &lt;/xs:simpleType&gt;
+ *          &lt;/xs:attribute&gt;
+ *        &lt;/xs:restriction&gt;
+ *      &lt;/xs:complexContent&gt;
+ *    &lt;/xs:complexType&gt;
+ *  &lt;/xs:element&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsEWhiteSpaceImpl extends XsTFacetImpl implements XsEWhiteSpace {
+  protected XsEWhiteSpaceImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setValue(String pValue) {
+    if ("preserve".equals(pValue)  ||  "replace".equals(pValue)  ||
+        "collapse".equals(pValue)) {
+      super.setValue(pValue);
+    } else {
+      throw new IllegalArgumentException("Invalid value: " + pValue + "; expected either of 'preserve', 'replace', or 'collapse'");
+    }
+  }
+
+  public boolean isPreserving() {
+    return "preserve".equals(getValue());
+  }
+
+  public boolean isReplacing() {
+    return "replace".equals(getValue());
+  }
+
+  public boolean isCollapsing() {
+    return "collapse".equals(getValue());
+  }
+
+  public String getFacetName() {
+    return "whiteSpace";
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:allModel</code>, as specified by
+ * the following:
+ * <pre>
+ *  &lt;xs:group name="allModel"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *      &lt;xs:element name="element" minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:complexType&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;restricted max/min&lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *          &lt;xs:complexContent&gt;
+ *            &lt;xs:restriction base="xs:localElement"&gt;
+ *              &lt;xs:sequence&gt;
+ *                &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *                &lt;xs:choice minOccurs="0"&gt;
+ *                  &lt;xs:element name="simpleType" type="xs:localSimpleType"/&gt;
+ *                  &lt;xs:element name="complexType" type="xs:localComplexType"/&gt;
+ *                &lt;/xs:choice&gt;
+ *                &lt;xs:group ref="xs:identityConstraint" minOccurs="0"
+ *                    maxOccurs="unbounded"/&gt;
+ *              &lt;/xs:sequence&gt;
+ *              &lt;xs:attribute name="minOccurs" use="optional" default="1"&gt;
+ *                &lt;xs:simpleType&gt;
+ *                  &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
+ *                    &lt;xs:enumeration value="0"/&gt;
+ *                    &lt;xs:enumeration value="1"/&gt;
+ *                  &lt;/xs:restriction&gt;
+ *                &lt;/xs:simpleType&gt;
+ *              &lt;/xs:attribute&gt;
+ *              &lt;xs:attribute name="maxOccurs" use="optional" default="1"&gt;
+ *                &lt;xs:simpleType&gt;
+ *                  &lt;xs:restriction base="xs:allNNI"&gt;
+ *                    &lt;xs:enumeration value="0"/&gt;
+ *                    &lt;xs:enumeration value="1"/&gt;
+ *                  &lt;/xs:restriction&gt;
+ *                &lt;/xs:simpleType&gt;
+ *              &lt;/xs:attribute&gt;
+ *            &lt;/xs:restriction&gt;
+ *          &lt;/xs:complexContent&gt;
+ *        &lt;/xs:complexType&gt;
+ *       &lt;/xs:element&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ * <p><em>Implementation note: The above restriction of a {@link XsTLocalElement}
+ * is interpreted as a usual local element, except that the <code>minOccurs</code>
+ * and <code>maxOccurs</code> attributes must be 0 or 1.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGAllModelImpl extends XsTAnnotatedImpl implements XsGAllModel {
+  private List elements;
+
+  protected XsGAllModelImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTLocalElement createElement() {
+    XsTLocalElement element = getObjectFactory().newXsTLocalAllElement(this);
+    if (elements == null) {
+      elements = new ArrayList();
+    }
+    elements.add(element);
+    return element;
+  }
+
+  public XsTLocalElement[] getElements() {
+    if (elements == null) {
+      return new XsTLocalElement[0];
+    }
+    return (XsTLocalElement[]) elements.toArray(new XsTLocalElement[elements.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:attrDecls</code>, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:group name="attrDecls"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ *        &lt;xs:element name="attribute" type="xs:attribute"/&gt;
+ *        &lt;xs:element name="attributeGroup" type="xs:attributeGroupRef"/&gt;
+ *      &lt;/xs:choice&gt;
+ *      &lt;xs:element ref="xs:anyAttribute" minOccurs="0"/&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGAttrDeclsImpl implements XsGAttrDecls {
+  private final XsObject owner;
+  private List childs;
+  private XsTWildcard anyAttribute;
+
+  protected XsGAttrDeclsImpl(XsObject pOwner) {
+    owner = pOwner;
+  }
+
+  protected void addChild(Object o) {
+    if (o instanceof XsTWildcard) {
+      if (anyAttribute != null) {
+        throw new IllegalStateException("Multiple 'anyAttribute' child elements are forbidden.");
+      }
+      anyAttribute = (XsTWildcard) o;
+    } else {
+      if (anyAttribute != null) {
+        throw new IllegalStateException("An 'attribute' or 'attributeGroup' child element is invalid after an 'anyAttribute' child element.");
+      }
+    }
+    if (childs == null) {
+      childs = new ArrayList();
+    }
+    childs.add(o);
+  }
+
+  public XsTAttribute createAttribute() {
+    XsTAttribute attribute = owner.getObjectFactory().newXsTAttribute(owner);
+    addChild(attribute);
+    return attribute;
+  }
+
+  public XsTAttribute[] getAttributes() {
+    if (childs == null  ||  childs.size() == 0) {
+      return new XsTAttribute[0];
+    }
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XsTAttribute) {
+        result.add(o);
+      }
+    }
+    return (XsTAttribute[]) result.toArray(new XsTAttribute[result.size()]);
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    XsTAttributeGroupRef attributeGroupRef = owner.getObjectFactory().newXsTAttributeGroupRef(owner);
+    addChild(attributeGroupRef);
+    return attributeGroupRef;
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    if (childs == null  ||  childs.size() == 0) {
+      return new XsTAttributeGroupRefImpl[0];
+    }
+    List result = new ArrayList();
+    for (Iterator iter = childs.iterator();  iter.hasNext();  ) {
+      Object o = iter.next();
+      if (o instanceof XsTAttributeGroupRef) {
+        result.add(o);
+      }
+    }
+    return (XsTAttributeGroupRef[]) result.toArray(new XsTAttributeGroupRef[result.size()]);
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    XsTWildcard myAnyAttribute = owner.getObjectFactory().newXsTWildcard(owner);
+    addChild(myAnyAttribute);
+    return myAnyAttribute;
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return anyAttribute;
+  }
+
+  public Object[] getAllAttributes() {
+    if (childs == null) {
+      return new Object[0];
+    } else {
+      return childs.toArray();
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the group <code>xs:complexTypeModel</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:group name="complexTypeModel"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:simpleContent"/&gt;
+ *      &lt;xs:element ref="xs:complexContent"/&gt;
+ *      &lt;xs:sequence&gt;
+ *        &lt;xs:annotation&gt;
+ *          &lt;xs:documentation&gt;
+ *            This branch is short for &amp;lt;complexContent&amp;gt;
+ *            &amp;lt;restriction base="xs:anyType"&amp;gt;
+ *            ...
+ *            &amp;lt;/restriction&amp;gt;
+ *            &amp;lt;/complexContent&amp;gt;
+ *          &lt;/xs:documentation&gt;
+ *        &lt;/xs:annotation&gt;
+ *        &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *        &lt;xs:group ref="xs:attrDecls"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGComplexTypeModelImpl implements XsGComplexTypeModel {
+  private final XsObject owner;
+  private XsESimpleContent simpleContent;
+  private XsEComplexContent complexContent;
+  private boolean otherContent;
+  private final XsGTypeDefParticle typeDefParticle;
+  private final XsGAttrDecls attrDecls;
+
+  protected XsGComplexTypeModelImpl(XsObject pOwner) {
+    owner = pOwner;
+    XsObjectFactory factory = owner.getObjectFactory();
+    typeDefParticle = factory.newXsGTypeDefParticle(owner);
+    attrDecls = factory.newXsGAttrDecls(owner);
+  }
+
+  public XsESimpleContent createSimpleContent() {
+    if (simpleContent != null) {
+      throw new IllegalStateException("Multiple 'simpleContent' child elements are forbidden.");
+    }
+    if (complexContent != null) {
+      throw new IllegalStateException("The 'simpleContent' and 'complexContent' child elements are mutually exclusive.");
+    }
+    if (otherContent) {
+      throw new IllegalStateException("The 'simpleContent' child element and the child elements 'all', 'choice', 'sequence', 'group', 'attribute', and 'attributeGroup' are mutually exclusive.");
+    }
+    return simpleContent = owner.getObjectFactory().newXsESimpleContent(owner);
+  }
+
+  public XsESimpleContent getSimpleContent() {
+    return simpleContent;
+  }
+
+  public XsEComplexContent createComplexContent() {
+    if (complexContent != null) {
+      throw new IllegalStateException("Multiple 'complexContent' child elements are forbidden.");
+    }
+    if (simpleContent != null) {
+      throw new IllegalStateException("The 'complexContent' and 'simpleContent' child elements are mutually exclusive.");
+    }
+    if (otherContent) {
+      throw new IllegalStateException("The 'complexContent' child element and the child elements 'all', 'choice', 'sequence', 'group', 'attribute', and 'attributeGroup' are mutually exclusive.");
+    }
+    return complexContent = owner.getObjectFactory().newXsEComplexContent(owner);
+  }
+
+  public XsEComplexContent getComplexContent() {
+    return complexContent;
+  }
+
+  protected void validateOtherContent() {
+    if (simpleContent != null) {
+      throw new IllegalStateException("The child elements 'all', 'choice', 'sequence', 'group', 'attribute', 'attributeGroup', and the child element 'simpleContent' are mutually exclusive.");
+    }
+    if (complexContent != null) {
+      throw new IllegalStateException("The child elements 'all', 'choice', 'sequence', 'group', 'attribute', 'attributeGroup', and the child element 'complexContent' are mutually exclusive.");
+    }
+  }
+
+  public XsTAttribute createAttribute() {
+    validateOtherContent();
+    return attrDecls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return attrDecls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    validateOtherContent();
+    return attrDecls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return attrDecls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    validateOtherContent();
+    return attrDecls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return attrDecls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return attrDecls.getAllAttributes();
+  }
+
+  public void validate() throws SAXException {
+    if (!otherContent  &&  (simpleContent == null  &&  complexContent == null)) {
+      throw new LocSAXException("You must specify either of the 'simpleContent', 'complexContent', 'all', 'choice', 'sequence', or 'group' child elements.",
+                                 owner.getLocator());
+    }
+  }
+
+  public XsTGroupRef createGroup() {
+    return typeDefParticle.createGroup();
+  }
+
+  public XsTAll createAll() {
+    return typeDefParticle.createAll();
+  }
+
+  public XsESequence createSequence() {
+    return typeDefParticle.createSequence();
+  }
+
+  public XsEChoice createChoice() {
+    return typeDefParticle.createChoice();
+  }
+
+  public XsTTypeDefParticle getTypeDefParticle() {
+    return typeDefParticle.getTypeDefParticle();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the group <code>xs:identityConstraint</code>,
+ * specified as follows:
+ * <pre>
+ *  <xs:group name="identityConstraint">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        The three kinds of identity constraints, all with
+ *        type of or derived from 'keybase'.
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:choice>
+ *      <xs:element ref="xs:unique"/>
+ *      <xs:element ref="xs:key"/>
+ *      <xs:element ref="xs:keyref"/>
+ *    </xs:choice>
+ *  </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGIdentityConstraintImpl implements XsGIdentityConstraint {
+  private final XsObject owner;
+  private List constraints;
+
+  protected XsGIdentityConstraintImpl(XsObject pOwner) {
+    owner = pOwner;
+  }
+
+  protected void addIdentityConstraint(XsTIdentityConstraint pConstraint) {
+    if (constraints == null) {
+      constraints = new ArrayList();
+    }
+    constraints.add(pConstraint);
+  }
+
+  public XsEUnique createUnique() {
+    XsEUnique unique = owner.getObjectFactory().newXsEUnique(owner);
+    addIdentityConstraint(unique);
+    return unique;
+  }
+
+  public XsEKey createKey() {
+    XsEKey key = owner.getObjectFactory().newXsEKey(owner);
+    addIdentityConstraint(key);
+    return key;
+  }
+
+  public XsEKeyref createKeyref() {
+    XsEKeyref keyref = owner.getObjectFactory().newXsEKeyref(owner);
+    addIdentityConstraint(keyref);
+    return keyref;
+  }
+
+  public XsTIdentityConstraint[] getIdentityConstraints() {
+    if (constraints == null) {
+      return new XsTIdentityConstraint[0];
+    }
+    return (XsTIdentityConstraint[]) constraints.toArray(new XsTIdentityConstraint[constraints.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:typeDefParticle</code> group,
+ * as specified by the following:
+ * <pre>
+ *  <xs:group name="typeDefParticle">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        'complexType' uses this
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:choice>
+ *      <xs:element name="group" type="xs:groupRef"/>
+ *      <xs:element ref="xs:all"/>
+ *      <xs:element ref="xs:choice"/>
+ *      <xs:element ref="xs:sequence"/>
+ *    </xs:choice>
+ *  </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGParticleImpl implements XsGParticle {
+  private final XsObject owner;
+  private List particles;
+
+  protected XsGParticleImpl(XsObject pOwner) {
+    owner = pOwner;
+  }
+
+  protected void addParticle(XsTParticle pParticle) {
+    if (particles == null) {
+      particles = new ArrayList();
+    }
+    particles.add(pParticle);
+  }
+
+  public XsTLocalElement createElement() {
+    XsTLocalElement element = owner.getObjectFactory().newXsTLocalElement(owner);
+    addParticle(element);
+    return element;
+  }
+
+  public XsTGroupRef createGroup() {
+    XsTGroupRef groupRef = owner.getObjectFactory().newXsTGroupRef(owner);
+    addParticle(groupRef);
+    return groupRef;
+  }
+
+  public XsTAll createAll() {
+    XsTAll all = owner.getObjectFactory().newXsTAll(owner);
+    addParticle(all);
+    return all;
+  }
+
+  public XsESequence createSequence() {
+    XsESequence sequence = owner.getObjectFactory().newXsESequence(owner);
+    addParticle(sequence);
+    return sequence;
+  }
+
+  public XsEChoice createChoice() {
+    XsEChoice choice = owner.getObjectFactory().newXsEChoice(owner);
+    addParticle(choice);
+    return choice;
+  }
+
+  public XsEAny createAny() {
+    XsEAny any = owner.getObjectFactory().newXsEAny(owner);
+    addParticle(any);
+    return any;
+  }
+
+  public XsTParticle[] getParticles() {
+    if (particles == null) {
+      return new XsTParticle[0];
+    } else {
+      return (XsTParticle[]) particles.toArray(new XsTParticle[particles.size()]);
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Interface of <code>xs:simpleRestrictionModel</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:group name="simpleRestrictionModel"&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/&gt;
+ *      &lt;xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *    &lt;/xs:sequence&gt;
+ *  &lt;/xs:group&gt;
+ *
+ *  &lt;xs:group name="facets"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        We should use a substitution group for facets, but
+ *        that's ruled out because it would allow users to
+ *        add their own, which we're not ready for yet.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:minExclusive"/&gt;
+ *      &lt;xs:element ref="xs:minInclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxExclusive"/&gt;
+ *      &lt;xs:element ref="xs:maxInclusive"/&gt;
+ *      &lt;xs:element ref="xs:totalDigits"/&gt;
+ *      &lt;xs:element ref="xs:fractionDigits"/&gt;
+ *      &lt;xs:element ref="xs:length"/&gt;
+ *      &lt;xs:element ref="xs:minLength"/&gt;
+ *      &lt;xs:element ref="xs:maxLength"/&gt;
+ *      &lt;xs:element ref="xs:enumeration"/&gt;
+ *      &lt;xs:element ref="xs:whiteSpace"/&gt;
+ *      &lt;xs:element ref="xs:pattern"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGSimpleRestrictionModelImpl implements XsGSimpleRestrictionModel {
+  private final XsObject owner;
+  private XsTLocalSimpleType simpleType;
+  private List facets;
+
+  protected XsGSimpleRestrictionModelImpl(XsObject pOwner) {
+    owner = pOwner;
+  }
+
+  public XsTLocalSimpleType createSimpleType() {
+    if (simpleType != null) {
+      throw new IllegalStateException("Multiple 'simpleType' childs are forbidden.");
+    }
+    if (facets != null  &&  facets.size() > 0) {
+      throw new IllegalStateException("The 'simpleType' child element must precede the '" +
+                                       ((XsTFacetBase) facets.get(0)).getFacetName() + "' child element.");
+    }
+    return simpleType = owner.getObjectFactory().newXsTLocalSimpleType(owner);
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return simpleType;
+  }
+
+  protected XsTFacetBase getFacetByName(String pName) {
+    if (facets != null) {
+      for (int i = 0;  i < facets.size();  i++) {
+        XsTFacetBase facet = (XsTFacetBase) facets.get(i);
+        if (pName.equals(facet.getFacetName())) {
+          return facet;
+        }
+      }
+    }
+    return null;
+  }
+
+  protected void addFacet(XsTFacetBase pFacet) {
+    if (facets == null) {
+      facets = new ArrayList();
+    }
+    facets.add(pFacet);
+  }
+
+  protected void addUniqueFacet(XsTFacetBase pFacet) {
+    if (getFacetByName(pFacet.getFacetName()) != null) {
+      throw new IllegalStateException("Multiple '" + pFacet.getFacetName() + "' childs are forbidden.");
+    }
+    addFacet(pFacet);
+  }
+
+  public XsEMinExclusive createMinExclusive() {
+    XsEMinExclusive minExclusive = owner.getObjectFactory().newXsEMinExclusive(owner);
+    addUniqueFacet(minExclusive);
+    return minExclusive;
+  }
+
+  public XsEMinExclusive getMinExclusive() {
+    return (XsEMinExclusive) getFacetByName("minExclusive");
+  }
+
+  public XsEMinInclusive createMinInclusive() {
+    XsEMinInclusive minInclusive = owner.getObjectFactory().newXsEMinInclusive(owner);
+    addUniqueFacet(minInclusive);
+    return minInclusive;
+  }
+
+  public XsEMinInclusive getMinInclusive() {
+    return (XsEMinInclusive) getFacetByName("minInclusive");
+  }
+
+  public XsEMaxExclusive createMaxExclusive() {
+    XsEMaxExclusive maxExclusive = owner.getObjectFactory().newXsEMaxExclusive(owner);
+    addUniqueFacet(maxExclusive);
+    return maxExclusive;
+  }
+
+  public XsEMaxExclusive getMaxExclusive() {
+    return (XsEMaxExclusive) getFacetByName("maxExclusive");
+  }
+
+  public XsEMaxInclusive createMaxInclusive() {
+    XsEMaxInclusive maxInclusive = owner.getObjectFactory().newXsEMaxInclusive(owner);
+    addUniqueFacet(maxInclusive);
+    return maxInclusive;
+  }
+
+  public XsEMaxInclusive getMaxInclusive() {
+    return (XsEMaxInclusive) getFacetByName("maxInclusive");
+  }
+
+  public XsETotalDigits createTotalDigits() {
+    XsETotalDigits totalDigits = owner.getObjectFactory().newXsETotalDigits(owner);
+    addUniqueFacet(totalDigits);
+    return totalDigits;
+  }
+
+  public XsETotalDigits getTotalDigits() {
+    return (XsETotalDigits) getFacetByName("totalDigits");
+  }
+
+  public XsEFractionDigits createFractionDigits() {
+    XsEFractionDigits fractionDigits = owner.getObjectFactory().newXsEFractionDigits(owner);
+    addUniqueFacet(fractionDigits);
+    return fractionDigits;
+  }
+
+  public XsEFractionDigits getFractionDigits() {
+    return (XsEFractionDigits) getFacetByName("fractionDigits");
+  }
+
+  public XsELength createLength() {
+    XsELength length = owner.getObjectFactory().newXsELength(owner);
+    addUniqueFacet(length);
+    return length;
+  }
+
+  public XsELength getLength() {
+    return (XsELength) getFacetByName("length");
+  }
+
+  public XsEMinLength createMinLength() {
+    XsEMinLength minLength = owner.getObjectFactory().newXsEMinLength(owner);
+    addUniqueFacet(minLength);
+    return minLength;
+  }
+
+  public XsEMinLength getMinLength() {
+    return (XsEMinLength) getFacetByName("minLength");
+  }
+
+  public XsEMaxLength createMaxLength() {
+    XsEMaxLength maxLength = owner.getObjectFactory().newXsEMaxLength(owner);
+    addUniqueFacet(maxLength);
+    return maxLength;
+  }
+
+  public XsEMaxLength getMaxLength() {
+    return (XsEMaxLength) getFacetByName("maxLength");
+  }
+
+  public XsEWhiteSpace createWhiteSpace() {
+    XsEWhiteSpace whiteSpace = owner.getObjectFactory().newXsEWhiteSpace(owner);
+    addUniqueFacet(whiteSpace);
+    return whiteSpace;
+  }
+
+  public XsEWhiteSpace getWhiteSpace() {
+    return (XsEWhiteSpace) getFacetByName("whiteSpace");
+  }
+
+  public XsEPattern createPattern() {
+    XsEPattern pattern = owner.getObjectFactory().newXsEPattern(owner);
+    addFacet(pattern);
+    return pattern;
+  }
+
+  public XsEPattern[] getPatterns() {
+    if (facets == null) {
+      return new XsEPattern[0];
+    }
+    List result = new ArrayList();
+    for (int i = 0;  i < facets.size();  i++) {
+      XsTFacetBase facet = (XsTFacetBase) facets.get(i);
+      if ("pattern".equals(facet.getFacetName())) {
+        result.add(facet);
+      }
+    }
+    return (XsEPattern[]) result.toArray(new XsEPattern[result.size()]);
+  }
+
+  public XsEEnumeration createEnumeration() {
+    XsEEnumeration enumeration = owner.getObjectFactory().newXsEEnumeration(owner);
+    addFacet(enumeration);
+    return enumeration;
+  }
+
+  public XsEEnumeration[] getEnumerations() {
+    if (facets == null) {
+      return new XsEEnumeration[0];
+    }
+    List result = new ArrayList();
+    for (int i = 0;  i < facets.size();  i++) {
+      XsTFacetBase facet = (XsTFacetBase) facets.get(i);
+      if ("enumeration".equals(facet.getFacetName())) {
+        result.add(facet);
+      }
+    }
+    return (XsEEnumeration[]) result.toArray(new XsEEnumeration[result.size()]);
+  }
+
+  public boolean hasFacets() {
+    return facets != null  &&  facets.size() > 0;
+  }
+
+  public XsTFacetBase[] getFacets() {
+    if (facets == null) {
+      return new XsEEnumeration[0];
+    }
+    return (XsTFacetBase[]) facets.toArray(new XsTFacetBase[facets.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:typeDefParticle</code> group,
+ * as specified by the following:
+ * <pre>
+ *  <xs:group name="typeDefParticle">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        'complexType' uses this
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:choice>
+ *      <xs:element name="group" type="xs:groupRef"/>
+ *      <xs:element ref="xs:all"/>
+ *      <xs:element ref="xs:choice"/>
+ *      <xs:element ref="xs:sequence"/>
+ *    </xs:choice>
+ *  </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGTypeDefParticleImpl implements XsGTypeDefParticle {
+  private final XsObject owner;
+  private XsTTypeDefParticle particle;
+
+  protected XsGTypeDefParticleImpl(XsObject pOwner) {
+    owner = pOwner;
+  }
+
+  protected void setTypeDefParticle(XsTTypeDefParticle pParticle) {
+    if (particle != null) {
+      throw new IllegalStateException("Only a single child element of 'all', 'group', 'choice', or 'sequence' is allowed.");
+    }
+    particle = pParticle;
+  }
+
+
+  public XsTTypeDefParticle getTypeDefParticle() {
+    return particle;
+  }
+
+  public XsTGroupRef createGroup() {
+    XsTGroupRef group = owner.getObjectFactory().newXsTGroupRef(owner);
+    setTypeDefParticle(group);
+    return group;
+  }
+
+  public XsTAll createAll() {
+    XsTAll all = owner.getObjectFactory().newXsTAll(owner);
+    setTypeDefParticle(all);
+    return all;
+  }
+
+  public XsESequence createSequence() {
+    XsESequence sequence = owner.getObjectFactory().newXsESequence(owner);
+    setTypeDefParticle(sequence);
+    return sequence;
+  }
+
+  public XsEChoice createChoice() {
+    XsEChoice choice = owner.getObjectFactory().newXsEChoice(owner);
+    setTypeDefParticle(choice);
+    return choice;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,338 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.apache.ws.jaxme.xs.parser.impl.AbstractXsSAXParser;
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>The XsObjectFactory, which allows to extend the parser.
+ * The various elements and/or attributes use this factory to
+ * create new objects.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsObjectFactoryImpl implements XsObjectFactory {
+  private static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+  private static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
+
+  protected XSContext getContext() {
+    return XSParser.getRunningInstance().getContext();
+  }
+
+  public Locator getLocator() {
+    return getContext().getLocator();
+  }
+
+  public XsAGDefRef newXsAGDefRef(XsObject pOwner) {
+    return new XsAGDefRefImpl(pOwner);
+  }
+
+  public XsAGOccurs newXsAGOccurs(XsObject pOwner) {
+    return new XsAGOccursImpl(pOwner);
+  }
+
+  public XsEAnnotation newXsEAnnotation(XsObject pParent) {
+    return new XsEAnnotationImpl(pParent);
+  }
+
+  public XsEAny newXsEAny(XsObject pParent) {
+    return new XsEAnyImpl(pParent);
+  }
+
+  public XsEAppinfo newXsEAppinfo(XsObject pParent) {
+    return new XsEAppinfoImpl(pParent);
+  }
+
+  public XsEComplexContent newXsEComplexContent(XsObject pParent) {
+    return new XsEComplexContentImpl(pParent);
+  }
+
+  public XsEChoice newXsEChoice(XsObject pParent) {
+    return new XsEChoiceImpl(pParent);
+  }
+
+  public XsEDocumentation newXsEDocumentation(XsObject pParent) {
+    return new XsEDocumentationImpl(pParent);
+  }
+
+  public XsEEnumeration newXsEEnumeration(XsObject pParent) {
+    return new XsEEnumerationImpl(pParent);
+  }
+
+  public XsEFractionDigits newXsEFractionDigits(XsObject pParent) {
+    return new XsEFractionDigitsImpl(pParent);
+  }
+
+  public XsEField newXsEField(XsObject pParent) {
+    return new XsEFieldImpl(pParent);
+  }
+
+  public XsEImport newXsEImport(XsObject pParent) {
+    return new XsEImportImpl(pParent);
+  }
+
+  public XsEInclude newXsEInclude(XsObject pParent) {
+    return new XsEIncludeImpl(pParent);
+  }
+
+  public XsEKey newXsEKey(XsObject pParent) {
+    return new XsEKeyImpl(pParent);
+  }
+
+  public XsEKeyref newXsEKeyref(XsObject pParent) {
+    return new XsEKeyrefImpl(pParent);
+  }
+
+  public XsELength newXsELength(XsObject pParent) {
+    return new XsELengthImpl(pParent);
+  }
+
+  public XsEList newXsEList(XsObject pParent) {
+    return new XsEListImpl(pParent);
+  }
+
+  public XsEMaxExclusive newXsEMaxExclusive(XsObject pParent) {
+    return new XsEMaxExclusiveImpl(pParent);
+  }
+
+  public XsEMaxInclusive newXsEMaxInclusive(XsObject pParent) {
+    return new XsEMaxInclusiveImpl(pParent);
+  }
+
+  public XsEMaxLength newXsEMaxLength(XsObject pParent) {
+    return new XsEMaxLengthImpl(pParent);
+  }
+
+  public XsEMinExclusive newXsEMinExclusive(XsObject pParent) {
+    return new XsEMinExclusiveImpl(pParent);
+  }
+
+  public XsEMinInclusive newXsEMinInclusive(XsObject pParent) {
+    return new XsEMinInclusiveImpl(pParent);
+  }
+
+  public XsEMinLength newXsEMinLength(XsObject pParent) {
+    return new XsEMinLengthImpl(pParent);
+  }
+
+  public XsENotation newXsENotation(XsObject pParent) {
+    return new XsENotationImpl(pParent);
+  }
+
+  public XsEPattern newXsEPattern(XsObject pParent) {
+    return new XsEPatternImpl(pParent);
+  }
+
+  public XsERedefine newXsERedefine(XsObject pParent) {
+    return new XsERedefineImpl(pParent);
+  }
+
+  public XsERestriction newXsERestriction(XsObject pParent) {
+    return new XsERestrictionImpl(pParent);
+  }
+
+  public XsESequence newXsESequence(XsObject pParent) {
+    return new XsESequenceImpl(pParent);
+  }
+
+  public XsESelector newXsESelector(XsObject pParent) {
+    return new XsESelectorImpl(pParent);
+  }
+
+  public XsESimpleContent newXsESimpleContent(XsObject pParent) {
+    return new XsESimpleContentImpl(pParent);
+  }
+
+  public XsESchema newXsESchema() {
+    return new XsESchemaImpl(getContext());
+  }
+
+  public XsETopLevelSimpleType newXsETopLevelSimpleType(XsObject pParent) {
+    return new XsETopLevelSimpleTypeImpl(pParent);
+  }
+
+  public XsETotalDigits newXsETotalDigits(XsObject pParent) {
+    return new XsETotalDigitsImpl(pParent);
+  }
+
+  public XsEUnion newXsEUnion(XsObject pParent) {
+    return new XsEUnionImpl(pParent);
+  }
+
+  public XsEUnique newXsEUnique(XsObject pParent) {
+    return new XsEUniqueImpl(pParent);
+  }
+
+  public XsEWhiteSpace newXsEWhiteSpace(XsObject pParent) {
+    return new XsEWhiteSpaceImpl(pParent);
+  }
+
+  public XsGAllModel newXsGAllModel(XsObject pParent) {
+    return new XsGAllModelImpl(pParent);
+  }
+
+  public XsGAttrDecls newXsGAttrDecls(XsObject pOwner) {
+    return new XsGAttrDeclsImpl(pOwner);
+  }
+
+  public XsGIdentityConstraint newXsGIdentityConstraint(XsObject pOwner) {
+    return new XsGIdentityConstraintImpl(pOwner);
+  }
+
+  public XsGParticle newXsGParticle(XsObject pOwner) {
+    return new XsGParticleImpl(pOwner);
+  }
+
+  public XsGComplexTypeModel newXsGComplexTypeModel(XsObject pOwner) {
+    return new XsGComplexTypeModelImpl(pOwner);
+  }
+
+  public XsGSimpleRestrictionModel newXsGSimpleRestrictionModel(XsObject pOwner) {
+    return new XsGSimpleRestrictionModelImpl(pOwner);
+  }
+
+  public XsGTypeDefParticle newXsGTypeDefParticle(XsObject pOwner) {
+    return new XsGTypeDefParticleImpl(pOwner);
+  }
+
+  public XsTAll newXsTAll(XsObject pParent) {
+    return new XsTAllImpl(pParent);
+  }
+
+  public XsTAnnotated newXsTAnnotated(XsObject pParent) {
+    return new XsTAnnotatedImpl(pParent);
+  }
+
+  public XsTAttribute newXsTAttribute(XsObject pParent) {
+    return new XsTAttributeImpl(pParent);
+  }
+
+  public XsTAttributeGroup newXsTAttributeGroup(XsObject pParent) {
+    return new XsTAttributeGroupImpl(pParent);
+  }
+
+  public XsTAttributeGroupRef newXsTAttributeGroupRef(XsObject pParent) {
+    return new XsTAttributeGroupRefImpl(pParent);
+  }
+
+  public XsTComplexRestrictionType newXsTComplexRestrictionType(XsObject pParent) {
+    return new XsTComplexRestrictionTypeImpl(pParent);
+  }
+
+  public XsTComplexType newXsTComplexType(XsObject pParent) {
+    return new XsTComplexTypeImpl(pParent);
+  }
+
+  public XsTExtensionType newXsTExtensionType(XsObject pParent) {
+    return new XsTExtensionTypeImpl(pParent);
+  }
+
+  public XsTLocalElement newXsTLocalElement(XsObject pParent) {
+    return new XsTLocalElementImpl(pParent);
+  }
+
+  /** <p>Creates a new instance of {@link XsTLocalElement}, which
+   * is located inside of an <code>xs:all</code> group. The
+   * element ensures that its <code>minOccurs</code> and
+   * <code>maxOccurs</code> values are 0 or 1.</p>
+   */
+  public XsTLocalElement newXsTLocalAllElement(XsObject pParent) {
+    return new XsTLocalAllElementImpl(pParent);
+  }
+
+  public XsTLocalComplexType newXsTLocalComplexType(XsObject pParent) {
+    return new XsTLocalComplexTypeImpl(pParent);
+  }
+
+  public XsTLocalSimpleType newXsTLocalSimpleType(XsObject pParent) {
+    return new XsTLocalSimpleTypeImpl(pParent);
+  }
+
+  public XsTNamedGroup newXsTNamedGroup(XsObject pParent) {
+    return new XsTNamedGroupImpl(pParent);
+  }
+
+  public XsTGroup newXsTGroup(XsObject pParent) {
+    return new XsTGroupImpl(pParent);
+  }
+
+  public XsTGroupRef newXsTGroupRef(XsObject pParent) {
+    return new XsTGroupRefImpl(pParent);
+  }
+
+  public XsTSimpleExplicitGroup newXsTSimpleExplicitGroup(XsObject pParent) {
+    return new XsTSimpleExplicitGroupImpl(pParent);
+  }
+
+  public XsTSimpleExtensionType newXsTSimpleExtensionType(XsObject pParent) {
+    return new XsTSimpleExtensionTypeImpl(pParent);
+  }
+
+  public XsTSimpleRestrictionType newXsTSimpleRestrictionType(XsObject pParent) {
+    return new XsTSimpleRestrictionTypeImpl(pParent);
+  }
+
+  public XsTTopLevelElement newXsTTopLevelElement(XsObject pParent) {
+    return new XsTTopLevelElementImpl(pParent);
+  }
+
+  public XsTWildcard newXsTWildcard(XsObject pParent) {
+    return new XsTWildcardImpl(pParent);
+  }
+
+  public XMLReader newXMLReader(boolean pValidating) throws ParserConfigurationException, SAXException {
+    SAXParserFactory spf = SAXParserFactory.newInstance();
+    spf.setNamespaceAware(true);
+    spf.setValidating(pValidating);
+    SAXParser sp = spf.newSAXParser();
+    if (pValidating) {
+      sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
+    }
+    XMLReader xr = sp.getXMLReader();
+    xr.setErrorHandler(new ErrorHandler(){
+      public void error(SAXParseException e) throws SAXException { throw e; }
+      public void fatalError(SAXParseException fe) throws SAXException { throw fe; }
+      public void warning(SAXParseException w) throws SAXException { throw w; }
+    });
+    return xr;
+  }
+
+  public XsSAXParser newXsSAXParser() {
+    return newXsSAXParser(newXsESchema());
+  }
+
+  public XsSAXParser newXsSAXParser(Object pBean) {
+    return new AbstractXsSAXParser(pBean){
+      public XSContext getData(){
+        return XSParser.getRunningInstance().getContext();
+      }
+    };
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.LocatorImpl;
+import org.xml.sax.helpers.NamespaceSupport;
+
+
+/** <p>Base class for all the types, attributes, elements, ...</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsObjectImpl implements XsObject {
+  private final XsObject parent;
+  private boolean isValidated;
+  private final Locator locator;
+
+  protected XsObjectImpl(XsObject pParent) {
+    if (pParent == null) {
+      if (!(this instanceof XsESchema)) {
+        throw new IllegalStateException("Only the schema may have a null parent.");
+      }
+    } else {
+      if (this instanceof XsESchema) {
+        throw new IllegalStateException("The schema must have a null parent.");
+      }
+    }
+    parent = pParent;
+    XSContext context = getContext();
+    if (context != null) {
+      Locator loc = context.getLocator();
+      locator = loc == null ? null : new LocatorImpl(getContext().getLocator());
+    } else {
+      locator = null;
+    }
+  }
+
+  public XsESchema getXsESchema() {
+    if (parent == null) {
+      return (XsESchema) this;
+    } else {
+      return parent.getXsESchema();
+    }
+  }
+
+  public boolean isTopLevelObject() { return parent == null  ||  parent instanceof XsESchema; }
+  public XsObject getParentObject() { return parent; }
+
+  public XsObjectFactory getObjectFactory() { return getContext().getXsObjectFactory(); }
+  public Locator getLocator() { return locator; }
+  protected NamespaceSupport getNamespaceSupport() { return getContext().getNamespaceSupport(); }
+  protected XsQName asXsQName(String pName) throws SAXException {
+  	return asXsQName(getXsESchema(), getLocator(), getNamespaceSupport(), pName);
+  }
+  protected static XsQName asXsQName(XsESchema pSchema, Locator pLocator, NamespaceSupport pNss, String pName) throws SAXException {
+    String[] parts = pNss.processName(pName, new String[3], false);
+    if (parts == null) {
+      throw new LocSAXException("Undeclared namespace prefix: " + pName, pLocator);
+    }
+    if (pSchema instanceof XsESchemaImpl
+        &&  pSchema.getTargetNamespace() == null
+        &&  (parts[0] == null  ||  "".equals(parts[0]))) {
+        // xs:include may map the target namespace
+        return ((XsESchemaImpl) pSchema).newXsQName(parts[1], XsQName.prefixOf(pName));
+    } else {
+        return new XsQName(parts[0], parts[1], XsQName.prefixOf(pName));
+    }
+  }
+  public XSContext getContext() { return getXsESchema().getContext(); }
+
+  protected final boolean isValidated() {
+    return isValidated;
+  }
+
+  public void validate() throws SAXException {
+    isValidated = true;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the following type:
+ * <pre>
+ *   &lt;xs:complexType name="all"&gt;
+ *     &lt;xs:annotation&gt;
+ *       &lt;xs:documentation&gt;
+ *         Only elements allowed inside
+ *       &lt;/xs:documentation&gt;
+ *     &lt;/xs:annotation&gt;
+ *     &lt;xs:complexContent&gt;
+ *       &lt;xs:restriction base="xs:explicitGroup"&gt;
+ *         &lt;xs:group ref="xs:allModel"/&gt;
+ *         &lt;xs:attribute name="minOccurs" use="optional" default="1"&gt;
+ *           &lt;xs:simpleType&gt;
+ *             &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
+ *               &lt;xs:enumeration value="0"/&gt;
+ *               &lt;xs:enumeration value="1"/&gt;
+ *             &lt;/xs:restriction&gt;
+ *           &lt;/xs:simpleType&gt;
+ *         &lt;/xs:attribute&gt;
+ *         &lt;xs:attribute name="maxOccurs" use="optional" default="1"&gt;
+ *           &lt;xs:simpleType&gt;
+ *             &lt;xs:restriction base="xs:allNNI"&gt;
+ *               &lt;xs:enumeration value="1"/&gt;
+ *             &lt;/xs:restriction&gt;
+ *           &lt;/xs:simpleType&gt;
+ *         &lt;/xs:attribute&gt;
+ *       &lt;/xs:restriction&gt;
+ *     &lt;/xs:complexContent&gt;
+ *   &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAllImpl extends XsTAnnotatedImpl implements XsTAll {
+  private final XsAGOccurs occurs;
+  private final XsGParticle particle;
+
+  protected XsTAllImpl(XsObject pParent) {
+    super(pParent);
+    occurs = getObjectFactory().newXsAGOccurs(this);
+    particle = getObjectFactory().newXsGParticle(this);
+  }
+
+  public void setName(XsNCName pName) {
+    throw new IllegalStateException("Use of the 'name' attribute is prohibited in xs:explicitGroup");
+  }
+
+  public XsNCName getName() {
+    throw new IllegalStateException("Use of the 'name' attribute is prohibited in xs:explicitGroup");
+  }
+
+  public void setRef(XsQName pRef) {
+    throw new IllegalStateException("Use of the 'name' attribute is prohibited in xs:explicitGroup");
+  }
+
+  public void setRef(String pRef) throws SAXException {
+    throw new IllegalStateException("Use of the 'name' attribute is prohibited in xs:explicitGroup");
+  }
+
+  public XsQName getRef() {
+    throw new IllegalStateException("Use of the 'name' attribute is prohibited in xs:explicitGroup");
+  }
+
+  public void setMaxOccurs(String pMaxOccurs) {
+    try {
+      if (Integer.parseInt(pMaxOccurs) != 1) {
+        throw new IllegalArgumentException();
+      }
+    } catch (Exception e) {
+      throw new IllegalArgumentException("Invalid value of the 'maxOccurs' attribute: " + pMaxOccurs + "; must be 1");
+    }
+  }
+
+  public int getMaxOccurs() {
+    return 1;
+  }
+
+  public void setMinOccurs(int pMinOccurs) {
+    occurs.setMinOccurs(pMinOccurs);
+  }
+
+  public int getMinOccurs() {
+    return occurs.getMinOccurs();
+  }
+
+  public XsTLocalElement createElement() {
+    return particle.createElement();
+  }
+
+  public XsTGroupRef createGroup() {
+    return particle.createGroup();
+  }
+
+  public XsTAll createAll() {
+    return particle.createAll();
+  }
+
+  public XsESequence createSequence() {
+    return particle.createSequence();
+  }
+
+  public XsEChoice createChoice() {
+    return particle.createChoice();
+  }
+
+  public XsEAny createAny() {
+    return particle.createAny();
+  }
+
+  public XsTParticle[] getParticles() {
+    return particle.getParticles();
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of an annotated element, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:complexType name="annotated"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        This type is extended by all types which allow annotation
+ *        other than &lt;schema&gt; itself.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:openAttrs"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="id" type="xs:ID"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAnnotatedImpl extends XsTOpenAttrsImpl implements XsTAnnotated {
+  private XsEAnnotation annotation;
+  private XsID id;
+
+  protected XsTAnnotatedImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsEAnnotation createAnnotation() {
+    if (annotation != null) {
+      throw new NullPointerException("Multiple 'annotation' elements are forbidden.");
+    }
+    return annotation = getObjectFactory().newXsEAnnotation(this);
+  }
+
+  public XsEAnnotation getAnnotation() {
+    return annotation;
+  }
+
+  public void setId(XsID pId) {
+    id = pId;
+  }
+
+  public XsID getId() {
+    return id;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of an <code>xs:attributeGroup</code>,
+ * with the following specification:
+ * <pre>
+ *  &lt;xs:complexType name="attributeGroup" abstract="true"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAttributeGroupImpl extends XsTAnnotatedImpl implements XsTAttributeGroup {
+  private final XsGAttrDecls decls;
+  private final XsAGDefRef defRef;
+
+  protected XsTAttributeGroupImpl(XsObject pParent) {
+    super(pParent);
+    decls = getObjectFactory().newXsGAttrDecls(this);
+    defRef = getObjectFactory().newXsAGDefRef(this);
+  }
+
+  public void setName(XsNCName pName) {
+    defRef.setName(pName);
+  }
+
+  public XsNCName getName() {
+    return defRef.getName();
+  }
+
+  public void setRef(XsQName pRef) {
+    defRef.setRef(pRef);
+  }
+
+  public void setRef(String pRef) throws SAXException {
+    setRef(asXsQName(pRef));
+  }
+
+  public XsQName getRef() {
+    return defRef.getRef();
+  }
+
+  public XsTAttribute createAttribute() {
+    return decls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return decls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    return decls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return decls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    return decls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return decls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return decls.getAllAttributes();
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    defRef.validate();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTAttributeGroupRef;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:attributeGroupRef</code>
+ * type, specified as follows:
+ * <pre>
+ *  &lt;xs:complexType name="attributeGroupRef"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:attributeGroup"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="ref" use="required" type="xs:QName"/&gt;
+ *        &lt;xs:attribute name="name" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAttributeGroupRefImpl extends XsTAnnotatedImpl implements XsTAttributeGroupRef {
+  private XsQName ref;
+
+  protected XsTAttributeGroupRefImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setRef(XsQName pRef) { ref = pRef; }
+  public void setRef(String pRef) throws SAXException {
+    setRef(asXsQName(pRef));
+  }
+  public XsQName getRef() { return ref; }
+  public void validate() {
+    if (ref == null) {
+      throw new NullPointerException("Missing attribute: 'ref'");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:attribute</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:complexType name="attribute"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *        &lt;xs:attribute name="type" type="xs:QName"/&gt;
+ *        &lt;xs:attribute name="use" use="optional" default="optional"&gt;
+ *          &lt;xs:simpleType&gt;
+ *            &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *              &lt;xs:enumeration value="prohibited"/&gt;
+ *              &lt;xs:enumeration value="optional"/&gt;
+ *              &lt;xs:enumeration value="required"/&gt;
+ *            &lt;/xs:restriction&gt;
+ *          &lt;/xs:simpleType&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="default" type="xs:string"/&gt;
+ *        &lt;xs:attribute name="fixed" type="xs:string"/&gt;
+ *        &lt;xs:attribute name="form" type="xs:formChoice"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAttributeImpl extends XsTAnnotatedImpl implements XsTAttribute {
+  private XsTLocalSimpleType simpleType;
+  private XsQName type;
+  private Use use = OPTIONAL;
+  private String defaultValue;
+  private String fixedValue;
+  private XsFormChoice form;
+  private XsNCName name;
+  private XsQName ref;
+
+  protected XsTAttributeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTLocalSimpleType createSimpleType() {
+    if (simpleType != null) {
+      throw new IllegalStateException("Multiple 'simpleType' child elements are forbidden.");
+    }
+    if (type != null) {
+      throw new IllegalStateException("The 'type' attribute and the 'simpleType' child element are mutually exclusive.");
+    }
+    return simpleType = getObjectFactory(). newXsTLocalSimpleType(this);
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return simpleType;
+  }
+
+  public void setType(XsQName pType) {
+    if (simpleType != null) {
+      throw new IllegalStateException("The 'type' attribute and the 'simpleType' child element are mutually exclusive.");
+    }
+    type = pType;
+  }
+
+  public void setType(String pType) throws SAXException {
+    setType(asXsQName(pType));
+  }
+
+  public XsQName getType() {
+    return type;
+  }
+
+  public void setUse(Use pUse) {
+    use = pUse;
+  }
+
+  public Use getUse() {
+    return use;
+  }
+
+  public void setDefault(String pDefault) {
+    defaultValue = pDefault;
+  }
+
+  public String getDefault() {
+    return defaultValue;
+  }
+
+  public void setFixed(String pFixed) {
+    fixedValue = pFixed;
+  }
+
+  public String getFixed() {
+    return fixedValue;
+  }
+
+  public void setForm(XsFormChoice pForm) throws SAXException {
+    if (isGlobal()  &&  pForm != null) {
+      throw new LocSAXException("The 'form' attribute is valid for local attributes only.",
+                                 getLocator());
+    }
+    form = pForm;
+  }
+
+  public XsFormChoice getForm() {
+    return form;
+  }
+
+  public void setName(XsNCName pName) {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public void setRef(XsQName pRef) {
+    ref = pRef;
+  }
+
+  public void setRef(String pRef) throws SAXException {
+    setRef(asXsQName(pRef));
+  }
+
+  public XsQName getRef() {
+    return ref;
+  }
+
+  public boolean isGlobal() { return isTopLevelObject(); }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:complexRestrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="complexRestrictionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:restrictionType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTComplexRestrictionTypeImpl extends XsTRestrictionTypeImpl
+    implements XsTComplexRestrictionType {
+  protected XsTComplexRestrictionTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTLocalSimpleType createSimpleType() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'simpleType' child element.", getLocator());
+  }
+
+  public XsEMinExclusive createMinExclusive() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'minExclusive' child element.", getLocator());
+  }
+
+  public XsEMinInclusive createMinInclusive() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'minInclusive' child element.", getLocator());
+  }
+
+  public XsEMaxExclusive createMaxExclusive() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'maxExclusive' child element.", getLocator());
+  }
+
+  public XsEMaxInclusive createMaxInclusive() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'maxInclusive' child element.", getLocator());
+  }
+
+  public XsETotalDigits createTotalDigits() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'totalDigits' child element.", getLocator());
+  }
+
+  public XsEFractionDigits createFractionDigits() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'fractionDigits' child element.", getLocator());
+  }
+
+  public XsELength createLength() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'length' child element.", getLocator());
+  }
+
+  public XsEMinLength createMinLength() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'minLength' child element.", getLocator());
+  }
+
+  public XsEMaxLength createMaxLength() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'maxLength' child element.", getLocator());
+  }
+
+  public XsEWhiteSpace createWhiteSpace() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'whiteSpace' child element.", getLocator());
+  }
+
+  public XsEPattern createPattern() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'pattern' child element.", getLocator());
+  }
+
+  public XsEEnumeration createEnumeration() throws SAXException {
+    throw new LocSAXException("A restriction with complex content doesn't support the 'enumeration' child element.", getLocator());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Base implementation of a complex type, to be shared
+ * by {@link org.apache.ws.jaxme.xs.xml.XsTLocalComplexType} and
+ * {@link org.apache.ws.jaxme.xs.xml.XsTComplexType}.
+ * Follows this specification:
+ * <pre>
+ *  &lt;xs:complexType name="complexType" abstract="true"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:complexTypeModel"/&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Will be restricted to required or forbidden
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="mixed" type="xs:boolean" use="optional" default="false"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Not allowed if simpleContent child is chosen.
+ *              May be overriden by setting on complexContent child.
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/&gt;
+ *        &lt;xs:attribute name="final" type="xs:derivationSet"/&gt;
+ *        &lt;xs:attribute name="block" type="xs:derivationSet"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ *
+ *  &lt;xs:group name="complexTypeModel"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:simpleContent"/&gt;
+ *      &lt;xs:element ref="xs:complexContent"/&gt;
+ *      &lt;xs:sequence&gt;
+ *        &lt;xs:annotation&gt;
+ *          &lt;xs:documentation&gt;
+ *            This branch is short for &amp;lt;complexContent&amp;gt;
+ *            &amp;lt;restriction base="xs:anyType"&amp;gt;
+ *            ...
+ *            &amp;lt;/restriction&amp;gt;
+ *            &amp;lt;/complexContent&amp;gt;
+ *          &lt;/xs:documentation&gt;
+ *        &lt;/xs:annotation&gt;
+ *        &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *        &lt;xs:group ref="xs:attrDecls"/&gt;
+ *      &lt;/xs:sequence&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ *
+ *  &lt;xs:group name="typeDefParticle"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        'complexType' uses this
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element name="group" type="xs:groupRef"/&gt;
+ *      &lt;xs:element ref="xs:all"/&gt;
+ *      &lt;xs:element ref="xs:choice"/&gt;
+ *      &lt;xs:element ref="xs:sequence"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTComplexTypeImpl extends XsTAnnotatedImpl implements XsTComplexType {
+  private XsESimpleContent simpleContent;
+  private XsEComplexContent complexContent;
+  private final XsGTypeDefParticle particle;
+  private final XsGAttrDecls attrDecls;
+  private boolean isParticleInUse, isMixed, isAbstract;
+  private XsDerivationSet finalSet;
+  private XsNCName name;
+
+  protected XsTComplexTypeImpl(XsObject pParent) {
+    super(pParent);
+    particle = getObjectFactory().newXsGTypeDefParticle(this);
+    attrDecls = getObjectFactory().newXsGAttrDecls(this);
+  }
+
+  public XsDerivationSet getFinal() {
+    return finalSet;
+  }
+
+  public void setFinal(XsDerivationSet pFinal) {
+    finalSet = pFinal;
+  }
+
+  public XsESimpleContent createSimpleContent() {
+    if (simpleContent != null) {
+      throw new IllegalStateException("Multiple 'simpleContent' elements are forbidden.");
+    }
+    if (complexContent != null  ||  isParticleInUse) {
+      throw new IllegalStateException("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive.");
+    }
+    return simpleContent = getObjectFactory().newXsESimpleContent(this);
+  }
+
+  public XsESimpleContent getSimpleContent() {
+    return simpleContent;
+  }
+
+  public XsEComplexContent createComplexContent() {
+    if (complexContent != null) {
+      throw new IllegalStateException("Multiple 'complexContent' elements are forbidden.");
+    }
+    if (simpleContent != null  ||  isParticleInUse) {
+      throw new IllegalStateException("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive.");
+    }
+    return complexContent = getObjectFactory().newXsEComplexContent(this);
+  }
+
+  public XsEComplexContent getComplexContent() {
+    return complexContent;
+  }
+
+  public XsTGroupRef createGroup() {
+    if (simpleContent != null  ||  complexContent != null  ||  isParticleInUse) {
+      throw new IllegalStateException("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive.");
+    }
+    isParticleInUse = true;
+    return particle.createGroup();
+  }
+
+  public XsTAll createAll() {
+    if (simpleContent != null  ||  complexContent != null  ||  isParticleInUse) {
+      throw new IllegalStateException("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive.");
+    }
+    isParticleInUse = true;
+    return particle.createAll();
+  }
+
+  public XsEChoice createChoice() {
+    if (simpleContent != null  ||  complexContent != null  ||  isParticleInUse) {
+      throw new IllegalStateException("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive.");
+    }
+    isParticleInUse = true;
+    return particle.createChoice();
+  }
+
+  public XsESequence createSequence() {
+    if (simpleContent != null  ||  complexContent != null  ||  isParticleInUse) {
+      throw new IllegalStateException("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive.");
+    }
+    isParticleInUse = true;
+    return particle.createSequence();
+  }
+
+  public XsTTypeDefParticle getTypeDefParticle() {
+    return particle.getTypeDefParticle();
+  }
+
+  public XsTAttribute createAttribute() {
+    return attrDecls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return attrDecls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    return attrDecls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return attrDecls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    return attrDecls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return attrDecls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return attrDecls.getAllAttributes();
+  }
+
+  public void setName(XsNCName pName) {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public boolean isAbstract() {
+    return isAbstract;
+  }
+
+  public void setAbstract(boolean pAbstract) {
+    isAbstract = pAbstract;
+  }
+
+  public boolean isMixed() {
+    return isMixed;
+  }
+
+  public void setMixed(boolean pMixed) {
+    isMixed = pMixed;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTElementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTElementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTElementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:element</code> type,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="element" abstract="true"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        The element element can be used either
+ *        at the top level to define an element-type binding globally,
+ *        or within a content model to either reference a globally-defined
+ *        element or type or declare an element-type binding locally.
+ *        The ref form is not allowed at the top level.
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:choice minOccurs="0"&gt;
+ *            &lt;xs:element name="simpleType" type="xs:localSimpleType"/&gt;
+ *            &lt;xs:element name="complexType" type="xs:localComplexType"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *        &lt;xs:attribute name="type" type="xs:QName"/&gt;
+ *        &lt;xs:attribute name="substitutionGroup" type="xs:QName"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:occurs"/&gt;
+ *        &lt;xs:attribute name="default" type="xs:string"/&gt;
+ *        &lt;xs:attribute name="fixed" type="xs:string"/&gt;
+ *        &lt;xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/&gt;
+ *        &lt;xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/&gt;
+ *        &lt;xs:attribute name="final" type="xs:derivationSet"/&gt;
+ *        &lt;xs:attribute name="block" type="xs:blockSet"/&gt;
+ *        &lt;xs:attribute name="form" type="xs:formChoice"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XsTElementImpl extends XsTAnnotatedImpl implements XsTElement {
+  private XsTLocalSimpleType simpleType;
+  private XsTLocalComplexType complexType;
+  private XsQName type;
+  private XsQName substitutionGroup;
+  private String defaultValue;
+  private String fixedValue;
+  private boolean isNillable;
+  private boolean isAbstract;
+  private XsDerivationSet finalSet;
+  private XsBlockSet blockSet;
+  private XsFormChoice formChoice;
+  private final XsAGDefRef defRef;
+  private final XsAGOccurs occurs;
+  private XsGIdentityConstraint constraint;
+
+  protected XsTElementImpl(XsObject pParent) {
+    super(pParent);
+    defRef = getObjectFactory().newXsAGDefRef(this);
+    occurs = getObjectFactory().newXsAGOccurs(this);
+    constraint = getObjectFactory().newXsGIdentityConstraint(this);
+  }
+
+  public XsTLocalSimpleType createSimpleType() throws SAXException {
+    if (simpleType != null) {
+      throw new LocSAXException("Multiple 'simpleType' childs are forbidden.", getLocator());
+    }
+    if (complexType != null) {
+      throw new LocSAXException("The 'simpleType' and 'complexType' childs are mutually exclusive.", getLocator());
+    }
+    if (type != null) {
+      throw new LocSAXException("The 'simpleType' child and the 'type' attribute are mutually exclusive.", getLocator());
+    }
+    return simpleType = getObjectFactory().newXsTLocalSimpleType(this);
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return simpleType;
+  }
+
+  public XsTLocalComplexType createComplexType() throws SAXException {
+    if (complexType != null) {
+      throw new LocSAXException("Multiple 'complexType' childs are forbidden.", getLocator());
+    }
+    if (simpleType != null) {
+      throw new LocSAXException("The 'simpleType' and 'complexType' childs are mutually exclusive.", getLocator());
+    }
+    if (type != null) {
+      throw new LocSAXException("The 'complexType' child and the 'type' attribute are mutually exclusive.", getLocator());
+    }
+    return complexType = getObjectFactory().newXsTLocalComplexType(this);
+  }
+
+  public XsTLocalComplexType getComplexType() {
+    return complexType;
+  }
+
+  public void setType(XsQName pType) throws SAXException {
+    if (simpleType != null) {
+      throw new LocSAXException("The 'simpleType' child element and the 'type' attribute are mutually exclusive.", getLocator());
+    }
+    if (complexType != null) {
+      throw new LocSAXException("The 'complexType' child element and the 'type' attribute are mutually exclusive.", getLocator());
+    }
+    type = pType;
+  }
+
+  public void setType(String pType) throws SAXException {
+    setType(asXsQName(pType));
+  }
+
+  public XsQName getType() {
+    return type;
+  }
+
+  public void setSubstitutionGroup(XsQName pSubstitutionGroup) throws SAXException {
+    substitutionGroup = pSubstitutionGroup;
+  }
+
+  public void setSubstitutionGroup(String pSubstitutionGroup) throws SAXException {
+    setSubstitutionGroup(asXsQName(pSubstitutionGroup));
+  }
+
+  public XsQName getSubstitutionGroup() {
+    return substitutionGroup;
+  }
+
+  public void setDefault(String pDefault) {
+    defaultValue = pDefault;
+  }
+
+  public String getDefault() {
+    return defaultValue;
+  }
+
+  public void setFixed(String pFixed) {
+    fixedValue = pFixed;
+  }
+
+  public String getFixed() {
+    return fixedValue;
+  }
+
+  public void setNillable(boolean pNillable) {
+    isNillable = pNillable;
+  }
+
+  public boolean getNillable() {
+    return isNillable;
+  }
+
+  public void setAbstract(boolean pAbstract) {
+    isAbstract = pAbstract;
+  }
+
+  public boolean getAbstract() {
+    return isAbstract;
+  }
+
+  public void setFinal(XsDerivationSet pFinal) {
+    finalSet = pFinal;
+  }
+
+  public XsDerivationSet getFinal() {
+    return finalSet;
+  }
+
+  public void setBlock(XsBlockSet pBlock) {
+    blockSet = pBlock;
+  }
+
+  public XsBlockSet getBlock() {
+    return blockSet;
+  }
+
+  public void setForm(XsFormChoice pForm) {
+    formChoice = pForm;
+  }
+
+  public XsFormChoice getForm() {
+    return formChoice;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (type == null  &&  simpleType == null  &&  complexType == null  &&  getRef() == null) {
+      setType(org.apache.ws.jaxme.xs.types.XSAnyType.getInstance().getName());
+    }
+    defRef.validate();
+    occurs.validate();
+  }
+
+  public void setName(XsNCName pName) {
+    defRef.setName(pName);
+  }
+
+  public XsNCName getName() {
+    return defRef.getName();
+  }
+
+  public void setRef(XsQName pRef) {
+    defRef.setRef(pRef);
+  }
+
+  public void setRef(String pRef) throws SAXException {
+    setRef(asXsQName(pRef));
+  }
+
+  public XsQName getRef() {
+    return defRef.getRef();
+  }
+
+  public void setMaxOccurs(String pMaxOccurs) {
+    occurs.setMaxOccurs(pMaxOccurs);
+  }
+
+  public int getMaxOccurs() {
+    return occurs.getMaxOccurs();
+  }
+
+  public void setMinOccurs(int pMinOccurs) {
+    occurs.setMinOccurs(pMinOccurs);
+  }
+
+  public int getMinOccurs() {
+    return occurs.getMinOccurs();
+  }
+
+  public XsEUnique createUnique() {
+    return constraint.createUnique();
+  }
+
+  public XsEKey createKey() {
+    return constraint.createKey();
+  }
+
+  public XsEKeyref createKeyref() {
+    return constraint.createKeyref();
+  }
+
+  public XsTIdentityConstraint[] getIdentityConstraints() {
+    return constraint.getIdentityConstraints();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExplicitGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExplicitGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExplicitGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.apache.ws.jaxme.xs.xml.XsTExplicitGroup;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:explicitGroup</code>
+ * type, as specified by the following:
+ * <pre>
+ *  <xs:complexType name="explicitGroup">
+ *    <xs:annotation>
+ *      <xs:documentation>
+ *        group type for the three kinds of group
+ *      </xs:documentation>
+ *    </xs:annotation>
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:group">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+ *        <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ *  </xs:complexType>
+ * </pre></p>
+ * <p><em>Implementation note:</em> This interface doesn't specify
+ * any additional methods. However, the implementations <code>validate()</code>
+ * method must ensure that
+ * <ol>
+ *   <li>neither of the 'name' or 'ref' attributes are set</li>
+ *   <li>Either of the 'element', 'choice', 'sequence', 'any', or 'group'
+ *     child elements is set, but not the 'all' element.</li>
+ * </ol>
+ * </p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTExplicitGroupImpl extends XsTGroupImpl implements XsTExplicitGroup {
+  protected XsTExplicitGroupImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(XsNCName pName) {
+    throw new IllegalStateException("This group must not have its 'name' attribute set.");
+  }
+
+  public void setRef(XsQName pRef) {
+    throw new IllegalStateException("This group must not have its 'ref' attribute set.");
+  }
+
+  public void setRef(String pRef) throws SAXException {
+    setRef(asXsQName(pRef));
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExtensionTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExtensionTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTExtensionTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:extensionType</code> type, as
+ * specified by:
+ * <pre>
+ *  &lt;xs:complexType name="extensionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="base" type="xs:QName" use="required"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTExtensionTypeImpl extends XsTAnnotatedImpl implements XsTExtensionType {
+  private XsQName base;
+  private final XsGTypeDefParticle particle;
+  private final XsGAttrDecls attrDecls;
+
+  protected XsTExtensionTypeImpl(XsObject pParent) {
+    super(pParent);
+    particle = getObjectFactory().newXsGTypeDefParticle(this);
+    attrDecls = getObjectFactory().newXsGAttrDecls(this);
+  }
+
+  public void setBase(XsQName pBase) {
+    base = pBase;
+  }
+
+  public void setBase(String pBase) throws SAXException {
+    setBase(asXsQName(pBase));
+  }
+
+  public XsQName getBase() {
+    return base;
+  }
+
+  public XsTGroupRef createGroup() {
+    return particle.createGroup();
+  }
+
+  public XsTAll createAll() {
+    return particle.createAll();
+  }
+
+  public XsEChoice createChoice() {
+    return particle.createChoice();
+  }
+
+  public XsESequence createSequence() {
+    return particle.createSequence();
+  }
+
+  public XsTTypeDefParticle getTypeDefParticle() {
+    return particle.getTypeDefParticle();
+  }
+
+  public XsTAttribute createAttribute() {
+    return attrDecls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return attrDecls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    return attrDecls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return attrDecls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    return attrDecls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return attrDecls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return attrDecls.getAllAttributes();
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (getBase() == null) {
+      throw new NullPointerException("Missing 'base' attribute.");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetBaseImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetBaseImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetBaseImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XsTFacetBaseImpl extends XsTAnnotatedImpl
+    implements XsTFacetBase {
+  protected XsTFacetBaseImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public abstract String getFacetName();
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFacetImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of a facet, following this specification:
+ * <pre>
+ *  &lt;xs:complexType name="facet"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:attribute name="value" use="required"/&gt;
+ *        &lt;xs:attribute name="fixed" type="xs:boolean" use="optional"
+ *                    default="false"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XsTFacetImpl extends XsTFixedFacetImpl {
+  private String value;
+
+  protected XsTFacetImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setValue(String pValue) {
+    value = pValue;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (value == null) {
+      throw new LocSAXException("Missing 'value' attribute", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFixedFacetImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFixedFacetImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTFixedFacetImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsTFixedFacet;
+
+
+/** <p>A common base class for {@link org.apache.ws.jaxme.xs.xml.XsTFacet} and
+ * {@link org.apache.ws.jaxme.xs.xml.XsTNumFacet}.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XsTFixedFacetImpl extends XsTFacetBaseImpl
+    implements XsTFixedFacet {
+  private boolean isFixed;
+
+  protected XsTFixedFacetImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setFixed(boolean pFixed) {
+    isFixed = pFixed;
+  }
+
+  public boolean isFixed() {
+    return isFixed;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:group</code>, type, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="group" abstract="true"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        group type for explicit groups, named top-level groups and
+ *        group references
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:defRef"/&gt;
+ *        &lt;xs:attributeGroup ref="xs:occurs"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTGroupImpl extends XsTAnnotatedImpl implements XsTGroup {
+  private final XsAGDefRef defRef;
+  private final XsAGOccurs occurs;
+  private final XsGParticle particle;
+
+  protected XsTGroupImpl(XsObject pParent) {
+    super(pParent);
+    defRef = getObjectFactory().newXsAGDefRef(this);
+    occurs = getObjectFactory().newXsAGOccurs(this);
+    particle = getObjectFactory().newXsGParticle(this);
+  }
+
+  public void setName(XsNCName pName) {
+    defRef.setName(pName);
+  }
+
+  public XsNCName getName() {
+    return defRef.getName();
+  }
+
+  public void setRef(XsQName pRef) {
+    defRef.setRef(pRef);
+  }
+
+  public void setRef(String pRef) throws SAXException {
+    setRef(asXsQName(pRef));
+  }
+
+  public XsQName getRef() {
+    return defRef.getRef();
+  }
+
+  public void setMaxOccurs(String pMaxOccurs) {
+    occurs.setMaxOccurs(pMaxOccurs);
+  }
+
+  public int getMaxOccurs() {
+    return occurs.getMaxOccurs();
+  }
+
+  public void setMinOccurs(int pMinOccurs) {
+    occurs.setMinOccurs(pMinOccurs);
+  }
+
+  public int getMinOccurs() {
+    return occurs.getMinOccurs();
+  }
+
+  public XsTLocalElement createElement() {
+    return particle.createElement();
+  }
+
+  public XsTGroupRef createGroup() {
+    return particle.createGroup();
+  }
+
+  public XsTAll createAll() {
+    return particle.createAll();
+  }
+
+  public XsESequence createSequence() {
+    return particle.createSequence();
+  }
+
+  public XsEChoice createChoice() {
+    return particle.createChoice();
+  }
+
+  public XsEAny createAny() {
+    return particle.createAny();
+  }
+
+  public XsTParticle[] getParticles() {
+    return particle.getParticles();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupRefImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupRefImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTGroupRefImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:groupRef</code> type,
+ * with the following specification:
+ * <pre>
+ *  <xs:complexType name="groupRef">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:realGroup">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="ref" use="required" type="xs:QName"/>
+ *        <xs:attribute name="name" use="prohibited"/>
+ *      </xs:restriction>
+ *   </xs:complexContent>
+ * </xs:complexType>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTGroupRefImpl extends XsTRealGroupImpl implements XsTGroupRef {
+  protected XsTGroupRefImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void validate() {
+    super.validate();
+    if (getName() != null) {
+      throw new IllegalStateException("A group reference must not have a 'name' attribute.");
+    }
+    if (getRef() == null) {
+      throw new NullPointerException("A group reference must have a nonempty 'ref' attribute.");
+    }
+    if (getParticles().length != 0) {
+      throw new NullPointerException("A group reference must not have any 'all', 'sequence', or 'choice' elements.");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTKeybaseImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTKeybaseImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTKeybaseImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:keybase</code> type, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="keybase"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:selector"/&gt;
+ *          &lt;xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName" use="required"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTKeybaseImpl extends XsTAnnotatedImpl implements XsTKeybase {
+  private XsESelector selector;
+  private List fields = new ArrayList();
+  private XsNCName name;
+
+  protected XsTKeybaseImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsESelector createSelector() {
+    if (selector != null) {
+      throw new IllegalStateException("Multiple 'selector' child elements are forbidden.");
+    }
+    if (fields.size() > 0) {
+      throw new IllegalStateException("The 'selector' child element must precede the 'field' child elements.");
+    }
+    selector = getObjectFactory().newXsESelector(this);
+    return selector;
+  }
+
+  public XsESelector getSelector() {
+    return selector;
+  }
+
+  public XsEField createField() {
+    if (selector == null) {
+      throw new NullPointerException("This 'field' child element must be preceded by a 'selector' child element.");
+    }
+    XsEField field = getObjectFactory().newXsEField(this);
+    fields.add(field);
+    return field;
+  }
+
+  public XsEField[] getFields() {
+    return (XsEField[]) fields.toArray(new XsEField[fields.size()]);
+  }
+
+  public void setName(XsNCName pName) {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public void validate() {
+    if (name == null) {
+      throw new NullPointerException("Missing attribute: 'name'");
+    }
+    if (selector == null) {
+      throw new NullPointerException("Missing child element: 'selector'");
+    }
+    if (fields.size() == 0) {
+      throw new NullPointerException("Missing child element: 'field'");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalAllElementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalAllElementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalAllElementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTLocalAllElementImpl extends XsTLocalElementImpl {
+  protected XsTLocalAllElementImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setMaxOccurs(String pValue) {
+    boolean valid = !"unbounded".equals(pValue);
+    if (valid) {
+      try {
+        int i = Integer.parseInt(pValue);
+        valid = i == 0  ||  i == 1;
+      } catch (Exception e) {
+        valid = false;
+      }
+    }
+    if (!valid) {
+      throw new IllegalArgumentException("Invalid value for 'maxOccurs': " + pValue + "; must be 0 or 1");
+    }
+    super.setMaxOccurs(pValue);
+  }
+  public void setMinOccurs(int pValue) {
+    if (pValue != 0  &&  pValue != 1) {
+      throw new IllegalArgumentException("Invalid value for 'minOccurs': " + pValue + "; must be 0 or 1");
+    }
+    super.setMinOccurs(pValue);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalComplexTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalComplexTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalComplexTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Interface of a local <code>xs:complexType</code>,
+ * following the specification below:
+ * <pre>
+ *  &lt;xs:complexType name="localComplexType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:complexType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:complexTypeModel"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="abstract" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="final" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="block" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTLocalComplexTypeImpl  extends XsTComplexTypeImpl implements XsTLocalComplexType {
+  protected XsTLocalComplexTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalElementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalElementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalElementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:localElement</code> type, as
+ * specified by:
+ * <pre>
+ *  &lt;xs:complexType name="localElement"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:element"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:choice minOccurs="0"&gt;
+ *            &lt;xs:element name="simpleType" type="xs:localSimpleType"/&gt;
+ *            &lt;xs:element name="complexType" type="xs:localComplexType"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="substitutionGroup" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="final" use="prohibited"/&gt;
+ *        &lt;xs:attribute name="abstract" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> This class doesn't specify any
+ * additional methods. It only disables the 'substitutionGroup',
+ * 'final', and 'abstract' attributes.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTLocalElementImpl extends XsTElementImpl implements XsTLocalElement {
+  protected XsTLocalElementImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setSubstitutionGroup(XsQName pSubstitutionGroup) {
+    throw new IllegalArgumentException("A local element must not have its 'substitutionGroup' attribute set.");
+  }
+
+  public void setSubstitutionGroup(String pSubstitutionGroup) {
+    throw new IllegalArgumentException("A local element must not have its 'substitutionGroup' attribute set.");
+  }
+
+  public void setFinal(XsDerivationSet pFinal) {
+    throw new IllegalArgumentException("A local element must not have its 'final' attribute set.");
+  }
+
+  public void setAbstract(boolean pAbstract) {
+    throw new IllegalArgumentException("A local element must not have its 'abstract' attribute set.");
+  }
+
+  public boolean isGlobal() { return false; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalSimpleTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalSimpleTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTLocalSimpleTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:localSimpleType</code> type,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="localSimpleType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:simpleType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:simpleDerivation"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" use="prohibited"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Forbidden when nested
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *        &lt;xs:attribute name="final" use="prohibited"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> The implementation must ensure,
+ * that the 'final' and 'name' attributes aren't set.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTLocalSimpleTypeImpl extends XsTSimpleTypeImpl implements XsTLocalSimpleType {
+  protected XsTLocalSimpleTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(XsNCName pName) throws SAXException {
+    throw new LocSAXException("A local simpleType must not have its 'name' attribute set.", getLocator());
+  }
+
+  public void setFinal(XsSimpleDerivationSet pFinal) throws SAXException {
+    throw new LocSAXException("A local simpleType must not have its 'final' attribute set.", getLocator());
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNamedGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNamedGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNamedGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of a named top-level group, with the following
+ * specification:
+ * <pre>
+ *  &lt;xs:complexType name="namedGroup"&gt;
+ *    &lt;xs:annotation&gt;
+ *      &lt;xs:documentation&gt;
+ *        Should derive this from realGroup, but too complicated for now
+ *      &lt;/xs:documentation&gt;
+ *    &lt;/xs:annotation&gt;
+ *    &lt;xs:sequence&gt;
+ *      &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *      &lt;xs:choice minOccurs="1" maxOccurs="1"&gt;
+ *        &lt;xs:element name="all"&gt;
+ *          &lt;xs:complexType&gt;
+ *            &lt;xs:complexContent&gt;
+ *              &lt;xs:restriction base="xs:all"&gt;
+ *                &lt;xs:group ref="xs:allModel"/&gt;
+ *                &lt;xs:attribute name="minOccurs" use="prohibited"/&gt;
+ *                &lt;xs:attribute name="maxOccurs" use="prohibited"/&gt;
+ *              &lt;/xs:restriction&gt;
+ *            &lt;/xs:complexContent&gt;
+ *          &lt;/xs:complexType&gt;
+ *        &lt;/xs:element&gt;
+ *        &lt;xs:element name="choice" type="xs:simpleExplicitGroup"/&gt;
+ *        &lt;xs:element name="sequence" type="xs:simpleExplicitGroup"/&gt;
+ *      &lt;/xs:choice&gt;
+ *    &lt;/xs:sequence&gt;
+ *    &lt;xs:attribute name="name" use="required" type="xs:NCName"/&gt;
+ *    &lt;xs:attribute name="ref" use="prohibited"/&gt;
+ *    &lt;xs:attribute name="minOccurs" use="prohibited"/&gt;
+ *    &lt;xs:attribute name="maxOccurs" use="prohibited"/&gt;
+ *  &lt;/xs:complexType&gt;
+ * &lt;/pre>&lt;/p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTNamedGroupImpl extends XsTAnnotatedImpl implements XsTNamedGroup {
+  private XsGAllModel all;
+  private XsTSimpleExplicitGroup sequence, choice;
+  private XsNCName name;
+
+  protected XsTNamedGroupImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(XsNCName pName) {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public XsGAllModel createAll() {
+    if (all != null) {
+      throw new IllegalStateException("Multiple 'all' child elements are forbidden.");
+    }
+    if (choice != null) {
+      throw new IllegalStateException("The 'choice' and 'all' child elements are mutually exclusive.");
+    }
+    if (sequence != null) {
+      throw new IllegalStateException("The 'sequence' and 'all' child elements are mutually exclusive.");
+    }
+    return all = getObjectFactory().newXsGAllModel(this);
+  }
+
+  public XsGAllModel getAll() {
+    return all;
+  }
+
+  public XsTSimpleExplicitGroup createSequence() {
+    if (sequence != null) {
+      throw new IllegalStateException("Multiple 'sequence' child elements are forbidden.");
+    }
+    if (all != null) {
+      throw new IllegalStateException("The 'all' and 'sequence' child elements are mutually exclusive.");
+    }
+    if (choice != null) {
+      throw new IllegalStateException("The 'all' and 'sequence' child elements are mutually exclusive.");
+    }
+    return sequence = getObjectFactory().newXsTSimpleExplicitGroup(this);
+  }
+
+  public XsTSimpleExplicitGroup getSequence() {
+    return sequence;
+  }
+
+  public XsTSimpleExplicitGroup createChoice() {
+    if (choice != null) {
+      throw new IllegalStateException("Multiple 'choice' elements are forbidden.");
+    }
+    if (sequence != null) {
+      throw new IllegalStateException("The 'sequence' and 'choice' elements are mutually exclusive.");
+    }
+    if (all != null) {
+      throw new IllegalStateException("The 'all' and 'choice' elements are mutually exclusive.");
+    }
+    return choice = getObjectFactory().newXsTSimpleExplicitGroup(this);
+  }
+
+  public XsTSimpleExplicitGroup getChoice() {
+    return choice;
+  }
+
+  public void validate() {
+    XsGAllModel myAll = getAll();
+    if (myAll == null) {
+      XsTSimpleExplicitGroup mySequence = getSequence();
+      if (mySequence == null) {
+        XsTSimpleExplicitGroup myChoice = getChoice();
+        if (myChoice == null) {
+          throw new NullPointerException("Neither of the 'all', 'choice', or 'sequence' elements are given.");
+        } else {
+        }
+      } else {
+      }
+    } else {
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNumFacetImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNumFacetImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTNumFacetImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+/** <p>Implementation of <code>xs:numFacet</code>, following
+ * this specification:
+ * <pre>
+ *  &lt;xs:complexType name="numFacet"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:facet"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public abstract class XsTNumFacetImpl extends XsTFixedFacetImpl
+    implements XsTNumFacet {
+  private long value = -1;
+
+  protected XsTNumFacetImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setValue(long pValue) throws SAXException {
+    if (pValue < 0) {
+      throw new LocSAXException("The 'value' attribute must not be negative.", getLocator());
+    }
+    value = pValue;
+  }
+
+  public long getValue() {
+    return value;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (value == -1) {
+      throw new LocSAXException("Missing 'value' attribute.", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTOpenAttrsImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTOpenAttrsImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTOpenAttrsImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+/** <p>A common base type for most of the schema elements.
+ * Implements the following specification:
+ * <pre>
+ *  &lt;xs:complexType name="openAttrs">
+ *    &lt;xs:annotation>
+ *      &lt;xs:documentation>
+ *        This type is extended by almost all schema types
+ *        to allow attributes from other namespaces to be
+ *        added to user schemas.
+ *      &lt;/xs:documentation>
+ *    &lt;/xs:annotation>
+ *    &lt;xs:complexContent>
+ *      &lt;xs:restriction base="xs:anyType">
+ *        &lt;xs:anyAttribute namespace="##other" processContents="lax"/>
+ *      &lt;/xs:restriction>
+ *    &lt;/xs:complexContent>
+ *  &lt;/xs:complexType&gt;
+ * </pre>
+ * 
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTOpenAttrsImpl extends XsObjectImpl implements XsTOpenAttrs {
+  private AttributesImpl attributes = new AttributesImpl();
+
+  protected XsTOpenAttrsImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public Attributes getOpenAttributes() {
+    return attributes;
+  }
+
+  /** <p>This method receives all the attributes, including those from the
+   * XML schema namespace. The method refuses to handle the attribute, if
+   * it has the XML schema namespace by returning the value false. Otherwise,
+   * the attribute is added to the list returned by {@link #getOpenAttributes()}
+   * and the value true is returned.</p>
+   */
+  public boolean setAttribute(String pQName, String pNamespaceURI, String pLocalName, String pValue)
+      throws SAXException {
+    if (pNamespaceURI == null  ||  "".equals(pNamespaceURI)) {
+      return false;
+    } else if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)) {
+      throw new IllegalStateException("Unknown attribute in " + getClass().getName() + ": " + pQName);
+    }
+    attributes.addAttribute(pNamespaceURI, pLocalName, pQName, "CDATA", pValue);
+    return true;
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRealGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRealGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRealGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:realGroup</code> type, as specified
+ * by the following:
+ * <pre>
+ *  &lt;xs:complexType name="realGroup"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:group"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:choice minOccurs="0" maxOccurs="1"&gt;
+ *            &lt;xs:element ref="xs:all"/&gt;
+ *            &lt;xs:element ref="xs:choice"/&gt;
+ *            &lt;xs:element ref="xs:sequence"/&gt;
+ *          &lt;/xs:choice&gt;
+ *        &lt;/xs:sequence&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * <p><em>Implementation note:</em> This interface does not define
+ * any additional methods. However, the <code>validate()</code>
+ * method must ensure, that either of <code>xs:all</code>,
+ * <code>xs:choice</code>, or <code>xs:sequence</code> is set.</p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTRealGroupImpl extends XsTGroupImpl implements XsTRealGroup {
+  protected XsTRealGroupImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsTGroupRef createGroup() {
+    throw new IllegalStateException("This group must not reference other groups.");
+  }
+
+  public XsEAny createAny() {
+    throw new IllegalStateException("This group must not have an an 'any' element.");
+  }
+
+  public XsTLocalElement createElement() {
+    throw new IllegalStateException("This group must not have an 'element' child element.");
+  }
+
+  public XsESequence createSequence() {
+    return super.createSequence();
+  }
+
+  public XsEChoice createChoice() {
+    return super.createChoice();
+  }
+
+  public XsTAll createAll() {
+    return super.createAll();
+  }
+
+  public void validate() {
+    if (getParticles().length > 1) {
+      throw new IllegalStateException("This group must have exactly a single 'sequence', 'choice', or 'all' element.");
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRestrictionTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRestrictionTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTRestrictionTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:restrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="restrictionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:choice&gt;
+ *            &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
+ *            &lt;xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/&gt;
+ *          &lt;/xs:choice&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="base" type="xs:QName" use="required"/&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTRestrictionTypeImpl extends XsTAnnotatedImpl
+    implements XsTRestrictionType {
+  private XsQName base;
+  private final XsGTypeDefParticle typeDefParticle;
+  private final XsGSimpleRestrictionModel simpleRestrictionModel;
+  private final XsGAttrDecls attrDecls;
+
+  protected XsTRestrictionTypeImpl(XsObject pParent) {
+    super(pParent);
+    typeDefParticle = getObjectFactory().newXsGTypeDefParticle(this);
+    simpleRestrictionModel = getObjectFactory().newXsGSimpleRestrictionModel(this);
+    attrDecls = getObjectFactory().newXsGAttrDecls(this);
+  }
+
+  public void setBase(XsQName pBase) {
+    base = pBase;
+  }
+
+  public void setBase(String pBase) throws SAXException {
+    setBase(asXsQName(pBase));
+  }
+
+  public XsQName getBase() {
+    return base;
+  }
+
+  public XsTGroupRef createGroup() {
+    return typeDefParticle.createGroup();
+  }
+
+  public XsTAll createAll() {
+    return typeDefParticle.createAll();
+  }
+
+  public XsESequence createSequence() {
+    return typeDefParticle.createSequence();
+  }
+
+  public XsEChoice createChoice() {
+    return typeDefParticle.createChoice();
+  }
+
+  public XsTTypeDefParticle getTypeDefParticle() {
+    return typeDefParticle.getTypeDefParticle();
+  }
+
+  public XsTLocalSimpleType createSimpleType() throws SAXException {
+    return simpleRestrictionModel.createSimpleType();
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return simpleRestrictionModel.getSimpleType();
+  }
+
+  public XsEMinExclusive createMinExclusive() throws SAXException {
+    return simpleRestrictionModel.createMinExclusive();
+  }
+
+  public XsEMinExclusive getMinExclusive() {
+    return simpleRestrictionModel.getMinExclusive();
+  }
+
+  public XsEMinInclusive createMinInclusive() throws SAXException {
+    return simpleRestrictionModel.createMinInclusive();
+  }
+
+  public XsEMinInclusive getMinInclusive() {
+    return simpleRestrictionModel.getMinInclusive();
+  }
+
+  public XsEMaxExclusive createMaxExclusive() throws SAXException {
+    return simpleRestrictionModel.createMaxExclusive();
+  }
+
+  public XsEMaxExclusive getMaxExclusive() {
+    return simpleRestrictionModel.getMaxExclusive();
+  }
+
+  public XsEMaxInclusive createMaxInclusive() throws SAXException {
+    return simpleRestrictionModel.createMaxInclusive();
+  }
+
+  public XsEMaxInclusive getMaxInclusive() {
+    return simpleRestrictionModel.getMaxInclusive();
+  }
+
+  public XsETotalDigits createTotalDigits() throws SAXException {
+    return simpleRestrictionModel.createTotalDigits();
+  }
+
+  public XsETotalDigits getTotalDigits() {
+    return simpleRestrictionModel.getTotalDigits();
+  }
+
+  public XsEFractionDigits createFractionDigits() throws SAXException {
+    return simpleRestrictionModel.createFractionDigits();
+  }
+
+  public XsEFractionDigits getFractionDigits() {
+    return simpleRestrictionModel.getFractionDigits();
+  }
+
+  public XsELength createLength() throws SAXException {
+    return simpleRestrictionModel.createLength();
+  }
+
+  public XsELength getLength() {
+    return simpleRestrictionModel.getLength();
+  }
+
+  public XsEMinLength createMinLength() throws SAXException {
+    return simpleRestrictionModel.createMinLength();
+  }
+
+  public XsEMinLength getMinLength() {
+    return simpleRestrictionModel.getMinLength();
+  }
+
+  public XsEMaxLength createMaxLength() throws SAXException {
+    return simpleRestrictionModel.createMaxLength();
+  }
+
+  public XsEMaxLength getMaxLength() {
+    return simpleRestrictionModel.getMaxLength();
+  }
+
+  public XsEWhiteSpace createWhiteSpace() throws SAXException {
+    return simpleRestrictionModel.createWhiteSpace();
+  }
+
+  public XsEWhiteSpace getWhiteSpace() {
+    return simpleRestrictionModel.getWhiteSpace();
+  }
+
+  public XsEPattern createPattern() throws SAXException {
+    return simpleRestrictionModel.createPattern();
+  }
+
+  public XsEPattern[] getPatterns() {
+    return simpleRestrictionModel.getPatterns();
+  }
+
+  public XsEEnumeration createEnumeration() throws SAXException {
+    return simpleRestrictionModel.createEnumeration();
+  }
+
+  public XsEEnumeration[] getEnumerations() {
+    return simpleRestrictionModel.getEnumerations();
+  }
+
+  public boolean hasFacets() {
+    return simpleRestrictionModel.hasFacets();
+  }
+
+  public XsTFacetBase[] getFacets() {
+    return simpleRestrictionModel.getFacets();
+  }
+
+  public XsTAttribute createAttribute() {
+    return attrDecls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return attrDecls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    return attrDecls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return attrDecls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    return attrDecls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return attrDecls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return attrDecls.getAllAttributes();
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (base == null) {
+      throw new LocSAXException("The 'base' attribute must be set.", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExplicitGroupImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExplicitGroupImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExplicitGroupImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.XsEAny;
+import org.apache.ws.jaxme.xs.xml.XsEChoice;
+import org.apache.ws.jaxme.xs.xml.XsESequence;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsTGroupRef;
+import org.apache.ws.jaxme.xs.xml.XsTLocalElement;
+import org.apache.ws.jaxme.xs.xml.XsTNestedParticle;
+import org.apache.ws.jaxme.xs.xml.XsTSimpleExplicitGroup;
+
+/**
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTSimpleExplicitGroupImpl extends XsTAnnotatedImpl implements XsTSimpleExplicitGroup {
+  private final List particles = new ArrayList();
+
+  protected XsTSimpleExplicitGroupImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  protected void addParticle(XsTNestedParticle pParticle) {
+    particles.add(pParticle);
+  }
+
+  public XsTLocalElement createElement() {
+    XsTLocalElement element = getObjectFactory().newXsTLocalElement(this);
+    addParticle(element);
+    return element;
+  }
+
+  public XsTGroupRef createGroup() {
+    XsTGroupRef groupRef = getObjectFactory().newXsTGroupRef(this);
+    addParticle(groupRef);
+    return groupRef;
+  }
+
+  public XsEChoice createChoice() {
+    XsEChoice choice = getObjectFactory().newXsEChoice(this);
+    addParticle(choice);
+    return choice;
+  }
+
+  public XsESequence createSequence() {
+    XsESequence sequence = getObjectFactory().newXsESequence(this);
+    addParticle(sequence);
+    return sequence;
+  }
+
+  public XsEAny createAny() {
+    XsEAny any = getObjectFactory().newXsEAny(this);
+    addParticle(any);
+    return any;
+  }
+
+  public XsTNestedParticle[] getParticles() {
+    return (XsTNestedParticle[]) particles.toArray(new XsTNestedParticle[particles.size()]);
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExtensionTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExtensionTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleExtensionTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:simpleExtensionType</code>, as
+ * specified by:
+ * <pre>
+ *  <xs:complexType name="simpleExtensionType">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:extensionType">
+ *        <xs:sequence>
+ *          <xs:annotation>
+ *            <xs:documentation>
+ *              No typeDefParticle group reference
+ *            </xs:documentation>
+ *          </xs:annotation>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:group ref="xs:attrDecls"/>
+ *        </xs:sequence>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ *  </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTSimpleExtensionTypeImpl extends XsTAnnotatedImpl implements XsTSimpleExtensionType {
+  private XsQName base;
+  private final XsGAttrDecls attrDecls;
+
+  protected XsTSimpleExtensionTypeImpl(XsObject pParent) {
+    super(pParent);
+    attrDecls = getObjectFactory().newXsGAttrDecls(this);
+  }
+
+  public void setBase(XsQName pBase) {
+    base = pBase;
+  }
+
+  public void setBase(String pBase) throws SAXException {
+    setBase(asXsQName(pBase));
+  }
+
+  public XsQName getBase() {
+    return base;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (getBase() == null) {
+      throw new LocSAXException("The 'base' attribute must be set.", getLocator());
+    }
+  }
+
+  public XsTAttribute createAttribute() {
+    return attrDecls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return attrDecls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    return attrDecls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return attrDecls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    return attrDecls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return attrDecls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return attrDecls.getAllAttributes();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleRestrictionTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleRestrictionTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleRestrictionTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:simpleRestrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ *  &lt;xs:complexType name="simpleRestrictionType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:restrictionType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:simpleRestrictionModel" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:attrDecls"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTSimpleRestrictionTypeImpl extends XsTRestrictionTypeImpl
+    implements XsTSimpleRestrictionType {
+  private final XsGSimpleRestrictionModel impl;
+  private final XsGAttrDecls decls;
+
+  protected XsTSimpleRestrictionTypeImpl(XsObject pParent) {
+    super(pParent);
+    impl = getObjectFactory().newXsGSimpleRestrictionModel(this);
+    decls = getObjectFactory().newXsGAttrDecls(this);
+  }
+
+  public XsTLocalSimpleType createSimpleType() throws SAXException {
+    return impl.createSimpleType();
+  }
+
+  public XsTLocalSimpleType getSimpleType() {
+    return impl.getSimpleType();
+  }
+
+  public XsEMaxExclusive getMaxExclusive() {
+    return impl.getMaxExclusive();
+  }
+
+  public XsEMinExclusive createMinExclusive() throws SAXException {
+    return impl.getMinExclusive();
+  }
+
+  public XsEMinExclusive getMinExclusive() {
+    return impl.getMinExclusive();
+  }
+
+  public XsEMaxInclusive createMaxInclusive() throws SAXException {
+    return impl.createMaxInclusive();
+  }
+
+  public XsEMaxInclusive getMaxInclusive() {
+    return impl.getMaxInclusive();
+  }
+
+  public XsEMinInclusive createMinInclusive() throws SAXException {
+    return impl.createMinInclusive();
+  }
+
+  public XsEMinInclusive getMinInclusive() {
+    return impl.getMinInclusive();
+  }
+
+  public XsETotalDigits createTotalDigits() throws SAXException {
+    return impl.createTotalDigits();
+  }
+
+  public XsETotalDigits getTotalDigits() {
+    return impl.getTotalDigits();
+  }
+
+  public XsEFractionDigits createFractionDigits() throws SAXException {
+    return impl.createFractionDigits();
+  }
+
+  public XsEFractionDigits getFractionDigits() {
+    return impl.getFractionDigits();
+  }
+
+  public XsELength createLength() throws SAXException {
+    return impl.createLength();
+  }
+
+  public XsELength getLength() {
+    return impl.getLength();
+  }
+
+  public XsEMinLength createMinLength() throws SAXException {
+    return impl.createMinLength();
+  }
+
+  public XsEMinLength getMinLength() {
+    return impl.getMinLength();
+  }
+
+  public XsEMaxLength createMaxLength() throws SAXException {
+    return impl.createMaxLength();
+  }
+
+  public XsEMaxLength getMaxLength() {
+    return impl.getMaxLength();
+  }
+
+  public XsEWhiteSpace createWhiteSpace() throws SAXException {
+    return impl.createWhiteSpace();
+  }
+
+  public XsEWhiteSpace getWhiteSpace() {
+    return impl.getWhiteSpace();
+  }
+
+  public XsEPattern createPattern() throws SAXException {
+    return impl.createPattern();
+  }
+
+  public XsEPattern[] getPatterns() {
+    return impl.getPatterns();
+  }
+
+  public XsEEnumeration createEnumeration() throws SAXException {
+    return impl.createEnumeration();
+  }
+
+  public XsEEnumeration[] getEnumerations() {
+    return impl.getEnumerations();
+  }
+
+  public boolean hasFacets() {
+    return impl.hasFacets();
+  }
+
+  public XsTFacetBase[] getFacets() {
+    return impl.getFacets();
+  }
+
+  public XsTAttribute createAttribute() {
+    return decls.createAttribute();
+  }
+
+  public XsTAttribute[] getAttributes() {
+    return decls.getAttributes();
+  }
+
+  public XsTAttributeGroupRef createAttributeGroup() {
+    return decls.createAttributeGroup();
+  }
+
+  public XsTAttributeGroupRef[] getAttributeGroups() {
+    return decls.getAttributeGroups();
+  }
+
+  public XsTWildcard createAnyAttribute() {
+    return decls.createAnyAttribute();
+  }
+
+  public XsTWildcard getAnyAttribute() {
+    return decls.getAnyAttribute();
+  }
+
+  public Object[] getAllAttributes() {
+    return decls.getAllAttributes();
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTSimpleTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the following specification for
+ * <code>xs:simpleType</code>:
+ * <pre>
+ *  &lt;xs:complexType name="simpleType" abstract="true"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:group ref="xs:simpleDerivation"/&gt;
+ *        &lt;xs:attribute name="final" type="xs:simpleDerivationSet"/&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName"&gt;
+ *          &lt;xs:annotation&gt;
+ *            &lt;xs:documentation&gt;
+ *              Can be restricted to required or forbidden
+ *            &lt;/xs:documentation&gt;
+ *          &lt;/xs:annotation&gt;
+ *        &lt;/xs:attribute&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ *
+ *  &lt;xs:group name="simpleDerivation"&gt;
+ *    &lt;xs:choice&gt;
+ *      &lt;xs:element ref="xs:restriction"/&gt;
+ *      &lt;xs:element ref="xs:list"/&gt;
+ *      &lt;xs:element ref="xs:union"/&gt;
+ *    &lt;/xs:choice&gt;
+ *  &lt;/xs:group&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTSimpleTypeImpl extends XsTAnnotatedImpl implements XsTSimpleType {
+  private XsERestriction restriction;
+  private XsEList list;
+  private XsEUnion union;
+  private XsSimpleDerivationSet finalSet;
+  private XsNCName name;
+
+  protected XsTSimpleTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public XsERestriction createRestriction() throws SAXException {
+    if (restriction != null  ||  list != null  ||  union != null) {
+      throw new LocSAXException("Only one 'restriction', 'list', or 'union' child element is allowed.", getLocator());
+    }
+    return restriction = getObjectFactory().newXsERestriction(this);
+  }
+
+  public XsERestriction getRestriction() {
+    return restriction;
+  }
+
+  public XsEList createList() throws SAXException {
+    if (restriction != null  ||  list != null  ||  union != null) {
+      throw new LocSAXException("Only one 'restriction', 'list', or 'union' child element is allowed.", getLocator());
+    }
+    return list = getObjectFactory().newXsEList(this);
+  }
+
+  public XsEList getList() {
+    return list;
+  }
+
+  public XsEUnion createUnion() throws SAXException {
+    if (restriction != null  ||  list != null  ||  union != null) {
+      throw new LocSAXException("Only one 'restriction', 'list', or 'union' child element is allowed.", getLocator());
+    }
+    return union = getObjectFactory().newXsEUnion(this);
+  }
+
+  public XsEUnion getUnion() {
+    return union;
+  }
+
+  public void setFinal(XsSimpleDerivationSet pSet) throws SAXException {
+    finalSet = pSet;
+  }
+
+  public XsSimpleDerivationSet getFinal() {
+    return finalSet;
+  }
+
+  public void setName(XsNCName pName) throws SAXException {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (restriction == null  &&  list == null  &&  union == null) {
+      throw new LocSAXException("Expected either of 'restriction', 'list' or 'union' child element.", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelComplexTypeImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelComplexTypeImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelComplexTypeImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of a top level <code>xs:complexType</code>,
+ * following the specification below:
+ * <pre>
+ *  &lt;xs:complexType name="topLevelComplexType"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:restriction base="xs:complexType"&gt;
+ *        &lt;xs:sequence&gt;
+ *          &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
+ *          &lt;xs:group ref="xs:complexTypeModel"/&gt;
+ *        &lt;/xs:sequence&gt;
+ *        &lt;xs:attribute name="name" type="xs:NCName" use="required"/&gt;
+ *      &lt;/xs:restriction&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTTopLevelComplexTypeImpl extends XsTComplexTypeImpl implements XsTTopLevelComplexType {
+  private XsNCName name;
+  private boolean isMixed, isAbstract;
+  private XsDerivationSet finalSet;
+  private XsDerivationSet blockSet;
+
+  protected XsTTopLevelComplexTypeImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public void setName(XsNCName pName) {
+    name = pName;
+  }
+
+  public XsNCName getName() {
+    return name;
+  }
+
+  public void setMixed(boolean pMixed) {
+    isMixed = pMixed;
+  }
+
+  public boolean isMixed() {
+    return isMixed;
+  }
+
+  public void setAbstract(boolean pAbstract) {
+    isAbstract = pAbstract;
+  }
+
+  public boolean isAbstract() {
+    return isAbstract;
+  }
+
+  public void setFinal(XsDerivationSet pFinal) {
+    finalSet = pFinal;
+  }
+
+  public XsDerivationSet getFinal() {
+    return finalSet;
+  }
+
+  public void setBlock(XsDerivationSet pBlock) {
+    blockSet = pBlock;
+  }
+
+  public XsDerivationSet getBlock() {
+    return blockSet;
+  }
+
+  public void validate() throws SAXException {
+    super.validate();
+    if (name == null) {
+      throw new LocSAXException("Missing attribute: 'name'", getLocator());
+    }
+  }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelElementImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelElementImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTTopLevelElementImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Interface of the <code>xs:topLevelElement</code> type, with
+ * the following specification:
+ * <pre>
+ *  <xs:complexType name="topLevelElement">
+ *    <xs:complexContent>
+ *      <xs:restriction base="xs:element">
+ *        <xs:sequence>
+ *          <xs:element ref="xs:annotation" minOccurs="0"/>
+ *          <xs:choice minOccurs="0">
+ *            <xs:element name="simpleType" type="xs:localSimpleType"/>
+ *            <xs:element name="complexType" type="xs:localComplexType"/>
+ *          </xs:choice>
+ *          <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ *        </xs:sequence>
+ *        <xs:attribute name="ref" use="prohibited"/>
+ *        <xs:attribute name="form" use="prohibited"/>
+ *        <xs:attribute name="minOccurs" use="prohibited"/>
+ *        <xs:attribute name="maxOccurs" use="prohibited"/>
+ *        <xs:attribute name="name" use="required" type="xs:NCName"/>
+ *      </xs:restriction>
+ *    </xs:complexContent>
+ * </xs:complexType>
+ *</pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTTopLevelElementImpl extends XsTElementImpl implements XsTTopLevelElement {
+  protected XsTTopLevelElementImpl(XsObject pParent) {
+    super(pParent);
+  }
+
+  public boolean isGlobal() { return true; }
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTWildcardImpl.java	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2003, 2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList.Basic;
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList.Other;
+
+
+/** <p>Implementation of the <code>xs:wildcard</code> type, with the
+ * following specification:
+ * <pre>
+ *  &lt;xs:complexType name="wildcard"&gt;
+ *    &lt;xs:complexContent&gt;
+ *      &lt;xs:extension base="xs:annotated"&gt;
+ *        &lt;xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/&gt;
+ *        &lt;xs:attribute name="processContents" use="optional" default="strict"
+ *          &lt;xs:simpleType&gt;
+ *            &lt;xs:restriction base="xs:NMTOKEN"&gt;
+ *              &lt;xs:enumeration value="skip"/&gt;
+ *              &lt;xs:enumeration value="lax"/&gt;
+ *              &lt;xs:enumeration value="strict"/&gt;
+ *            &lt;/xs:restriction&gt;
+ *          &lt;/xs:simpleType&gt;
+ *        &lt;/xs:attribute&gt;
+ *      &lt;/xs:extension&gt;
+ *    &lt;/xs:complexContent&gt;
+ *  &lt;/xs:complexType&gt;
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe at ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTWildcardImpl extends XsTAnnotatedImpl implements XsTWildcard {
+	private XsNamespaceList namespaceList = XsNamespaceList.ANY;
+	private ProcessContents processContents = STRICT;
+	
+	protected XsTWildcardImpl(XsObject pParent) {
+		super(pParent);
+	}
+	
+	public void setNamespace(final String pNamespaceList) {
+        if (getXsESchema().getTargetNamespace() == null) {
+            // The target can be changed, when importing this schema,
+            // thus we have to return a mutable object.
+            XsAnyURI pTargetNamespace = getXsESchema().getTargetNamespace();
+            if ("##any".equals(pNamespaceList)) {
+                namespaceList = XsNamespaceList.ANY;
+            } else if ("##other".equals(pNamespaceList)) {
+                namespaceList = new Other(pTargetNamespace){
+                    public XsAnyURI[] getUris() {
+                        XsAnyURI targetNamespace = getXsESchema().getTargetNamespace();
+                        if (targetNamespace == null) {
+                            return super.getUris();
+                        } else {
+                            return new XsAnyURI[]{targetNamespace};
+                        }
+                    }
+                };
+            } else {
+                namespaceList = new Basic(pNamespaceList, pTargetNamespace){
+                    public XsAnyURI[] getUris() {
+                        XsAnyURI targetNamespace = getXsESchema().getTargetNamespace();
+                        if (targetNamespace == null) {
+                            return super.getUris();
+                        } else {
+                            return XsNamespaceList.valueOf(pNamespaceList, targetNamespace).getUris();
+                        }
+                    }
+                };
+            };
+        } else {
+            // The target cannot be changed, so we return an immutable object.
+            namespaceList = XsNamespaceList.valueOf(pNamespaceList, getXsESchema().getTargetNamespace());
+        }
+	}
+	
+	public XsNamespaceList getNamespace() {
+		return namespaceList;
+	}
+	
+	public void setProcessContents(ProcessContents pProcessContents) {
+		processContents = pProcessContents;
+	}
+	
+	public ProcessContents getProcessContents() {
+		return processContents;
+	}
+}

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/impl/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.xml.impl Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains an implementation of the <code>JaxMeXS</code> schema object model type.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/package.html
===================================================================
--- branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/package.html	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/src/xs/org/apache/ws/jaxme/xs/xml/package.html	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,31 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ 
+      http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+    <head>
+        <title>
+Package Documentation for org.apache.ws.jaxme.xs.xml Package
+    </title>
+</head>
+    <body bgcolor="white">
+        <p>
+Contains schema object model type interfaces for 
+<a href='http://ws.apache.org/jaxme/xs/'>JaxMeXS</a>: the <code>JaxMe</code> 
+parser for XML Schema.
+    </p>
+</body>
+</html>

Added: branches/jaxme/upstream/0.5.1/status.xml
===================================================================
--- branches/jaxme/upstream/0.5.1/status.xml	                        (rev 0)
+++ branches/jaxme/upstream/0.5.1/status.xml	2006-09-17 11:21:23 UTC (rev 2448)
@@ -0,0 +1,416 @@
+<?xml version="1.0"?>
+<!--
+ * Copyright 2002-2004  The Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+-->
+<status>
+
+  <developers>
+    <person name="Jochen Wiedmann"       email="jochen.wiedmann at gmail dot com" id="JW" />
+    <person name="Davanum Srinivas"      email="dims at yahoo.com"          id="DS" />
+    <person name="Robert Burrell Donkin" email="rdonkin at apache.org"      id="RD" />
+    <person name="Changshin Lee (Ias)"   email="iasandcb at tmax.co.kr"     id="CL" />
+    <person name="Nacho G. Mac Dowell"   email="mac at apache.org"			id="NM" />
+    <!-- Add more people here -->
+  </developers>
+
+  <todo>
+  </todo>
+
+  <changes>
+    <release version="0.5.1" date="06-Jan-2006">
+      <action dev="JW" type="enhancement" context="js">
+        Added several methods for modifying and querying the
+        methods signature.
+		(Frederic Ahring, fahring at de.ibm.com)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The ChoiceHandlerSG did not treat a choice
+        with minOccurs="0" as optional. (JAXME-65)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The source distribution did not contain the necessary
+        build scripts. (JAXME-67, Boris Gruschke,
+        <boris at gruschke.de>)
+      </action>
+      <action dev="JW" type="fix" context="runtime">
+        It wasn't possible to set the properties JAXME_FORMAT_*.
+        David Gilliland <dgilliland62 at users.sourceforge.net>
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The generated marshallers didn't honor the JAXME_FORMAT_*.
+        properties.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The namespace of a simple type xs:QName wasn't necessarily
+        declared by the marshaller. (JAXME-72, Andreas Arrgård,
+        andreas.arrgard at octagroup.com)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The "indexed" collection type didn't handle strings properly.
+        (Ricardo Brito da Rocha, ricardo.rocha at cern.ch)
+      </action>
+      <action dev="JW" type="fix" context="js">
+        Added the BeanSchemaWriter, which converts a Java bean
+        into an XML schema.
+      </action>
+      <action dev="JW" type="enhancement" context="generator">
+        The separation between "Java source files" and "resource
+        files" is now supported. This is typically required by
+        projects, which are following the Maven directory layout.
+        The XJC Ant task and the Main frontent both have a new
+        option "resourceTarget".
+      </action>
+      <action dev="JW" type="enhancement" context="generator">
+        Added support for external binding files, based on a
+        suggestion from Ortwin Glueck (oglueck at apache.org).
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        Fixed an NPE in the DTDParser. (JAXME-79)
+      </action>
+    </release>
+	<release version="0.5" date="2005-Aug-08">
+      <action dev="JW" type="enhancement" context="js">
+        Added JavaSource.getConstructor(JavaQName[]).
+		(Frederic Ahring, fahring at de.ibm.com)
+      </action>
+      <action dev="JW" type="fix" context="js">
+        The method JavaSource.addThrows() does now verify,
+        whether an exception is already declared.
+		(Frederic Ahring, fahring at de.ibm.com)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+		A sequence was always treated as a required group,
+		even if all particles were optional.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Added a unit test for mixed content handling. Fixed
+        the handling of complex child elements in mixed
+        content types.
+      </action>
+      <action dev="JW" type="fix" context="js">
+        The method JavaSource.newBeanProperty() was mismatching
+        void and boolean when checking for "isFoo" vs. "getFoo".
+		(Frederic Ahring, fahring at de.ibm.com)
+      </action>
+      <action dev="JW" type="fix" context="js">
+        Got rid of JavaQNameImpl.getInstance(String, boolean).
+		(Frederic Ahring, fahring at de.ibm.com)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        A facet violation detected by the Unmarshaller was exposed
+        as an IllegalArgumentException. The IllegalArgumentException
+        is now trapped and converted to a proper ValidationEvent.
+        (JAXME-62)
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        If a complex type was created by referencing a group, then
+        the referencing particles maxOccurs and minOccurs values haven't
+        been inherited. (JAXME-63)
+      </action>
+	</release>
+	<release version="0.5beta" date="2005-Jul-13">
+	  <action dev="JW" type="enhancement" context="generator">
+	    Added support for mixed content.
+	  </action>
+      <action dev="JW" type="enhancement" context="generator">
+        Use of xs:extension is now mapped to proper Java
+        inheritance (at least for the bean classes).
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed that the handler and driver classes could not
+        be compiled, if enumerations had default values.
+      </action>
+      <action dev="JW" type="fix" context="js">
+        The JavaParser didn't handle multidimensional arrays
+        properly. (Frederic Ahring, fahring at de.ibm.com)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed that the generator didn't detect top level groups with
+        multiplicity > 1 in a complex type.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed a ClassCastException, which appeared for unknown
+        reasons.
+      </action>
+	</release>
+    <release version="0.4" date="2005-May-19">
+      <action dev="JW" type="fix" context="xs">
+        The methods XSSimpleContentImpl.isEmpty(),
+        XSSimpleContentImpl.isMixed(), and
+        XSSimpleContentImpl.isElementOnly() are no longer
+        throwing an exception, but return false.
+        (Daniel Barclay, daniel at fgm.com)
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        Fixed, that the DTD parser wasn't generating complex
+        types properly. (Richard Calmbach,
+        RichardCalmbach at fairisaac.com)
+      </action>
+	  <action dev="JW" type="fix" context="generator">
+	    The PropertySG didn't distinguish clearly between
+	    the property name ("foo") and the generated Java
+	    fields name ("_foo"). As a consequence, invalid
+	    code has been generated in some cases. See
+	    JAXME-50 in Jira. (Geert Barentsen,
+	    geert.barentsen at telenet.be)
+	  </action>
+	  <action dev="JW" type="fix" context="generator">
+	    A proper ParseConversionEvent is now generated, if the
+	    conversion of a simple type fails.
+	  </action>
+      <action dev="NM" type="fix" context="generator">
+      	Fixed default value generation for primitive types. 
+      	See JAXME-47 in Jira.
+      </action>
+	  <action dev="JW" type="fix" context="xs">
+	    Fixed that recursive xs:include caused an endless loop.
+		(Daniel Barclay, daniel at fgm.com)
+	  </action>
+      <action dev="NM" type="fix" context="js">
+        Fixed primitive array generation in IndentationEngineImpl
+        that raised a ClassCastException.
+        See JAXME-48 in Jira.
+      </action>    
+      <action dev="JW" type="enhancement" context="generator">
+        Enabled support for xs:entity.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed that the object factory methods didn't work for
+        inner classes.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed a "Not implemented" IllegalStateException in the
+        UnmarshallerHandlerImpl, which caused unmarshalling of
+        nested groups to fail in some cases.
+      </action>
+    </release>
+    <release version="0.4beta" date="2005-Apr-17">
+      <action dev="JW" type="enhancement" context="generator">
+        The ObjectFactory does now contain methods for creating
+        implementations of anonymous content interfaces.
+      </action>
+      <action dev="JW" type="enhancement" context="generator">
+        Added support for collection type "indexed".
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed that invalid code was generated for xs:integer in
+        combination with xs:totalDigits. (Doru Sular, dorus at savatech.ro)
+      </action>
+      <action dev="jw" type="enhancement">
+        Added support for nested groups with multiplicity &lt;= 1.
+      </action>
+      <action dev="JW" type="fix" context="runtime">
+        For compatibility reasons with the JAXB RI, an XML declaration
+        is now generated by default.
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        The xs:include statement is now properly converting a schema
+        without target namespace to the including schemas target
+        namespace. (Mik Lernout, mik at futurestreet.org)
+      </action>
+      <action dev="JW" type="enhancement" context="xs">
+        Added the DTDParser, which converts a DTD into an equivalent
+        instance of XML Schema.
+      </action>
+      <action dev="JW" type="enhancement" context="generator">
+        Added the nested element "dtd" to the Ant task, which allows
+        to use DTD's rather than instances of XML Schema.
+      </action>
+      <action dev="JW" type="enhancement" context="api">
+        Replaced JAXBSource with a streaming implementation.
+        Richard Zschech, richard.zschech at cqrdata.com
+      </action>
+    </release>
+    <release version="0.3.2" date="unreleased">
+      <action dev="JW" type="fix" context="generator">
+        Fixed bug in the unmarshalling of elements with simple
+        content. (Fredrik Vraalsen, fredrik at vraalsen.no)
+        See JAXME-38 in Jira.
+      </action>
+	  <action dev="JW" type="fix" context="generator">
+	    Fixed the handling of the Ant tasks "extension" attribute
+	    and the handling of "xjc:serializable". Ensured that
+	    Ant error messages contain a location.
+	  </action>
+      <action dev="JW" type="fix" context="xs">
+        An empty complex type with value true for the mixed attribute
+        is now exposed as content type "mixed", and not "empty".
+        (Mik Lernout, mik at futurestreet.org)
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        An empty complex type with value true for the mixed attribute
+        is now exposed as content type "mixed", and not "empty".
+        (Mik Lernout, mik at futurestreet.org)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        An attribute with an enumeration required setting the
+        "package" property. See JAXME-37 in Jira.
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        The XsDateTimeFormat parser used the values JANUARY=1,
+        FEBRUARY=2, ..., and not 0, 1, ..., as it should be.
+        Markus Holzner, MarkusHo at gmx.net
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        Restrictions of restricted simple types haven't been
+        handled properly in restrictions of simple content
+        types. (Daniel B., daniel at fgm.com) See JAXME-44
+        in Jira.
+      </action>
+      <action dev="JW" type="fix" context="runtime">
+        A namespace prefix wasn't declared for atomic elements.
+        Marshalling such elements required an outer element
+        with the same namespace. (Dogan Atay, doganatay at yahoo.com)
+        See JAXME-45 in Jira.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The "isSet" property wasn't properly triggered.
+        (Marcin Kuthan, mkuthan at pit.edu.pl) See JAXME-39
+        in Jira.
+      </action>
+    </release>
+    <release version="0.3.1" date="2004-Sep-03">
+      <action dev="JW" type="fix" context="generator">
+        The generator does now check, whether a "getClass" getter is
+        generated. If so, it produces an error message and emits a
+        hint to jaxb:property.
+        (Nacho G. Mac Dowell, igonzalez at informa.es)
+      </action>
+	  <action dev="JW" type="fix" context="runtime">
+	    The marshaller was producing unnecessary SAX events,
+	    resulting in &lt;foo&gt;&lt;/foo&gt;, rather than
+	    &lt;foo/&gt;.
+	  </action>
+	  <action dev="JW" type="fix" context="generator">
+	    The up-to-date check wasn't failing in all cases.
+	  </action>
+	  <action dev="JW" type="fix" context="generator">
+	    Added support for recursive elements and types.
+        (Nacho G. Mac Dowell, igonzalez at informa.es)
+        See JAXME-26 in Jira.
+	  </action>
+	  <action dev="JW" type="fix" context="xs">
+	    An element reference in a group wasn't flagged as global.
+	    See JAXME-13 in Jira.
+	  </action>
+	  <action dev="JW" type="fix" context="runtime">
+	    Fixed JDK 1.4 dependencies. (Nacho G. Mac Dowell, igonzalez at informa.es)
+	  </action>
+	  <action dev="JW" type="fix" context="xs">
+	    Fixed an NPE when setting jaxb:globalBindings/jaxb:javaType.
+	    See JAXME-21 in Jira.
+	  </action>
+	  <action dev="JW" type="fix" context="xs">
+	    Restrictions of simple list types didn't have the
+	    isList() property set. Likewise for restrictions of
+	    simple union types. See JAXME-20 in Jira.
+	  </action>
+      <action dev="JW" type="fix" context="generator">
+        If an attribute or element is mapped to the Java type "boolean",
+        then the getter is now called "isFoo", rather than "getFoo".
+        See JAXB SPEC, 4.5.1, and JAXME-19 in Jira.
+      </action>
+      <action dev="JW" type="fix" context="runtime">
+        Attributes in the following namespaces are now by default
+        ignored: The XML namespace (http://www.w3.org/XML/1998/namespace),
+        the XMLNS namespace (http://www.w3.org/2000/xmlns/), and the
+        XML Schema namespace (http://www.w3.org/2001/XMLSchema-instance).
+        See JAXME-17 in Jira.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        An attributes type was implicitly always generated as a local
+        type, possibly referencing a global type. See JAXME-18 in Jira.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        The xs:all type is now properly handled. See JAXME-16 and
+        JAXME-15 in Jira.
+      </action>
+      <action dev="JW" type="fix" context="runtime">
+      	The marshaller properties for setting the attributes
+      	xsi:schemaLocation, or xsi:noNamespaceSchemaLocation,
+      	are now handled properly. See JAXME-22 in Jira.
+      </action>
+    </release>
+    <release version="0.3" date="2004-Jul-19">
+      <action dev="CL" type="enhancement" context="generator">
+      	Initial work on nested groups.
+      </action>
+      <action dev="JW" type="improvement" context="build system">
+      	Added support for creating a clover report. See misc.html for a howto.
+      </action>
+      <action dev="JW" type="enhancement" context="generator">
+      	Added support for wildcard attributes (xs:anyAttribute); note that
+      	extensions must be turned on, because the JAXB Specification disallows
+      	wildcard attributes.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+      	Marshalling and unmarshalling simpleContent wasn't actually working.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+      	Typesafe enumerations had wrong code in some cases.
+      	(Peter Nagy, &lt;peter.1.nagy at nokia.com&gt;)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+      	Attention, incompatible change: The types xs:dateTime, xs:date, and
+      	xs:time are now handled as specified by XML Schema. They used to be
+      	parsed and formatted as specified by DateFormat.getDateTimeFormat().
+      </action>
+      <action dev="JW" type="enhancement" context="pm">
+      	Added the TaminoAPI4JPm.
+      </action>
+      <action dev="JW" type="fix" context="pm">
+      	Fixed a bug in the JdbcTypeSG's handling of nested classes.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+      	Fixed a bug in the JAXBSchemaSG's handling of global simple types.
+      	(Chris Kirk &lt;mrck1996 at yahoo.co.uk&gt;)
+      </action>
+      <action dev="JW" type="fix" context="generator">
+      	The object factory has not been able to generate global types.
+      	Local types are still missing, though.
+      	(Colin Bendell &lt;cbendell at point2.com&gt;)
+      </action>
+      <action dev="CL" type="fix" context="generator">
+      	Fixed a bug in the QNameSG's mis-overriding getCastToString method.
+      	Refactored JMXmlSerializer.Data.getNamespaceSupport to getNamespaceContext()
+      	in order to follow this fix up.
+      </action>
+      <action dev="JW" type="enhancement" context="xs">
+      	Added support for identity constraints.
+      	(Chris Kirk &lt;mrck1996 at yahoo.co.uk&gt;)
+      </action>
+      <action dev="JW" type="admin" context="all">
+        Changed license to ASL 2.0.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Changed the nameXmlTransformation attribute to nameXmlTransform.
+        Thanks to David Holscher &lt;David.Holscher at Nav-International.com&gt;
+        for the hint.
+      </action>
+      <action dev="JW" type="fix" context="xs">
+        Fixed a possible NPE, reported by Nina Juliadotter, &lt;nvjuliad at it.uts.edu.au&gt;.
+      </action>
+      <action dev="JW" type="fix" context="generator">
+        Fixed that the specified package name was ignored for enumerations.
+        Reported by Nicolas De Loof, &lt;nicolas.deloof at cgey.com&gt;
+      </action>
+      <action dev="JW" type="fix" context="runtime">
+        Fixed a wrong cast when assigning the JMMarshaller's XMLDeclaration property.
+        Veniamin Fichin, &lt;3ca28f66 at mail.ru&gt;
+      </action>
+    </release>
+  </changes>
+</status>




More information about the pkg-java-commits mailing list