Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| WebLogic Integration
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 java.util.Calendar` | `getCalendarFromXMLDate(java.lang.String strXMLDate)` Parses `strXMLDate` into a Java Calendar object
`static java.util.Calendar` | `getCalendarFromXMLDateTime(java.lang.String strXMLDateTime)` Parses `strXMLDateTime` into a Java Calendar object
`static java.util.Calendar` | `getCalendarFromXMLTime(java.lang.String strXMLTime)` Parses `strXMLTime` into a Java Calendar object
`static java.lang.String` | `getXMLDateFromCalendar(java.util.Calendar cal)` Returns the XML date representation for a Calendar object `cal`
`static java.lang.String` | `getXMLDateTimeFromCalendar(java.util.Calendar cal)`
`static java.lang.String` | `getXMLTimeFromCalendar(java.util.Calendar cal)` Returns the XML time representation for a Calendar object `cal`
`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

### getCalendarFromXMLDate

    public static final java.util.Calendar getCalendarFromXMLDate(java.lang.String strXMLDate)
                                                           throws java.lang.IllegalArgumentException

  Parses `strXMLDate` into a Java Calendar object

  Parameters:
    `strXMLDate` - - a non-null Gregorian calendar date; the following formats are valid according to the XML Schema specification: CCYY-MM-DD CCYY-MM-DDZ CCYY-MM-DD-hh:mm CCYY-MM-DD+hh:mm CCYY-MM-DD-hh CCYY-MM-DD+hh XX..XCCYY-MM-DD, for dates beyond 9999 -CCYY..., for dates before 0 AD
  Returns:
    a Java Calendar
  Throws:
    java.lang.IllegalArgumentException - if `strXMLDate` is not a valid date according to the XML schema specification.

### getXMLDateFromCalendar

    public static final java.lang.String getXMLDateFromCalendar(java.util.Calendar cal)

  Returns the XML date representation for a Calendar object `cal`

  Parameters:
    `cal` - - a Java Calendar; must not be null
  Returns:
    a String date formatted according to the XML schema specification for the XML date datatype.
  Throws:
    java.lang.IllegalArgumentException - if the argument is null

### getCalendarFromXMLDateTime

    public static final java.util.Calendar getCalendarFromXMLDateTime(java.lang.String strXMLDateTime)
                                                               throws java.lang.IllegalArgumentException

  Parses `strXMLDateTime` into a Java Calendar object

  Parameters:
    `strXMLDate` - - a Gregorian calendar date; the following formats are valid according to the XML Schema specification: CCYY-MM-DDThh:mm:ss.sss CCYY-MM-DDThh:mm:ss.sssZ CCYY-MM-DDThh:mm:ss CCYY-MM-DDThh:mm:ssZ CCYY-MM-DDThh:mm:ss.sss-hh:mm CCYY-MM-DDThh:mm:ss.sss+hh:mm CCYY-MM-DDThh:mm:ss.sss-hh CCYY-MM-DDThh:mm:ss.sss+hh CCYY-MM-DDThh:mm:ss-hh:mm CCYY-MM-DDThh:mm:ss+hh:mm CCYY-MM-DDThh:mm:ss-hh CCYY-MM-DDThh:mm:ss+hh XX..XCCYY-MM-DD, for dates beyond 9999 -CCYY..., for dates before 0 AD
  Returns:
    a Java Calendar
  Throws:
    java.lang.IllegalArgumentException - if `strXMLDate` is not a valid date according to the XML schema specification.

### getXMLDateTimeFromCalendar

    public static final java.lang.String getXMLDateTimeFromCalendar(java.util.Calendar cal)

### getCalendarFromXMLTime

    public static final java.util.Calendar getCalendarFromXMLTime(java.lang.String strXMLTime)
                                                           throws java.lang.IllegalArgumentException

  Parses `strXMLTime` into a Java Calendar object

  Parameters:
    `strXMLTime` - - a non-null Gregorian calendar time; the following formats are valid according to the XML Schema specification: hh:mm:ss hh:mm:ssZ hh:mm:ss.sss hh:mm:ss.sssZ hh:mm:ss+hh:mm hh:mm:ss-hh:mm hh:mm:ss+hh hh:mm:ss-hh hh:mm:ss.sss+hh:mm hh:mm:ss.sss-hh:mm hh:mm:ss.sss+hh hh:mm:ss.sss-hh
  Returns:
    a Java Calendar
  Throws:
    java.lang.IllegalArgumentException - if `strXMLDate` is not a valid date according to the XML schema specification.

### getXMLTimeFromCalendar

    public static final java.lang.String getXMLTimeFromCalendar(java.util.Calendar cal)

  Returns the XML time representation for a Calendar object `cal`

  Parameters:
    `cal` - - a Java Calendar; must not be null
  Returns:
    a String time formatted according to the XML schema specification for the XML time datatype.
  Throws:
    java.lang.IllegalArgumentException - if the argument is null

### 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 -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| WebLogic Integration
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Integration (WLI)