|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.axis.utils.XMLUtils
Nested Class Summary | |
static class |
XMLUtils.ParserErrorHandler
|
Field Summary | |
static String |
httpAuthCharEncoding
|
Constructor Summary | |
XMLUtils()
|
Method Summary | |
static Element[] |
asElementArray(List list)
Converts a List with org.w3c.dom.Element objects to an Array with org.w3c.dom.Element objects. |
static String |
base64encode(byte[] bytes)
|
static void |
DocumentToStream(Document doc,
OutputStream out)
|
static String |
DocumentToString(Document doc)
Turn a whole DOM document into XML |
static void |
DocumentToWriter(Document doc,
Writer writer)
|
static void |
ElementToStream(Element element,
OutputStream out)
|
static String |
ElementToString(Node element)
turn an element into an XML fragment |
static String |
ElementToString(Node element,
boolean omitXMLDecl)
|
static void |
ElementToWriter(Element element,
Writer writer)
|
static void |
ElementToWriter(Element element,
Writer writer,
boolean omitXMLDecl,
boolean pretty)
|
static Node |
findNode(Node node,
javax.xml.namespace.QName name)
Find a Node with a given QName |
static String |
getChildCharacterData(Element parentEl)
Concat all the text and cdata node children of this elem and return the resulting text. |
static InputSource |
getEmptyInputSource()
|
static String |
getEncoding()
Get the current encoding in effect |
static javax.xml.namespace.QName |
getFullQNameFromString(String str,
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 String |
getInnerXMLString(Element element)
get the inner XML inside an element as a string. |
static InputSource |
getInputSourceFromURI(String uri)
Utility to get the bytes uri. |
static String |
getNamespace(String prefix,
Node e)
|
static String |
getNamespace(String prefix,
Node e,
Node stopNode)
Searches for the namespace URI of the given prefix in the given DOM range. |
static String |
getPrefix(String uri,
Node e)
|
static javax.xml.namespace.QName |
getQNameFromString(String str,
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 SAXParser |
getSAXParser()
Get a SAX parser instance from the JAXP factory. |
static String |
getStringForQName(javax.xml.namespace.QName qname,
Element e)
Return a string for a particular QName, mapping a new prefix if necessary. |
static void |
initSAXFactory(String factoryClassName,
boolean namespaceAware,
boolean validating)
Initialize the SAX parser factory. |
static Document |
newDocument()
Get an empty new Document |
static Document |
newDocument(InputSource inp)
Get a new Document read from the input source |
static Document |
newDocument(InputStream inp)
Get a new Document read from the input stream |
static Document |
newDocument(String uri)
Get a new Document read from the indicated uri |
static Document |
newDocument(String uri,
String username,
String password)
Create a new document from the given URI, use the username and password if the URI requires authentication. |
static void |
normalize(Node node)
Trim all new lines from text nodes. |
static void |
PrettyDocumentToStream(Document doc,
OutputStream out)
|
static String |
PrettyDocumentToString(Document doc)
|
static void |
PrettyDocumentToWriter(Document doc,
Writer writer)
|
static void |
PrettyElementToStream(Element element,
OutputStream out)
|
static void |
PrettyElementToWriter(Element element,
Writer writer)
|
static InputSource |
sourceToInputSource(Source source)
Utility to get the bytes uri |
static Element |
StringToElement(String namespace,
String name,
String string)
Convert a simple string to an element with a text node |
static String |
trim(String str)
|
static String |
xmlEncodeString(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 |
public static final String httpAuthCharEncoding
Constructor Detail |
public XMLUtils()
Method Detail |
public static String xmlEncodeString(String orig)
orig
- the String to encode
public static String getEncoding()
public static void initSAXFactory(String factoryClassName, boolean namespaceAware, boolean validating)
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 parservalidating
- true if we want a validating parserpublic static SAXParser getSAXParser()
public static Document newDocument() throws ParserConfigurationException
ParserConfigurationException
- if construction problems occurpublic static Document newDocument(InputSource inp) throws ParserConfigurationException, SAXException, IOException
ParserConfigurationException
- if construction problems occur
SAXException
- if the document has xml sax problems
IOException
- if i/o exceptions occurpublic static Document newDocument(InputStream inp) throws ParserConfigurationException, SAXException, IOException
ParserConfigurationException
- if construction problems occur
SAXException
- if the document has xml sax problems
IOException
- if i/o exceptions occurpublic static Document newDocument(String uri) throws ParserConfigurationException, SAXException, IOException
ParserConfigurationException
- if construction problems occur
SAXException
- if the document has xml sax problems
IOException
- if i/o exceptions occurpublic static Document newDocument(String uri, String username, String password) throws ParserConfigurationException, SAXException, IOException
uri
- the resource to getusername
- basic auth usernamepassword
- basic auth password
ParserConfigurationException
- if construction problems occur
SAXException
- if the document has xml sax problems
IOException
- if i/o exceptions occurpublic static String ElementToString(Node element, boolean omitXMLDecl)
public static String ElementToString(Node element)
element
-
public static String DocumentToString(Document doc)
doc
- DOM document
public static String PrettyDocumentToString(Document doc)
public static void ElementToWriter(Element element, Writer writer, boolean omitXMLDecl, boolean pretty)
public static void ElementToStream(Element element, OutputStream out)
public static void PrettyElementToStream(Element element, OutputStream out)
public static void ElementToWriter(Element element, Writer writer)
public static void PrettyElementToWriter(Element element, Writer writer)
public static void DocumentToStream(Document doc, OutputStream out)
public static void PrettyDocumentToStream(Document doc, OutputStream out)
public static void DocumentToWriter(Document doc, Writer writer)
public static void PrettyDocumentToWriter(Document doc, Writer writer)
public static Element StringToElement(String namespace, String name, String string)
namespace
- - element namespacename
- - element namestring
- - value of the text node
public static String getInnerXMLString(Element element)
element
-
public static String getPrefix(String uri, Node e)
public static String getNamespace(String prefix, Node e, Node stopNode)
prefix
- the prefix to finde
- the starting nodestopNode
- null to search in all the document or a parent node where the search must stop.
public static String getNamespace(String prefix, Node e)
public static javax.xml.namespace.QName getQNameFromString(String str, Node e)
public static javax.xml.namespace.QName getFullQNameFromString(String str, Node e)
public static String getStringForQName(javax.xml.namespace.QName qname, Element e)
public static String getChildCharacterData(Element parentEl)
parentEl
- the element whose cdata/text node values are to
be combined.
public static InputSource getInputSourceFromURI(String uri)
uri
- the resource to get#getInputSourceFromURI(String uri, String username, String password)
public static InputSource sourceToInputSource(Source source)
source
- the resource to getpublic static final String base64encode(byte[] bytes)
public static InputSource getEmptyInputSource()
public static Node findNode(Node node, javax.xml.namespace.QName name)
node
- parent nodename
- QName of the child we need to find
public static void normalize(Node node)
node
- public static String trim(String str)
public static Element[] asElementArray(List list)
list
- List containing org.w3c.dom.Element objects
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |