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 DocumentBuilderFactory |
getBuilderFactory() |
static Map<String,String> |
getMapFromElementAttributes(Element element)
Constructs a
Map from the attributes on the given element. |
static SAXParserFactory |
getSAXParserFactory() |
static Source |
getSAXSource(Reader inputReader) |
static XMLReader |
getXMLParser(ClassLoader l)
Convenience to get default xml parser.
|
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 DocumentBuilderFactory getBuilderFactory()
public static String serialize(Element elem) throws IOException
elem
- null or ElementIOException
public static Map<String,String> 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)
public static XMLReader getXMLParser(ClassLoader l) throws SAXException
SAXException
public static SAXParserFactory getSAXParserFactory()
public static Source getSAXSource(Reader inputReader) throws IOException
IOException