com.opencms.template
Class CmsXmlXercesParser

java.lang.Object
  |
  +--com.opencms.template.CmsXmlXercesParser
All Implemented Interfaces:
I_CmsXmlParser

public class CmsXmlXercesParser
extends Object
implements I_CmsXmlParser

Implementation of the OpenCms XML parser interface for the Xerces parser.

Version:
$Revision: 1.20 $ $Date: 2003/01/31 17:03:19 $
Author:
Alexander Kandzior, Alexander Lucas

Field Summary
 
Fields inherited from interface com.opencms.template.I_CmsXmlParser
C_XML_LINE_WIDTH
 
Constructor Summary
CmsXmlXercesParser()
           
 
Method Summary
 Document createEmptyDocument(String docNod)
          Creates an empty DOM XML document.
 String getOriginalEncoding(Document doc)
           
 void getXmlText(Document doc, OutputStream out, String encoding)
          Calls a XML printer for converting a XML DOM document to a String.
 void getXmlText(Document doc, Writer out)
          Calls a XML printer for converting a XML DOM document to a String.
 void getXmlText(Document doc, Writer out, String encoding)
          Calls a XML printer for converting a XML DOM document to a String.
 Node importNode(Document doc, Node node)
          Used to import a node from a foreign document.
protected  Document parse(InputSource input)
          Common internal method to actually parse input.
 Document parse(InputStream in)
           
 Document parse(Reader in)
          Parses the given text with the Xerces parser.
 void serialize(Document doc, OutputStream in)
           
 String toString()
          Gets a description of the parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsXmlXercesParser

public CmsXmlXercesParser()
Method Detail

createEmptyDocument

public Document createEmptyDocument(String docNod)
                             throws Exception
Creates an empty DOM XML document. Workaround because the original method is not working as expected.

Specified by:
createEmptyDocument in interface I_CmsXmlParser
Parameters:
docNod - first Node in empty XML document
Returns:
Empty document.
Exception

getXmlText

public void getXmlText(Document doc,
                       OutputStream out,
                       String encoding)
Calls a XML printer for converting a XML DOM document to a String.

Specified by:
getXmlText in interface I_CmsXmlParser
Parameters:
doc - Document to be printed.
out - OutputStream to print to.
encoding - the character encoding to be used while serializing document, if null - original or default encoding will be used

getXmlText

public void getXmlText(Document doc,
                       Writer out,
                       String encoding)
Calls a XML printer for converting a XML DOM document to a String.

Specified by:
getXmlText in interface I_CmsXmlParser
Parameters:
doc - Document to be printed.
out - Writer to print to.
encoding - the character encoding to be used while serializing

getXmlText

public void getXmlText(Document doc,
                       Writer out)
Calls a XML printer for converting a XML DOM document to a String.

Specified by:
getXmlText in interface I_CmsXmlParser
Parameters:
doc - Document to be printed.
out - Writer to print to.

importNode

public Node importNode(Document doc,
                       Node node)
Used to import a node from a foreign document.

Specified by:
importNode in interface I_CmsXmlParser
Parameters:
doc - Destination document that should import the node.
node - Node to be imported.
Returns:
New node that belongs to the document doc

parse

public Document parse(Reader in)
               throws Exception
Parses the given text with the Xerces parser.

Specified by:
parse in interface I_CmsXmlParser
Parameters:
in - Reader with the input text.
Returns:
Parsed text as DOM document.
Throws:
Exception

parse

public Document parse(InputStream in)
               throws Exception
Specified by:
parse in interface I_CmsXmlParser
Exception

parse

protected Document parse(InputSource input)
                  throws Exception
Common internal method to actually parse input.

Exception

serialize

public void serialize(Document doc,
                      OutputStream in)
               throws Exception
Exception

toString

public String toString()
Gets a description of the parser.

Specified by:
toString in interface I_CmsXmlParser
Overrides:
toString in class Object
Returns:
Parser description.

getOriginalEncoding

public String getOriginalEncoding(Document doc)
Specified by:
getOriginalEncoding in interface I_CmsXmlParser