Extensible and Open?

I wrote in the introduction to this chapter that the notions of “extensible” and “open” are largely independent. After all you have seen, you might even think that opening a schema can be an impediment to its extensibility. Let’s say I have written an open model for the content of the book element that allows foreign nodes:

  <define name="book-content">
    <interleave>
      <attribute name="id"/>
      <attribute name="available"/>
      <element name="isbn">
        <ref name="isbn-content"/>
      </element>
      <element name="title">
        <ref name="title-content"/>
      </element>
      <zeroOrMore>
        <element name="author">
          <ref name="author-content"/>
        </element>
      </zeroOrMore>
      <zeroOrMore>
        <element name="character">
          <ref name="character-content"/>
        </element>
      </zeroOrMore>
      <ref name="foreign-nodes"/>
    </interleave>
  </define>

or:

 book-content =
    attribute id { text }
  & attribute available { text }
  & element isbn { isbn-content }
  & element title { title-content }
  & element author { author-content }*
  & element character { character-content }*
  & foreign-nodes

I have independently applied the tips for building an extensible schema (using interleave and containers) and also for defining an open schema (referencing a wildcard to allow foreign nodes). Unfortunately, if my schema is open, it’s no longer very extensible.

Imagine that I want to add a couple of XLink attributes to define a link to a web page. I can’t combine this new attribute with the existing schema using interleave. This new attribute would be considered a ...

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.