I'm playing around with an XML schema and trying to produce a simple valid document that uses it.
The schema XSD is provided by the W3C, so I can't imagine anything's actually wrong with it. But xmllint
on the command line as well as any number of freebie online validators complain about the actual XSD (not my test document) with:
The QName value '{http://www.w3.org/XML/1998/namespace}id' does not resolve to a(n) attribute declaration.
Note that it can't resolve the id
type/name, which is base XML stuff. I'm not an XML master, so I may be missing something obvious about the namespace/linkage here. This isn't a problem with my test document, because even a trivial test document fails in the XSD compile bit.
Here's the XSD file. Here is a trivial test document:
<?xml version="1.0" encoding="UTF-8"?>
<ink xmlns="http://www.w3.org/2003/InkML"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/TR/2011/REC-InkML-20110920/inkml.xsd">
</ink>
But try as I might, I can't get xmllint
or any online validators to even get past the XSD parse/compile phase, because the XML id type is somehow wonky.
Is my understanding of XML incorrect here? I'm asking on SO (vs another site) because ultimately this is about understanding the XML specification and dependencies to write and validate a document. I'd welcome code snippets that do the right thing, whatever the right thing is.
Thoughts? Thanks.