oracle.xml.classgen
Class CGNode

java.lang.Object
  |
  +--oracle.xml.classgen.CGNode
Direct Known Subclasses:
CGDocument

public abstract class CGNode
extends java.lang.Object
implements CXMLConstants

Serves as the base class for nodes generated by the DTD compiler


Field Summary
TypeField
protected  boolean isValidating
           
 
Fields inherited from interface oracle.xml.comp.CXMLConstants
ATTR_DEF, ATTR_TOKEN, ATTRDECL_DEF, CDATA_DEF, CHAR_DEF, COMMENT_DEF, CXML_VERSION, cXMLFILE, cXMLFILE_LEN, DEBUG, DTD_DEF, ELEMENTDECL_DEF, END, ENTITY_DEF, ENTITYREF_DEF, META_ID_MAX, names, NOTATION_DEF, NS_DEF, NULLSTR, PI_DEF, PREFIX_DEF, TAG_DEF, TAG_TOKEN, TOKEN_ONLY, XMLDECL_DEF
 
Constructor Summary
TypeConstructor
protected CGNode(java.lang.String elementName)
          Constructor for the Elements of the DOM Tree
 
Method Summary
TypeMethod
protected  void addCDATASection(java.lang.String theData)
          Adds CDATA Section to the Element
protected  void addData(java.lang.String theData)
          Adds PCDATA to the XMLElement theElement
protected  void addNode(CGNode theNode)
          Adds a node as a child to the element
protected  void deleteData(java.lang.String theData)
          Deletes PCDATA from the XMLElement theElement
protected  java.lang.String getAttribute(java.lang.String attName)
          Gets the value of the Attribute
protected  CGDocument getCGDocument()
          Gets the base document (root Element)
protected  java.lang.String getData()
          Gets the PCDATA of the Element
protected abstract  DTD getDTDNode()
          Gets the static DTD from the base document
protected  XMLElement getElementNode()
          Get the XMLElement node corresponding to this CGNode.
protected  java.lang.Object getNode(java.lang.String theNode)
          Gets the CGNode which is one of the children of the element 'theElemnt' corresponding to this node whose name matches the input string.
protected  void readExternal(oracle.xml.io.XMLObjectInput in, oracle.xml.comp.CXMLContext cxmlContext)
          Reads the compressed stream and instantiate the corresponding node
protected  void setAttribute(java.lang.String attName, java.lang.String value)
          Sets the value of the Attribute
 void setDocument(CGDocument d)
          Sets the base document (root Element)
protected  void setElementNode(XMLElement node)
          Set the XMLElement node corresponding to this CGNode.
protected  void storeID(java.lang.String attName, java.lang.String id)
          Store this value for an ID identifier, so that we can later verify IDREF values
protected  void storeIDREF(java.lang.String attName, java.lang.String idref)
          Store this value for an IDREF identifier, so that we can later verify, if an corresponding ID was defined.
protected  void validateContent()
          Checks if the content of the element is valid as per the Content Model specified in DTD
protected  boolean validEntity(java.lang.String entity)
          Checks if the ENTITY identifier is valid
protected  boolean validID(java.lang.String name)
          Checks if the ID identifier is valid
protected  boolean validNMTOKEN(java.lang.String name)
          Checks if the NMTOKEN identifier is valid
protected  void writeExternal(oracle.xml.io.XMLObjectOutput out, oracle.xml.comp.CXMLContext cxmlContext)
          Writes the compressed stream corresponding to this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isValidating

protected boolean isValidating
Constructor Detail

CGNode

protected CGNode(java.lang.String elementName)
Constructor for the Elements of the DOM Tree
Parameters:
elementName - Name of the element
Method Detail

setElementNode

protected void setElementNode(XMLElement node)
Set the XMLElement node corresponding to this CGNode.
Parameters:
node - The XMLElement

getElementNode

protected XMLElement getElementNode()
Get the XMLElement node corresponding to this CGNode.

addData

protected void addData(java.lang.String theData)
                throws InvalidContentException
Adds PCDATA to the XMLElement theElement
Parameters:
theData - Text to be added to the element
Throws:
InvalidContentException - Thrown if theData has illegal characters (validation must be set to TRUE)
See Also:
DTDClassGenerator.setValidationMode(boolean)

