sk.uniba.euromath.document.schema.impl
Class SchemaImpl

java.lang.Object
  extended by sk.uniba.euromath.document.schema.impl.SchemaImpl
All Implemented Interfaces:
ISchema

public final class SchemaImpl
extends Object
implements ISchema

Implements the Schema interface.

Author:
Martin Vysny

Field Summary
 ComputeInsertLists computeInsertLists
          Computation of insertlists, that are insertable into element's content.
 IValidationContextP context
          Validation context.
 com.sun.msv.grammar.IDContextProvider2 contextProvider
          Wrapper around context.
 DelNodesComputer delElementsComputer
          Computes the elements that needs to be deleted along with given elements.
 com.sun.msv.verifier.regexp.REDocumentDeclaration docDecl
          Instance of generated elements getter.
 EncloseDecloseElements encloseDecloseElements
          Provides enclose/declose functionality.
 ExpFinder expFinder
          Accessor to element's definition.
 ExpTools expTools
          DomTools used for processing Expression.
 com.sun.msv.grammar.Grammar grammar
          MSV Grammar.
 InsertableContentChecker insertableContentChecker
          Detects places for insertable nodes.
 NameClassTools ncTools
          DomTools used for processing NameClass.
 ValidatorImpl validator
          Instance of validator.
 
Method Summary
 IElementRuleP getElementRule(Element element)
          Returns rule representing given existing element.
 INameListP<IAttributeRuleP> getExportedAttributes()
           Computes all attributes defined in this schema, regardless of element, which they are bound to.
 String getNamespaceUri()
          Returns URI for which the Schema works.
 INameListP<INewElementRuleP> getRootElements()
          Returns list of possible local names of the root elements.
 Iterator<String> getWarnings()
          Returns warnings that occured during schema loading.
 RulePool newTemporaryPool()
          Returns pool, that can be used to store temporary NewElementRuleImpl or AttributeRuleImpl.
 void validate(Element element)
           Validates given root element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expTools

public final ExpTools expTools
DomTools used for processing Expression.


expFinder

public final ExpFinder expFinder
Accessor to element's definition.


ncTools

public final NameClassTools ncTools
DomTools used for processing NameClass.


grammar

public final com.sun.msv.grammar.Grammar grammar
MSV Grammar.


validator

public final ValidatorImpl validator
Instance of validator.


computeInsertLists

public final ComputeInsertLists computeInsertLists
Computation of insertlists, that are insertable into element's content.


delElementsComputer

public final DelNodesComputer delElementsComputer
Computes the elements that needs to be deleted along with given elements.


encloseDecloseElements

public final EncloseDecloseElements encloseDecloseElements
Provides enclose/declose functionality.


docDecl

public final com.sun.msv.verifier.regexp.REDocumentDeclaration docDecl
Instance of generated elements getter.


context

public final IValidationContextP context
Validation context.


contextProvider

public final com.sun.msv.grammar.IDContextProvider2 contextProvider
Wrapper around context.


insertableContentChecker

public final InsertableContentChecker insertableContentChecker
Detects places for insertable nodes.

Method Detail

getExportedAttributes

public INameListP<IAttributeRuleP> getExportedAttributes()
Description copied from interface: ISchema

Computes all attributes defined in this schema, regardless of element, which they are bound to. Returned array must NOT be modifed in any way. These attributes are called exported - they can be inserted into other namespaces.

This list serves for purpose of adding attributes of this namespace to elements from another namespace. Thus, if there are 2 or more attributes defined with same QName in schema, they cannot be returned here. That would raise ambiguity, because attributes are denoted only by QName, and we would have to select from more rules.

Local attributes have empty URI instead of its own namespace URI, so empty URI must be replaced by its namespace URI.

Result should be computed when object is created.

Specified by:
getExportedAttributes in interface ISchema
Returns:
all attributes of this schema. Result list must contain AttributeRule instances.
See Also:
ISchema.getExportedAttributes()

getRootElements

public INameListP<INewElementRuleP> getRootElements()
Description copied from interface: ISchema
Returns list of possible local names of the root elements. URI is fixed and can be returned with function getNamespaceUri()- root element automatically belongs to the bounded URI. Caller guarantees that it won't modify this set. In exchange, Schema must cache this set.

Specified by:
getRootElements in interface ISchema
Returns:
set of strings representing local names of the root elements.
See Also:
ISchema.getRootElements()

getNamespaceUri

public String getNamespaceUri()
Description copied from interface: ISchema
Returns URI for which the Schema works. Schema may accept elements/attributes from other namespaces, however it should not attempt to define their content.

Specified by:
getNamespaceUri in interface ISchema
Returns:
URI to which the Schema is bound.
See Also:
ISchema.getNamespaceUri()

getWarnings

public Iterator<String> getWarnings()
Description copied from interface: ISchema
Returns warnings that occured during schema loading. Items of iterator must NOT be modified nor deleted.

Specified by:
getWarnings in interface ISchema
Returns:
Iterator of String representing warnings, or null if there were no warnings.
See Also:
ISchema.getWarnings()

validate

public void validate(Element element)
              throws SchemaException
Description copied from interface: ISchema

Validates given root element. It must be full validation, no elements nor texts must not be skipped. If this element is not valid, exception must be thrown.

When element from another namespace uri is encountered in the process of validation, just call ValidationContextP.validate() to validate this unknown element.

The only exception to this rule is emp:id attribute, which the schema must ignore.

Specified by:
validate in interface ISchema
Parameters:
element - element to be validated, always one of possible root elements from this namespace.
Throws:
SchemaException - if something goes wrong in the process of validation. The Schema instance must provide as much information as possible about error. It should display path to errorneous element with getPathToRoot() method of EuromathSchemaProvider class.
See Also:
ISchema.validate(org.w3c.dom.Element)

newTemporaryPool

public RulePool newTemporaryPool()
Returns pool, that can be used to store temporary NewElementRuleImpl or AttributeRuleImpl.

Returns:
new temporary rule pool.

getElementRule

public IElementRuleP getElementRule(Element element)
Description copied from interface: ISchema
Returns rule representing given existing element. If the document is not valid then the rule returned is correct if and only if the rule can be identified from the name of the element - the element is said to be context-free.

Specified by:
getElementRule in interface ISchema
Parameters:
element - the element. It must stay unchanged while returned instance is used.
Returns:
rule, used to modify contents of given element.


Copyright © 2003-2006 null. All Rights Reserved.