com.xmlmind.domutil
Class LoaderImpl

java.lang.Object
  extended by com.xmlmind.domutil.LoaderImpl
All Implemented Interfaces:
Loader
Direct Known Subclasses:
XLoader

public class LoaderImpl
extends java.lang.Object
implements Loader

An implementation of Loader making use by default of the built-in XInclude processor (possibly XInclude 1.0, not 1.1; possibly limited) of the XML parser.


Constructor Summary
LoaderImpl()
           
LoaderImpl(boolean xincludeAware, Console c)
           
 
Method Summary
static org.xml.sax.XMLReader createXMLReader(boolean xincludeAware)
           
static java.lang.String format(org.xml.sax.SAXParseException e)
           
 ConsoleHelper getConsole()
          Returns the console on which messages issued during document loading are to be displayed.
 org.xml.sax.EntityResolver getEntityResolver()
          Returns the entity resolver being used when loading an XML document.
static boolean isAddingElementPointer()
          Not part of the public, documented, API: returns true if element XPath pointers are added to NodeLocations during the loading of XML documents.
 org.w3c.dom.Document load(java.io.File file)
           
 org.w3c.dom.Document load(java.io.InputStream in, java.net.URL url)
          Load document from specified input stream.
 org.w3c.dom.Document load(java.net.URL url)
           
static void setAddingElementPointer(boolean add)
          Not part of the public, documented, API: specifies whether to add element XPath pointers to NodeLocations during the loading of XML documents.
 void setConsole(Console c)
          Specifies the console on which messages issued during document loading are to be displayed.
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          Specifies which entity resolver to use when loading an XML document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoaderImpl

public LoaderImpl()

LoaderImpl

public LoaderImpl(boolean xincludeAware,
                  Console c)
Method Detail

setAddingElementPointer

public static void setAddingElementPointer(boolean add)
Not part of the public, documented, API: specifies whether to add element XPath pointers to NodeLocations during the loading of XML documents.

This facility is needed to implement XXE's Check Assembly.

See Also:
isAddingElementPointer()

isAddingElementPointer

public static boolean isAddingElementPointer()
Not part of the public, documented, API: returns true if element XPath pointers are added to NodeLocations during the loading of XML documents.

This facility is needed to implement XXE's Check Assembly.

See Also:
setAddingElementPointer(boolean)

setConsole

public void setConsole(Console c)
Description copied from interface: Loader
Specifies the console on which messages issued during document loading are to be displayed.

Specified by:
setConsole in interface Loader
Parameters:
c - the console; may be null, in which case messages are displayed on System.err and System.out
See Also:
Loader.getConsole()

getConsole

public ConsoleHelper getConsole()
Description copied from interface: Loader
Returns the console on which messages issued during document loading are to be displayed.

Specified by:
getConsole in interface Loader
See Also:
Loader.setConsole(com.xmlmind.util.Console)

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Description copied from interface: Loader
Specifies which entity resolver to use when loading an XML document.

Specified by:
setEntityResolver in interface Loader
Parameters:
resolver - which resolver to use. May be null.
See Also:
Loader.getEntityResolver()

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Description copied from interface: Loader
Returns the entity resolver being used when loading an XML document. May return null.

Specified by:
getEntityResolver in interface Loader
See Also:
Loader.setEntityResolver(org.xml.sax.EntityResolver)

load

public org.w3c.dom.Document load(java.io.File file)
                          throws java.io.IOException
Throws:
java.io.IOException

load

public org.w3c.dom.Document load(java.net.URL url)
                          throws java.io.IOException
Throws:
java.io.IOException

load

public org.w3c.dom.Document load(java.io.InputStream in,
                                 java.net.URL url)
                          throws java.io.IOException
Description copied from interface: Loader
Load document from specified input stream.

Note: xi:include elements (XInclude) are expected to have been processed in the loaded document.

Specified by:
load in interface Loader
Parameters:
in - input stream allowing to load the document
url - URL of the document to be loaded if known; null otherwise
Returns:
loaded document
Throws:
java.io.IOException - if, for any reason, an I/O exception is raised during the processing. Note that XML parse exception and XInclude exception are reported as IOExceptions.

createXMLReader

public static org.xml.sax.XMLReader createXMLReader(boolean xincludeAware)

format

public static final java.lang.String format(org.xml.sax.SAXParseException e)