|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.randomcoder.xml.XmlUtils
public final class XmlUtils
Various convenience methods to get data in and out of DOM, pretty print, etc.
Copyright (c) 2006, Craig Condit. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
| Method Summary | |
|---|---|
static Transformer |
getTransformer(boolean indent,
String publicId,
String systemId,
Source xsl)
Gets a Transformer object suitable for writing DOM objects. |
static void |
logXml(org.apache.commons.logging.Log log,
Document doc)
Log XML to the given log object. |
static void |
logXml(org.apache.commons.logging.Log log,
Document doc,
String publicId,
String systemId)
Log XML to the given log object. |
static void |
logXml(org.apache.commons.logging.Log log,
String message,
Document doc)
Log XML to the given log object. |
static void |
logXml(org.apache.commons.logging.Log log,
String message,
Document doc,
String publicId,
String systemId)
Log XML to the given log object. |
static Document |
parseXml(InputSource source)
Parse the given input source into a DOM object. |
static void |
prettyPrint(Document input,
StreamResult output)
Pretty-print (indent) a DOM document. |
static void |
prettyPrint(Document input,
StreamResult output,
DocumentType docType)
Pretty-print (indent) a DOM document. |
static void |
writeXml(Document doc,
Result result,
String publicId,
String systemId)
Writes a DOM object to the given Result. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Document parseXml(InputSource source)
throws SAXException,
IOException
source - input source
SAXException - if parsing fails
IOException - if an I/O error occurs
public static void writeXml(Document doc,
Result result,
String publicId,
String systemId)
throws TransformerException
doc - Document to convertresult - destinationpublicId - public id of dtd or null if not specifiedsystemId - system id of dtd or null if not specified
TransformerException - if transformation fails
public static Transformer getTransformer(boolean indent,
String publicId,
String systemId,
Source xsl)
indent - whether to indent outputpublicId - public id of dtd or null if not specifiedsystemId - system id of dtd or null if not specifiedxsl - XSL source or null if not needed
public static void logXml(org.apache.commons.logging.Log log,
Document doc)
log - log to output todoc - document to write
public static void logXml(org.apache.commons.logging.Log log,
Document doc,
String publicId,
String systemId)
log - log to output todoc - document to writepublicId - public id for dtd or null for nonesystemId - system id for dtd or null for none
public static void logXml(org.apache.commons.logging.Log log,
String message,
Document doc)
log - log to output tomessage - message to adddoc - document to write
public static void logXml(org.apache.commons.logging.Log log,
String message,
Document doc,
String publicId,
String systemId)
log - log to output tomessage - message to adddoc - document to writepublicId - public id for dtd or null for nonesystemId - system id for dtd or null for none
public static void prettyPrint(Document input,
StreamResult output)
throws TransformerException
input - DOM inputoutput - stream result
TransformerException - if transformation fails
public static void prettyPrint(Document input,
StreamResult output,
DocumentType docType)
throws TransformerException
input - DOM inputoutput - stream resultdocType - DTD to output
TransformerException - if transformation fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||