WebLogic Integration


com.bea.document
Class XMLUtils

java.lang.Object
  |
  +--com.bea.document.XMLUtils

public class XMLUtils
extends java.lang.Object

The XMLUtils class contains utility methods used to work with XML documents.

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
XMLUtils()
           
 
Method Summary
static java.lang.String decodeXML(java.lang.String encoded)
          Decode XML markup characters (< > & " ' &#;).
static java.lang.String encodeXML(java.lang.String s)
          Encode XML markup characters (< > & " ').
static java.lang.String encodeXML(java.lang.String s, boolean canonical)
          Encode XML markup characters (< > & " ').
static boolean isTextEmpty(org.w3c.dom.Text text)
          Test if a Text node is empty (contains only whitespace)
static void serializeXML(org.w3c.dom.Document document, java.io.Writer writer)
          Serialize (write to storage) a W3C DOM Document
static void serializeXML(org.w3c.dom.Document document, java.io.Writer writer, java.lang.String encoding)
          Serialize (write to storage) a W3C DOM Document
static void serializeXMLNode(java.io.Writer writer, int indent, org.w3c.dom.Node node)
          Serializes (write to storage) an XML node and its descendents.
static java.lang.String translateXMLString(java.lang.String value)
          Deprecated. superceded by encodeXML().
static java.lang.String XMLtoString(org.w3c.dom.Document document)
          Serialize (write to storage) a W3C DOM Document.
 
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

decodeXML

public static java.lang.String decodeXML(java.lang.String encoded)
Decode XML markup characters (< > & " ' &#;).

Parameters:
encoded - - The encoded XML document.
Returns:
A decoded XML document.

encodeXML

public static java.lang.String encodeXML(java.lang.String s)
Encode XML markup characters (< > & " ').

Parameters:
s - - The XML document to encode.
Returns:
A encoded XML document.

encodeXML

public static java.lang.String encodeXML(java.lang.String s,
                                         boolean canonical)
Encode XML markup characters (< > & " ').

Parameters:
s - - The XML document to encode.
canonical - - If true \n and \r are encoded as &#;
Returns:
A encoded XML document.

isTextEmpty

public static boolean isTextEmpty(org.w3c.dom.Text text)
Test if a Text node is empty (contains only whitespace)

Parameters:
text - - the Text node to test
Returns:
- true if Text node is null or contains only whitespace; false otherwise.

translateXMLString

public static java.lang.String translateXMLString(java.lang.String value)
Deprecated. superceded by encodeXML().
Encode XML String.

Parameters:
value - XML string to be encoded
Returns:
encoded XML

serializeXMLNode

public static void serializeXMLNode(java.io.Writer writer,
                                    int indent,
                                    org.w3c.dom.Node node)
                             throws java.io.IOException
Serializes (write to storage) an XML node and its descendents.

Parameters:
writer - The stream to write the serialized representation of an XML element and its descendents.
indent - The number of spaces to indent XML elements.
node - A node to serialize, along with its attributes, and its descendents.
Throws:
java.io.IOException -  

XMLtoString

public static java.lang.String XMLtoString(org.w3c.dom.Document document)
                                    throws java.io.IOException
Serialize (write to storage) a W3C DOM Document. Same as:
     StringWriter out = new StringWriter();
     serializeXML(document, out);
 

Parameters:
document - the document to be serialized
Returns:
xml in string format
Throws:
java.io.IOException -  

serializeXML

public static void serializeXML(org.w3c.dom.Document document,
                                java.io.Writer writer)
                         throws java.io.IOException
Serialize (write to storage) a W3C DOM Document

Parameters:
document - the document to be serialized
Returns:
xml in string format
Throws:
java.io.IOException -  

serializeXML

public static void serializeXML(org.w3c.dom.Document document,
                                java.io.Writer writer,
                                java.lang.String encoding)
                         throws java.io.IOException
Serialize (write to storage) a W3C DOM Document

Parameters:
document - the document to be serialized
Returns:
xml in string format
Throws:
java.io.IOException -  

WebLogic Integration

WebLogic Integration (WLI)