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

## org.apache.axis2.util
Class XMLUtils

    java.lang.Object
      org.apache.axis2.util.XMLUtils

    public class XMLUtils

extends java.lang.Object

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

Field Summary
`static java.lang.String` | `charEncoding`

Constructor Summary
`XMLUtils()`

Method Summary
`static java.lang.String` | `base64encode(byte[] bytes)`
`static org.w3c.dom.Node` | `findNode(org.w3c.dom.Node node, javax.xml.namespace.QName name)` Finds a Node with a given QNameb.
`static java.lang.String` | `getChildCharacterData(org.w3c.dom.Element parentEl)` Concatinates all the text and cdata node children of this elem and returns the resulting text.
`static org.xml.sax.InputSource` | `getEmptyInputSource()`
`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 javax.xml.namespace.QName` | `getQNameFromString(java.lang.String str, org.w3c.dom.Node e)` Returns 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 java.lang.String` | `getStringForQName(javax.xml.namespace.QName qname, org.w3c.dom.Element e)` Returns a string for a particular QName, mapping a new prefix if necessary.
`static void` | `initSAXFactory(java.lang.String factoryClassName, boolean namespaceAware, boolean validating)` Initializes the SAX parser factory.
`static org.w3c.dom.Document` | `newDocument()` Gets an empty new Document.
`static org.w3c.dom.Document` | `newDocument(org.xml.sax.InputSource inp)` Gets a new Document read from the input source.
`static org.w3c.dom.Document` | `newDocument(java.io.InputStream inp)` Gets a new Document read from the input stream
`static org.w3c.dom.Document` | `newDocument(java.lang.String uri)` Gets a new Document read from the indicated uri
`static org.w3c.dom.Document` | `newDocument(java.lang.String uri, java.lang.String username, java.lang.String password)` Creates a new document from the given URI.
`static void` | `releaseSAXParser(javax.xml.parsers.SAXParser parser)` Returns a SAX parser for reuse.
`static org.w3c.dom.Element` | `toDOM(org.apache.axiom.om.OMElement element)` Converts a given OMElement to a DOM Element.
`static org.apache.axiom.om.OMElement` | `toOM(org.w3c.dom.Element element)` Convert DOM Element into a fully built OMElement
`static org.apache.axiom.om.OMElement` | `toOM(org.w3c.dom.Element element, boolean buildAll)` Convert DOM Element into a fully built OMElement
`static org.apache.axiom.om.OMNode` | `toOM(java.io.InputStream inputStream)` Converts a given inputstream to an OMNode The reurned OMNode is fully built.
`static org.apache.axiom.om.OMNode` | `toOM(java.io.InputStream inputStream, boolean buildAll)` Converts a given inputstream to an OMNode The reurned OMNode is fully built if buildAll is true.
`static org.apache.axiom.om.OMNode` | `toOM(java.io.Reader reader)` Converts a given Reader to an OMNode.
`static org.apache.axiom.om.OMNode` | `toOM(java.io.Reader reader, boolean buildAll)` Converts a given Reader to an OMNode.

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

Field Detail

### charEncoding

    public static final java.lang.String charEncoding

See Also:
  Constant Field Values

Constructor Detail

### XMLUtils

    public XMLUtils()

Method Detail

### initSAXFactory

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

  Initializes 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

### releaseSAXParser

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

  Returns a SAX parser for reuse.

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

### newDocument

    public static org.w3c.dom.Document newDocument()
                                            throws javax.xml.parsers.ParserConfigurationException

  Gets an empty new Document.

  Returns:
    Returns Document.
  Throws:
    `javax.xml.parsers.ParserConfigurationException` - if construction problems occur

### newDocument

    public static org.w3c.dom.Document newDocument(org.xml.sax.InputSource inp)
                                            throws javax.xml.parsers.ParserConfigurationException,
                                                   org.xml.sax.SAXException,
                                                   java.io.IOException

  Gets a new Document read from the input source.

  Returns:
    Returns Document.
  Throws:
    `javax.xml.parsers.ParserConfigurationException` - if construction problems occur
    `org.xml.sax.SAXException` - if the document has xml sax problems
    `java.io.IOException` - if i/o exceptions occur

### newDocument

    public static org.w3c.dom.Document newDocument(java.io.InputStream inp)
                                            throws javax.xml.parsers.ParserConfigurationException,
                                                   org.xml.sax.SAXException,
                                                   java.io.IOException

  Gets a new Document read from the input stream

  Returns:
    Returns Document.
  Throws:
    `javax.xml.parsers.ParserConfigurationException` - if construction problems occur
    `org.xml.sax.SAXException` - if the document has xml sax problems
    `java.io.IOException` - if i/o exceptions occur

### newDocument

    public static org.w3c.dom.Document newDocument(java.lang.String uri)
                                            throws javax.xml.parsers.ParserConfigurationException,
                                                   org.xml.sax.SAXException,
                                                   java.io.IOException

  Gets a new Document read from the indicated uri

  Returns:
    Returns Document.
  Throws:
    `javax.xml.parsers.ParserConfigurationException` - if construction problems occur
    `org.xml.sax.SAXException` - if the document has xml sax problems
    `java.io.IOException` - if i/o exceptions occur

### newDocument

    public static org.w3c.dom.Document newDocument(java.lang.String uri,
                                                   java.lang.String username,
                                                   java.lang.String password)
                                            throws javax.xml.parsers.ParserConfigurationException,
                                                   org.xml.sax.SAXException,
                                                   java.io.IOException

  Creates a new document from the given URI. Uses the username and password if the URI requires authentication.

  Parameters:
    `uri` - the resource to get
    `username` - basic auth username
    `password` - basic auth password
  Throws:
    `javax.xml.parsers.ParserConfigurationException` - if construction problems occur
    `org.xml.sax.SAXException` - if the document has xml sax problems
    `java.io.IOException` - if i/o exceptions occur

### 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 javax.xml.namespace.QName getQNameFromString(java.lang.String str,
                                                               org.w3c.dom.Node e)

  Returns 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:
    Returns a QName generated from the given string representation.

### getStringForQName

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

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

### getChildCharacterData

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

  Concatinates all the text and cdata node children of this elem and returns the resulting text. (by Matt Duftler)

  Parameters:
    `parentEl` - the element whose cdata/text node values are to be combined.
  Returns:
    Returns the concatinated 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

### base64encode

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

### getEmptyInputSource

    public static org.xml.sax.InputSource getEmptyInputSource()

### findNode

    public static org.w3c.dom.Node findNode(org.w3c.dom.Node node,
                                            javax.xml.namespace.QName name)

  Finds a Node with a given QNameb.

  Parameters:
    `node` - parent node
    `name` - QName of the child we need to find
  Returns:
    Returns child node.

### toOM

    public static org.apache.axiom.om.OMElement toOM(org.w3c.dom.Element element)
                                              throws java.lang.Exception

  Convert DOM Element into a fully built OMElement

  Parameters:
    `element` - dom Element
  Returns:
    OMElement
  Throws:
    `java.lang.Exception`

### toOM

    public static org.apache.axiom.om.OMElement toOM(org.w3c.dom.Element element,
                                                     boolean buildAll)
                                              throws java.lang.Exception

  Convert DOM Element into a fully built OMElement

  Parameters:
    `element` -
    `buildAll` - if true, full OM tree is immediately built. if false, caller is responsible for building the tree and closing the parser.
  Returns:
  Throws:
    `java.lang.Exception`

### toDOM

    public static org.w3c.dom.Element toDOM(org.apache.axiom.om.OMElement element)
                                     throws java.lang.Exception

  Converts a given OMElement to a DOM Element.

  Parameters:
    `element` -
  Returns:
    Returns Element.
  Throws:
    `java.lang.Exception`

### toOM

    public static org.apache.axiom.om.OMNode toOM(java.io.InputStream inputStream)
                                           throws javax.xml.stream.XMLStreamException

  Converts a given inputstream to an OMNode The reurned OMNode is fully built.

  Parameters:
    `inputStream` -
  Returns:
    OMNode
  Throws:
    `javax.xml.stream.XMLStreamException`

### toOM

    public static org.apache.axiom.om.OMNode toOM(java.io.InputStream inputStream,
                                                  boolean buildAll)
                                           throws javax.xml.stream.XMLStreamException

  Converts a given inputstream to an OMNode The reurned OMNode is fully built if buildAll is true. If buildAll is false, the caller is responsible for closing the parser.

  Parameters:
    `inputStream` -
    `buildAll` -
  Returns:
    OMNode
  Throws:
    `javax.xml.stream.XMLStreamException`

### toOM

    public static org.apache.axiom.om.OMNode toOM(java.io.Reader reader)
                                           throws javax.xml.stream.XMLStreamException

  Converts a given Reader to an OMNode. The reurned OMNode is fully built.

  Parameters:
    `reader` -
  Returns:
  Throws:
    `javax.xml.stream.XMLStreamException`

### toOM

    public static org.apache.axiom.om.OMNode toOM(java.io.Reader reader,
                                                  boolean buildAll)
                                           throws javax.xml.stream.XMLStreamException

  Converts a given Reader to an OMNode. The reurned OMNode is fully built if buildAll is true. If buildAll is false, the caller is responsible for closing the parser.

  Parameters:
    `reader` -
    `buildAll` -
  Returns:
    OMNode
  Throws:
    `javax.xml.stream.XMLStreamException`

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

Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.