org.grinvin.xml
Class XMLUtils
public final class XMLUtils
extends java.lang.Object
Helper methods for XML-processing.
static Document | loadDocumentFromInputStream(InputStream stream)
|
static Element | loadFromClassPath(ClassLoader classLoader, String filename) - Converts the given XML file into a JDOM element.
|
static Element | loadFromClassPath(String filename) - Converts the given XML file into a JDOM element.
|
static Element | loadFromInputStream(InputStream stream) - Converts the given XML on the input stream into a JDOM element with all
external entities (mainly DTDs) searched for in the package
org.grinvin.dtds , but resolved by the class loader of this class.
|
static Element | loadFromInputStreamNonValidating(InputStream stream)
|
loadDocumentFromInputStream
public static Document loadDocumentFromInputStream(InputStream stream)
throws JDOMException,
IOException
loadFromClassPath
public static Element loadFromClassPath(ClassLoader classLoader,
String filename)
throws IOException
Converts the given XML file into a JDOM element. The file will
be loaded by the given class loader and all external entities (mainly DTDs)
are searched for in the package org.grinvin.dtds
, but
resolved by the class loader of this class.
classLoader
- Class loader to be used for loading the XML file.filename
- Filename relative to the root of the class path, must not start
with a slash (/).
- the JDOM element corresponding to the root of file,
or null if the file did not exist.
loadFromClassPath
public static Element loadFromClassPath(String filename)
throws IOException
Converts the given XML file into a JDOM element. The file should
reside in the class path, and all external entities (mainly DTDs)
are searched for in the package
org.grinvin.dtds
, also
in the class path.
Has the same effect as a call to
loadFromClassPath(ClassLoader,String)
with the class loader of this class as a first parameter.
filename
- Filename relative to the root of the class path, must not start
with a slash (/).
- the JDOM element corresponding to the root of file,
or null if the file did not exist.
loadFromInputStream
public static Element loadFromInputStream(InputStream stream)
throws JDOMException,
IOException
Converts the given XML on the input stream into a JDOM element with all
external entities (mainly DTDs) searched for in the package
org.grinvin.dtds
, but resolved by the class loader of this class.
stream
- InputStream containing the XML code.
- the JDOM element corresponding to the root of the XML.
loadFromInputStreamNonValidating
public static Element loadFromInputStreamNonValidating(InputStream stream)
throws JDOMException,
IOException