Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Problem with "Missing scheme in absolute URI reference"

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Tatu Saloranta <cowtowncoder AT yahoo.com>
  • To: xom-interest AT lists.ibiblio.org, Peter Murray-Rust <pm286 AT cam.ac.uk>
  • Subject: Re: [XOM-interest] Problem with "Missing scheme in absolute URI reference"
  • Date: Wed, 31 Dec 2008 10:08:28 -0800 (PST)

Just to be clear, based on error message the problem is not the scheme part,
but that DTD references can not be located.

The usual work-around is to configure underlying parser (such as Xerces/SAX)
to redirect reads that are needed to access the DTD. For Sax this is done by
setting org.xml.sax.EntityResolver in XMLReader, and for Stax similarly by
setting XMLInputFactory.RESOLVER property on input factory. In either case,
one usually just returns empty document as dummy DTD.

DTD read is needed even when not validating since it could contain default
attributes or general entities. And although theoretically adding
'standalone="yes"' in xml declaration might allow skipping reading, my
recollection is that Xerces still tries to read DTD in question no matter
what.

Hope this helps,

-+ Tatu +-


--- On Wed, 12/31/08, Peter Murray-Rust <pm286 AT cam.ac.uk> wrote:

> From: Peter Murray-Rust <pm286 AT cam.ac.uk>
> Subject: [XOM-interest] Problem with "Missing scheme in absolute URI
> reference"
> To: xom-interest AT lists.ibiblio.org
> Date: Wednesday, December 31, 2008, 9:32 AM
> I am trying to parse some SVG generated by pstoedit and so
> out of my
> control. This uses a DOCTYPE + remote DTD which appear to
> be valid but
> which throw the above exception. (I don't understand it
> as there are no
> explicit namespaceURIs). The SYSTEM identifiers appear to
> be valid from
> the W3C site (I have copied them to make sure). I attach
> (simplified)
> code snippets which demonstrate the problem using XOM-1.1.
> The second
> one is valid against the W3C validation service (except for
> missing
> required SVG attributes)
>
> At present the workaround is to edit the XML to remove the
> DOCTYPE as I
> cannot control its output. I prefer not to do this - is
> there a way of
> setting XOM to ignore the DOCTYPE or some otehr setting?
>
> Thanks
>
> P.
>
> public class TestXOM {
>
> public static void main(String[] args) {
> String[] strings = {
> "<?xml version='1.0'
> encoding='UTF-8'?>"+
> "<!DOCTYPE svg SYSTEM
> \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\";>"+
> "<svg/>",
>
> "<?xml version='1.0'
> encoding='UTF-8'?>"+
> "<!DOCTYPE svg SYSTEM
> \"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd\";>"+
> "<svg/>",
>
> "<?xml version='1.0'
> encoding='UTF-8'?>"+
> "<!DOCTYPE svg SYSTEM
> \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/nonexistent.dtd\";>"+
> "<svg/>"
> };
> for (String s : strings) {
> try {
> new Builder().build(new StringReader(s));
> System.out.println("parsed OK");
> } catch (Exception e) {
> System.out.println(e);
> }
> }
> }
> }
>
> which gives:
>
> parsed OK
>
> nu.xom.ParsingException: Missing scheme in absolute URI
> reference
>
> java.io.FileNotFoundException:
> http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/nonexistent.dtd
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest







Archive powered by MHonArc 2.6.24.

Top of Page