electric.xml
Class Child

java.lang.Object
  extended byelectric.xml.Node
      extended byelectric.xml.Child
All Implemented Interfaces:
java.lang.Cloneable, IDOMConstants, IXMLConstants, org.w3c.dom.Node, java.io.Serializable
Direct Known Subclasses:
AttlistDecl, CharacterData, ElementDecl, EntityDecl, Instruction, NotationDecl, Parent

public abstract class Child
extends Node
implements java.lang.Cloneable

Child is the abstract root of all nodes that have a parent, and includes method for adding/inserting siblings

Author:
webMethods
See Also:
Serialized Form

Field Summary
protected  Parent parent
           
 
Fields inherited from class electric.xml.Node
list, next, prev
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface electric.xml.IXMLConstants
ATTLIST_START, ATTLIST_STOP, CDATA, CDATA_START, CDATA_STOP, CLOSE_TAG, COLON, COMMENT_START, COMMENT_STOP, DOCTYPE_START, DOCTYPE_STOP, ELEMENTDECL_START, ELEMENTDECL_STOP, ENCODING, ENTITYDECL_START, ENTITYDECL_STOP, ID, ID_CASE, INSTRUCTION_START, INSTRUCTION_STOP, NEGATIVE_INFINITY, NOT_A_NUMBER, NOTATIONDECL_START, NOTATIONDECL_STOP, NULL, OPEN_TAG, POSITIVE_INFINITY, PUBLIC, SPECIALS, STANDALONE, SUBSTITUTES, SYSTEM, UNDEFINED, VERSION, XML, XML_NAMESPACE, XMLDECL_START, XMLDECL_STOP, XMLNS, XMLNS_NAMESPACE
 
Fields inherited from interface electric.xml.IDOMConstants
CDATA_SECTION_NAME, COMMENT_NAME, CORE, DOCUMENT_FRAGMENT_NAME, DOCUMENT_NAME, HIERARCHY_REQUEST_ERR, TEXT_NAME
 
Constructor Summary
protected Child()
          Construct a Child with no parent.
  Child(Parent parent)
          Construct a Child with the specified parent.
 
Method Summary
abstract  java.lang.Object clone()
          Return a clone of this Node.
 org.w3c.dom.Node cloneNode(boolean deep)
          Return a duplicate of this node, i.e., serve as a generic copy constructor for nodes.
 ByteArray getByteArray()
          Write myself with no indentation to a ByteArray and return the ByteArray.
 ByteArray getByteArray(boolean expandEmptyElements)
          Write myself with no indentation to a ByteArray and return the ByteArray.
 ByteArray getByteArray(NodeWriter nodeWriter)
           
 byte[] getBytes()
          Write myself with no indentation to a byte array and then return the byte array.
 byte[] getBytes(boolean expandEmptyElements)
          Write myself with no indentation to a byte array and then return the byte array.
 byte[] getBytes(java.lang.String xmlString)
           
 Document getDocument()
          Return my parent's document, or null if I have no parent.
 Child getNextSiblingChild()
          Return my next sibling, or null if I have none.
 org.w3c.dom.Document getOwnerDocument()
          Return the Document object associated with this node.
 Parent getParent()
          Return my parent.
 org.w3c.dom.Node getParentNode()
          Return the parent of this node.
 Child getPreviousSiblingChild()
          Return my previous sibling, or null if I have none.
 Element getRoot()
          Return my parent's root, or null if I have no parent.
 void replaceWith(Child child)
          Replace myself with the specified Child.
 Child setNextSiblingChild(Child child)
          Set my next sibling to be the specified child.
 void setParent(Parent parent)
          Set my parent.
 Child setPreviousSiblingChild(Child child)
          Set my previous sibling to be the specified child.
 java.lang.String toString()
          Write myself to a String, starting with indent level 0, and then return the String.
 java.lang.String toString(int indent)
          Write myself to a String, starting at the specified indent level, and then return the String.
 void write(java.io.File file)
          Write myself, starting at indent level 0, to the specified File.
 void write(java.io.OutputStream stream)
          Write myself, starting at indent level 0, to the specified OutputStream.
 void write(java.io.Writer writer)
          Write myself, starting at indent level 0, to the specified Writer.
 
Methods inherited from class electric.xml.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNextSiblingNode, getNode, getNode, getNodeName, getNodes, getNodeType, getNodeValue, getPrefix, getPreviousSibling, getPreviousSiblingNode, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, read, remove, removeChild, replaceChild, setNextSiblingNode, setNodeValue, setPrefix, setPreviousSiblingNode, size, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected Parent parent
Constructor Detail

Child

protected Child()
Construct a Child with no parent.


Child

public Child(Parent parent)
Construct a Child with the specified parent.

