Class com.ibm.xml.parser.ElementDecl
java.lang.Object
|
+----com.ibm.xml.parser.Child
|
+----com.ibm.xml.parser.ElementDecl
- Subclasses:
- TreeFactory.TreeElementDecl
- public class ElementDecl
- extends Child
- implements ElementDefinition
The ElementDecl class implements the ElementDefinition interface as defined by the Document Object Model (DOM).
Element declarations in the DTD determine the possible structure of the XML document.
The following structures, known as content models, are supported for element declaration:
- EMPTY
- This Element can not have any content, and must appear as an empty Element in the
XML document. For example, the EMPTY element declaration
<!ELEMENT graphic EMPTY>
would have the Element tag <graphic/>
appear in the XML document.
- ANY
- This Element can have any combination of character data and element types allow by
the DTD.
- #PCDATA
- This Element must only contain character data. For example, the #PCDATA
element declaration
<!ELEMENT text (#PCDATA)>
could have the Element
tag <text>a group of character data</text>
appear in the XML document.
- MODEL_GROUP
- This Element allows a mixture of #PCDATA and other Elements as their children.
The following language primitives are used to help express this relationship:
- ( and )
- Surround a sequence of alternatives
- ,
- Separates each Element type in a sequence
- |
- Separates each Element type in a list of alternatives
- ? and *
- Indicates that an Element or group occurs zero or more times
- +
- Indicates that an Element or group occurs one or more times
To illustrate this point, the element declaration
<!ELEMENT memo (from, to+, cc*, date?, content)>
could have the Element
tag <memo> <from>me</from> <to>you</to> <to>and you</to> <content>hello world</content> </memo>
appear in the XML document.
- Version:
- Revision: 96 1.6 src/com/ibm/xml/parser/ElementDecl.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
- See Also:
- ElementDefinition, Child
Method Summary
|
void
|
acceptPost(Visitor visitor)
Implements the accept operation of the visitor design pattern when the end of
an ElementDecl Node is recognized when traversing the document object tree.
|
void
|
acceptPre(Visitor visitor)
Implements the accept operation of the visitor design pattern when the start of
an ElementDecl Node is recognized when traversing the document object tree.
|
java.lang.Object
|
clone()
Clone this element definition Node using the appropriate factory.
|
Node
|
getAttributeDefinitions()
Returns the attribute list that was defined by this element definition.
|
ModelGroup
|
getContentModel()
Returns the content model used by this element definition.
|
int
|
getContentType()
Returns the content type which represents the content model used by this element definition.
|
Node
|
getExceptions()
This method is only meaningful for HTML documents, and not for XML documents.
Deprecated |
Node
|
getInclusions()
This method is only meaningful for HTML documents, and not for XML documents.
Deprecated |
java.lang.String
|
getName()
Returns this element definition's name.
|
int
|
getNodeType()
Returns that this object is an element definition Node.
|
void
|
setAttributeDefinitions(Node attList)
Sets the attribute list that was defined by this element definition.
|
void
|
setContentModel(ModelGroup contentModel)
Sets the content model used by this element definition.
|
void
|
setContentType(int contentType)
Sets the content type which represents the content model used by this element definition.
|
void
|
setExceptions(Node exception)
This method is only meaningful for HTML documents, and not for XML documents.
Deprecated |
void
|
setInclusions(Node inclusion)
This method is only meaningful for HTML documents, and not for XML documents.
Deprecated |
void
|
setName(java.lang.String name)
Sets this element definition's name.
|
Methods inherited from class com.ibm.xml.parser.Child
|
clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toXMLString, toXMLString |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ElementDecl
public ElementDecl(java.lang.String name,
ContentModel contentModel)
- Constructor.
- Parameters:
name
- This element definition's name.
contentModel
- The content model to associate with this element definition,
or null if the content model is to be set later.
clone
public java.lang.Object clone()
- Clone this element definition Node using the appropriate factory.
This method is defined by Child.
- Returns:
- Cloned element definition Node.
- Overrides:
- clone in class Child
- See Also:
- clone
getNodeType
public int getNodeType()
- Returns that this object is an element definition Node.
This method is defined by DOM.
- Returns:
- Element definition Node indicator.
getName
public java.lang.String getName()
- Returns this element definition's name.
This method is defined by DOM.
- Implements:
- getName in interface ElementDefinition
- Returns:
- The string that is this Element's name, or null if no name.
- See Also:
- setName
setName
public void setName(java.lang.String name)
- Sets this element definition's name.
This method is defined by DOM.
- Implements:
- setName in interface ElementDefinition
- Parameters:
name
- The string that is this element definition's name.
- See Also:
- getName
getContentType
public int getContentType()
- Returns the content type which represents the content model used by this element definition.
This method is defined by DOM.
- Implements:
- getContentType in interface ElementDefinition
- Returns:
- The content type for this element's definition, or null if
no content type has been defined.
Must be one of org.w3c.dom.ElementDefinition#ContentType.
Note that the XML4J parser will never set
PCDATA
as the
content type; MODEL_GROUP
will be set instead. - See Also:
- setContentType, getContentModel
setContentType
public void setContentType(int contentType)
- Sets the content type which represents the content model used by this element definition.
This method is defined by DOM.
- Implements:
- setContentType in interface ElementDefinition
- Parameters:
contentType
- The content type for this element's definition.
Must be one of org.w3c.dom.ElementDefinition#ContentType.
- See Also:
- getContentType, setContentModel
getContentModel
public ModelGroup getContentModel()
- Returns the content model used by this element definition. The returned value is
only meaningful if this element definition's content type is
MODEL_GROUP
.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getContentModel in interface ElementDefinition
- Returns:
- The content model for this element's definition, or null if
no content model has been defined.
- See Also:
- getContentType, setContentModel
setContentModel
public void setContentModel(ModelGroup contentModel)
- Sets the content model used by this element definition. The specified contentModel is
only meaningful if this element definition's content type is
MODEL_GROUP
.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setContentModel in interface ElementDefinition
- Parameters:
contentModel
- The content model for this element's definition.
- See Also:
- setContentType, getContentModel
getAttributeDefinitions
public Node getAttributeDefinitions()
- Returns the attribute list that was defined by this element definition.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- getAttributeDefinitions in interface ElementDefinition
- Returns:
- The Node that defines the attribute list for this element definition,
or null if no attributes defined.
- See Also:
- elements, setAttributeDefinitions
setAttributeDefinitions
public void setAttributeDefinitions(Node attList)
- Sets the attribute list that was defined by this element definition.
This method is defined by DOM.
This method is CURRENTLY NOT IMPLEMENTED.
- Implements:
- setAttributeDefinitions in interface ElementDefinition
- Parameters:
attList
- The Node that defines the attribute list for this element definition.
- See Also:
- addElement, getAttributeDefinitions
getInclusions
public Node getInclusions()
- Note: getInclusions() is deprecated.This method will not be implemented in XML4J.
- This method is only meaningful for HTML documents, and not for XML documents.
This method is defined by DOM.
- Implements:
- getInclusions in interface ElementDefinition
- Returns:
- Always returns null.
- See Also:
- setInclusions
setInclusions
public void setInclusions(Node inclusion)
- Note: setInclusions() is deprecated.This method will not be implemented in XML4J.
- This method is only meaningful for HTML documents, and not for XML documents.
This method is defined by DOM.
- Implements:
- setInclusions in interface ElementDefinition
- See Also:
- getInclusions
getExceptions
public Node getExceptions()
- Note: getExceptions() is deprecated.This method will not be implemented in XML4J.
- This method is only meaningful for HTML documents, and not for XML documents.
This method is defined by DOM.
- Implements:
- getExceptions in interface ElementDefinition
- Returns:
- Always returns null.
- See Also:
- setExceptions
setExceptions
public void setExceptions(Node exception)
- Note: setExceptions() is deprecated.This method will not be implemented in XML4J.
- This method is only meaningful for HTML documents, and not for XML documents.
This method is defined by DOM.
- Implements:
- setExceptions in interface ElementDefinition
- See Also:
- getExceptions
acceptPre
public void acceptPre(Visitor visitor) throws java.lang.Exception
- Implements the accept operation of the visitor design pattern when the start of
an ElementDecl Node is recognized when traversing the document object tree.
- Parameters:
visitor
- The implemention of the Visitor operation (toXMLString, digest, ...)
- Throws:
- java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
- See Also:
- Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException
acceptPost
public void acceptPost(Visitor visitor) throws java.lang.Exception
- Implements the accept operation of the visitor design pattern when the end of
an ElementDecl Node is recognized when traversing the document object tree.
- Parameters:
visitor
- The implemention of the Visitor operation (toXMLString, digest, ...)
- Throws:
- java.lang.Exception - Thrown if this Node can not be visitted, or traversal modification is requested.
- See Also:
- Visitor, TreeTraversal, NonRecursivePreorderTreeTraversal, TreeTraversalException