Top Description Inners Fields Constructors Methods
com.sun.msv.reader.trex.ng.comp

public Class RELAXNGCompReader

extends RELAXNGReader
Class Inheritance
Imports
java.text.MessageFormat, java.util.Map, .ResourceBundle, javax.xml.parsers.SAXParserFactory, org.xml.sax.Attributes, .InputSource, .Locator, .SAXException, com.sun.msv.grammar.AttributeExp, .ExpressionPool, com.sun.msv.grammar.relaxng.RELAXNGGrammar, com.sun.msv.grammar.trex.TREXGrammar, com.sun.msv.reader.GrammarReaderController, .State, com.sun.msv.reader.trex.ng.RELAXNGReader, com.sun.msv.util.LightStack, .StartTagInfo

reads RELAX NG grammar with DTD compatibility annotation and constructs abstract grammar model.
Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RELAXNGCompReader.StateFactory

creates various State object, which in turn parses grammar.

Field Summary

Modifier and TypeField and Description
public static final String
AnnotationNamespace

Namespace URI of RELAX NG DTD compatibility annotation

public static final String
public static final String
public static final String
private final Map<AttributeExp, String>
private boolean
private final LightStack
lastRNGElement

The local name of the preceding RELAX NG element sibling.

Inherited from com.sun.msv.reader.trex.ng.RELAXNGReader:
currentNamedPatterndatatypeLibURIdirectRefernceERR_BAD_DATA_VALUEERR_BAD_FACETERR_INCONSISTENT_COMBINEERR_INCONSISTENT_KEY_TYPEERR_INFOSET_URI_ATTRIBUTEERR_INVALID_PARAMETERSERR_MULTIPLE_EXCEPTERR_NAKED_INFINITE_ATTRIBUTE_NAMECLASSERR_NOT_ABSOLUTE_URIERR_REDEFINING_UNDEFINEDERR_UNDEFINED_DATATYPE_1ERR_UNDEFINED_KEYERR_UNKNOWN_DATATYPE_VOCABULARY_1ERR_XMLNS_ATTRIBUTERELAXNGNamespacerelaxNGSchema4SchemarestrictionChecker

Constructor Summary

AccessConstructor and Description
public
RELAXNGCompReader(GrammarReaderController controller)

easy-to-use constructor.

public
RELAXNGCompReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool)

easy-to-use constructor.

public
RELAXNGCompReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXNGCompReader.StateFactory stateFactory, ExpressionPool pool)

full constructor

Method Summary

Modifier and TypeMethod and Description
protected final void
addDefaultValue(AttributeExp exp, String value)

note that the specified expression is marked with the default value.

public void
endElement(String
The element's Namespace URI, or the empty string.
uri
,
String
The element's local name, or the empty string.
local
,
String
The element's qualified (prefixed) name, or the empty string.
qname
)

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Filter an end element event.
protected TREXGrammar
protected String
localizeMessage(String propertyName, Object[] args)

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.localizeMessage.

formats localized message with arguments
public static TREXGrammar

Returns:

it always returns RELAXNGGrammar, but due to the restriction imposed by Java language, I cannot change the signature of this method.
parse
(String grammarURL, GrammarReaderController controller)

loads RELAX NG pattern.

public static TREXGrammar

Returns:

it always returns RELAXNGGrammar, but due to the restriction imposed by Java language, I cannot change the signature of this method.
parse
(InputSource grammar, GrammarReaderController controller)

loads RELAX NG pattern.

public void
startElement(String
The element's Namespace URI, or the empty string.
uri
,
String
The element's local name, or the empty string.
local
,
String
The element's qualified (prefixed) name, or the empty string.
qname
,
Attributes
The element's attributes.
atts
)

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Filter a start element event.
public void
wrapUp()

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.wrapUp.

performs final wrap-up.
Inherited from com.sun.msv.reader.trex.ng.RELAXNGReader:
createExpressionChildStatecreateNameClassChildStateendDocumentgetCurrentDatatypeLibrarygetDatatypeLibraryFactorygetRefExpParseInfogetRELAXNGSchema4SchemagetStateFactoryisGrammarElementparseparseresolveDataTyperesolveDataTypeLibraryresolveNamespacePrefixsetDatatypeLibraryFactorystartDocument

Field Detail

AnnotationNamespaceback to summary
public static final String AnnotationNamespace

Namespace URI of RELAX NG DTD compatibility annotation

