← Prev in month ← Prev in thread
Next in thread → Next in month →

Re: [xml-dev] How to create an XML language that is the intersection of two XML languages?

From
Rick Jelliffe <>
To
"Roger L. Costello" <>
Date
2013-12-31T23:16:12Z
ID
<>
Thread
Re: [xml-dev] How to create an XML language that is the intersection of two XML languages?

The mechanism is simply to validate twice, first against one schema and second against the other. (It is one way of handling inherited exclusion exceptions: James Clark modeled html A not under A that way in RNG IIRC.)

ISO DSDL was designed to allow you to specify this kind of thing in nice tractable layers; and Schematron has always had parallel patterns. The closest that xsd provides in this space is probably the substitution group.

In general, you cannot validate a document against two closed schemas (grammars) unless they are derived (in a looser sense than xsd derivation) from a common base (whether notional or real).

Open schemas are a different matter.
Rick

On 31/12/2013 9:00 AM, "Costello, Roger L." <[email protected]> wrote:
Hi Folks,

Suppose person #1 creates an XML language for Books:

    <xs:element name="Books">
        ...
    </xs:element>

Person #2 creates an XML language for Magazines:

    <xs:element name="Magazines">
        ...
    </xs:element>

Now, person #3 can reuse them to create an XML language that is the union of Books and Magazines:

    <xs:element name="BookStore">
        <xs:complexType>
            <xs:choice>
                <xs:element ref="Books" />
                <xs:element ref="Magazines" />
            </xs:choice>
        </xs:complexType>
    </xs:element>

Neat! We can create an XML language that is the union of two XML languages, without any changes to them.

What about intersection, can we create an XML language that is the intersection of two XML languages?

Suppose person #4 creates an XML language consisting of a mixture of an arbitrary number of <A> and <B> elements:

    <xs:group name="As-and-Bs">
        <xs:sequence maxOccurs="unbounded">
            <xs:element name="A" minOccurs="0"> ... </xs:element>
            <xs:element name="B" minOccurs="0"> ... </xs:element>
        </xs:sequence>
    </xs:group>

Person #5 creates an XML language consisting of a mixture of an arbitrary number of <B> and <C> elements:

    <xs:group name="Bs-and-Cs">
        <xs:sequence maxOccurs="unbounded">
            <xs:element name="B" minOccurs="0"> ... </xs:element>
            <xs:element name="C" minOccurs="0"> ... </xs:element>
        </xs:sequence>
    </xs:group>

Now, person #6 wants to reuse them to create an XML language that is the intersection of the two languages.

How would person #6 create this intersection language (without any change to the As-and-Bs language or the Bs-and-Cs language)?

/Roger





_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: [email protected]
subscribe: [email protected]
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
← Prev in month ← Prev in thread
Next in thread → Next in month →