-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conflicting ID-types for attribute "id" #211
Comments
Of course github mangled the xml code... Here are the files attached |
(I had to append .txt extensions for github to be happy...) |
ID checking is defined as part of the Relax NG DTD compatibility specification and being something inherited from DTDs, their definition should be consistent for an element matched by a Relax NG pattern.
Regards, |
But db._any isn't used anywhere in the XML file. There may be an error in the DocBook 5 schema (for instance, if an XML file uses xml:id somewhere in MathML contents as a descendant of a DocBook element, the user wouldn't get what he may expect), but here xml:id doesn't appear as a descendant of a DocBook element, so that db._any isn't used and there shouldn't be any error. |
The thing is that it is possible in an instance document to appear a "root" element in that area and in that case the processor will not know how to consider the ID type for the xml:id attribute - this is a static error, that analyses the schema, not a runtime error on a specific instance document. I mentioned the options above - one is to turn off ID checking. Best Regards, |
If a "root" element appears in db._any, then the xml:id attribute would have type text in this context, because this is what the grammar says. Consider the following XML file:
Here, the xml:id="foo" would be of type ID because one has That said, the "xml:" namespace is special, as it is standard. https://www.w3.org/XML/1998/namespace says: "The xml:id specification defines a single attribute, xml:id, known to be of type ID independently of any DTD or schema." Note the "independently". So, because of this, xml:id="bar" is of type ID. This is how libxml2 behaves (I've checked, replacing linkend="foo" by linkend="bar"). That's probably why the DocBook 5 schema doesn't exclude And note that ID checking is useful, I don't want to turn it off. Currently, jing cannot work with any serious schema that mixes DocBook 5 and another namespace. |
I agree that this is one of the major pain points with Relax NG, but I do not know the best way forward... Regards, |
If this can be useful in tests, here are two standalone examples. The first example
The corresponding schema:
For this first example, according to the "xml:" namespace specifications, xml:id is always of type ID (what's inside The second example
The corresponding schema:
Here, I've replaced the standard |
Please note that this functionality is part of the DTD compatibility specification, and that means you cannot have two different declarations for the same attribute in the same element, because you cannot have that in a DTD. |
I suggest two possibilities:
|
Is this an outright bug that we ideally should fix in the sources? Or rather if it’s more of an enhancement request? |
Well, it looks like a bug: the tool is saying the tdb.xml file is invalid while it is valid |
The conflicting ID type error is not reported on the XML document, it is a problem reported on the schema and it is related to the DTD compatibility spec [1]. The DTD compatibility ID checking is controlled by an option [2], so you can disable that. This check does what the DTD compatibility spec says, so it is not a problem in Jing, if the spec is updated then Jing can follow the updated spec. [1] https://www.oasis-open.org/committees/relax-ng/compatibility-20011203.html#id
[2] http://www.thaiopensource.com/relaxng/jing.html
|
The |
Hello,
As reported by Vincent Lefevre in Debian bug report http://bugs.debian.org/834555 :
“
jing yields an error on a valid XML file (neither xmllint, nor
Emacs nXML complain).
Consider the following files:
==> tdb.xml <==
.==> tdb.rnc <==
default namespace = "http://localhost/"
include "/usr/share/xml/docbook/schema/rng/5.0/docbook.rnc" { start |= notAllowed }
root =
element root {
attribute xml:id { xsd:ID },
db.para
}
start = root
==> tdb.rng <==
<grammar ns="http://localhost/" xmlns="http://relaxng.org/ns/structure/1.0"
+datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
Note: I generated tdb.rng with "trang tdb.rnc tdb.rng" and updated
the path to docbook.rng to reuse the schemas from the docbook5-xml
package.
I get the following error:
zira:~> jing tdb.rng tdb.xml
[warning] /usr/bin/jing: No java runtime was found
/usr/share/xml/docbook/schema/rng/5.0/docbook.rng:83:16: error: conflicting ID-types for attribute "id" from
+namespace "http://www.w3.org/XML/1998/namespace" of element "root" from namespace "http://localhost/"
while with xmllint from libxml2-utils:
zira:~> xmllint --noout --relaxng tdb.rng tdb.xml
tdb.xml validates
and when I open tdb.xml in Emacs, it is said:
-UUU:----F1 tdb.xml All L1 (nXML Valid) --------------
Using schema ~/tdb.rnc
”
The text was updated successfully, but these errors were encountered: