public class XMLUtil extends Object
Constructor and Description |
---|
XMLUtil() |
Modifier and Type | Method and Description |
---|---|
protected static Document |
_loadDocument(InputSource inputSource)
loads an xml document from the xslt input source
|
static void |
clean(Node node)
deletes the comment nodes and text nodes with all empty spaces.
|
static Map |
getMapFromElementAttributes(Element element)
Constructs a
Map from the attributes on the given element. |
static Document |
loadDocumentFromReader(Reader reader)
loads an xml document by the suplied java.io.Reader
|
static Document |
loadDocumentFromXML(String xml)
Load XML (String format) into a Document
|
static String |
serialize(Element elem)
Serialize the element
|
public static Document loadDocumentFromXML(String xml) throws ParserConfigurationException, FactoryConfigurationError, SAXException, IOException
xml
- String in XML formatParserConfigurationException
FactoryConfigurationError
SAXException
IOException
public static Document loadDocumentFromReader(Reader reader) throws ParserConfigurationException, FactoryConfigurationError, SAXException, IOException
reader
- is an open Reader to an xml document.ParserConfigurationException
FactoryConfigurationError
SAXException
IOException
protected static Document _loadDocument(InputSource inputSource) throws ParserConfigurationException, FactoryConfigurationError, SAXException, IOException
inputSource
- is the xslt input sourceParserConfigurationException
FactoryConfigurationError
SAXException
IOException
public static String serialize(Element elem) throws IOException
elem
- null or ElementIOException
public static Map getMapFromElementAttributes(Element element)
Map
from the attributes on the given element. namespaces
are ignored.element
- the element to get the attributes frompublic static void clean(Node node)