Class InterningXmlVisitor
java.lang.Object
com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor
- All Implemented Interfaces:
XmlVisitor
XmlVisitor
decorator that interns all string tokens.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sun.xml.bind.v2.runtime.unmarshaller.XmlVisitor
XmlVisitor.TextPredictor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
endElement
(TagName tagName) void
endPrefixMapping
(String prefix) Called afterXmlVisitor.endElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName)
event to notify the end of a binding.Returns theUnmarshallingContext
at the end of the chain.Gets the predictor that can be used for the caller to avoid callingXmlVisitor.text(CharSequence)
unnecessarily.void
startDocument
(LocatorEx locator, NamespaceContext nsContext) Notifies a start of the document.void
startElement
(TagName tagName) Notifies a start tag of a new element.void
startPrefixMapping
(String prefix, String nsUri) Called beforeXmlVisitor.startElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName)
event to notify a new namespace binding.void
text
(CharSequence pcdata) Text events.
-
Constructor Details
-
InterningXmlVisitor
-
-
Method Details
-
startDocument
Description copied from interface:XmlVisitor
Notifies a start of the document.- Specified by:
startDocument
in interfaceXmlVisitor
- Parameters:
locator
- This live object returns the location information as the parsing progresses. must not be null.nsContext
- Some broken XML APIs can't iterate all the in-scope namespace bindings, which makes it impossible to emulateXmlVisitor.startPrefixMapping(String, String)
correctly when unmarshalling a subtree. Connectors that use such an API can pass in additionalNamespaceContext
object that knows about the in-scope namespace bindings. Otherwise (and normally) it is null.Ideally this object should be immutable and only represent the namespace URI bindings in the context (those done above the element that JAXB started unmarshalling), but it can also work even if it changes as the parsing progress (to include namespaces declared on the current element being parsed.)
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceXmlVisitor
- Throws:
SAXException
-
startElement
Description copied from interface:XmlVisitor
Notifies a start tag of a new element. namespace URIs and local names must be interned.- Specified by:
startElement
in interfaceXmlVisitor
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceXmlVisitor
- Throws:
SAXException
-
startPrefixMapping
Description copied from interface:XmlVisitor
Called beforeXmlVisitor.startElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName)
event to notify a new namespace binding.- Specified by:
startPrefixMapping
in interfaceXmlVisitor
- Throws:
SAXException
-
endPrefixMapping
Description copied from interface:XmlVisitor
Called afterXmlVisitor.endElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName)
event to notify the end of a binding.- Specified by:
endPrefixMapping
in interfaceXmlVisitor
- Throws:
SAXException
-
text
Description copied from interface:XmlVisitor
Text events.The caller should consult
XmlVisitor.TextPredictor
to see if the unmarshaller is expecting any PCDATA. If the above is returning false, the caller is OK to skip any text in XML. The net effect is that we can ignore whitespaces quickly.- Specified by:
text
in interfaceXmlVisitor
- Parameters:
pcdata
- represents character data. This object can be mutable (such asStringBuilder
); it only needs to be fixed while this method is executing.- Throws:
SAXException
-
getContext
Description copied from interface:XmlVisitor
Returns theUnmarshallingContext
at the end of the chain.- Specified by:
getContext
in interfaceXmlVisitor
- Returns:
- always return the same object, so caching the result is recommended.
-
getPredictor
Description copied from interface:XmlVisitor
Gets the predictor that can be used for the caller to avoid callingXmlVisitor.text(CharSequence)
unnecessarily.- Specified by:
getPredictor
in interfaceXmlVisitor
-