|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.XMLFilterImpl | +--com.sun.msv.reader.GrammarReader
base implementation of grammar readers that read grammar from SAX2 stream. GrammarReader class can be used as a ContentHandler that parses a grammar. So the typical usage is
Or you may want to use several pre-defined static "parse" methods for ease of use.GrammarReader reader = new RELAXGrammarReader(...); XMLReader parser = .... // create a new XMLReader here parser.setContentHandler(reader); parser.parse(whateverYouLike); return reader.grammar; // obtain parsed grammar.
Inner Class Summary | |
static interface |
GrammarReader.BackPatch
|
class |
GrammarReader.BackwardReferenceMap
memorizes what declarations are referenced from where. |
class |
GrammarReader.ChainPrefixResolver
|
static interface |
GrammarReader.PrefixResolver
namespace prefix to URI conversion map. |
Method Summary | |
void |
addBackPatchJob(GrammarReader.BackPatch job)
|
String |
combineURL(String baseURL,
String relativeURL)
converts the relative URL to the absolute one by using the specified base URL. |
abstract State |
createExpressionChildState(State parent,
StartTagInfo tag)
this method must be implemented by the derived class to create language-default expresion state. |
void |
detectUndefinedOnes(ReferenceContainer container,
String errMsg)
detects undefined ReferenceExp and reports it as an error. |
void |
endPrefixMapping(String prefix)
|
Datatype |
getBackwardCompatibleType(String typeName)
tries to obtain a DataType object by resolving obsolete names. |
State |
getCurrentState()
gets current State object. |
Locator |
getDeclaredLocationOf(Object o)
|
abstract Grammar |
getResultAsGrammar()
gets the parsed AGM. |
boolean |
isNotation(String notationName)
checks if a notation is declared with the specified name. |
boolean |
isUnparsedEntity(String entityName)
checks if an unparsed entity is declared with the specified name. |
boolean |
onID(String uri,
String local,
Object token)
this method is called when another ID is found to check whether this ID is already used or not. |
void |
onIDREF(String uri,
String local,
Object token)
this method is called when an IDREF is found. |
void |
parse(InputSource source)
parses a grammar from the specified source |
void |
parse(String source)
parses a grammar from the specified source |
void |
popState()
pops the previous state from the stack |
void |
pushState(State newState,
State parentState,
StartTagInfo startTag)
pushs the current state into the stack and sets new one |
void |
reportError(Exception nestedException,
String propertyName)
|
void |
reportError(Exception nestedException,
String propertyName,
Object arg1)
|
void |
reportError(Locator[] locs,
String propertyName,
Object[] args)
|
void |
reportError(String propertyName)
|
void |
reportError(String propertyName,
Object arg1)
|
void |
reportError(String propertyName,
Object[] args,
Exception nestedException,
Locator[] errorLocations)
reports an error to the controller |
void |
reportError(String propertyName,
Object arg1,
Object arg2)
|
void |
reportError(String propertyName,
Object arg1,
Object arg2,
Object arg3)
|
void |
reportWarning(String propertyName,
Object arg1)
|
void |
reportWarning(String propertyName,
Object[] args,
Locator[] locations)
reports a warning to the controller |
void |
reportWarning(String propertyName,
Object arg1,
Object arg2)
|
abstract Datatype |
resolveDataType(String typeName)
gets DataType object from type name. |
InputSource |
resolveLocation(State sourceState,
String url)
obtains InputSource for the specified url. |
String |
resolveNamespacePrefix(String prefix)
Resolves a namespace prefix to the corresponding namespace URI. |
void |
setDeclaredLocationOf(Object o)
|
void |
setDocumentLocator(Locator loc)
|
String[] |
splitQName(String qName)
calls processName method of NamespaceSupport. |
void |
startPrefixMapping(String prefix,
String uri)
|
void |
switchSource(State sourceState,
String url,
State newState)
switchs InputSource to the specified URL and parses it by the specified state. |
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
characters, endDocument, endElement, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startElement, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public Locator locator
public final GrammarReaderController controller
public final javax.xml.parsers.SAXParserFactory parserFactory
public final ExpressionPool pool
public static final GrammarReader.PrefixResolver basePrefixResolver
public GrammarReader.PrefixResolver prefixResolver
public final GrammarReader.BackwardReferenceMap backwardReference
public boolean hadError
public static final String ERR_MALPLACED_ELEMENT
public static final String ERR_IO_EXCEPTION
public static final String ERR_SAX_EXCEPTION
public static final String ERR_XMLPARSERFACTORY_EXCEPTION
public static final String ERR_CHARACTERS
public static final String ERR_DISALLOWED_ATTRIBUTE
public static final String ERR_MISSING_ATTRIBUTE
public static final String ERR_BAD_ATTRIBUTE_VALUE
public static final String ERR_MISSING_ATTRIBUTE_2
public static final String ERR_CONFLICTING_ATTRIBUTES
public static final String ERR_RECURSIVE_INCLUDE
public static final String ERR_UNDEFINED_DATATYPE
public static final String ERR_DATATYPE_ALREADY_DEFINED
public static final String ERR_MISSING_CHILD_EXPRESSION
public static final String ERR_MORE_THAN_ONE_CHILD_EXPRESSION
public static final String ERR_MORE_THAN_ONE_CHILD_TYPE
public static final String ERR_MISSING_CHILD_TYPE
public static final String ERR_ILLEGAL_FINAL_VALUE
public static final String ERR_RUNAWAY_EXPRESSION
public static final String ERR_MISSING_TOPLEVEL
public static final String WRN_MAYBE_WRONG_NAMESPACE
public static final String WRN_DEPRECATED_TYPENAME
public static final String ERR_BAD_TYPE
public static final String ERR_RECURSIVE_DATATYPE
Method Detail |
public abstract Grammar getResultAsGrammar()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in class XMLFilterImpl
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in class XMLFilterImpl
public final String[] splitQName(String qName)
public abstract Datatype resolveDataType(String typeName)
typeName
- For RELAX, this is unqualified type name. For TREX,
this is a QName.public Datatype getBackwardCompatibleType(String typeName)
public final InputSource resolveLocation(State sourceState, String url)
sourceState
- The base URI of this state is used to resolve the resource.public final String combineURL(String baseURL, String relativeURL)
public void switchSource(State sourceState, String url, State newState)
sourceState
- this state is used to resolve the URL.newState
- this state will parse top-level of new XML source.
this state receives document element by its createChildState method.public final void parse(String source)
parse
in class XMLFilterImpl
public final void parse(InputSource source)
parse
in class XMLFilterImpl
public void setDeclaredLocationOf(Object o)
public Locator getDeclaredLocationOf(Object o)
public void detectUndefinedOnes(ReferenceContainer container, String errMsg)
public void pushState(State newState, State parentState, StartTagInfo startTag)
public void popState()
public final State getCurrentState()
public abstract State createExpressionChildState(State parent, StartTagInfo tag)
public void setDocumentLocator(Locator loc)
setDocumentLocator
in class XMLFilterImpl
public String resolveNamespacePrefix(String prefix)
ValidationContext
If the prefix is "" (empty string), it indicates unprefixed value. The callee should resolved it as if it sees an unprefixed element, rather than unprefixed attribute.
If the prefix is "xml", then the callee must resolve this prefix into "http://www.w3.org/XML/1998/namespace", as defined in the XML Namespace rec.
resolveNamespacePrefix
in interface ValidationContext
org.relaxng.datatype.ValidationContext
public boolean isUnparsedEntity(String entityName)
ValidationContext
isUnparsedEntity
in interface ValidationContext
org.relaxng.datatype.ValidationContext
public boolean isNotation(String notationName)
ValidationContext
isNotation
in interface ValidationContext
org.relaxng.datatype.ValidationContext
public boolean onID(String uri, String local, Object token)
IDContextProvider
onID
in interface IDContextProvider
com.sun.msv.grammar.IDContextProvider
symbolSpaceName
- token has to be unique within the same symbol space,
but two tokens can have the same name if they reside in
different symbol spaces.public void onIDREF(String uri, String local, Object token)
IDContextProvider
onIDREF
in interface IDContextProvider
public void addBackPatchJob(GrammarReader.BackPatch job)
public final void reportError(String propertyName)
public final void reportError(String propertyName, Object arg1)
public final void reportError(String propertyName, Object arg1, Object arg2)
public final void reportError(String propertyName, Object arg1, Object arg2, Object arg3)
public final void reportError(Exception nestedException, String propertyName)
public final void reportError(Exception nestedException, String propertyName, Object arg1)
public final void reportError(Locator[] locs, String propertyName, Object[] args)
public final void reportWarning(String propertyName, Object arg1)
public final void reportWarning(String propertyName, Object arg1, Object arg2)
public final void reportError(String propertyName, Object[] args, Exception nestedException, Locator[] errorLocations)
public final void reportWarning(String propertyName, Object[] args, Locator[] locations)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |