Class SchemaNode

java.lang.Object
org.dlese.dpc.xml.schema.SchemaNode

public class SchemaNode extends Object
SchemaNode wraps a node in the Schema's instance document, and stores information about it such as whether the node is an attribute or element, if is required, and its xpath. SchemaNodes are stored in a SchemaNodeMap that is keyed by XPaths.
Author:
ostwald

$Id $

  • Constructor Details

    • SchemaNode

      public SchemaNode(org.dom4j.Element e, GlobalDef typeDef, String xpath, SchemaNodeMap schemaNodeMap)
      Constructor for the SchemaNode object used for Schema elements that refer to Global Elements, such as attributes and elements
      Parameters:
      e - schema element that refers to a global element
      typeDef - Description of the Parameter
      xpath - Description of the Parameter
      typeName - data type of the referred-to element
    • SchemaNode

      public SchemaNode(org.dom4j.Element e, GlobalDef typeDef, String xpath, SchemaNodeMap schemaNodeMap, GlobalDef validatingType)
      SchemaNode constructor used for schema elements defined as SimpleType or ComplexType types. From the element we can extract attributes such as occurrence information minOccurs and MaxOccurs. From the typeDef we can determine the validatingDataType (in the case of ComplexTypes with simpleContent or complexContent).
      Parameters:
      e - Description of the Parameter
      typeDef - Description of the Parameter
      xpath - Description of the Parameter
  • Method Details

    • assignAttributes

      public void assignAttributes(org.dom4j.Element donor)
      NOT USED!! Only override existing attributes if the particular attribute is explicitly defined in the donor element.
    • getDocumentation

      public String getDocumentation()
    • setDocumentation

      public void setDocumentation(String doc)
    • getMaxOccurs

      public int getMaxOccurs()
    • getMinOccurs

      public int getMinOccurs()
    • isUnbounded

      public boolean isUnbounded()
      Gets the unbounded attribute of the SchemaNode object
      Returns:
      The unbounded value
    • isReadOnly

      public boolean isReadOnly()
      Gets the readOnly attribute of the SchemaNode object
      Returns:
      The readOnly value
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Sets the readOnly attribute of the SchemaNode object
      Parameters:
      readOnly - The new readOnly value
    • getDocOrderIndex

      public int getDocOrderIndex()
    • setDocOrderIndex

      public void setDocOrderIndex(int i)
    • isNillable

      public boolean isNillable()
      Gets the nillable attribute of the SchemaNode object
      Returns:
      The nillable value
    • isAbstract

      public boolean isAbstract()
    • setIsAbstract

      public void setIsAbstract(boolean b)
    • getSubstitutionGroup

      public List getSubstitutionGroup()
    • isHeadElement

      public boolean isHeadElement()
      A "headElement" has a substitutionGroup of elements that may be substituted for it.
    • getSubstitutionElement

      public org.dom4j.Element getSubstitutionElement()
    • setSubstitutionElement

      public void setSubstitutionElement(org.dom4j.Element e)
      SubstitutionElement is the instance Element, complete with children, for this schemaNode. Since this is a substitution element, we don't want to recompute it. NOTE: why do individual schemaNodes have to store this element? why isn't it just stored ONCE (i.e., in the headElement?)
    • getHeadElementName

      public String getHeadElementName()
    • setHeadElementName

      public void setHeadElementName(String name)
    • setSubstitutionGroup

      public void setSubstitutionGroup(List sg)
      SubstitutionGroup is a list of GlobalElements
    • isSubstitutionGroupMember

      public boolean isSubstitutionGroupMember()
    • isRepeatingCompositorMember

      public boolean isRepeatingCompositorMember()
    • getParentCompositorMaxOccurs

      public int getParentCompositorMaxOccurs()
      Get the "maxOccurs" value of this SchemaNode's parent compositor.

      Return 1 if there is no parentCompositor - is this OK?

    • isCompositorSingleton

      public boolean isCompositorSingleton()
      Returns true if this SchemaNode is the only child of a compositor
    • isAttribute

      public boolean isAttribute()
      Gets the attribute attribute of the SchemaNode object
      Returns:
      The attribute value
    • isElement

      public boolean isElement()
      Gets the element attribute of the SchemaNode object
      Returns:
      The element value
    • isRequired

      public boolean isRequired()
      Gets the required attribute of the SchemaNode object
      Returns:
      The required value
    • getAttributeNames

      public List getAttributeNames()
      gets names of the attributes of the schema element (NOT the instance element!)
    • getAttr

      public String getAttr(String key)
      Gets the attr attribute of the SchemaNode object
      Parameters:
      key - Description of the Parameter
      Returns:
      The attr value
    • getProp

      public Object getProp(String key)
      Gets the attr attribute of the SchemaNode object
      Parameters:
      key - Description of the Parameter
      Returns:
      The attr value
    • getXpath

      public String getXpath()
      Gets the xpath for this SchemaNode in the context of the SchemaHelper.instanceDocument.
      Returns:
      The xpath value
    • getTypeDef

      public GlobalDef getTypeDef()
    • isDerivedModel

      public boolean isDerivedModel()
    • isDerivedTextOnlyModel

      public boolean isDerivedTextOnlyModel()
    • isDerivedContentModel

      public boolean isDerivedContentModel()
    • getValidatingType

      public GlobalDef getValidatingType()
      Gets the validatingTypeName attribute of the SchemaNode object. This is the name of the XSDatatype object that will be used to validate values for this node.
      Returns:
      The validatingTypeName value
    • hasCompositor

      public boolean hasCompositor()
    • isCompositorMember

      public boolean isCompositorMember()
    • hasChoiceCompositor

      public boolean hasChoiceCompositor()
    • hasSequenceCompositor

      public boolean hasSequenceCompositor()
    • hasSequenceCompositorSIMPLE

      public boolean hasSequenceCompositorSIMPLE()
    • hasSequenceCompositorEXPERIMENTAL

      public boolean hasSequenceCompositorEXPERIMENTAL()
      EXPERIMENTAL
    • getCompositor

      public Compositor getCompositor()
      Returns the compositor associated with this SchemaNode's typeDef, or null if the typeDef does not have a Compositor.
    • getParent

      public SchemaNode getParent()
    • isRecursive

      public boolean isRecursive()
    • getIsChoiceMember

      public boolean getIsChoiceMember()
    • getNodeType

      public short getNodeType()
      Gets the nodeType attribute of the SchemaNode object (corresponding to the type of XML node this schemaNode wraps). Value will be one of Node.ATTRIBUTE_NODE, Node.ELEMENT_NODE, or Node.UNKNOWN_NODE
      Returns:
      The nodeType value
    • toString

      public String toString()
      Produces string representation for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      Description of the Return Value
    • prtln

      public static void prtln(String s)
      Description of the Method
      Parameters:
      s - Description of the Parameter