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: Peter Murray-Rust <pm286 AT cam.ac.uk>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Problem with "Missing scheme in absolute URI reference"
  • Date: Wed, 31 Dec 2008 18:37:49 +0000

Many thanks, this is very helpful

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

I guessed this might be the case. It's obviously a confusing error message but that may be inevitable if Xerces is involved. Just to confirm, the DTD itself is accessible - it is presumably references within it that give the problem.


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.

Understood. However configuring Xerces is not always a relaxing operation and it would be nice to avoid it.


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.

Again I guessed this - I tried standalone="yes" without success and assumed some default overrid it.

Hope this helps,

It does.

A gentle suggestion would be to be able to configure XOM to hide some of this. Basically "I know what I want to do and it uses simple XML ideas and doesn't need the complexity of DTDs, Schemas or whatever. I'll take my chances on in working as I would like". For many of us (as I have argued consistently since XML started) Xerces and XMLSchema are vastly more complex than we require and they cause us more problems than they solve. If it weren't for XOM I would have great problems in using XML.

P.

-+ 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