org.grinvin.xml

Class XMLUtils


public final class XMLUtils
extends java.lang.Object

Helper methods for XML-processing.

Method Summary

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.

Method Details

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.
Parameters:
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 (/).
Returns:
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
Parameters:
filename - Filename relative to the root of the class path, must not start with a slash (/).
Returns:
the JDOM element corresponding to the root of file, or null if the file did not exist.