OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

office-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [office-comment] Ambiguity problems caused by ID/IDREF


Dear Murata-san,

I have made some experiments with the schema changes you have suggested, 
but still get error reports from jing (without the -i option), and msv, 
if warnings are enabled.

My modified definition for "anyAttListOrElements" is below. I had 
previously replaced all attributes of type ID with an xml:id attribute. 
For that reason xml:id is the only attribute of type ID.

One of the messages I get from jing is:

"error: an "element" pattern containing an "attribute" pattern with a 
non-null ID-type must have a name class that contains only "choice" and 
"name" elements"

MSV reports

"The "ID" type has ID semantics and therefore the enclosing element 
pattern must have a simple name."

and similar messages for the other attributes.

The reason for these messages seems to be the third item of the list in 
section 4 of the RNG DTD Compatibility specification:

"A RELAX NG schema is compatible with this feature if and only if, after 
schema simplification, for each data or value element that specifies a 
datatype associated with a non-null ID-type, all of the following hold:

[...]

     * the first child of the element ancestor is a name element"

If I read this correctly, then DTD Compatibility specification does 
allow to define an ID attribute only for elements that have a specific 
name, but not for elements that have an arbitrary name, that is, whose 
names are specified by name classes. Is my understanding correct?

If yes, then this actually seems to be an issue for the xml:id 
attribute, that we must allow in our definitions of "any content", but 
there we do not know at the time we write the schema at which elements 
it may occur. For all other attributes, I could imagine that there is a 
solution which is based either on not permitting the attributes (this 
may work in case of math), or defining the names of the elements where 
they can occur (this is some effort, but it at least should be 
possible). But for xml:id, that does not work. We can neither forbid the 
attribute, nor seems there to be a solution that allow it at arbitrary 
elements that is compatible with the RNG DTD Compatibility specification.

Do you agree, or do you have an idea how adapt the schema that it allows 
xml:id within the "any content" definitions in a way that is compatible 
to the DTD Compatibility specification?

Best regards

Michael

<define name="anyAttListOrElements">
   <zeroOrMore>
     <choice>
       <attribute>
         <anyName>
	  <except>
             <name>xml:id</name>
             <name>text:continue-list</name>
             <name>text:change-id</name>
             <name>draw:nav-order</name>
             <name>draw:start-shape</name>
             <name>draw:end-shape</name>
             <name>draw:control</name>
             <name>draw:caption-id</name>
             <name>draw:shape-id</name>
             <name>presentation:master-element</name>
             <name>smil:targetElement</name>
           </except>
         </anyName>
         <text/>
       </attribute>
       <attribute name="xml:id">
<ref name="ID"/>
       </attribute>
       <attribute name="text:continue-list">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="text:change-id">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="draw:nav-order">
         <ref name="IDREFS"/>
       </attribute>
       <attribute name="draw:start-shape">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="draw:end-shape">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="draw:control">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="draw:caption-id">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="draw:shape-id">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="presentation:master-element">
         <ref name="IDREF"/>
       </attribute>
       <attribute name="smil:targetElement">
         <ref name="IDREF"/>
       </attribute>
     </choice>
   </zeroOrMore>
</define>

MURATA Makoto (FAMILY Given) wrote:
> Dear colleagues,
> 
> The RNG schema for ODF 1.0 is "correct" (as defined in ISO/IEC
> 197575-2), but is it not compatible (as defined in  "RELAX NG DTD
> Compatibility"), as Alex correctly pointed out.
> 
> For example, consider the form:id attribute.  It is defined as
> ID. After schema normalization (as defined in ISO/IEC 197575-2), this
> attribute will occur in the define element for <form:text>. That
> define element competes with the definition of anyElements.  However,
> the definition of anyElements does not specify the attribute form:id
> as an ID.  Therefore, the condition in the last bullet of the first
> itemized list of Section 3 of "RELAX NG DTD Compatibility" is not
> satisfied.
> 
> One way to solve this problem is to replace
> 
> mathMarkup =
>   (attribute * { text }
>    | text
>    | element * { mathMarkup })*
> 
> 
> by 
> 
> mathMarkup =
>   (attribute * -  (anim:id
>               | draw:control
>               | draw:end-shape
>               | draw:id
>               | draw:shape-id
>               | draw:start-shape
>               | form:id
>               | presentation:master-element
>               | smil:targetElement
>               | text:change-id
>               | text:id)  { text }
>    | attribute anim:id { ID }
>    | attribute draw:control { IDREF }
>    | attribute draw:end-shape { IDREF }
>    | attribute draw:id { ID }
>    | attribute draw:shape-id { IDREF }
>    | attribute draw:start-shape { IDREF }
>    | attribute form:id { ID }
>    | attribute presentation:master-element { IDREF }
>    | attribute smil:targetElement { IDREF }
>    | attribute text:change-id { IDREF }
>    | attribute text:id { ID }
>    | text
>    | element * { mathMarkup })*
> 
> and replace 
> 
> anyAttListOrElements =
>   attribute * { text }*,
>   anyElements
> 
> by
> 
> anyAttListOrElements =
>   attribute * -  (anim:id
>       | draw:control
>       | draw:end-shape
>       | draw:id
>       | draw:shape-id
>       | draw:start-shape
>       | form:id
>       | presentation:master-element
>       | smil:targetElement
>       | text:change-id
>       | text:id) { text }*,
>   (attribute anim:id { ID }
>    | attribute draw:control { IDREF }
>    | attribute draw:end-shape { IDREF }
>    | attribute draw:id { ID }
>    | attribute draw:shape-id { IDREF }
>    | attribute draw:start-shape { IDREF }
>    | attribute form:id { ID }
>    | attribute presentation:master-element { IDREF }
>    | attribute smil:targetElement { IDREF }
>    | attribute text:change-id { IDREF }
>    | attribute text:id { ID })*,
>   anyElements
> 
> After this change, jing does not complain.  (But remember that jing
> does not check a:defaultValue.)
> 
> You might want to be more specific.  For example, the definition of
> mathMarkup can be:
> 
> mathMarkup =
>   attribute local:*  { text }
>    | attribute xlink:href { text }
>    | attribute xlink:type { text }
>    | text
>    | element mml:* { mathMarkup })*
> 
> where 
> 
> namespace local = ""
> namespace mml = "http://www.w3.org/1998/Math/MathML";
> 
> 
> 


-- 
Michael Brauer, Technical Architect Software Engineering
StarOffice/OpenOffice.org
Sun Microsystems GmbH             Nagelsweg 55
D-20097 Hamburg, Germany          michael.brauer@sun.com
http://sun.com/staroffice         +49 40 23646 500
http://blogs.sun.com/GullFOSS

Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1,
	   D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]