org.comedia.util.xml
Class CDefaultXmlElement

java.lang.Object
  |
  +--org.comedia.util.xml.CDefaultXmlElement
All Implemented Interfaces:
CXmlElement

public class CDefaultXmlElement
extends java.lang.Object
implements CXmlElement

Presents a default XML element which can contain strings or other XML elements. This class does not perform any XML validation.


Field Summary
protected  java.util.ArrayList childs
          The child element objects.
protected  java.util.Hashtable props
          The element properties.
protected  java.lang.String tagName
          The element tag name.
 
Constructor Summary
CDefaultXmlElement()
          Constructs this class with default properties.
CDefaultXmlElement(java.lang.String tagName)
          Constructs this class and assignes tag name.
 
Method Summary
 void clear()
          Clears the content of this element and restores an initial state.
 CXmlElement createChildElement(java.lang.String tagName)
          Creates a child element to this one.
protected  java.lang.String createIndent(int indent)
          Creates an indent string.
 void parseChildElements(CXmlScanner scanner)
          Parses child elements from input stream.
 void parseElement(CXmlScanner scanner)
          Parses this element from input stream.
 void writeChildElements(java.io.Writer out, int indent)
          Writes child elements of this element to output stream.
 void writeElement(java.io.Writer out, int indent)
          Writes this element from output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagName

protected java.lang.String tagName
The element tag name.

props

protected java.util.Hashtable props
The element properties.

childs

protected java.util.ArrayList childs
The child element objects.
Constructor Detail

CDefaultXmlElement

public CDefaultXmlElement()
Constructs this class with default properties.

CDefaultXmlElement

public CDefaultXmlElement(java.lang.String tagName)
Constructs this class and assignes tag name.
Parameters:
tagName - a name of element tag.
Method Detail

clear

public void clear()
Clears the content of this element and restores an initial state.
Specified by:
clear in interface CXmlElement

parseElement

public void parseElement(CXmlScanner scanner)
                  throws CXmlException
Parses this element from input stream.
Specified by:
parseElement in interface CXmlElement
Parameters:
scanner - lexical scanner to parse XML.

parseChildElements

public void parseChildElements(CXmlScanner scanner)
                        throws CXmlException
Parses child elements from input stream.
Specified by:
parseChildElements in interface CXmlElement
Parameters:
scanner - lexical scanner to parse XML.

createIndent

protected java.lang.String createIndent(int indent)
Creates an indent string.
Parameters:
indent - number of white spaces in the indent.

writeElement

public void writeElement(java.io.Writer out,
                         int indent)
                  throws java.io.IOException
Writes this element from output stream.
Specified by:
writeElement in interface CXmlElement
Parameters:
output - stream to write this element and all contents.
indent - number of indent spaces.

writeChildElements

public void writeChildElements(java.io.Writer out,
                               int indent)
                        throws java.io.IOException
Writes child elements of this element to output stream.
Specified by:
writeChildElements in interface CXmlElement
Parameters:
output - stream to write child elemens.
indent - number of indent spaces.

createChildElement

public CXmlElement createChildElement(java.lang.String tagName)
Creates a child element to this one.
Specified by:
createChildElement in interface CXmlElement
Parameters:
tagName - a name of element tag.