com.sun.msv.reader
public abstract class GrammarReader extends XMLFilterImpl implements IDContextProvider2
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.
UNKNOWN: com.sun.msv.reader.relax.RELAXReader#parse com.sun.msv.reader.trex.TREXGrammarReader#parse
Nested Class Summary | |
---|---|
static interface | GrammarReader.BackPatch |
class | GrammarReader.BackwardReferenceMap
memorizes what declarations are referenced from where.
this information is used to report the source of errors. |
class | GrammarReader.ChainPrefixResolver |
static interface | GrammarReader.PrefixResolver
namespace prefix to URI conversion map.
this variable is evacuated to InclusionContext when the parser is switched. |
Field Summary | |
---|---|
GrammarReader.BackwardReferenceMap | backwardReference keeps track of all backward references to every ReferenceExp.
this map should be used to report the source of error
of undefined-something. |
static GrammarReader.PrefixResolver | basePrefixResolver
The namespace prefix resolver that only resolves "xml" prefix.
|
Controller | controller this object receives errors and warnings |
static String | ERR_BAD_ATTRIBUTE_VALUE |
static String | ERR_BAD_TYPE |
static String | ERR_CHARACTERS |
static String | ERR_CONFLICTING_ATTRIBUTES |
static String | ERR_DATATYPE_ALREADY_DEFINED |
static String | ERR_DISALLOWED_ATTRIBUTE |
static String | ERR_FRAGMENT_IDENTIFIER |
static String | ERR_ILLEGAL_FINAL_VALUE |
static String | ERR_MALPLACED_ELEMENT |
static String | ERR_MISSING_ATTRIBUTE |
static String | ERR_MISSING_ATTRIBUTE_2 |
static String | ERR_MISSING_CHILD_EXPRESSION |
static String | ERR_MISSING_CHILD_TYPE |
static String | ERR_MISSING_TOPLEVEL |
static String | ERR_MORE_THAN_ONE_CHILD_EXPRESSION |
static String | ERR_MORE_THAN_ONE_CHILD_TYPE |
static String | ERR_RECURSIVE_DATATYPE |
static String | ERR_RECURSIVE_INCLUDE |
static String | ERR_RUNAWAY_EXPRESSION |
static String | ERR_UNDEFINED_DATATYPE |
Locator | locator document Locator that is given by XML reader |
SAXParserFactory | parserFactory Reader may create another SAXParser from this factory |
ExpressionPool | pool this object must be used to create a new expression |
GrammarReader.PrefixResolver | prefixResolver |
static String | WRN_DEPRECATED_TYPENAME |
static String | WRN_MAYBE_WRONG_NAMESPACE |
Method Summary | |
---|---|
void | addBackPatchJob(GrammarReader.BackPatch job) |
void | addBackPatchJob(XSDatatypeExp job) |
String | combineURI(String baseURI, String relativeURI)
converts the relative URL to the absolute one by using the specified base URL. |
String | combineURL(String baseURI, String relativeURI) |
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.
this method is used in the final wrap-up process of parsing. |
void | endPrefixMapping(String prefix) |
XSDatatype | getBackwardCompatibleType(String typeName)
tries to obtain a DataType object by resolving obsolete names.
this method is useful for backward compatibility purpose. |
String | getBaseUri() |
State | getCurrentState() gets current State object. |
Locator | getDeclaredLocationOf(Object o) |
abstract Grammar | getResultAsGrammar()
gets the parsed AGM.
|
boolean | isNotation(String notationName) |
boolean | isUnparsedEntity(String entityName) |
Iterator | iterateInscopeNamespaces()
Iterates Map.Entry objects which has the prefix as key and
the namespace URI as value. |
void | onID(Datatype dt, StringToken token) |
void | parse(String source) parses a grammar from the specified source |
void | parse(InputSource 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(String propertyName) |
void | reportError(String propertyName, Object arg1) |
void | reportError(String propertyName, Object arg1, Object arg2) |
void | reportError(String propertyName, Object arg1, Object arg2, Object arg3) |
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, Object[] args, Exception nestedException, Locator[] errorLocations) reports an error to the controller |
void | reportWarning(String propertyName) |
void | reportWarning(String propertyName, Object arg1) |
void | reportWarning(String propertyName, Object arg1, Object arg2) |
void | reportWarning(String propertyName, Object[] args, Locator[] locations) reports a warning to the controller |
InputSource | resolveLocation(State sourceState, String uri)
obtains InputSource for the specified url.
|
String | resolveNamespacePrefix(String prefix) |
void | runBackPatchJob() Performs all back-patchings. |
void | setDeclaredLocationOf(Object o) |
void | setDocumentLocator(Locator loc) |
String[] | splitQName(String qName)
Resolves a QName into a pair of (namespace URI,local name).
|
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.
|
void | switchSource(InputSource source, State newState) |
void | _parse(Object source, Locator errorSource) parses a grammar from the specified source |
Deprecated: use the combineURI method.
Returns: null if the start tag is an error.
Parameters: sourceState The base URI of this state is used to resolve the resource.
Returns: always return non-null valid object
Parameters: 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.