Module com.sun.xml.bind
Class InterningXmlVisitor
- java.lang.Object
-
- org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.InterningXmlVisitor
-
- All Implemented Interfaces:
XmlVisitor
public final class InterningXmlVisitor extends Object implements XmlVisitor
XmlVisitordecorator that interns all string tokens.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor
XmlVisitor.TextPredictor
-
-
Constructor Summary
Constructors Constructor Description InterningXmlVisitor(XmlVisitor next)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendDocument()voidendElement(TagName tagName)voidendPrefixMapping(String prefix)Called afterXmlVisitor.endElement(org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.TagName)event to notify the end of a binding.UnmarshallingContextgetContext()Returns theUnmarshallingContextat the end of the chain.XmlVisitor.TextPredictorgetPredictor()Gets the predictor that can be used for the caller to avoid callingXmlVisitor.text(CharSequence)unnecessarily.voidstartDocument(LocatorEx locator, NamespaceContext nsContext)Notifies a start of the document.voidstartElement(TagName tagName)Notifies a start tag of a new element.voidstartPrefixMapping(String prefix, String nsUri)Called beforeXmlVisitor.startElement(org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.TagName)event to notify a new namespace binding.voidtext(CharSequence pcdata)Text events.
-
-
-
Constructor Detail
-
InterningXmlVisitor
public InterningXmlVisitor(XmlVisitor next)
-
-
Method Detail
-
startDocument
public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException
Description copied from interface:XmlVisitorNotifies a start of the document.- Specified by:
startDocumentin 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 additionalNamespaceContextobject 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
public void endDocument() throws SAXException- Specified by:
endDocumentin interfaceXmlVisitor- Throws:
SAXException
-
startElement
public void startElement(TagName tagName) throws SAXException
Description copied from interface:XmlVisitorNotifies a start tag of a new element. namespace URIs and local names must be interned.- Specified by:
startElementin interfaceXmlVisitor- Throws:
SAXException
-
endElement
public void endElement(TagName tagName) throws SAXException
- Specified by:
endElementin interfaceXmlVisitor- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String nsUri) throws SAXException
Description copied from interface:XmlVisitorCalled beforeXmlVisitor.startElement(org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.TagName)event to notify a new namespace binding.- Specified by:
startPrefixMappingin interfaceXmlVisitor- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
Description copied from interface:XmlVisitorCalled afterXmlVisitor.endElement(org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.TagName)event to notify the end of a binding.- Specified by:
endPrefixMappingin interfaceXmlVisitor- Throws:
SAXException
-
text
public void text(CharSequence pcdata) throws SAXException
Description copied from interface:XmlVisitorText events.The caller should consult
XmlVisitor.TextPredictorto 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:
textin 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
public UnmarshallingContext getContext()
Description copied from interface:XmlVisitorReturns theUnmarshallingContextat the end of the chain.- Specified by:
getContextin interfaceXmlVisitor- Returns:
- always return the same object, so caching the result is recommended.
-
getPredictor
public XmlVisitor.TextPredictor getPredictor()
Description copied from interface:XmlVisitorGets the predictor that can be used for the caller to avoid callingXmlVisitor.text(CharSequence)unnecessarily.- Specified by:
getPredictorin interfaceXmlVisitor
-
-