diff options
author | Paul Phillips <paulp@improving.org> | 2009-11-28 22:18:12 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-11-28 22:18:12 +0000 |
commit | 61cbe9441dd360e60a1b102972b7110c8579b4d2 (patch) | |
tree | f62f84d93116c46fa4239732cb26dcae2374310c | |
parent | b22086d0eb54a4d14cc04714d6d33395ca167f8c (diff) | |
download | scala-61cbe9441dd360e60a1b102972b7110c8579b4d2.tar.gz scala-61cbe9441dd360e60a1b102972b7110c8579b4d2.tar.bz2 scala-61cbe9441dd360e60a1b102972b7110c8579b4d2.zip |
Fix for #2725 - configure the SAX parser not to...
Fix for #2725 - configure the SAX parser not to freak out
on an invalid doctype URL.
-rw-r--r-- | src/library/scala/xml/factory/XMLLoader.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/library/scala/xml/factory/XMLLoader.scala b/src/library/scala/xml/factory/XMLLoader.scala index dc2b07f6d3..f85a8b5347 100644 --- a/src/library/scala/xml/factory/XMLLoader.scala +++ b/src/library/scala/xml/factory/XMLLoader.scala @@ -24,13 +24,17 @@ trait XMLLoader[T <: Node] import scala.xml.Source._ def adapter: FactoryAdapter = new NoBindingFactoryAdapter() - /* Override this to use a different SAXParser. */ - def parser: SAXParser = { + private val saxFactory = { val f = SAXParserFactory.newInstance() f.setNamespaceAware(false) - f.newSAXParser() + // Discovered at: http://www.jdom.org/docs/faq.html#a0350 (see ticket #2725) + f.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) + f } + /* Override this to use a different SAXParser. */ + def parser: SAXParser = saxFactory.newSAXParser() + /** Loads XML from the given InputSource, using the supplied parser. * The methods available in scala.xml.XML use the XML parser in the JDK. */ |