public class ParseUtil extends Object
Constructor and Description |
---|
ParseUtil() |
Modifier and Type | Method and Description |
---|---|
static Document |
parse(File file)
Parses a file using a namespace-aware, non-validating parser.
|
static Document |
parse(InputSource source)
Parses the supplied source with a namespace-aware, non-validating
parser, using the built-in error handler that throws on parse errors
and ignores warnings.
|
static Document |
parse(InputSource source,
ErrorHandler errHandler)
Parses the supplied source with a namespace-aware, non-validating
parser, using a caller-supplied error handler.
|
static Document |
parse(InputStream in)
Parses the supplied source with a namespace-aware, non-validating
parser, using the built-in error handler that throws on parse errors
and ignores warnings.
|
static Document |
parse(String xml)
Parses a string containing XML, using a namespace-aware, non-validating
parser.
|
static Document |
parseFromClasspath(String resourcePath)
Parses a resource loaded from the classpath, using the current thread's context
classloader, and a default error handler.
|
static Document |
parseFromClasspath(String resourcePath,
Class<?> klass)
Parses a resource loaded from the classpath, using the classloader
associated with the specified class, and a default error handler.
|
static Document |
parseFromClasspath(String resourcePath,
Class<?> klass,
ErrorHandler errorHandler)
Parses a resource loaded from the classpath, using the classloader
associated with the specified class, and the specified error handler.
|
static Document |
parseFromClasspath(String resourcePath,
ErrorHandler errorHandler)
Parses a resource loaded from the classpath, using the current thread's context
classloader, and a specified error handler.
|
static Document |
validatingParse(InputSource source,
EntityResolver resolver,
ErrorHandler errHandler)
Parses the supplied source with a namespace-aware, DTD-validating
parser, using a caller-supplied error handler and entity resolver.
|
static Document |
validatingParse(InputSource source,
ErrorHandler errHandler)
Parses the supplied source with a namespace-aware, DTD-validating
parser, using a caller-supplied error handler and default entity
resolver.
|
static Document |
validatingParse(InputSource source,
Schema schema,
ErrorHandler errHandler)
Parses the supplied source with a namespace-aware, XSD-validating
parser, using a caller-supplied error handler and entity resolver.
|
public static Document parse(InputSource source, ErrorHandler errHandler)
XmlException
- for any configuration or fatal execution error.public static Document parse(InputSource source)
XmlException
- for any configuration or execution error.public static Document parse(InputStream in)
XmlException
- for any configuration or execution error,
including IOException
public static Document parse(String xml)
XmlException
- for any configuration or execution error.public static Document parse(File file)
FileInputStream
s for the finalizer to
close.XmlException
- for any error, including file-not-found.public static Document validatingParse(InputSource source, EntityResolver resolver, ErrorHandler errHandler)
null
, to use the built-in
defaults.XmlException
- for any configuration or fatal execution error.public static Document validatingParse(InputSource source, ErrorHandler errHandler)
XmlException
- for any configuration or fatal execution error.public static Document validatingParse(InputSource source, Schema schema, ErrorHandler errHandler)
null
, to use the built-in
defaults.XmlException
- for any configuration or fatal execution error.public static Document parseFromClasspath(String resourcePath)
public static Document parseFromClasspath(String resourcePath, ErrorHandler errorHandler)
public static Document parseFromClasspath(String resourcePath, Class<?> klass)
public static Document parseFromClasspath(String resourcePath, Class<?> klass, ErrorHandler errorHandler)