org.merlotxml.util.xml.xerces
Class SchemaGrammarComplexTypeImpl

java.lang.Object
  extended byorg.merlotxml.util.xml.GrammarComplexType
      extended byorg.merlotxml.util.xml.xerces.SchemaGrammarComplexTypeImpl

public class SchemaGrammarComplexTypeImpl
extends GrammarComplexType

An implementation of GrammarComplexType for Schemas.

Author:
Evert Hoff

Nested Class Summary
 
Nested classes inherited from class org.merlotxml.util.xml.GrammarComplexType
GrammarComplexType.ListComparator
 
Field Summary
static java.lang.String INSERT_PLACE_HOLDER
           
 
Fields inherited from class org.merlotxml.util.xml.GrammarComplexType
_attributes, _namedAttributes, _simpleContent, debugLevel, totalDurationIsEachAttributeValid, totalDurationIsLocationValid, totalDurationIsSimpleContentValid
 
Constructor Summary
SchemaGrammarComplexTypeImpl(SchemaGrammarDocumentImpl grammarDocument, SchemaGrammarComplexTypeImpl parentComplexType, org.apache.xerces.xs.XSElementDeclaration elementDeclaration, org.apache.xerces.xs.XSParticle particle)
           
SchemaGrammarComplexTypeImpl(SchemaGrammarDocumentImpl grammarDocument, org.apache.xerces.xs.XSElementDeclaration elementDeclaration)
           
 
Method Summary
 GrammarComplexType getChild(java.lang.String name)
          Gets a locally defined element by name.
 GrammarComplexType[] getChildren()
          Gets all the children defined within the scope of this parent.
 java.lang.String getDocumentation()
          Gets the value of the value defined in the Schema.