Parameters:
parent - The parent.
Method Detail

toString

public java.lang.String toString()
Write myself to a String, starting with indent level 0, and then return the String.


toString

public java.lang.String toString(int indent)
Write myself to a String, starting at the specified indent level, and then return the String. If the indent level is -1, no indentation will occur, otherwise the indent level increases by two at each child node.

Parameters:
indent - The initial indent level.

clone

public abstract java.lang.Object clone()
Return a clone of this Node.


setParent

public void setParent(Parent parent)
Set my parent.

Parameters:
parent - The new parent value.

getParent

public Parent getParent()
Return my parent.


replaceWith

public void replaceWith(Child child)
Replace myself with the specified Child.

Parameters:
child - The Child.

getNextSiblingChild

public Child getNextSiblingChild()
Return my next sibling, or null if I have none.


setNextSiblingChild

public Child setNextSiblingChild(Child child)
Set my next sibling to be the specified child. If the child was already in a document, remove it first.

Parameters:
child - The child to add
Returns:
Myself, to allow cascading.

getPreviousSiblingChild

public Child getPreviousSiblingChild()
Return my previous sibling, or null if I have none.


setPreviousSiblingChild

public Child setPreviousSiblingChild(Child child)
Set my previous sibling to be the specified child. If the child was already in a document, remove it first.

Parameters:
child - The child to add
Returns:
Myself, to allow cascading.

getDocument

public Document getDocument()
Return my parent's document, or null if I have no parent.


getRoot

public Element getRoot()
Return my parent's root, or null if I have no parent.


write

public void write(java.io.Writer writer)
           throws java.io.IOException
Write myself, starting at indent level 0, to the specified Writer.

Parameters:
writer - The Writer.
Throws:
java.io.IOException - If an I/O exception occurs.

write

public void write(java.io.File file)
           throws java.io.IOException
Write myself, starting at indent level 0, to the specified File. The File is written in either UTF-8 or UTF-16 format, depending on the encoding style of the document.

Parameters:
file - The File to write to.
Throws:
java.io.IOException - If an I/O exception occurs.

write

public void write(java.io.OutputStream stream)
           throws java.io.IOException
Write myself, starting at indent level 0, to the specified OutputStream. The stream is written in either UTF-8 or UTF-16 format, depending on the encoding style of the document.

Parameters:
stream - The OutputStream to write to.
Throws:
java.io.IOException - If an I/O exception occurs.

getByteArray

public ByteArray getByteArray()
                       throws java.io.UnsupportedEncodingException
Write myself with no indentation to a ByteArray and return the ByteArray. The format of the bytes depends on the encoding style of the document.

Throws:
java.io.UnsupportedEncodingException

getByteArray

public ByteArray getByteArray(boolean expandEmptyElements)
                       throws java.io.UnsupportedEncodingException
Write myself with no indentation to a ByteArray and return the ByteArray. The format of the bytes depends on the encoding style of the document.

Parameters:
expandEmptyElements - Expand empty elements?
Throws:
java.io.UnsupportedEncodingException

getByteArray

public ByteArray getByteArray(NodeWriter nodeWriter)
                       throws java.io.UnsupportedEncodingException
Parameters:
nodeWriter - The NodeWriter.
Throws:
java.io.UnsupportedEncodingException

getBytes

public byte[] getBytes(java.lang.String xmlString)
                throws java.io.UnsupportedEncodingException
Parameters:
xmlString -
Throws:
java.io.UnsupportedEncodingException

getBytes

public byte[] getBytes()
                throws java.io.UnsupportedEncodingException
Write myself with no indentation to a byte array and then return the byte array. The format of the bytes depends on the encoding style of the document.

Throws:
java.io.UnsupportedEncodingException

getBytes

public byte[] getBytes(boolean expandEmptyElements)
                throws java.io.UnsupportedEncodingException
Write myself with no indentation to a byte array and then return the byte array. The format of the bytes depends on the encoding style of the document.

Parameters:
expandEmptyElements - Expand empty elements?
Throws:
java.io.UnsupportedEncodingException

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Return a duplicate of this node, i.e., serve as a generic copy constructor for nodes. The duplicate node has no parent; ( parentNode is null.). Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning an Attribute directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute (specified is true). Cloning any other type of node simply returns a copy of this node. Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly. In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in class Node
Parameters:
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Return the Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

Specified by:
getOwnerDocument in interface org.w3c.dom.Node
Overrides:
getOwnerDocument in class Node

getParentNode

public org.w3c.dom.Node getParentNode()
Return the parent of this node. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.

Specified by:
getParentNode in interface org.w3c.dom.Node
Overrides:
getParentNode in class Node


copyright© 2001-2004 by webMethods All Rights Reserved.