Package org.jvnet.basicjaxb.util
Class CreateToplevelXJBindings
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.jvnet.basicjaxb.util.CreateToplevelXJBindings
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
A helper application to generate JAXB bindings for nested complex types. This application
searches an XML Schema file for anonymously defined complex types that are nested within
parent types. JPA 2.1 requires that member types be elevated to top-level classes. The
XJC tool provides a feature to generate top-level classes but uses a simple naming convention
for the Java type that may lead to name collisions. This helper generates bindings with complex
type names based on the entire parentage to avoid name collisions.
To use this helper, run it on each schema file and copy/paste the output to your bindings file
(i.e. bindings.xjb).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidendElement(String uri, String localName, String qName) static voidMain application start.voidvoidstartElement(String namespaceURI, String localName, String qName, Attributes attributes) Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
-
Constructor Details
-
CreateToplevelXJBindings
public CreateToplevelXJBindings()
-
-
Method Details
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes attributes) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
main
Main application start.- Parameters:
args- The command line arguments- Throws:
Exception- When the XML schema cannot be parsed.
-