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

## oracle.portal.utils.xml.v1
Class XMLUtil

    java.lang.Object
      |
      +--oracle.portal.utils.xml.v1.XMLUtil

public class XMLUtil
extends java.lang.Object

Class containing utility methods for parsing and manipulating XML documents.

Constructor Summary
`XMLUtil()`

Method Summary
`static oracle.xml.parser.v2.XMLDocument` | `applyXSL(oracle.xml.parser.v2.XMLDocument xmldoc, oracle.xml.parser.v2.XSLStylesheet xsl, java.io.OutputStream errOut)` Apply the given stylesheet to the given XML document, reporting errors and warnings to the given `OutputStream`.
`static java.lang.String` | `escapeXML(java.lang.String text, boolean isAttribute)` General utility to escape text for inclusion in XML.
`static java.lang.String` | `escapeXMLAttribute(java.lang.String text)` Properly escapes text for inclusion in as XML attribute value.
`static java.lang.String` | `escapeXMLText(java.lang.String text)` Properly escapes text for inclusion in as XML text.
`static boolean` | `getBooleanValue(java.lang.String value)` Convert the given String encoding of a boolean value (`"true"` or `"false"`) to a `boolean`.
`static java.util.Enumeration` | `getStyleSheetPIs(oracle.xml.parser.v2.XMLDocument doc)` Get an `Enumeration` of `ProcessingInstruction`s from the given XML document which have a target of `"xml-stylesheet"`.
`static java.util.Enumeration` | `getTargetPIs(oracle.xml.parser.v2.XMLDocument doc, java.lang.String targetName)` Get an `Enumeration` of `ProcessingInstruction`s from the given XML document which have the specified target (for example, `"xml-stylesheet"`).
`static int` | `getVersionMajor(java.lang.String version)` Given a version number string, get the integer corresponding to the 'major version'.
`static java.util.Enumeration` | `getXslDocs(oracle.xml.parser.v2.XMLDocument doc)` Get an `Enumeration` of `XSLStylesheet`s referenced by processing instructions in the given XML document which have a target of `"xml-stylesheet"`.
`static oracle.xml.parser.v2.XMLDocument` | `parseDocument(java.io.InputStream docInputStream, java.io.OutputStream errOut)` Parse an XML document from the given `InputStream`, reporting errors and warnings to the given `OutputStream`.
`static java.util.Hashtable` | `parsePI(org.w3c.dom.ProcessingInstruction pi)` Given a `ProcessingInstruction` whose data contains attribute/value pairs, return a `Hashtable` which contains the attributes as keys and their corresponding values as values.

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

Constructor Detail

### XMLUtil

    public XMLUtil()

Method Detail

### parseDocument

    public static oracle.xml.parser.v2.XMLDocument parseDocument(java.io.InputStream docInputStream,
                                                                 java.io.OutputStream errOut)
                                                          throws java.io.IOException,
                                                                 org.xml.sax.SAXException

  Parse an XML document from the given `InputStream`, reporting errors and warnings to the given `OutputStream`.
  Parameters:
    `docInputStream` - `InputStream` from which the document should be read
    `errOut` - `OutputStream` to which parsing errors and warnings should be reported
  Throws:
    java.io.IOException - if an I/O error occurs
    org.xml.sax.SAXException - if a parsing error occurs

### applyXSL

    public static oracle.xml.parser.v2.XMLDocument applyXSL(oracle.xml.parser.v2.XMLDocument xmldoc,
                                                            oracle.xml.parser.v2.XSLStylesheet xsl,
                                                            java.io.OutputStream errOut)
                                                     throws java.io.IOException,
                                                            oracle.xml.parser.v2.XSLException

  Apply the given stylesheet to the given XML document, reporting errors and warnings to the given `OutputStream`.
  Parameters:
    `xmldoc` - a parsed XML document
    `xsl` - a parsed XSL stylesheet
    `errOut` - `OutputStream` to which stylesheet processing errors should be reported

### getTargetPIs

    public static java.util.Enumeration getTargetPIs(oracle.xml.parser.v2.XMLDocument doc,
                                                     java.lang.String targetName)

  Get an `Enumeration` of `ProcessingInstruction`s from the given XML document which have the specified target (for example, `"xml-stylesheet"`).
  Parameters:
    `doc` - the XML document
    `targetName` - the target of the processing instructions to be returned
  Returns:
    `Enumeration` of `ProcessingInstruction`s from the given XML document which have the specified target.

### getStyleSheetPIs

    public static java.util.Enumeration getStyleSheetPIs(oracle.xml.parser.v2.XMLDocument doc)

  Get an `Enumeration` of `ProcessingInstruction`s from the given XML document which have a target of `"xml-stylesheet"`.
  Parameters:
    `doc` - the XML document
  Returns:
    `Enumeration` of `ProcessingInstruction`s from the given XML document which have a target of `"xml-stylesheet"`.

### getXslDocs

    public static java.util.Enumeration getXslDocs(oracle.xml.parser.v2.XMLDocument doc)
                                            throws java.io.IOException,
                                                   org.xml.sax.SAXException,
                                                   oracle.xml.parser.v2.XSLException

  Get an `Enumeration` of `XSLStylesheet`s referenced by processing instructions in the given XML document which have a target of `"xml-stylesheet"`.
  Parameters:
    `doc` - the XML document
  Returns:
    `Enumeration` of `XSLStylesheet`s referenced by processing instructions in the given XML document which have a target of `"xml-stylesheet"`.

### parsePI

    public static java.util.Hashtable parsePI(org.w3c.dom.ProcessingInstruction pi)
                                       throws org.xml.sax.SAXException

  Given a `ProcessingInstruction` whose data contains attribute/value pairs, return a `Hashtable` which contains the attributes as keys and their corresponding values as values.
  Parameters:
    `pi` - a processing instruction
  Returns:
    `Hashtable` mapping processing instruction attributes to values

### getBooleanValue

    public static boolean getBooleanValue(java.lang.String value)

  Convert the given String encoding of a boolean value (`"true"` or `"false"`) to a `boolean`.
  Parameters:
    `value` - String representation of a boolean value
  Returns:
    `true` if the string is not `null` and matches the string `"true"` in a case-insensitive comparison

### getVersionMajor

    public static int getVersionMajor(java.lang.String version)

  Given a version number string, get the integer corresponding to the 'major version'. For example, calling this method on the string `"3.2.1"` would return the integer `3`.
  Parameters:
    `version` - a version number string, e.g. "3.2.1"
  Returns:
    the integer 'major version' represented by the digits before the first '.' in the string
  Throws:
    java.lang.NumberFormatException - if the string does not contain a valid integer major version

### escapeXMLAttribute

    public static java.lang.String escapeXMLAttribute(java.lang.String text)

  Properly escapes text for inclusion in as XML attribute value. I.e. escapes &, <, >, ', and ".
  Parameters:
    `text` - the String to escape
  Returns:
    the escaped text.

### escapeXMLText

    public static java.lang.String escapeXMLText(java.lang.String text)

  Properly escapes text for inclusion in as XML text. I.e. escapes &, <, and >.
  Parameters:
    `text` - the String to escape
  Returns:
    the escaped text.

### escapeXML

    public static java.lang.String escapeXML(java.lang.String text,
                                             boolean isAttribute)

  General utility to escape text for inclusion in XML. I.e. escapes &, <, and > if regular XML text or escapes &, <, >, ', and " if an XML attribute value.
  Parameters:
    `text` - the String to escape
    `isAttribute` - indicates if the text should be escaped for inclusion as an attributes value. If `false` then regular text is assumed.
  Returns:
    the escaped text.

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