| com.sun.xml.bind.v2.runtime.unmarshaller.XmlVisitor
All known Subclasses: com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext, com.sun.xml.bind.v2.runtime.unmarshaller.MTOMDecorator, com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor, com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller,
XmlVisitor | public interface XmlVisitor (Code) | | Walks the XML document structure.
Implemented by the unmarshaller and called by the API-specific connectors.
Event Call Sequence
The
XmlVisitor expects the event callbacks in the following order:
CALL SEQUENCE := startDocument ELEMENT endDocument
ELEMENT := startPrefixMapping ELEMENT endPrefixMapping
| startElement BODY endElement
BODY := text? (ELEMENT text?)*
Note in particular that text events may not be called in a row;
consecutive characters (even those separated by PIs and comments)
must be reported as one event, unlike SAX.
All namespace URIs, local names, and prefixes of element and attribute
names must be interned. qnames need not be interned.
Typed PCDATA
For efficiency, JAXB RI defines a few
CharSequence implementations
that can be used as a parameter to the
XmlVisitor.text(CharSequence) method.
For example, see
Base64Data .
Error Handling
The visitor may throw
SAXException to abort the unmarshalling process
in the middle.
author: Kohsuke Kawaguchi |
Inner Class :interface TextPredictor | |
startDocument | void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException(Code) | | Notifies a start of the document.
Parameters: locator - This live object returns the location information as the parsing progresses.must not be null. Parameters: nsContext - Some broken XML APIs can't iterate all the in-scope namespace bindings,which makes it impossible to emulate XmlVisitor.startPrefixMapping(String,String) correctlywhen unmarshalling a subtree. Connectors that use such an API canpass in additional NamespaceContext object that knows about thein-scope namespace bindings. Otherwise (and normally) it is null.Ideally this object should be immutable and only represent the namespace URI bindingsin 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 includenamespaces declared on the current element being parsed.) |
startElement | void startElement(TagName tagName) throws SAXException(Code) | | Notifies a start tag of a new element.
namespace URIs and local names must be interned.
|
text | void text(CharSequence pcdata) throws SAXException(Code) | | Text events.
The caller should consult
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.
Parameters: pcdata - represents character data. This object can be mutable(such as StringBuilder); it only needs to be fixedwhile this method is executing. |
|
|