public final class LoadDoc extends Object implements LoadOptions
LoadDocument
.
When a document cannot be loaded, the methods of this class return
null
instead of raising exceptions.
The exceptions, errors and warnings reported by the methods
of LoadDocument
are displayed using an error dialog box.
When this class is used not interactively, then errors and warnings are reported on specified console (if any). In such case, this class is as thread-safe as the console it uses.
ADD_ANY_DOCUMENT_TYPE, ADD_AUTO_DOCUMENT_TYPE, ADD_DECLARED_PREFIXES, ADD_LINE_COLUMN, ADD_XML_DECLARATION, DONT_INCLUDE, DONT_STRIP_WHITESPACE, GUESS_IGNORABLE_WHITESPACE, XINCLUDE
Modifier and Type | Method and Description |
---|---|
static URL |
getURL(InputSource in)
Helper method: returns the URL corresponding to the systemId of
specified source.
|
static Document |
load(File file,
Component parentComponent)
Loads and returns specified XML document.
|
static Document |
load(File file,
int options,
Console console,
Component parentComponent)
Loads and returns specified XML document.
|
static Document |
load(InputSource source,
int options,
Console console,
Component parentComponent)
Loads and returns specified XML document.
|
static Document |
load(InputSource source,
URL url,
int options,
CommandEnv env)
Not for public use.
|
static Document |
load(InputSource source,
URL url,
int options,
Console console,
Component parentComponent)
Not for public use.
|
static Document |
load(URL url,
Component parentComponent)
Loads and returns specified XML document.
|
static Document |
load(URL url,
int options,
Console console,
Component parentComponent)
Loads and returns specified XML document.
|
static boolean |
reportErrors(Console console,
URL docURL,
List<LoadError> loadErrors,
List<LoadError> loadWarnings)
Helper method: prints specified errors on specified console.
|
static boolean |
showErrors(Component parentComponent,
URL docURL,
List<LoadError> loadErrors,
List<LoadError> loadWarnings)
Helper method: display specified errors in a dialog box having
specified component as its parent.
|
public static Document load(File file, Component parentComponent)
file
- location of the document to be loadedparentComponent
- used to display the error dialog box;
may be null
in which case errors, if any, are printed on
System.err
null
if specified document
cannot be loadedpublic static Document load(URL url, Component parentComponent)
url
- location of the document to be loadedparentComponent
- used to display the error dialog box;
may be null
in which case errors, if any, are printed on
System.err
null
if specified document
cannot be loadedpublic static Document load(File file, int options, Console console, Component parentComponent)
file
- location of the document to be loadedoptions
- LoadDocument
optionsconsole
- when parentComponent is null
,
this console is used to print errors.
May be null
in which case errors, if any, are printed on
System.err
.parentComponent
- used to display the error dialog box;
may be null
in which case errors, if any, are printed on
consolenull
if specified document
cannot be loadedpublic static Document load(URL url, int options, Console console, Component parentComponent)
url
- location of the document to be loadedoptions
- LoadDocument
optionsconsole
- when parentComponent is null
,
this console is used to print errors.
May be null
in which case errors, if any, are printed on
System.err
.parentComponent
- used to display the error dialog box;
may be null
in which case errors, if any, are printed on
consolenull
if specified document
cannot be loadedpublic static Document load(InputSource source, int options, Console console, Component parentComponent)
source
- specifies the source of document to be loadedoptions
- LoadDocument
optionsconsole
- when parentComponent is null
,
this console is used to print errors.
May be null
in which case errors, if any, are printed on
System.err
.parentComponent
- used to display the error dialog box;
may be null
in which case errors, if any, are printed on
consolenull
if specified document
cannot be loadedpublic static Document load(InputSource source, URL url, int options, Console console, Component parentComponent)
public static Document load(InputSource source, URL url, int options, CommandEnv env)
public static URL getURL(InputSource in)
public static final boolean showErrors(Component parentComponent, URL docURL, List<LoadError> loadErrors, List<LoadError> loadWarnings)