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

Peter Murray-Rust pm286 at cam.ac.uk
Wed Dec 31 11:32:32 EST 2008


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


More information about the XOM-interest mailing list