Top Description Fields Constructors Methods
com.sun.tools.xjc.reader.internalizer

pack-priv Class DOMBuilder

extends SAX2DOMEx
Class Inheritance
Imports
java.util.Set, com.sun.tools.xjc.reader.Const, org.glassfish.jaxb.core.marshaller.SAX2DOMEx, org.w3c.dom.Document, .Element, .Node, org.xml.sax.Attributes, .Locator

Builds DOM while keeping the location information.

This class also looks for outer most <jaxb:bindings> customizations.

Author
Kohsuke Kawaguchi ([email protected])

Field Summary

Modifier and TypeField and Description
private Locator
private final LocatorTable
locatorTable

Location information will be stored into this object.

private final Set<Element>
Inherited from org.glassfish.jaxb.core.marshaller.SAX2DOMEx:
documentnodeStack

Constructor Summary

AccessConstructor and Description
public
DOMBuilder(Document dom, LocatorTable ltable, Set<Element>
This set will receive newly found outermost jaxb:bindings customizations.
outerMostBindings
)

Grows a DOM tree under the given document, and stores location information to the given table.

Method Summary

Modifier and TypeMethod and Description
public void
endElement(String namespaceURI, String localName, String qName)

Overrides org.glassfish.jaxb.core.marshaller.SAX2DOMEx.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

public void
setDocumentLocator(Locator locator)

Overrides org.glassfish.jaxb.core.marshaller.SAX2DOMEx.setDocumentLocator.

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Receive an object for locating the origin of SAX document events.

public void
startElement(String namespaceURI, String localName, String qName, Attributes atts)

Overrides org.glassfish.jaxb.core.marshaller.SAX2DOMEx.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the beginning of an element.

Inherited from org.glassfish.jaxb.core.marshaller.SAX2DOMEx:
characterscharactersendDocumentendPrefixMappinggetCurrentElementgetDOMignorableWhitespacenamespaceprocessingInstructionskippedEntitystartDocumentstartPrefixMapping

Field Detail

locatorback to summary
private Locator locator
locatorTableback to summary
private final LocatorTable locatorTable

Location information will be stored into this object.

outerMostBindingsback to summary
private final Set<Element> outerMostBindings

Constructor Detail

DOMBuilderback to summary
public DOMBuilder(Document dom, LocatorTable ltable, Set<Element> outerMostBindings)

Grows a DOM tree under the given document, and stores location information to the given table.

Parameters
outerMostBindings:Set<Element>

This set will receive newly found outermost jaxb:bindings customizations.

Method Detail

endElementback to summary
public void endElement(String namespaceURI, String localName, String qName)

Overrides org.glassfish.jaxb.core.marshaller.SAX2DOMEx.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement event for every endElement event (even when the element is empty).

For information on the names, see startElement.

Annotations
@Override
setDocumentLocatorback to summary
public void setDocumentLocator(Locator locator)

Overrides org.glassfish.jaxb.core.marshaller.SAX2DOMEx.setDocumentLocator.

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Doc from org.xml.sax.ContentHandler.setDocumentLocator.

Receive an object for locating the origin of SAX document events.

SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.

The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

Note that the locator will return correct information only during the invocation SAX event callbacks after startDocument returns and before endDocument is called. The application should not attempt to use it at any other time.

Annotations
@Override
startElementback to summary
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)

Overrides org.glassfish.jaxb.core.marshaller.SAX2DOMEx.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.ContentHandler.startElement.

Receive notification of the beginning of an element.

The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding endElement event for every startElement event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.

This event allows up to three name components for each element:

  1. the Namespace URI;
  2. the local name; and
  3. the qualified (prefixed) name.

Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:

  • the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
  • the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default).

Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes property is true (it is false by default, and support for a true value is optional).

Like characters(), attribute values may have characters that need more than one char value.

Annotations
@Override