CERR_ANN_CHILD_ELEMENTback to summary
public static final String CERR_ANN_CHILD_ELEMENT
CERR_ANN_INVALID_ATTRIBUTEback to summary
public static final String CERR_ANN_INVALID_ATTRIBUTE
CERR_ANN_MISPLACEDback to summary
public static final String CERR_ANN_MISPLACED
defaultedAttributesback to summary
private final Map<AttributeExp, String> defaultedAttributes
inAnnotationback to summary
private boolean inAnnotation
lastRNGElementback to summary
private final LightStack lastRNGElement

The local name of the preceding RELAX NG element sibling.

Constructor Detail

RELAXNGCompReaderback to summary
public RELAXNGCompReader(GrammarReaderController controller)

easy-to-use constructor.

RELAXNGCompReaderback to summary
public RELAXNGCompReader(GrammarReaderController controller, SAXParserFactory parserFactory, ExpressionPool pool)

easy-to-use constructor.

RELAXNGCompReaderback to summary
public RELAXNGCompReader(GrammarReaderController controller, SAXParserFactory parserFactory, RELAXNGCompReader.StateFactory stateFactory, ExpressionPool pool)

full constructor

Method Detail

addDefaultValueback to summary
protected final void addDefaultValue(AttributeExp exp, String value)

note that the specified expression is marked with the default value. this method is called when a:defaultValue is found.

endElementback to summary
public void endElement(String uri, String local, String qname) throws SAXException

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.helpers.XMLFilterImpl.endElement.

Filter an end element event.

Parameters
uri:String

The element's Namespace URI, or the empty string.

local:String

The element's local name, or the empty string.

qname:String

The element's qualified (prefixed) name, or the empty string.

Exceptions
SAXException:
The client may throw an exception during processing.
getGrammarback to summary
protected TREXGrammar getGrammar()

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.getGrammar.

localizeMessageback to summary
protected String localizeMessage(String propertyName, Object[] args)

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.localizeMessage.

Doc from com.sun.msv.reader.GrammarReader.localizeMessage.

formats localized message with arguments

parseback to summary
public static TREXGrammar parse(String grammarURL, GrammarReaderController controller)

loads RELAX NG pattern.

Returns:TREXGrammar

it always returns RELAXNGGrammar, but due to the restriction imposed by Java language, I cannot change the signature of this method.

parseback to summary
public static TREXGrammar parse(InputSource grammar, GrammarReaderController controller)

loads RELAX NG pattern.

Returns:TREXGrammar

it always returns RELAXNGGrammar, but due to the restriction imposed by Java language, I cannot change the signature of this method.

startElementback to summary
public void startElement(String uri, String local, String qname, Attributes atts) throws SAXException

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.XMLFilterImpl.startElement.

Filter a start element event.

Parameters
uri:String

The element's Namespace URI, or the empty string.

local:String

The element's local name, or the empty string.

qname:String

The element's qualified (prefixed) name, or the empty string.

atts:Attributes

The element's attributes.

Exceptions
SAXException:
The client may throw an exception during processing.
wrapUpback to summary
public void wrapUp()

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.wrapUp.

Doc from com.sun.msv.reader.trex.TREXBaseReader.wrapUp.

performs final wrap-up. This method is called from the RootState object, after the parsing is completed.

This method has to be called after the run-away expression check is done.

com.sun.msv.reader.trex.ng.comp back to summary

public Class RELAXNGCompReader.StateFactory

extends StateFactory
Class Inheritance

creates various State object, which in turn parses grammar. parsing behavior can be customized by implementing custom StateFactory.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public State
public TREXGrammar
Inherited from com.sun.msv.reader.trex.ng.RELAXNGReader.StateFactory:
datadataExceptdataParamdefinedivInGrammarelementexternalRefgetDatatypeLibrarygrammarincludeGrammarlistnsAnyNamensExceptnsNsNameparentRefredefineredefineStartrefstarttextvalue

Constructor Detail

StateFactoryback to summary
public StateFactory()

Method Detail

attributeback to summary
public State attribute(State parent, StartTagInfo tag)

Overrides com.sun.msv.reader.trex.ng.RELAXNGReader.StateFactory.attribute.

createGrammarback to summary
public TREXGrammar createGrammar(ExpressionPool pool, TREXGrammar parent)

Overrides com.sun.msv.reader.trex.TREXBaseReader.StateFactory.createGrammar.