public final class InterningXmlVisitor extends Object implements XmlVisitor
XmlVisitor
decorator that interns all string tokens.XmlVisitor.TextPredictor
Constructor and Description |
---|
InterningXmlVisitor(XmlVisitor next) |
Modifier and Type | Method and Description |
---|---|
void |
endDocument() |
void |
endElement(TagName tagName) |
void |
endPrefixMapping(String prefix)
Called after
XmlVisitor.endElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName) event to notify the end of a binding. |
UnmarshallingContext |
getContext()
Returns the
UnmarshallingContext at the end of the chain. |
XmlVisitor.TextPredictor |
getPredictor()
Gets the predictor that can be used for the caller to avoid
calling
XmlVisitor.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 before
XmlVisitor.startElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName) event to notify a new namespace binding. |
void |
text(CharSequence pcdata)
Text events.
|
public InterningXmlVisitor(XmlVisitor next)
public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException
XmlVisitor
startDocument
in interface XmlVisitor
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 emulate XmlVisitor.startPrefixMapping(String, String)
correctly
when unmarshalling a subtree. Connectors that use such an API can
pass in additional NamespaceContext
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.)
SAXException
public void endDocument() throws SAXException
endDocument
in interface XmlVisitor
SAXException
public void startElement(TagName tagName) throws SAXException
XmlVisitor
startElement
in interface XmlVisitor
SAXException
public void endElement(TagName tagName) throws SAXException
endElement
in interface XmlVisitor
SAXException
public void startPrefixMapping(String prefix, String nsUri) throws SAXException
XmlVisitor
XmlVisitor.startElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName)
event to notify a new namespace binding.startPrefixMapping
in interface XmlVisitor
SAXException
public void endPrefixMapping(String prefix) throws SAXException
XmlVisitor
XmlVisitor.endElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName)
event to notify the end of a binding.endPrefixMapping
in interface XmlVisitor
SAXException
public void text(CharSequence pcdata) throws SAXException
XmlVisitor
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.
text
in interface XmlVisitor
pcdata
- represents character data. This object can be mutable
(such as StringBuilder
); it only needs to be fixed
while this method is executing.SAXException
public UnmarshallingContext getContext()
XmlVisitor
UnmarshallingContext
at the end of the chain.getContext
in interface XmlVisitor
public XmlVisitor.TextPredictor getPredictor()
XmlVisitor
XmlVisitor.text(CharSequence)
unnecessarily.getPredictor
in interface XmlVisitor
Copyright © 2018 JBoss by Red Hat. All rights reserved.