Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Overloading element names

From: McSwell <maxwell@------.---.--->
To: NULL
Date: 3/7/2009 8:43:00 AM
I have written an XML schema using RNG, and some XML docs that
(according to xmllint) conform to that schema.  I noticed recently
that I did something odd, and I'm surprised that xmllint hasn't
complained.  The oddity is similar to what, in object oriented
programming circles, is called "overloading".

Specifically, I have two different element definitions in the same
namespace that use the same name.  There's maybe a good reason for
that; one of them defines an object, assigning it an ID, while the
other points to the defined object using an IDREF.

Here's an example.  First the parts of the schema, simplified:

   <define name="TerminalUnitType" combine="choice">
       <ref name="Phoneme"/> <!--Defined below-->
   </define>
   <define name="TerminalUnitType" combine="choice">
       <ref name="Grapheme"/> <!--Defined below-->
   </define>
   ... (more TerminalUnitType defns)...

   <define name="Phoneme" combine="choice">
       <element name="Phoneme">
           ...define some attrs, including id...
       </element>
   </define>
   ...
   <define name="Ref2Phoneme" combine="choice">
       <element name="Phoneme">
           <attribute name="idref"/>
       </element>
   </define>

Notice that I've defined the element "Phoneme" twice: the first time
with an id (and some other stuff, not shown), and the second time with
an idref.  The XML doc follows this; there are instances of Phonemes
that have the id etc.:
    <Ph:Phoneme id="phDDA" spelling="\u09A1"/>
and there are instances of Phonemes that have just the idref:
   <Ph:Phoneme idref="phDDA"/>

How did I get away with this?  Is it because I used <define
name="TerminalUnitType" combine="choice">?  (Looking back, I'm not
sure that defining the TerminalUnitType bought me anything.)

And is it a Bad Idea to define the name twice?  Conceptually, both
indeed represent phonemes, although I'm thinking maybe I should call
the first one (the one with the 'id' attr) "PhonemeDefinition" instead
of "Phoneme".

Thoughts?

   Mike Maxwell


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent