Ambiguity in RNC grammar
"Jeff Rafter" <[email protected]> Sat, 8 May 2004 09:29:47 -0700
| Newsgroups | gmane.text.xml.relaxng.general |
|---|---|
| Message-ID | <00ef01c43519$adc57530$6403a8c0@ARIMATHEA> |
I have just about finished the translator I am working on for RNC->RNG. I
stumbled upon what I think is an ambiguity in the grammar. Because XML
allows for a "-" in a name, and RNC allows for "-" as part of a dataExcept
(or nameExcept)-- I think that there is a collision. Consider:
start = foo
foo = element foo { string-chars }
string-chars = element string-chars { string }
chars = "????????"
In the declaration of the element foo, what is expected? The child element
string-chars, or a string minus the value of chars?
This is obviously fringe case-- but then, that was why I wrote my own
parser/translator was to learn all of the fringe cases. Jing and
XMLDistilled are treating it as an XML name char (when there are no
spaces)-- which is what I was doing as well. This suggests that the
ambiguity could be clarified very easily with an addition to the
tokenization section about the precedence of "-".
In general this is good but can create other problems:
start = foo
foo = element foo { xsd:int-xsd:byte }
XMLDistilled passes this file, where Jing raises an error "datatype
'int-xsd' ... not recognized".
Is there a recommendation?
Thanks,
Jeff Rafter