com.japisoft.dtdparser.node
Class ElementDTDNode

java.lang.Object
  extended bycom.japisoft.dtdparser.node.DTDNode
      extended bycom.japisoft.dtdparser.node.ElementDTDNode
All Implemented Interfaces:
DocumentWritable
Direct Known Subclasses:
ElementRefDTDNode, ElementSetDTDNode

public class ElementDTDNode
extends DTDNode
implements DocumentWritable

Element definition

Version:
1.0
Author:
(c) 2002 - 2003 JAPISOFT

Field Summary
static int ONE_ITEM_OPERATOR
          default operator
static int ONE_MORE_ITEM_OPERATOR
          '+' operator
static int ZERO_MORE_ITEM_OPERATOR
          '*' operator
static int ZERO_ONE_ITEM_OPERATOR
          '?'
 
Fields inherited from class com.japisoft.dtdparser.node.DTDNode
ATTRIBUTE, COMMENT, ELEMENT, ELEMENT_REF, ELEMENT_SET, ENTITY, ROOT
 
Constructor Summary
ElementDTDNode()
           
ElementDTDNode(java.lang.String name)
          Build an Element node with the following name
 
Method Summary
 void addDTDNode(DTDNode node)
          Overriding for getting attribute node
 AttributeDTDNode getAttributeDeclaration(java.lang.String name)
           
 java.lang.String getName()
           
 int getOperator()
           
 java.lang.String getOperatorString()
           
 boolean hasANY()
          Can have any element children
 boolean hasPCDATA()
          PCDATA support for text content
 boolean isEMPTY()
           
 boolean isNodeChildSupported(java.lang.String nodeName, java.lang.String previousName, int occurrence)
           
 void setANY(boolean any)
          Can have any element children
 void setEMPTY(boolean empty)
          empty node : by default false
 void setName(java.lang.String name)
          Name of the element
 void setOperator(int op)
          Set the occurency operator : - ZERO_MORE_ITEM_OPERATOR, - ONE_MORE_ITEM_OPERATOR, - ZERO_ONE_ITEM_OPERATOR
 void setPCDATA(boolean pcdata)
          PCDATA support for text content
 java.lang.String toString()
           
 void writeDocument(java.io.PrintWriter output)
          Write a minimal valid XML document
 
Methods inherited from class com.japisoft.dtdparser.node.DTDNode
getDTDNodeAt, getDTDNodeCount, getDTDNodeForType, getDTDNodeIndex, getDTDNodes, getDTDParentNode, getNodeComment, getNodeType, getRoot, isAttribute, isComment, isElement, isElementRef, isElementSet, isEmpty, isEntity, isRoot, removeDTDNode, setDTDParentNode, setNodeComment, setNodeType, setRoot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE_ITEM_OPERATOR

public static final int ONE_ITEM_OPERATOR
default operator

See Also:
Constant Field Values

ZERO_ONE_ITEM_OPERATOR

public static final int ZERO_ONE_ITEM_OPERATOR
'?' operator

See Also:
Constant Field Values

ZERO_MORE_ITEM_OPERATOR

public static final int ZERO_MORE_ITEM_OPERATOR
'*' operator

See Also:
Constant Field Values

ONE_MORE_ITEM_OPERATOR

public static final int ONE_MORE_ITEM_OPERATOR
'+' operator

See Also:
Constant Field Values
Constructor Detail

ElementDTDNode

public ElementDTDNode()

ElementDTDNode

public ElementDTDNode(java.lang.String name)
Build an Element node with the following name

Method Detail

addDTDNode

public void addDTDNode(DTDNode node)
Overriding for getting attribute node

Overrides:
addDTDNode in class DTDNode

getAttributeDeclaration

public AttributeDTDNode getAttributeDeclaration(java.lang.String name)
Returns:
a DTD attribute declaration for the following name

setName

public void setName(java.lang.String name)
Name of the element


getName

public java.lang.String getName()
Returns:
the name of the element ( tag name )

setEMPTY

public void setEMPTY(boolean empty)
empty node : by default false


isEMPTY

public boolean isEMPTY()
Returns:
true if the node is empty

setOperator

public void setOperator(int op)
Set the occurency operator : - ZERO_MORE_ITEM_OPERATOR, - ONE_MORE_ITEM_OPERATOR, - ZERO_ONE_ITEM_OPERATOR


getOperatorString

public java.lang.String getOperatorString()
Returns:
"*", "+", "?" or ""

getOperator

public int getOperator()
Returns:
the occurency operator

setPCDATA

public void setPCDATA(boolean pcdata)
PCDATA support for text content


hasPCDATA

public boolean hasPCDATA()
PCDATA support for text content


setANY

public void setANY(boolean any)
Can have any element children


hasANY

public boolean hasANY()
Can have any element children


isNodeChildSupported

public boolean isNodeChildSupported(java.lang.String nodeName,
                                    java.lang.String previousName,
                                    int occurrence)
Returns:
true if the nodeName is supported as child, previousName is to check if the sequence if a good one, occurrence if for the child count

writeDocument

public void writeDocument(java.io.PrintWriter output)
                   throws java.io.IOException
Write a minimal valid XML document

Specified by:
writeDocument in interface DocumentWritable
Throws:
java.io.IOException

toString

public java.lang.String toString()