I ran into the following error:
c.h.h.j.r.m.impl.RDFDefaultErrorHandler (line 1 column 20): XML version "1.1" is not supported, only XML 1.0 is supported.
This error is coming from Apache Jena's RDF parser when it encounters an XML document that declares version 1.1. The error message tells you exactly where the issue is:
What's happening:
We're trying to parse an RDF/XML file
That file has <?xml version="1.1"?> in its declaration (at line 1, column 20)
Jena's XML parser only supports XML 1.0
Solutions:
Option 1: Preprocess the file
javaString content = Files.readString(Path.of("file.rdf"));
content = content.replaceFirst("<?xml version=\"1.1\"", "<?xml version=\"1.0\"");
Model model = ModelFactory.createDefaultModel();
model.read(new StringReader(content), null);
Option 2: Use a different parser
Try switching to Turtle or N-Triples format if you control the source data, as they don't have this XML version dependency.
Option 3: Convert upstream
If we're fetching this from an external source, we might need to preprocess it before passing to Jena, or contact the data provider to use XML 1.0.
The error is specifically in c.h.h.j.r.m.impl.RDFDefaultErrorHandler which is Jena's error reporting mechanism - the actual parsing failure happens in the XML parser underneath.
I ran into the following error:
This error is coming from Apache Jena's RDF parser when it encounters an XML document that declares version 1.1. The error message tells you exactly where the issue is:
What's happening:
We're trying to parse an RDF/XML file
That file has
<?xml version="1.1"?>in its declaration (at line 1, column 20)Jena's XML parser only supports XML 1.0
Solutions:
Option 1: Preprocess the file
Option 2: Use a different parser
Try switching to Turtle or N-Triples format if you control the source data, as they don't have this XML version dependency.
Option 3: Convert upstream
If we're fetching this from an external source, we might need to preprocess it before passing to Jena, or contact the data provider to use XML 1.0.
The error is specifically in
c.h.h.j.r.m.impl.RDFDefaultErrorHandlerwhich is Jena's error reporting mechanism - the actual parsing failure happens in the XML parser underneath.