final
class
DocumentParserUsingDomLS extends AbstractDocumentParser
Instance Constructors
-
new
DocumentParserUsingDomLS(domImplementation: DOMImplementationLS, parserCreator: (DOMImplementationLS) ⇒ LSParser)
Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
val
domImplementation: DOMImplementationLS
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
parse(inputStream: InputStream): Document
-
final
def
parse(file: File): Document
-
final
def
parse(uri: URI): Document
-
val
parserCreator: (DOMImplementationLS) ⇒ LSParser
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
withParserCreator(newParserCreator: (DOMImplementationLS) ⇒ LSParser): DocumentParserUsingDomLS
Inherited from AnyRef
Inherited from Any
DOM-LS-based
Documentparser.Typical non-trivial creation is as follows, assuming class
MyEntityResolver, which extendsLSResourceResolver, and classMyErrorHandler, which extendsDOMErrorHandler:A custom
LSResourceResolvercould be used to retrieve DTDs locally, or even to suppress DTD resolution. The latter can be coded as follows (see http://stuartsierra.com/2008/05/08/stop-your-java-sax-parser-from-downloading-dtds), risking some loss of information:For completeness, a custom
DOMErrorHandlerclass that simply throws an exception:If more flexibility is needed in configuring the
DocumentParserthan offered by this class, consider writing a wrapperDocumentParserwhich wraps aDocumentParserUsingDomLS, but adapts theparsemethod. This would make it possible to set an encoding on theLSInput, for example. As another example, this would allow for adapting the conversion from a DOMDocumentto yaidomDocument.A
DocumentParserUsingDomLSinstance can be re-used multiple times, from the same thread. If theDOMImplementationLSis thread-safe, it can even be re-used from multiple threads. Typically aDOMImplementationLScannot be trusted to be thread-safe, however. In a web application, one (safe) way to deal with that is to use oneDOMImplementationLSinstance per request.