deleteData

protected void deleteData(java.lang.String theData)
                   throws InvalidContentException
Deletes PCDATA from the XMLElement theElement
Parameters:
theData - Text to be deleted from an element
Throws:
InvalidContetnException - Thrown if theData is not present in the Element

getData

protected java.lang.String getData()
                            throws InvalidContentException
Gets the PCDATA of the Element
Throws:
InvalidContentException - Thrown if the data is not present.

addCDATASection

protected void addCDATASection(java.lang.String theData)
                        throws InvalidContentException
Adds CDATA Section to the Element
Parameters:
theData - Text to be added as CDATA Section to the element
Throws:
InvalidContentException - Thrown if theData has illegal characters (validation must be set to TRUE)
See Also:
DTDClassGenerator.setValidationMode(boolean)

addNode

protected void addNode(CGNode theNode)
                throws InvalidContentException
Adds a node as a child to the element
Parameters:
theNode - The node to be added as child
Throws:
InvalidContentException - Thrown if the Node cannot be added as child as per Content Model of the element (validation must be set to TRUE)
See Also:
DTDClassGenerator.setValidationMode(boolean)

getNode

protected java.lang.Object getNode(java.lang.String theNode)
                            throws InvalidContentException
Gets the CGNode which is one of the children of the element 'theElemnt' corresponding to this node whose name matches the input string.
Parameters:
theNode - The name of the string corresponding to which the CGNode is returned

setDocument

public void setDocument(CGDocument d)
Sets the base document (root Element)
Parameters:
d - Base CGDocument

getCGDocument

protected CGDocument getCGDocument()
Gets the base document (root Element)
Returns:
The base CGDocument

getDTDNode

protected abstract DTD getDTDNode()
Gets the static DTD from the base document
Returns:
DTD stored in base CGDocument

setAttribute

protected void setAttribute(java.lang.String attName,
                            java.lang.String value)
Sets the value of the Attribute
Parameters:
attName - Name of the attribute
value - Value of the attribute

getAttribute

protected java.lang.String getAttribute(java.lang.String attName)
Gets the value of the Attribute
Parameters:
attName - Name of the attribute
Returns:
value Value of the attribute

storeID

protected void storeID(java.lang.String attName,
                       java.lang.String id)
Store this value for an ID identifier, so that we can later verify IDREF values
Parameters:
attName - Name of the ID Attribute
id - Value of the ID

storeIDREF

protected void storeIDREF(java.lang.String attName,
                          java.lang.String idref)
Store this value for an IDREF identifier, so that we can later verify, if an corresponding ID was defined.
Parameters:
attName - Name of the IDREF Attribute
idref - Value of the IDREF

validID

protected boolean validID(java.lang.String name)
Checks if the ID identifier is valid
Parameters:
name - value of the ID Attribute
Returns:
True if ID is valid, else false

validEntity

protected boolean validEntity(java.lang.String entity)
Checks if the ENTITY identifier is valid
Parameters:
name - value of the Entity Attribute
Returns:
True if Entity is valid, else false

validNMTOKEN

protected boolean validNMTOKEN(java.lang.String name)
Checks if the NMTOKEN identifier is valid
Parameters:
name - value of the Nmtoken Attribute
Returns:
True if Nmtoken is valid, else false

validateContent

protected void validateContent()
                        throws InvalidContentException
Checks if the content of the element is valid as per the Content Model specified in DTD
Returns:
True if content is valid, else false

writeExternal

protected void writeExternal(oracle.xml.io.XMLObjectOutput out,
                             oracle.xml.comp.CXMLContext cxmlContext)
                      throws java.io.IOException
Writes the compressed stream corresponding to this node.
Parameters:
out - ObjectOutput stream to write the compressed data
cxmlContext - The context of the compressed stream

readExternal

protected void readExternal(oracle.xml.io.XMLObjectInput in,
                            oracle.xml.comp.CXMLContext cxmlContext)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Reads the compressed stream and instantiate the corresponding node
Parameters:
in - The ObjectInput stream that is used to read the compressed stream.
cxmlContext - The context of the compresses stream
Throws:
java.io.IOException - thrown when there an IO Error occur
java.lang.ClassNotFoundException - is thrown when the corresponding class could not be instantiated.