protected  org.w3c.dom.Element[] getElementPath(org.w3c.dom.Element el)
           
 boolean getIsEachAttributeValid(org.w3c.dom.Element el)
          Checks the validity of the values of each of the attributes.
 boolean getIsNillable()
          Means whether an attribute xsi:nil='true' may be inserted into the XML file.
 boolean getIsSimpleContentAllowed()
          Determines if the element may contain simple content (#PCDATA).
 boolean getIsSimpleContentValid(org.w3c.dom.Element el)
          Validates the value of the simple content of this element.
 int getMaxOccurs()
          Gets the maximum number of instances of this type of element that are allowed.
 int getMinOccurs()
          Gets the valid minimum number of instances of this type of element.
 java.lang.String getName()
          Gets the name of this complex type.
 GrammarComplexType getParentComplexType(org.w3c.dom.Element el)
           
protected  SchemaGrammarDocumentImpl getSchemaGrammarDocumentImpl()
           
protected  org.w3c.dom.Node getTextNode(org.w3c.dom.Element el)
           
 org.apache.xerces.xs.XSElementDeclaration getXSElementDeclaration()
           
 boolean isEmptyType()
           
 boolean isMixedType()
           
 void resetValidation(org.w3c.dom.Element el)
           
 int validate(org.w3c.dom.Element el)
          Validates the element in terms of its position in the structure of the document.
protected  int validate(java.lang.String[] candidateNodeNames)
          Validates the candidate node names for their position in the structure.
protected  boolean validate(org.apache.xerces.xs.XSParticle particle, java.util.Vector candidateNodeNames)
           
protected  boolean validate(org.apache.xerces.xs.XSParticle particle, java.util.Vector candidateNodeNames, int level)
           
protected  java.lang.String[] whatCanGoHere(java.lang.String[] currentChildElements, int insertPosition)
          The possible elements that could be inserted at this position, given the current children.
protected  boolean whatCanGoHere(org.apache.xerces.xs.XSParticle particle, java.util.Vector candidateNodeNames, java.util.Vector result, int level)
           
 
Methods inherited from class org.merlotxml.util.xml.GrammarComplexType
debug, getAttribute, getAttributes, getChildNodeNames, getChildNodeNamesWithoutText, getFirstMissingChildName, getIndexWithoutTextNodes, getInsertableElements, getInsertableElements, getInsertPosition, getIsComplete, getIsLocationValid, getNames, getPositionAmongPeers, getSimpleContent, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSERT_PLACE_HOLDER

public static final java.lang.String INSERT_PLACE_HOLDER
See Also:
Constant Field Values
Constructor Detail

SchemaGrammarComplexTypeImpl

public SchemaGrammarComplexTypeImpl(SchemaGrammarDocumentImpl grammarDocument,
                                    org.apache.xerces.xs.XSElementDeclaration elementDeclaration)

SchemaGrammarComplexTypeImpl

public SchemaGrammarComplexTypeImpl(SchemaGrammarDocumentImpl grammarDocument,
                                    SchemaGrammarComplexTypeImpl parentComplexType,
                                    org.apache.xerces.xs.XSElementDeclaration elementDeclaration,
                                    org.apache.xerces.xs.XSParticle particle)
Method Detail

getChild

public GrammarComplexType getChild(java.lang.String name)
Description copied from class: GrammarComplexType
Gets a locally defined element by name.

Specified by:
getChild in class GrammarComplexType
Parameters:
name - The name of the child element.
Returns:
The child.

getChildren

public GrammarComplexType[] getChildren()
Description copied from class: GrammarComplexType
Gets all the children defined within the scope of this parent.

Specified by:
getChildren in class GrammarComplexType
Returns:
The children.

getParentComplexType

public GrammarComplexType getParentComplexType(org.w3c.dom.Element el)
Specified by:
getParentComplexType in class GrammarComplexType

getElementPath

protected org.w3c.dom.Element[] getElementPath(org.w3c.dom.Element el)

getDocumentation

public java.lang.String getDocumentation()
Description copied from class: GrammarComplexType
Gets the value of the value defined in the Schema. This is a useful place to store help documentation about each element.

Specified by:
getDocumentation in class GrammarComplexType
Returns:
The documentation value

getIsEachAttributeValid

public boolean getIsEachAttributeValid(org.w3c.dom.Element el)
Description copied from class: GrammarComplexType
Checks the validity of the values of each of the attributes.

Overrides:
getIsEachAttributeValid in class GrammarComplexType
Parameters:
el - The element for which all attributes must be checked.
Returns:
False if any attribute is invalid.

getIsNillable

public boolean getIsNillable()
Description copied from class: GrammarComplexType
Means whether an attribute xsi:nil='true' may be inserted into the XML file.

For DTDs always returns false.

For Schemas, returns whether nillable has been set to true for this element.

Specified by:
getIsNillable in class GrammarComplexType

getIsSimpleContentAllowed

public boolean getIsSimpleContentAllowed()
Description copied from class: GrammarComplexType
Determines if the element may contain simple content (#PCDATA).

Specified by:
getIsSimpleContentAllowed in class GrammarComplexType
Returns:
The isSimpleContentAllowed value

getIsSimpleContentValid

public boolean getIsSimpleContentValid(org.w3c.dom.Element el)
Description copied from class: GrammarComplexType
Validates the value of the simple content of this element. In other words, the value of the #text node below this element is validated.

Overrides:
getIsSimpleContentValid in class GrammarComplexType
Parameters:
el - The element to be validated.
Returns:
The isSimpleContentValid value

getTextNode

protected org.w3c.dom.Node getTextNode(org.w3c.dom.Element el)

getMaxOccurs

public int getMaxOccurs()
Description copied from class: GrammarComplexType
Gets the maximum number of instances of this type of element that are allowed.

Specified by:
getMaxOccurs in class GrammarComplexType
Returns:
The maxOccurs value, or -1 for infinite.

getMinOccurs

public int getMinOccurs()
Description copied from class: GrammarComplexType
Gets the valid minimum number of instances of this type of element.

Specified by:
getMinOccurs in class GrammarComplexType
Returns:
The minOccurs value

getName

public java.lang.String getName()
Description copied from class: GrammarComplexType
Gets the name of this complex type. Might be null if it is an anonymous complex type.

Specified by:
getName in class GrammarComplexType
Returns:
The name value

validate

public int validate(org.w3c.dom.Element el)
Description copied from class: GrammarComplexType
Validates the element in terms of its position in the structure of the document.

Specified by:
validate in class GrammarComplexType
Parameters:
el - The element to be validated for structure.
Returns:
The position of the first child that is not valid.

resetValidation

public void resetValidation(org.w3c.dom.Element el)
Specified by:
resetValidation in class GrammarComplexType

isEmptyType

public boolean isEmptyType()
Specified by:
isEmptyType in class GrammarComplexType

getXSElementDeclaration

public org.apache.xerces.xs.XSElementDeclaration getXSElementDeclaration()

isMixedType

public boolean isMixedType()
Specified by:
isMixedType in class GrammarComplexType

validate

protected int validate(java.lang.String[] candidateNodeNames)
Description copied from class: GrammarComplexType
Validates the candidate node names for their position in the structure.

Specified by:
validate in class GrammarComplexType
Parameters:
candidateNodeNames - Description of Parameter
Returns:
The position of the first child that is not valid.

validate

protected boolean validate(org.apache.xerces.xs.XSParticle particle,
                           java.util.Vector candidateNodeNames)

validate

protected boolean validate(org.apache.xerces.xs.XSParticle particle,
                           java.util.Vector candidateNodeNames,
                           int level)

whatCanGoHere

protected java.lang.String[] whatCanGoHere(java.lang.String[] currentChildElements,
                                           int insertPosition)
Description copied from class: GrammarComplexType
The possible elements that could be inserted at this position, given the current children.

Overrides:
whatCanGoHere in class GrammarComplexType
Parameters:
currentChildElements - The current children node names.
insertPosition - The zero-based position where a new child is to be inserted.
Returns:
The possible element node names, of which one may be chosen.

whatCanGoHere

protected boolean whatCanGoHere(org.apache.xerces.xs.XSParticle particle,
                                java.util.Vector candidateNodeNames,
                                java.util.Vector result,
                                int level)

getSchemaGrammarDocumentImpl

protected SchemaGrammarDocumentImpl getSchemaGrammarDocumentImpl()