Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller

pack-priv final Class ValidatingUnmarshaller

extends Object
implements XmlVisitor, TextPredictor
Class Inheritance
All Implemented Interfaces
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.TextPredictor, org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor
Imports
org.glassfish.jaxb.runtime.v2.runtime.output.Pcdata, org.glassfish.jaxb.runtime.v2.util.FatalAdapter, org.glassfish.jaxb.core.v2.runtime.unmarshaller.LocatorEx, org.xml.sax.SAXException, javax.xml.namespace.NamespaceContext, javax.xml.validation.Schema, .ValidatorHandler

XmlVisitor decorator that validates the events by using JAXP validation API.
Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private char[]
private final XmlVisitor
private NamespaceContext
private final XmlVisitor.TextPredictor
private final ValidatorHandler

Constructor Summary

AccessConstructor and Description
public
ValidatingUnmarshaller(Schema schema, XmlVisitor next)

Creates a new instance of ValidatingUnmarshaller.

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
endPrefixMapping(String prefix)

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.endPrefixMapping.

Called after endElement event to notify the end of a binding.

public boolean
expectText()

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.TextPredictor.expectText.

Deprecated

Returns true if the visitor is expecting a text event as the next event.

public UnmarshallingContext
public XmlVisitor.TextPredictor
getPredictor()

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.getPredictor.

Gets the predictor that can be used for the caller to avoid calling text(CharSequence) unnecessarily.

public void
public void
startElement(TagName tagName)

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startElement.

Notifies a start tag of a new element.

public void
startPrefixMapping(String prefix, String nsUri)

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startPrefixMapping.

Called before startElement event to notify a new namespace binding.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private char[] buf
nextback to summary
private final XmlVisitor next
nsContextback to summary
private NamespaceContext nsContext
predictorback to summary
private final XmlVisitor.TextPredictor predictor

TextPredictor of the next XmlVisitor.

validatorback to summary
private final ValidatorHandler validator

Constructor Detail

ValidatingUnmarshallerback to summary
public ValidatingUnmarshaller(Schema schema, XmlVisitor next)

Creates a new instance of ValidatingUnmarshaller.

Method Detail

endDocumentback to summary
public void endDocument() throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.endDocument.

Annotations
@Override
endElementback to summary
public void endElement(TagName tagName) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.endElement.

Annotations
@Override
endPrefixMappingback to summary
public void endPrefixMapping(String prefix) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.endPrefixMapping.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.endPrefixMapping.

Called after endElement event to notify the end of a binding.

Annotations
@Override
expectTextback to summary
public boolean expectText()

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.TextPredictor.expectText.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.TextPredictor.expectText.

Deprecated

Returns true if the visitor is expecting a text event as the next event.

This is primarily intended to be used for optimization to avoid buffering characters unnecessarily. If this method returns false and the connector sees whitespace it can safely skip it.

If this method returns true, all the whitespaces are considered significant and thus need to be reported as a XmlVisitor#text event. Furthermore, if the element has no children (like <foo/>), then it has to be reported an empty XmlVisitor#text event.

Annotations
@Deprecated
@Override
getContextback to summary
public UnmarshallingContext getContext()

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.getContext.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.getContext.

Returns the UnmarshallingContext at the end of the chain.

Annotations
@Override
getPredictorback to summary
public XmlVisitor.TextPredictor getPredictor()

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.getPredictor.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.getPredictor.

Gets the predictor that can be used for the caller to avoid calling text(CharSequence) unnecessarily.

Annotations
@Override
startDocumentback to summary
public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startDocument.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startDocument.

Notifies a start of the document.

Annotations
@Override
startElementback to summary
public void startElement(TagName tagName) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startElement.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startElement.

Notifies a start tag of a new element. namespace URIs and local names must be interned.

Annotations
@Override
startPrefixMappingback to summary
public void startPrefixMapping(String prefix, String nsUri) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startPrefixMapping.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.startPrefixMapping.

Called before startElement event to notify a new namespace binding.

Annotations
@Override
textback to summary
public void text(CharSequence pcdata) throws SAXException

Implements org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.text.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.XmlVisitor.text.

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.

Annotations
@Override