|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thaiopensource.xml.sax.DelegatingContentHandler
com.oxygenxml.validate.nvdl.SchemaImpl.Handler
private class SchemaImpl.Handler
This class is registered as content handler on the XMLReader that parses the NVDL script. It creates the Schema representation for this script and also validates the script against the NVDL schema.
Nested Class Summary | |
---|---|
(package private) class |
SchemaImpl.Handler.ModeData
|
Field Summary | |
---|---|
private CountingErrorHandler |
ceh
A counting error handler that wraps the error handler. |
private String |
defaultSchemaType
The value of rules/@schemaType |
private ErrorHandler |
eh
The error handler. |
private int |
foreignDepth
For ignoring foreign elements. |
private boolean |
hadError
Flag indicating that we encountered an error. |
private Localizer |
localizer
Convert error keys to messages. |
private Locator |
locator
Error locator. |
(package private) SchemaImpl.Handler.ModeData |
md
Stores mode data. |
private Stack |
modeDataStack
Keeps the elements from mode data stack. |
private Stack |
nvdlStack
Keeps the elements from NVDL representing the current context. |
private SchemaReceiverImpl |
sr
The schema receiver. |
private Validator |
validator
The validator that checks the script against the NVDL RelaxNG schema. |
private XmlBaseHandler |
xmlBaseHandler
Handle xml:base attributes. |
Constructor Summary | |
---|---|
SchemaImpl.Handler(SchemaReceiverImpl sr)
Creates a handler. |
Method Summary | |
---|---|
private Schema |
createSubSchema(boolean isAttributesSchema)
Creates a sub schema for the ending validate action (this is called from finishValidate). |
void |
endElement(String namespaceURI,
String localName,
String qName)
End element callback. |
(package private) void |
error(String key)
Report a no arguments error from a key. |
(package private) void |
error(String key,
String arg)
Report an one argument error. |
(package private) void |
error(String key,
String arg,
Locator locator)
Report an one argument error with location. |
(package private) void |
error(String key,
String arg1,
String arg2)
Report a two arguments error. |
private void |
finishIncludedMode()
Notification that the mode element ends. |
private void |
finishMode()
Notification that the mode element ends. |
private void |
finishNestedMode()
Notification that the mode element ends. |
private void |
finishValidate()
Notification that the validate element ends. |
private ModeUsage |
getModeUsage(Attributes attributes)
Creates a mode usage that matches current mode and uses further the mode specified by the useMode attribute. |
private String |
getNs(Attributes attributes)
Get the namespace from the ns attribute. |
Schema |
getSchema()
|
private String |
getSchema(Attributes attributes)
Get the URI specified by a schema attribute and if we have a relative location resolve that against the base URI taking into account also eventual xml:base attributes. |
private String |
getSchemaType(Attributes attributes)
Get the schema type |
private Mode |
getUseMode(Attributes attributes)
Get the Mode for the useMode attribute. |
private void |
parseAllow(Attributes attributes)
Parse an allow action. |
private void |
parseAnyNamespace(Attributes attributes)
Parse an anyNamespace rule. |
private void |
parseAttach(Attributes attributes)
Parse an attach action. |
private void |
parseAttachPlaceholder(Attributes attributes)
Parse an attachPlaceholder action. |
private void |
parseCancelNestedActions(Attributes attributes)
Parse a cancel nested actions action. |
private void |
parseContext(Attributes attributes)
Parse context dependent mode usages. |
private void |
parseIncludedMode(Attributes attributes)
Parse a mode element. |
private void |
parseMode(Attributes attributes)
Parse a mode element. |
private void |
parseNamespace(Attributes attributes)
Parse a namespace rule. |
private void |
parseNestedMode(Attributes attributes)
Parse a mode element. |
private void |
parseOption(Attributes attributes)
Parse a validate option. |
private void |
parseReject(Attributes attributes)
Parse a reject action. |
private void |
parseRule(String ns,
Attributes attributes)
Parse namespace and anyNamespace rules/ |
private void |
parseRules(Attributes attributes)
Parse the rules element. |
private void |
parseTrigger(Attributes attributes)
Parse a trigger element. |
private void |
parseUnwrap(Attributes attributes)
Parse an unwrap action. |
private void |
parseValidate(Attributes attributes)
Parse a validate action. |
void |
setDocumentLocator(Locator locator)
Callback with the document locator. |
void |
startDocument()
On start document. |
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
Start element callback. |
private ElementsOrAttributes |
toElementsOrAttributes(String value,
ElementsOrAttributes defaultValue)
Get an ElementsOrAttributes instance depending on the match attribute value. |
RuntimeException |
unwrapException(RuntimeException e)
|
Methods inherited from class com.thaiopensource.xml.sax.DelegatingContentHandler |
---|
characters, endDocument, endPrefixMapping, getDelegate, ignorableWhitespace, processingInstruction, setDelegate, skippedEntity, startPrefixMapping |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final SchemaReceiverImpl sr
private boolean hadError
private final ErrorHandler eh
private final CountingErrorHandler ceh
private final Localizer localizer
private Locator locator
private final XmlBaseHandler xmlBaseHandler
private int foreignDepth
private String defaultSchemaType
private Validator validator
SchemaImpl.Handler.ModeData md
private Stack modeDataStack
private Stack nvdlStack
Constructor Detail |
---|
SchemaImpl.Handler(SchemaReceiverImpl sr)
sr
- The Schema Receiver implementation for NVDL schemas.Method Detail |
---|
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DelegatingContentHandler
locator
- The document locator.public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class DelegatingContentHandler
SAXException
public Schema getSchema() throws IncorrectSchemaException, SAXException
getSchema
in interface SchemaFuture
IncorrectSchemaException
SAXException
public RuntimeException unwrapException(RuntimeException e) throws SAXException, IOException, IncorrectSchemaException
unwrapException
in interface SchemaFuture
SAXException
IOException
IncorrectSchemaException
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DelegatingContentHandler
uri
- The namespace uri for this element.localName
- The element local name.qName
- The element qualified name.attributes
- The attributes of this element.
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DelegatingContentHandler
namespaceURI
- The namespace uri for this element.localName
- The element local name.qName
- The element qualified name.
SAXException
private void parseRules(Attributes attributes)
attributes
- The rule element attributes.private void parseMode(Attributes attributes) throws SAXException
attributes
- The element attributes.
SAXException
private void parseIncludedMode(Attributes attributes) throws SAXException
attributes
- The element attributes.
SAXException
private void parseNestedMode(Attributes attributes) throws SAXException
attributes
- The element attributes.
SAXException
private void parseNamespace(Attributes attributes) throws SAXException
attributes
- The namespace element attributes.
SAXException
private void parseAnyNamespace(Attributes attributes) throws SAXException
attributes
- The anyNamespace element attributes.
SAXException
private void parseRule(String ns, Attributes attributes) throws SAXException
ns
- The namespace, ##any for anyNamespaceattributes
- The rule attributes.
SAXException
private void parseValidate(Attributes attributes) throws SAXException
attributes
- The validate element attributes.
SAXException
private void finishValidate() throws SAXException
SAXException
private void finishMode() throws SAXException
SAXException
private void finishIncludedMode() throws SAXException
SAXException
private void finishNestedMode() throws SAXException
SAXException
private Schema createSubSchema(boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException
isAttributesSchema
- If the schema is intended to validate only attributes.
IOException
IncorrectSchemaException
SAXException
private void parseOption(Attributes attributes) throws SAXException
attributes
- The option element attributes.
SAXException
private void parseTrigger(Attributes attributes) throws SAXException
attributes
- The trigger element attributes.
SAXException
private void parseAttach(Attributes attributes)
attributes
- The attach element attributes.private void parseUnwrap(Attributes attributes)
attributes
- The unwrap element attributes.private void parseAttachPlaceholder(Attributes attributes)
attributes
- The attachPlaceholder element attributes.private void parseAllow(Attributes attributes)
attributes
- The allow element attributes.private void parseReject(Attributes attributes)
attributes
- The reject element attributes.private void parseCancelNestedActions(Attributes attributes)
attributes
- The cancelNestedActions element attributes.private void parseContext(Attributes attributes) throws SAXException
attributes
- The context element attributes.
SAXException
private String getSchema(Attributes attributes) throws SAXException
attributes
- The validate element attributes.
SAXException
- If the schema contains a fragment id.private String getSchemaType(Attributes attributes)
attributes
- The attributes
private ElementsOrAttributes toElementsOrAttributes(String value, ElementsOrAttributes defaultValue)
value
- The match attribute value.defaultValue
- The default value if value is null.
private ModeUsage getModeUsage(Attributes attributes)
attributes
- The action element attributes.
private Mode getUseMode(Attributes attributes)
attributes
- the attributes
private String getNs(Attributes attributes) throws SAXException
attributes
- The list of attributes of the namespace element
SAXException
void error(String key) throws SAXException
key
- The error key.
SAXException
void error(String key, String arg) throws SAXException
key
- The error key.arg
- The argument.
SAXException
void error(String key, String arg, Locator locator) throws SAXException
key
- The error key.arg
- The argument.locator
- The location.
SAXException
void error(String key, String arg1, String arg2) throws SAXException
key
- The error key.arg1
- The first argument.arg2
- The second argument.
SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |