[relaxng-user] jing: error: conflicting ID-types
John Cowan
jcowan at reutershealth.com
Tue Sep 30 12:10:15 ICT 2003
David Carlisle scripsit:
>
> I had a DTD
>
> <!ELEMENT x ANY>
> <!ATTLIST x id ID #IMPLIED>
>
> that I wanted to convert to relax ng, trang produced
>
> x = element x { attlist.x, any }
> attlist.x &= attribute id { xsd:ID }?
> start = x
> any =
> (element * {
> attribute * { text }*,
> any
> }
> | text)*
> Am I confused or is Jing?
The fault is with Trang, and yet it's hard to see how it could do any
better without taking an entirely different approach.
The semantics of ANY in a DTD are essentially (#PCDATA|FOO|BAR|BAZ|...)*,
where FOO, BAR, BAZ, ... are the declared elements in the DTD. It does
not mean that "any XML" is permissible here, but that's how Trang
translates it.
Consequently, the declaration of the element named "x" as having an "id"
attribute of type ID conflicts with the implicit declaration of "x" (as
part of the element wildcard) as having an "id" attribute (as part of the
attribute wildcard) of type text. Normally, this wouldn't matter, but
the semantics of type ID are global, and RNG requires that ID-declared
attributes be consistent throughout the document.
Here is an RNC schema that should do what you want:
x = element x { attlist.x & not-x* & x* & text}
attlist.x &= attribute id { xsd:ID }?
start = x
not-x = element (* - x) { attribute * {text}* & not-x* & x* & text }
--
John Cowan jcowan at reutershealth.com www.reutershealth.com www.ccil.org/~cowan
Consider the matter of Analytic Philosophy. Dennett and Bennett are well-known.
Dennett rarely or never cites Bennett, so Bennett rarely or never cites Dennett.
There is also one Dummett. By their works shall ye know them. However, just as
no trinities have fourth persons (Zeppo Marx notwithstanding), Bummett is hardly
known by his works. Indeed, Bummett does not exist. It is part of the function
of this and other e-mail messages, therefore, to do what they can to create him.
More information about the relaxng-user
mailing list