Java Doc for SchemaCompiler.java in  » 6.0-JDK-Modules-com.sun » tools » com » sun » tools » internal » xjc » api » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » tools » com.sun.tools.internal.xjc.api 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sun.tools.internal.xjc.api.SchemaCompiler

All known Subclasses:   com.sun.tools.internal.xjc.api.impl.s2j.SchemaCompilerImpl,
SchemaCompiler
public interface SchemaCompiler (Code)
Schema-to-Java compiler.

The caller can parse multiple schema documents, JAXB external binding files (or potentially WSDL and JSR-109.next mapping files in the future).

All the errors found during this process will be sent to the registered ErrorListener .

Once all the documents are parsed, call the SchemaCompiler.bind() method to get the compiled JAXBModel object.

Tips: namespace URI -> package customization

The caller can feed the following synthesized schema to achive the namespace URI -> Java package customization:


 <schema targetNamespace="xml.namespace.uri"
 xmlns="http://www.w3.org/2001/XMLSchema"
 xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
 jaxb:version="1.0">
 <annotation><appinfo>
 <jaxb:schemaBindings>
 <jaxb:package name="java.package.name"/>
 </jaxb:schemaBindings>
 </appinfo></annotation>
 </schema>
 
Feed this synthesized schema document for each namespace URI you need to map.
author:
   Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)




Method Summary
 S2JJAXBModelbind()
     Obtains the compiled schema object model. Once this method is called, no other method should be invoked on the SchemaCompiler . null if the compilation fails.
 voidforcePackageName(String packageName)
     Forces all the JAXB-generated classes to go into the specific package.

This setting takes precedence over the SchemaCompiler.setDefaultPackageName(String) or any of the customization found in the JAXB binding files.

 OptionsgetOptions()
     Allows the calling code to tweak more schema compilation details.

The caller can use this method to obtain an Options instance, then tweak settings on it.

 ContentHandlergetParserHandler(String systemId)
     Parses schemas or external bindings through SAX events by feeding events into SAX ContentHandler .
 voidparseSchema(InputSource source)
     Parses a schema or an external binding file from an external source.
 voidparseSchema(String systemId, Element element)
     Parses a schema or an external binding file from the specified DOM element.

The given DOM element is treated as if it's the root of a virtual document.

XJC will not be able to print location information for errors found in this document, since DOM doesn't have them. For this reason, use of this method is strongly discouraged.
Parameters:
  systemId - We need an absolute system ID that uniquely designates the virtualdocument.

 voidparseSchema(String systemId, XMLStreamReader reader)
     Parses a schema or an external binding file from the given source.
 voidsetClassNameAllocator(ClassNameAllocator allocator)
     Sets the ClassNameAllocator to be used for the binding operation.
 voidsetDefaultPackageName(String packageName)
     Sets the default Java package name into which the generated code will be placed.

Customizations in the binding files/schemas will have precedence over this setting. Set to null to use the default package name computation algorithm as specified by the JAXB spec (which is the default behavior.)

Initially this parameter is set to null.
Parameters:
  packageName - Java pckage name such as "org.foo.bar".

 voidsetEntityResolver(EntityResolver entityResolver)
    
 voidsetErrorListener(ErrorListener errorListener)
    



Method Detail
bind
S2JJAXBModel bind()(Code)
Obtains the compiled schema object model. Once this method is called, no other method should be invoked on the SchemaCompiler . null if the compilation fails. The errors should have beendelivered to the registered error handler in such a case.



forcePackageName
void forcePackageName(String packageName)(Code)
Forces all the JAXB-generated classes to go into the specific package.

This setting takes precedence over the SchemaCompiler.setDefaultPackageName(String) or any of the customization found in the JAXB binding files. This method is designed to implement the semantics of the command-line '-p' option.

This somewhat ugly semantics actually have a long history now and too late to change.
See Also:   SchemaCompiler.setDefaultPackageName(String)




getOptions
Options getOptions()(Code)
Allows the calling code to tweak more schema compilation details.

The caller can use this method to obtain an Options instance, then tweak settings on it. The updated settings will be used when the SchemaCompiler.bind() method is invoked.
since:
   2.0.2Options




getParserHandler
ContentHandler getParserHandler(String systemId)(Code)
Parses schemas or external bindings through SAX events by feeding events into SAX ContentHandler .
Parameters:
  systemId - The system ID of the document to be read in.
See Also:   SchemaCompiler.parseSchema(String,XMLStreamReader)



parseSchema
void parseSchema(InputSource source)(Code)
Parses a schema or an external binding file from an external source.
Parameters:
  source - Its system Id must be set to an absolute URI.



parseSchema
void parseSchema(String systemId, Element element)(Code)
Parses a schema or an external binding file from the specified DOM element.

The given DOM element is treated as if it's the root of a virtual document.

XJC will not be able to print location information for errors found in this document, since DOM doesn't have them. For this reason, use of this method is strongly discouraged.
Parameters:
  systemId - We need an absolute system ID that uniquely designates the virtualdocument. This should be different from the system ID ofthe document which contains this element.

One way to do that is by adding a fragment identifierto the system ID of the document. For example, if the documentis "foo.wsdl" and you are passing in its types section, youcan use an unique identifier like "foo.wsdl#types"




parseSchema
void parseSchema(String systemId, XMLStreamReader reader) throws XMLStreamException(Code)
Parses a schema or an external binding file from the given source.

A stream reader must be pointing at the element or at the start of the document. XML is parsed until the corresponding end tag, then the sub tree is processed as a schema document.

When this method returns successfully, the parser is at the next token of the end element.
Parameters:
  systemId - The absolute system ID of the document that is being parsed.This information is necessary to avoid double-inclusionand etc.Note that XMLStreamReader.getLocation onlyreturns the system ID of the entity it is parsing, notnecessarily the system ID of the document itself.
throws:
  XMLStreamException - If an error happens while parsing a document.Note that not only the parser but also the XJC itselfmay throw this error (as a result of the additional validationfor example.)




setClassNameAllocator
void setClassNameAllocator(ClassNameAllocator allocator)(Code)
Sets the ClassNameAllocator to be used for the binding operation.

This mechanism would allow the caller to participate in the binding operation.
See Also:   ClassNameAllocator




setDefaultPackageName
void setDefaultPackageName(String packageName)(Code)
Sets the default Java package name into which the generated code will be placed.

Customizations in the binding files/schemas will have precedence over this setting. Set to null to use the default package name computation algorithm as specified by the JAXB spec (which is the default behavior.)

Initially this parameter is set to null.
Parameters:
  packageName - Java pckage name such as "org.foo.bar". Use "" to represent the root package,and null to defer to the default computation algorithm.
See Also:   SchemaCompiler.forcePackageName(String)




setEntityResolver
void setEntityResolver(EntityResolver entityResolver)(Code)



setErrorListener
void setErrorListener(ErrorListener errorListener)(Code)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.