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

## org.apache.axis.utils
Class XMLUtils

    java.lang.Object
      |
      +--org.apache.axis.utils.XMLUtils

public class XMLUtils
extends java.lang.Object

Inner Class Summary
`static class` | `XMLUtils.ParserErrorHandler`

Field Summary
`static java.lang.String` | `charEncoding`
`protected static org.apache.commons.logging.Log` | `log`

Constructor Summary
`XMLUtils()`

Method Summary
`static java.lang.String` | `base64encode(byte[] bytes)`
`static void` | `DocumentToStream(org.w3c.dom.Document doc, java.io.OutputStream out)`
`static java.lang.String` | `DocumentToString(org.w3c.dom.Document doc)`
`static void` | `DocumentToWriter(org.w3c.dom.Document doc, java.io.Writer writer)`
`static void` | `ElementToStream(org.w3c.dom.Element element, java.io.OutputStream out)`
`static java.lang.String` | `ElementToString(org.w3c.dom.Element element)`
`static void` | `ElementToWriter(org.w3c.dom.Element element, java.io.Writer writer)`
`static java.lang.String` | `getChildCharacterData(org.w3c.dom.Element parentEl)` Concat all the text and cdata node children of this elem and return the resulting text.
`static java.lang.String` | `getInnerXMLString(org.w3c.dom.Element element)`
`static org.xml.sax.InputSource` | `getInputSourceFromURI(java.lang.String uri)` Utility to get the bytes uri.
`static java.lang.String` | `getNamespace(java.lang.String prefix, org.w3c.dom.Node e)`
`static java.lang.String` | `getPrefix(java.lang.String uri, org.w3c.dom.Node e)`
`static QName` | `getQNameFromString(java.lang.String str, org.w3c.dom.Node e)` Return a QName when passed a string like "foo:bar" by mapping the "foo" prefix to a namespace in the context of the given Node.
`static javax.xml.parsers.SAXParser` | `getSAXParser()` Get a SAX parser instance from the JAXP factory.
`java.lang.String` | `getStringForQName(QName qname, org.w3c.dom.Element e)` Return a string for a particular QName, mapping a new prefix if necessary.
`static void` | `initSAXFactory(java.lang.String factoryClassName, boolean namespaceAware, boolean validating)` Initialize the SAX parser factory.
`static org.w3c.dom.Document` | `newDocument()`
`static org.w3c.dom.Document` | `newDocument(org.xml.sax.InputSource inp)`
`static org.w3c.dom.Document` | `newDocument(java.io.InputStream inp)`
`static org.w3c.dom.Document` | `newDocument(java.lang.String uri)`
`static org.w3c.dom.Document` | `newDocument(java.lang.String uri, java.lang.String username, java.lang.String password)` Create a new document from the given URI, use the username and password if the URI requires authentication.
`static void` | `PrettyDocumentToStream(org.w3c.dom.Document doc, java.io.OutputStream out)`
`static void` | `PrettyDocumentToWriter(org.w3c.dom.Document doc, java.io.Writer writer)`
`static void` | `PrettyElementToStream(org.w3c.dom.Element element, java.io.OutputStream out)`
`static void` | `PrettyElementToWriter(org.w3c.dom.Element element, java.io.Writer writer)`
`static void` | `privateElementToWriter(org.w3c.dom.Element element, java.io.Writer writer, boolean omitXMLDecl, boolean pretty)`
`static void` | `releaseSAXParser(javax.xml.parsers.SAXParser parser)` Return a SAX parser for reuse.
`static org.xml.sax.InputSource` | `sourceToInputSource(Source source)` Utility to get the bytes uri
`static org.w3c.dom.Element` | `StringToElement(java.lang.String namespace, java.lang.String name, java.lang.String string)` Convert a simple string to an element with a text node
`static java.lang.String` | `xmlEncodeString(java.lang.String orig)` Encode a string appropriately for XML.

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

Field Detail

### log

    protected static org.apache.commons.logging.Log log

### charEncoding

    public static final java.lang.String charEncoding

Constructor Detail

### XMLUtils

    public XMLUtils()

Method Detail

### xmlEncodeString

    public static java.lang.String xmlEncodeString(java.lang.String orig)

  Encode a string appropriately for XML. Lifted from ApacheSOAP 2.2 (org.apache.soap.Utils)
  Parameters:
    `orig` - the String to encode
  Returns:
    a String in which XML special chars are repalced by entities

### initSAXFactory

    public static void initSAXFactory(java.lang.String factoryClassName,
                                      boolean namespaceAware,
                                      boolean validating)

  Initialize the SAX parser factory.
  Parameters:
    `factoryClassName` - The (optional) class name of the desired SAXParserFactory implementation. Will be assigned to the system property javax.xml.parsers.SAXParserFactory unless this property is already set. If `null`, leaves current setting alone.
    `namespaceAware` - true if we want a namespace-aware parser
    `validating` - true if we want a validating parser

