org.apache.cocoon.xml
Class XMLUtils

java.lang.Object
  |
  +--org.apache.cocoon.xml.XMLUtils

public class XMLUtils
extends java.lang.Object

XML utility methods.

Version:
CVS $Id: XMLUtils.java,v 1.6 2002/04/02 14:13:34 cziegeler Exp $
Author:
Nicola Ken Barozzi, Sylvain Wallez, Carsten Ziegeler

Constructor Summary
XMLUtils()
           
 
Method Summary
static java.util.Properties defaultSerializeToXMLFormat()
          This is the default properties set used to serialize xml.
static java.util.Properties defaultSerializeToXMLFormat(boolean omitXMLDeclaration)
          This is the default properties set used to serialize xml.
static XMLConsumer getConsumer(org.xml.sax.ContentHandler ch)
          Get an XMLConsumer from ContentHandler.
static XMLConsumer getConsumer(org.xml.sax.ContentHandler ch, org.xml.sax.ext.LexicalHandler lh)
          Get an XMLConsumer from a ContentHandler and a LexicalHandler.
static java.lang.String serializeNode(org.w3c.dom.Node node, java.util.Properties format)
          Serialize a DOM node to a String.
static java.lang.String serializeNodeToXML(org.w3c.dom.Node node)
          Serialize a DOM node to a String.
static void stripDuplicateAttributes(org.w3c.dom.Node node, org.w3c.dom.Node parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtils

public XMLUtils()
Method Detail

stripDuplicateAttributes

public static void stripDuplicateAttributes(org.w3c.dom.Node node,
                                            org.w3c.dom.Node parent)

getConsumer

public static XMLConsumer getConsumer(org.xml.sax.ContentHandler ch,
                                      org.xml.sax.ext.LexicalHandler lh)
Get an XMLConsumer from a ContentHandler and a LexicalHandler. If the content handler is already an XMLConsumer, it is returned as is, otherwise it is wrapped in an XMLConsumer with the lexical handler.
Parameters:
ch - the content handler, which should not be null
lh - the lexical handler, which can be null
Returns:
an XMLConsumer for ch an lh

getConsumer

public static XMLConsumer getConsumer(org.xml.sax.ContentHandler ch)
Get an XMLConsumer from ContentHandler. If the content handler is already an XMLConsumer, it is returned as is, otherwise it is wrapped in an XMLConsumer.
Parameters:
ch - the content handler, which should not be null
Returns:
an XMLConsumer for ch

serializeNodeToXML

public static java.lang.String serializeNodeToXML(org.w3c.dom.Node node)
                                           throws ProcessingException
Serialize a DOM node to a String. The defaultSerializeToXMLFormat() is used to format the serialized xml.

defaultSerializeToXMLFormat

public static java.util.Properties defaultSerializeToXMLFormat()
This is the default properties set used to serialize xml. It is used by the serializeNodeToXML() method. The format is as follows: Method: xml Encoding: ISO-8859-1 Omit xml declaration: no Indent: yes

defaultSerializeToXMLFormat

public static java.util.Properties defaultSerializeToXMLFormat(boolean omitXMLDeclaration)
This is the default properties set used to serialize xml. It is used by the serializeNodeToXML() method. The omit xml declaration property can be controlled by the flag. Method: xml Encoding: ISO-8859-1 Omit xml declaration: according to the flag Indent: yes

serializeNode

public static java.lang.String serializeNode(org.w3c.dom.Node node,
                                             java.util.Properties format)
                                      throws ProcessingException
Serialize a DOM node to a String. The format of the output can be specified with the properties. If the node is null the empty string is returned.


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.