com.sun.xml.bind.v2.schemagen
Class XmlSchemaGenerator<T,C,F,M>

java.lang.Object
  extended by com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator<T,C,F,M>

public final class XmlSchemaGenerator<T,C,F,M>
extends java.lang.Object

Generates a set of W3C XML Schema documents from a set of Java classes.

A client must invoke methods in the following order:

  1. Create a new XmlSchemaGenerator
  2. Invoke add(com.sun.xml.bind.v2.model.core.ClassInfo) methods, multiple times if necessary.
  3. Invoke write(javax.xml.bind.SchemaOutputResolver)
  4. Discard the XmlSchemaGenerator.


Constructor Summary
XmlSchemaGenerator(Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types)
           
 
Method Summary
 void add(ArrayInfo<T,C> a)
           
 void add(ClassInfo<T,C> clazz)
          Adds a new class to the list of classes to be written.
 void add(ElementInfo<T,C> elem)
          Adds a new element to the list of elements to be written.
 void add(EnumLeafInfo<T,C> envm)
           
 void add(javax.xml.namespace.QName tagName, NonElement<T,C> type)
          Adds an additional element declaration.
protected static java.lang.String relativize(java.lang.String uri, java.lang.String baseUri)
          TODO: JAX-WS dependency on this method - consider moving this method into com.sun.tools.jxc.util.Util Relativizes a URI by using another URI (base URI.)
 void write(javax.xml.bind.SchemaOutputResolver resolver)
          Write out the schema documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlSchemaGenerator

public XmlSchemaGenerator(Navigator<T,C,F,M> navigator,
                          TypeInfoSet<T,C,F,M> types)
Method Detail

add

public void add(ClassInfo<T,C> clazz)
Adds a new class to the list of classes to be written.

A ClassInfo may have two namespaces --- one for the element name and the other for the type name. If they are different, we put the same ClassInfo to two Namespaces.


add

public void add(ElementInfo<T,C> elem)
Adds a new element to the list of elements to be written.


add

public void add(EnumLeafInfo<T,C> envm)

add

public void add(ArrayInfo<T,C> a)

add

public void add(javax.xml.namespace.QName tagName,
                NonElement<T,C> type)
Adds an additional element declaration.

Parameters:
tagName - The name of the element declaration to be added.
type - The type this element refers to. Can be null, in which case the element refers to an empty anonymous complex type.

write

public void write(javax.xml.bind.SchemaOutputResolver resolver)
           throws java.io.IOException
Write out the schema documents.

Throws:
java.io.IOException

relativize

protected static java.lang.String relativize(java.lang.String uri,
                                             java.lang.String baseUri)
TODO: JAX-WS dependency on this method - consider moving this method into com.sun.tools.jxc.util.Util Relativizes a URI by using another URI (base URI.)

For example, relative("http://www.sun.com/abc/def","http://www.sun.com/pqr/stu") => "../abc/def"

This method only works on hierarchical URI's, not opaque URI's (refer to the java.net.URI javadoc for complete definitions of these terms.

This method will not normalize the relative URI.

Returns:
the relative URI or the original URI if a relative one could not be computed