se.unlogic.standardutils.xml
Class XMLUtils
java.lang.Object
se.unlogic.standardutils.xml.XMLUtils
public class XMLUtils
- extends Object
Method Summary |
static void |
append(Document doc,
Element targetElement,
Collection<? extends XMLable> beans)
|
static void |
append(Document doc,
Element targetElement,
String elementName,
Collection<? extends XMLable> beans)
|
static void |
append(Document doc,
Element targetElement,
String elementName,
String subElementsName,
List<? extends Object> values)
|
static void |
append(Document doc,
Element targetElement,
String elementName,
String subElementsName,
Object[] values)
|
static void |
appendNewCDATAElement(Document doc,
Element targetElement,
String elementName,
Object value)
|
static void |
appendNewCDATAElement(Document doc,
Element targetElement,
String elementName,
String value)
|
static void |
appendNewElement(Document doc,
Element targetElement,
String elementName,
Object value)
|
static void |
appendNewElement(Document doc,
Element targetElement,
String elementName,
String value)
|
static Element |
createCDATAElement(String name,
Object value,
Document doc)
|
static Document |
createDomDocument()
|
static Element |
createElement(String name,
Object value,
Document doc)
|
static Document |
createNamespaceAwareDomDocument()
|
static Element |
getTimeUnits(Document doc,
XMLUtils.TimeUnit timeUnit)
|
static Document |
parseXmlFile(File f,
boolean validating)
|
static Document |
parseXmlFile(File file,
boolean validating,
boolean namespaceAware)
|
static Document |
parseXmlFile(InputStream stream,
boolean validating)
|
static Document |
parseXmlFile(String filename,
boolean validating,
boolean namespaceAware)
|
static Document |
parseXmlFile(URI uri,
boolean validating)
|
static void |
replaceSingleNode(Element parent,
Node node)
Adds or replaces node in parent. |
static String |
toString(Document doc,
String encoding,
boolean indent)
|
static void |
toString(Document doc,
String encoding,
Writer w,
boolean indent)
|
static void |
writeXmlFile(Document doc,
File file,
boolean indent,
String encoding)
|
static void |
writeXmlFile(Document doc,
File file,
Map.Entry<String,String>... outputKeys)
|
static void |
writeXmlFile(Document doc,
String filename,
boolean indent,
String encoding)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLUtils
public XMLUtils()
createDomDocument
public static Document createDomDocument()
createNamespaceAwareDomDocument
public static Document createNamespaceAwareDomDocument()
toString
public static String toString(Document doc,
String encoding,
boolean indent)
throws TransformerFactoryConfigurationError,
TransformerException
- Throws:
TransformerFactoryConfigurationError
TransformerException
toString
public static void toString(Document doc,
String encoding,
Writer w,
boolean indent)
throws TransformerFactoryConfigurationError,
TransformerException
- Throws:
TransformerFactoryConfigurationError
TransformerException
parseXmlFile
public static Document parseXmlFile(String filename,
boolean validating,
boolean namespaceAware)
throws SAXException,
IOException,
ParserConfigurationException
- Throws:
SAXException
IOException
ParserConfigurationException
parseXmlFile
public static Document parseXmlFile(File file,
boolean validating,
boolean namespaceAware)
throws SAXException,
IOException,
ParserConfigurationException
- Throws:
SAXException
IOException
ParserConfigurationException
parseXmlFile
public static Document parseXmlFile(URI uri,
boolean validating)
throws SAXException,
IOException,
ParserConfigurationException
- Throws:
SAXException
IOException
ParserConfigurationException
parseXmlFile
public static Document parseXmlFile(File f,
boolean validating)
throws SAXException,
IOException,
ParserConfigurationException
- Throws:
SAXException
IOException
ParserConfigurationException
parseXmlFile
public static Document parseXmlFile(InputStream stream,
boolean validating)
throws SAXException,
IOException,
ParserConfigurationException
- Throws:
SAXException
IOException
ParserConfigurationException
createElement
public static Element createElement(String name,
Object value,
Document doc)
createCDATAElement
public static Element createCDATAElement(String name,
Object value,
Document doc)
writeXmlFile
public static void writeXmlFile(Document doc,
File file,
boolean indent,
String encoding)
throws TransformerFactoryConfigurationError,
TransformerException
- Throws:
TransformerFactoryConfigurationError
TransformerException
writeXmlFile
public static void writeXmlFile(Document doc,
File file,
Map.Entry<String,String>... outputKeys)
throws TransformerFactoryConfigurationError,
TransformerException
- Throws:
TransformerFactoryConfigurationError
TransformerException
writeXmlFile
public static void writeXmlFile(Document doc,
String filename,
boolean indent,
String encoding)
throws TransformerFactoryConfigurationError,
TransformerException
- Throws:
TransformerFactoryConfigurationError
TransformerException
append
public static void append(Document doc,
Element targetElement,
Collection<? extends XMLable> beans)
append
public static void append(Document doc,
Element targetElement,
String elementName,
String subElementsName,
Object[] values)
append
public static void append(Document doc,
Element targetElement,
String elementName,
String subElementsName,
List<? extends Object> values)
append
public static void append(Document doc,
Element targetElement,
String elementName,
Collection<? extends XMLable> beans)
appendNewCDATAElement
public static void appendNewCDATAElement(Document doc,
Element targetElement,
String elementName,
String value)
appendNewElement
public static void appendNewElement(Document doc,
Element targetElement,
String elementName,
String value)
appendNewCDATAElement
public static void appendNewCDATAElement(Document doc,
Element targetElement,
String elementName,
Object value)
appendNewElement
public static void appendNewElement(Document doc,
Element targetElement,
String elementName,
Object value)
replaceSingleNode
public static void replaceSingleNode(Element parent,
Node node)
throws RuntimeException
- Adds or replaces node in parent.
- Parameters:
parent
- node
-
- Throws:
Exception
- - Node cannot exist more than once,
i.e. multiple nodes with the same name cannot exist in parent.
RuntimeException
getTimeUnits
public static Element getTimeUnits(Document doc,
XMLUtils.TimeUnit timeUnit)
Copyright © 2011. All Rights Reserved.