Package org.dlese.dpc.xml.schema
Class SchemaNode
java.lang.Object
org.dlese.dpc.xml.schema.SchemaNode
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
ConstructorsConstructorDescriptionSchemaNode(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 elementsSchemaNode(org.dom4j.Element e, GlobalDef typeDef, String xpath, SchemaNodeMap schemaNodeMap, GlobalDef validatingType) SchemaNode constructor used for schema elements defined as SimpleType or ComplexType types. -
Method Summary
Modifier and TypeMethodDescriptionvoidassignAttributes(org.dom4j.Element donor) NOT USED!! Only override existing attributes if the particular attribute is explicitly defined in the donor element.Gets the attr attribute of the SchemaNode objectgets names of the attributes of the schema element (NOT the instance element!)Returns the compositor associated with this SchemaNode's typeDef, or null if the typeDef does not have a Compositor.intbooleanintintshortGets the nodeType attribute of the SchemaNode object (corresponding to the type of XML node this schemaNode wraps).intGet the "maxOccurs" value of this SchemaNode's parent compositor.Gets the attr attribute of the SchemaNode objectorg.dom4j.ElementGets the validatingTypeName attribute of the SchemaNode object.getXpath()Gets the xpath for this SchemaNode in the context of the SchemaHelper.instanceDocument.booleanbooleanbooleanbooleanEXPERIMENTALbooleanbooleanbooleanGets the attribute attribute of the SchemaNode objectbooleanbooleanReturns true if this SchemaNode is the only child of a compositorbooleanbooleanbooleanbooleanGets the element attribute of the SchemaNode objectbooleanA "headElement" has a substitutionGroup of elements that may be substituted for it.booleanGets the nillable attribute of the SchemaNode objectbooleanGets the readOnly attribute of the SchemaNode objectbooleanbooleanbooleanGets the required attribute of the SchemaNode objectbooleanbooleanGets the unbounded attribute of the SchemaNode objectstatic voidDescription of the MethodvoidsetDocOrderIndex(int i) voidsetDocumentation(String doc) voidsetHeadElementName(String name) voidsetIsAbstract(boolean b) voidsetReadOnly(boolean readOnly) Sets the readOnly attribute of the SchemaNode objectvoidsetSubstitutionElement(org.dom4j.Element e) SubstitutionElement is the instance Element, complete with children, for this schemaNode.voidSubstitutionGroup is a list of GlobalElementstoString()Produces string representation for debugging purposes.
-
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 elementtypeDef- Description of the Parameterxpath- Description of the ParametertypeName- 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 ParametertypeDef- Description of the Parameterxpath- 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
-
setDocumentation
-
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
-
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
-
setHeadElementName
-
setSubstitutionGroup
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
gets names of the attributes of the schema element (NOT the instance element!) -
getAttr
Gets the attr attribute of the SchemaNode object- Parameters:
key- Description of the Parameter- Returns:
- The attr value
-
getProp
Gets the attr attribute of the SchemaNode object- Parameters:
key- Description of the Parameter- Returns:
- The attr value
-
getXpath
Gets the xpath for this SchemaNode in the context of the SchemaHelper.instanceDocument.- Returns:
- The xpath value
-
getTypeDef
-
isDerivedModel
public boolean isDerivedModel() -
isDerivedTextOnlyModel
public boolean isDerivedTextOnlyModel() -
isDerivedContentModel
public boolean isDerivedContentModel() -
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
Returns the compositor associated with this SchemaNode's typeDef, or null if the typeDef does not have a Compositor. -
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
Produces string representation for debugging purposes. -
prtln
Description of the Method- Parameters:
s- Description of the Parameter
-