DLESE Tools
v1.6.0

org.dlese.dpc.xml.schema
Class SchemaNode

java.lang.Object
  extended by 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 Summary
SchemaNode(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
SchemaNode(Element e, GlobalDef typeDef, String xpath, SchemaNodeMap schemaNodeMap, GlobalDef validatingType)
          SchemaNode constructor used for schema elements defined as SimpleType or ComplexType types.
 
Method Summary
 void assignAttributes(Element donor)
          NOT USED!! Only override existing attributes if the particular attribute is explicitly defined in the donor element.
 String getAttr(String key)
          Gets the attr attribute of the SchemaNode object
 List getAttributeNames()
          gets names of the attributes of the schema element (NOT the instance element!)
 Compositor getCompositor()
          Returns the compositor associated with this SchemaNode's typeDef, or null if the typeDef does not have a Compositor.
 int getDocOrderIndex()
           
 String getDocumentation()
           
 String getHeadElementName()
           
 boolean getIsChoiceMember()
           
 int getMaxOccurs()
           
 int getMinOccurs()
           
 short getNodeType()
          Gets the nodeType attribute of the SchemaNode object (corresponding to the type of XML node this schemaNode wraps).
 SchemaNode getParent()
           
 int getParentCompositorMaxOccurs()
          Get the "maxOccurs" value of this SchemaNode's parent compositor.
 Object getProp(String key)
          Gets the attr attribute of the SchemaNode object
 Element getSubstitutionElement()
           
 List getSubstitutionGroup()
           
 GlobalDef getTypeDef()
           
 GlobalDef getValidatingType()
          Gets the validatingTypeName attribute of the SchemaNode object.
 String getXpath()
          Gets the xpath for this SchemaNode in the context of the SchemaHelper.instanceDocument.
 boolean hasChoiceCompositor()
           
 boolean hasCompositor()
           
 boolean hasSequenceCompositor()
           
 boolean hasSequenceCompositorEXPERIMENTAL()
          EXPERIMENTAL
 boolean hasSequenceCompositorSIMPLE()
           
 boolean isAbstract()
           
 boolean isAttribute()
          Gets the attribute attribute of the SchemaNode object
 boolean isCompositorMember()
           
 boolean isCompositorSingleton()
          Returns true if this SchemaNode is the only child of a compositor
 boolean isDerivedContentModel()
           
 boolean isDerivedModel()
           
 boolean isDerivedTextOnlyModel()
           
 boolean isElement()
          Gets the element attribute of the SchemaNode object
 boolean isHeadElement()
          A "headElement" has a substitutionGroup of elements that may be substituted for it.
 boolean isNillable()
          Gets the nillable attribute of the SchemaNode object
 boolean isReadOnly()
          Gets the readOnly attribute of the SchemaNode object
 boolean isRecursive()
           
 boolean isRepeatingCompositorMember()
           
 boolean isRequired()
          Gets the required attribute of the SchemaNode object
 boolean isSubstitutionGroupMember()
           
 boolean isUnbounded()
          Gets the unbounded attribute of the SchemaNode object
static void prtln(String s)
          Description of the Method
 void setDocOrderIndex(int i)
           
 void setDocumentation(String doc)
           
 void setHeadElementName(String name)
           
 void setIsAbstract(boolean b)
           
 void setReadOnly(boolean readOnly)
          Sets the readOnly attribute of the SchemaNode object
 void setSubstitutionElement(Element e)
          SubstitutionElement is the instance Element, complete with children, for this schemaNode.
 void setSubstitutionGroup(List sg)
          SubstitutionGroup is a list of GlobalElements
 String toString()
          Produces string representation for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SchemaNode

public SchemaNode(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:
typeName - data type of the referred-to element
e - schema element that refers to a global element
xpath - Description of the Parameter
typeDef - Description of the Parameter

SchemaNode

public SchemaNode(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 Detail

assignAttributes

public void assignAttributes(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 Element getSubstitutionElement()

setSubstitutionElement

public void setSubstitutionElement(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

DLESE Tools
v1.6.0