Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.outerj.pollo.xmleditor.schema
Class MsvSchema  view MsvSchema download MsvSchema.java

java.lang.Object
  extended byorg.outerj.pollo.xmleditor.schema.MsvSchema
All Implemented Interfaces:
ISchema

public class MsvSchema
extends java.lang.Object
implements ISchema

An ISchema implementation using MSV. The schema is read and then flattend out to the same level as the BasicSchema implementation, meaning information about content model, required attributes, etc. is ignored. The MSV grammar is kept however for doing validation (FIXME note to myself: these need to be cached and shared between open files).


Nested Class Summary
 class MsvSchema.MsvGrammarWalker
          The goals of MsvGrammarWalker is to convert an MSV Grammar object to Pollo's own simple schema-structure.
 class MsvSchema.MsvSchemaErrorHandler
           
 class MsvSchema.PolloMsvController
           
 
Field Summary
protected  org.outerj.pollo.xmleditor.util.NodeMap elementSchemas
           
protected  MsvSchema.MsvSchemaErrorHandler errorHandler
           
protected  Grammar grammar
           
protected  SimpleNamespaceContext namespaceContext
           
protected  java.lang.String source
           
protected  org.outerj.pollo.xmleditor.schema.msv.PolloMsvVerifier verifier
           
 
Constructor Summary
MsvSchema()
           
 
Method Summary
 java.util.Collection getAllowedSubElements(org.w3c.dom.Element element)
           
 java.util.Collection getAllowedSubTexts(org.w3c.dom.Element element)
           
protected  AttributeSchema getAttributeSchema(org.w3c.dom.Element element, java.lang.String namespaceURI, java.lang.String localName)
           
 java.util.Collection getAttributesFor(org.w3c.dom.Element element)
          Returns the list of attributes an element can have.
protected  ElementSchema getElementSchema(java.lang.String namespaceURI, java.lang.String localName)
           
 Expression getExpression(org.w3c.dom.Document document, org.w3c.dom.Element element)
          Verifies the document up to the given element, and then returns the Expression describing the content model that the verifiers expects for that element.
private  java.lang.String[] getNameParts(NameClass nameClass)
           
 java.lang.String[] getPossibleAttributeValues(org.w3c.dom.Element element, java.lang.String namespaceURI, java.lang.String localName)
          Returns an array containing a list of possible values an attribute can have, or null if such a list is not available.
protected  void init(java.util.HashMap initParams)
          Builds elementSchemas NodeMap (as with Basic Schema).
protected  void initializeVerifier()
           
 boolean isChildAllowed(org.w3c.dom.Element parent, org.w3c.dom.Element child)
          Returns true if the element child is allowed as child of the element parent.
 java.util.Collection validate(org.w3c.dom.Document document)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespaceContext

protected SimpleNamespaceContext namespaceContext

elementSchemas

protected org.outerj.pollo.xmleditor.util.NodeMap elementSchemas

source

protected java.lang.String source

grammar

protected Grammar grammar

verifier

protected org.outerj.pollo.xmleditor.schema.msv.PolloMsvVerifier verifier

errorHandler

protected MsvSchema.MsvSchemaErrorHandler errorHandler
Constructor Detail

MsvSchema

public MsvSchema()
Method Detail

init

protected void init(java.util.HashMap initParams)
             throws java.lang.Exception
Builds elementSchemas NodeMap (as with Basic Schema).


getNameParts

private final java.lang.String[] getNameParts(NameClass nameClass)

getAttributesFor

public java.util.Collection getAttributesFor(org.w3c.dom.Element element)
Returns the list of attributes an element can have.

Specified by:
getAttributesFor in interface ISchema

isChildAllowed

public boolean isChildAllowed(org.w3c.dom.Element parent,
                              org.w3c.dom.Element child)
Returns true if the element child is allowed as child of the element parent.

Specified by:
isChildAllowed in interface ISchema

getPossibleAttributeValues

public java.lang.String[] getPossibleAttributeValues(org.w3c.dom.Element element,
                                                     java.lang.String namespaceURI,
                                                     java.lang.String localName)
Returns an array containing a list of possible values an attribute can have, or null if such a list is not available.

Specified by:
getPossibleAttributeValues in interface ISchema

getAllowedSubElements

public java.util.Collection getAllowedSubElements(org.w3c.dom.Element element)
Specified by:
getAllowedSubElements in interface ISchema

getAllowedSubTexts

public java.util.Collection getAllowedSubTexts(org.w3c.dom.Element element)
Specified by:
getAllowedSubTexts in interface ISchema

getElementSchema

protected ElementSchema getElementSchema(java.lang.String namespaceURI,
                                         java.lang.String localName)

getAttributeSchema

protected AttributeSchema getAttributeSchema(org.w3c.dom.Element element,
                                             java.lang.String namespaceURI,
                                             java.lang.String localName)

validate

public java.util.Collection validate(org.w3c.dom.Document document)
                              throws ValidationNotSupportedException,
                                     java.lang.Exception
Specified by:
validate in interface ISchema

getExpression

public Expression getExpression(org.w3c.dom.Document document,
                                org.w3c.dom.Element element)
                         throws java.lang.Exception
Verifies the document up to the given element, and then returns the Expression describing the content model that the verifiers expects for that element.

Implementation note: this depends on the classes PolloMsvVerifier and SAXEventGenerator to stop the validation at a certain node.


initializeVerifier

protected void initializeVerifier()