org.foray.xml
Class DomUtil

java.lang.Object
  extended by org.foray.xml.DomUtil

public final class DomUtil
extends Object

Utility class containing methods useful in parsing or building XML.


Field Summary
static String XMLNS_NAMESPACE_URI
          The namespace declaration to be assigned to the namespace definition in XML documents.
 
Method Summary
static LSInput createLSInput(InputStream inputStream, String publicId, String systemId)
          Converts an input stream into an LSInput.
static DOMImplementationLS getDOMImplementation()
          Returns the DOM Implementation.
static DOMImplementationRegistry getDOMRegistry()
          Returns the DOM Implementation registry.
static Document streamToDom(InputStream inputStream, LSResourceResolver resourceResolver)
          Converts an input stream to a generic DOM Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_NAMESPACE_URI

public static final String XMLNS_NAMESPACE_URI
The namespace declaration to be assigned to the namespace definition in XML documents.

See Also:
"http://www.w3.org/2000/xmlns/", Constant Field Values
Method Detail

getDOMRegistry

public static DOMImplementationRegistry getDOMRegistry()
                                                throws IOException
Returns the DOM Implementation registry.

Returns:
The DOM Implementation registry.
Throws:
IOException - For errors obtaining an instance of the registry.

getDOMImplementation

public static DOMImplementationLS getDOMImplementation()
                                                throws IOException
Returns the DOM Implementation.

Returns:
The DOM Implementation.
Throws:
IOException - For errors obtaining an instance of the DOM Implementation registry.

streamToDom

public static Document streamToDom(InputStream inputStream,
                                   LSResourceResolver resourceResolver)
                            throws IOException
Converts an input stream to a generic DOM Document.

Parameters:
inputStream - The stream to be parsed to a DOM document.
resourceResolver - The resource resolver to use, which can be null. This is useful for cases where we want (for example) to find a DTD locally instead of on the internet.
Returns:
The DOM document.
Throws:
IOException - For errors parsing the document.

createLSInput

public static LSInput createLSInput(InputStream inputStream,
                                    String publicId,
                                    String systemId)
Converts an input stream into an LSInput.

Parameters:
publicId - The public ID to attache to the input.
systemId - The system ID to attach to the input.
inputStream - The input stream to attach to the input.
Returns:
The new input.


Copyright © 2017. All rights reserved.