Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.conversation.base
Class XmlParsingUtils

    java.lang.Object
      com.ibm.conversation.base.XmlParsingUtils

public class XmlParsingUtils
extends java.lang.Object

Class XmlParsingUtils provides a few convenience functions used in parsing XML files.

These functions are used by `CpXmlParser`, but they're split out into their own class because they can be applied to general XML documents, not just cpXML docs, and to simplify the already-bloated CpXmlParser class.

Method Summary
`static java.lang.String` | `getLeafText(org.w3c.dom.Element element)` Returns the text inside a leaf element.
`static long` | `millisFromDuration(java.lang.String durationString)` Converts an xs:duration string to milliseconds, using the current System Date as starting Date.
`static long` | `millisFromDuration(java.lang.String durationString, java.util.Date startDate)` Converts an `xs:duration` string to milliseconds, as measured from the given Date.
`static void` | `testMillisFromDuration(java.lang.String durString)` Runs a unit test of the `millisFromDuration()` function.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getLeafText

    public static java.lang.String getLeafText(org.w3c.dom.Element element)

  Returns the text inside a leaf element.

  This method assumes that the arg is indeed a leaf (i.e., there are no other elements inside it) and that there is indeed text inside it.

  Parameters:
    `element` - The leaf element.
  Returns:
    The text inside the leaf element.

### millisFromDuration

    public static long millisFromDuration(java.lang.String durationString)

  Converts an xs:duration string to milliseconds, using the current System Date as starting Date.

  The starting Date makes a difference only when the duration string specifies some number of years and/or months, since the number of days per month is not constant.

  Parameters:
    `durationString` - The xs:duration string.
  Returns:
    The number of milliseconds represented by that duration.

### millisFromDuration

    public static long millisFromDuration(java.lang.String durationString,
                                          java.util.Date startDate)

  Converts an `xs:duration` string to milliseconds, as measured from the given Date.

  The starting Date makes a difference only when the duration string specifies some number of years and/or months, since the number of days per month is not constant.

  Parameters:
    `durationString` - The `xs:duration` string.
    `startDate` - The Date to use as starting Date.
  Returns:
    The number of milliseconds represented by that duration.

### testMillisFromDuration

    public static void testMillisFromDuration(java.lang.String durString)

  Runs a unit test of the `millisFromDuration()` function.

  Calculates the milliseconds and prints both duration string and milliseconds on standard output.

  Parameters:
    `durString` - The duration string to convert to milliseconds.

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005