### getSAXParser

    public static javax.xml.parsers.SAXParser getSAXParser()

  Get a SAX parser instance from the JAXP factory.
  Returns:
    a SAXParser instance.

### releaseSAXParser

    public static void releaseSAXParser(javax.xml.parsers.SAXParser parser)

  Return a SAX parser for reuse.
  Parameters:
    `parser` - A SAX parser that is available for reuse

### newDocument

    public static org.w3c.dom.Document newDocument()

### newDocument

    public static org.w3c.dom.Document newDocument(org.xml.sax.InputSource inp)

### newDocument

    public static org.w3c.dom.Document newDocument(java.io.InputStream inp)

### newDocument

    public static org.w3c.dom.Document newDocument(java.lang.String uri)

### newDocument

    public static org.w3c.dom.Document newDocument(java.lang.String uri,
                                                   java.lang.String username,
                                                   java.lang.String password)

  Create a new document from the given URI, use the username and password if the URI requires authentication.

### ElementToString

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

### DocumentToString

    public static java.lang.String DocumentToString(org.w3c.dom.Document doc)

### privateElementToWriter

    public static void privateElementToWriter(org.w3c.dom.Element element,
                                              java.io.Writer writer,
                                              boolean omitXMLDecl,
                                              boolean pretty)

### ElementToStream

    public static void ElementToStream(org.w3c.dom.Element element,
                                       java.io.OutputStream out)

### PrettyElementToStream

    public static void PrettyElementToStream(org.w3c.dom.Element element,
                                             java.io.OutputStream out)

### ElementToWriter

    public static void ElementToWriter(org.w3c.dom.Element element,
                                       java.io.Writer writer)

### PrettyElementToWriter

    public static void PrettyElementToWriter(org.w3c.dom.Element element,
                                             java.io.Writer writer)

### DocumentToStream

    public static void DocumentToStream(org.w3c.dom.Document doc,
                                        java.io.OutputStream out)

### PrettyDocumentToStream

    public static void PrettyDocumentToStream(org.w3c.dom.Document doc,
                                              java.io.OutputStream out)

### DocumentToWriter

    public static void DocumentToWriter(org.w3c.dom.Document doc,
                                        java.io.Writer writer)

### PrettyDocumentToWriter

    public static void PrettyDocumentToWriter(org.w3c.dom.Document doc,
                                              java.io.Writer writer)

### StringToElement

    public static org.w3c.dom.Element StringToElement(java.lang.String namespace,
                                                      java.lang.String name,
                                                      java.lang.String string)

  Convert a simple string to an element with a text node
  Parameters:
    `namespace` - - element namespace
    `name` - - element name
    `string` - - value of the text node
  Returns:
    element - an XML Element

### getInnerXMLString

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

### getPrefix

    public static java.lang.String getPrefix(java.lang.String uri,
                                             org.w3c.dom.Node e)

### getNamespace

    public static java.lang.String getNamespace(java.lang.String prefix,
                                                org.w3c.dom.Node e)

### getQNameFromString

    public static QName getQNameFromString(java.lang.String str,
                                           org.w3c.dom.Node e)

  Return a QName when passed a string like "foo:bar" by mapping the "foo" prefix to a namespace in the context of the given Node.
  Returns:
    a QName generated from the given string representation

### getStringForQName

    public java.lang.String getStringForQName(QName qname,
                                              org.w3c.dom.Element e)

  Return a string for a particular QName, mapping a new prefix if necessary.

### getChildCharacterData

    public static java.lang.String getChildCharacterData(org.w3c.dom.Element parentEl)

  Concat all the text and cdata node children of this elem and return the resulting text. (by Matt Duftler)
  Parameters:
    `parentEl` - the element whose cdata/text node values are to be combined.
  Returns:
    the concatanated string.

### getInputSourceFromURI

    public static org.xml.sax.InputSource getInputSourceFromURI(java.lang.String uri)

  Utility to get the bytes uri. Does NOT handle authenticated URLs, use getInputSourceFromURI(uri, username, password)
  Parameters:
    `uri` - the resource to get
  See Also:
    `#getInputSourceFromURI(String uri, String username, String password)`

### sourceToInputSource

    public static org.xml.sax.InputSource sourceToInputSource(Source source)

  Utility to get the bytes uri
  Parameters:
    `source` - the resource to get

### base64encode

    public static final java.lang.String base64encode(byte[] bytes)

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

Copyright © 2002 Apache XML Project. All Rights Reserved.