com.sun.msv.verifier.regexp

Class ExpressionAcceptor

Implemented Interfaces:
Acceptor
Known Direct Subclasses:
ContentModelAcceptor

public abstract class ExpressionAcceptor
extends Object
implements Acceptor

Acceptor implementation.

When you are using REDocumentDeclaration, then the acceptor is always guaranteed to be a subclass of this class. Therefore, by using this regexp implementation of VGM, you can always downcast Acceptor to this class and access its contents to get more information.

If you consider VGM as an automaton, this class can be thought as a lazy automaton acceptor.

Author:
Kohsuke KAWAGUCHI

Fields inherited from interface com.sun.msv.verifier.Acceptor

STRING_IGNORE, STRING_PROHIBITED, STRING_STRICT

Constructor Summary

ExpressionAcceptor(REDocumentDeclaration docDecl, Expression exp, boolean ignoreUndeclaredAttributes)

Method Summary

Acceptor
createChildAcceptor(StartTagInfo tag, StringRef errRef)
creates combined child acceptor and primitive child acceptors (if necessary).
Expression
getExpression()
gets the residual content model.
int
getStringCareLevel()
boolean
isAcceptState(StringRef errRef)
checks if this Acceptor is satisifed
boolean
onAttribute(String namespaceURI, String localName, String qName, String value, IDContextProvider context, StringRef refErr, DatatypeRef refType)
Deprecated.
boolean
onAttribute2(String namespaceURI, String localName, String qName, String value, IDContextProvider2 context, StringRef refErr, DatatypeRef refType)
boolean
onEndAttributes(StartTagInfo sti, StringRef refErr)
boolean
onText(String literal, IDContextProvider context, StringRef refErr, DatatypeRef refType)
Deprecated.
boolean
onText2(String literal, IDContextProvider2 provider, StringRef refErr, DatatypeRef refType)
boolean
stepForwardByContinuation(Expression continuation, StringRef errRef)

Constructor Details

ExpressionAcceptor

public ExpressionAcceptor(REDocumentDeclaration docDecl,
                          Expression exp,
                          boolean ignoreUndeclaredAttributes)

Method Details

createChildAcceptor

public Acceptor createChildAcceptor(StartTagInfo tag,
                                    StringRef errRef)
creates combined child acceptor and primitive child acceptors (if necessary). be careful not to keep returned object too long because it is reused whenever the method is called.
Specified by:
createChildAcceptor in interface Acceptor
Returns:
null if errRef is null and this expression cannot accept given start tag. if errRef is non-null and error recovery is not possible.

getExpression

public Expression getExpression()
gets the residual content model.

This method returns the expression that represents the expected content model it will read. For example, if the original content model is (A,(B|C)) and this acceptor has already read A, then this method returns (B|C).

The returned residual is useful to find out what elements can appear next.

If you consider VGM as an automaton, the residual content model can be thought as the current state. Also, At the same time, right language (a regular expression that represents the language it can accept from now on).


getStringCareLevel

public int getStringCareLevel()
Specified by:
getStringCareLevel in interface Acceptor

isAcceptState

public boolean isAcceptState(StringRef errRef)
checks if this Acceptor is satisifed
Specified by:
isAcceptState in interface Acceptor

onAttribute

public final boolean onAttribute(String namespaceURI,
                                 String localName,
                                 String qName,
                                 String value,
                                 IDContextProvider context,
                                 StringRef refErr,
                                 DatatypeRef refType)

Deprecated.

Specified by:
onAttribute in interface Acceptor

onAttribute2

public final boolean onAttribute2(String namespaceURI,
                                  String localName,
                                  String qName,
                                  String value,
                                  IDContextProvider2 context,
                                  StringRef refErr,
                                  DatatypeRef refType)
Specified by:
onAttribute2 in interface Acceptor

onEndAttributes

public boolean onEndAttributes(StartTagInfo sti,
                               StringRef refErr)
Specified by:
onEndAttributes in interface Acceptor

onText

public final boolean onText(String literal,
                            IDContextProvider context,
                            StringRef refErr,
                            DatatypeRef refType)

Deprecated.

Specified by:
onText in interface Acceptor

onText2

public boolean onText2(String literal,
                       IDContextProvider2 provider,
                       StringRef refErr,
                       DatatypeRef refType)
Specified by:
onText2 in interface Acceptor

stepForwardByContinuation

public final boolean stepForwardByContinuation(Expression continuation,
                                               StringRef errRef)