com.mulesoft.adapter.helper
Class XML

java.lang.Object
  extended by com.mulesoft.adapter.helper.XML

public final class XML
extends Object

Helper methods for XML document.


Method Summary
static byte[] emptyDocument()
           
static String firstNamedTextNode(Document document, String tagName)
           
static Document parse(InputStream contentStream)
           
static String rootTag(Document document)
          e.g.
static String stripNamespaceIfNecessary(String tagName)
          Strip namespace of a tag if any.
static List<List<String>> textNodes(Document document)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

textNodes

public static List<List<String>> textNodes(Document document)
Parameters:
document -
Returns:
all first level text nodes

firstNamedTextNode

public static String firstNamedTextNode(Document document,
                                        String tagName)
Parameters:
document -
tagName -
Returns:
text node value of first occurrence of node whose tag name is `tagName`

rootTag

public static String rootTag(Document document)
e.g. For document returns `tag`

Parameters:
document -
Returns:
root tag name

parse

public static Document parse(InputStream contentStream)
                      throws ParserConfigurationException,
                             SAXException,
                             IOException
Parameters:
content -
Returns:
specified String as an XML Document
Throws:
ParserConfigurationException
SAXException
IOException

stripNamespaceIfNecessary

public static String stripNamespaceIfNecessary(String tagName)
Strip namespace of a tag if any. e.g. for `ns:tag` returns `tag`. for `tag` returns `tag`.

Parameters:
tagName -
Returns:

emptyDocument

public static byte[] emptyDocument()


Copyright © 2012. All Rights Reserved.