XML

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Redefine and Import used together - is this valid?

    1 answers - 2097 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    PGP SIGNED MESSAGE
    Hash: SHA1
    Danny Vint writes:
    I have the following situation:
    1) Base industry standard schema (ACRD)
    2) A schema that imports the ACRD schema (to reuse data types and
    some elements) that defines my organizations new elements and
    aggregates (ACME)
    3) A schema that redefines #1 ACRD to modify existing elements and
    aggregates to include my new ACME elements.
    I then have a docuemnt instance the references #3.
    Xerces and XSV say my document and schemas are valid.
    XSV accepts your package because it never processes a namespaced
    schema document more than once if it can avoid it, so the nested,
    potentially problematic, import in (2), does not cause a problem
    because the ACRD schema document has already been processed (during
    the processing of (3), so the 'schemaLocation' of the import in (2) is
    ignored).
    This is conformant behaviour, because the REC says that
    'schemaLocation' on <xs:importis a hint, which need not be followed.
    But it's not _required_ behaviour, for better or worse.
    I'd like to see a way for users to mandate such behaviour. . .
    ht
    - --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail: ht (AT) inf (DOT) ed.ac.uk
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
    PGP SIGNATURE
    Version: GnuPG v1.2.6 (GNU/Linux)
    FiqsAYY5s2Dfk/Y3uq1A=
    =3fsp
    PGP SIGNATURE
    XML-DEV is a publicly archived, unmoderated list hosted by ASIS
    to support XML implementation and development. To minimize
    spam in the archives, you must subscribe before posting.
    [Un]Subscribe/change address:
    unsubscribe: xml-dev-unsubscribe (AT) lists (DOT) xml.org
    subscribe: xml-dev-subscribe (AT) lists (DOT) xml.org
    List archive:
    List Guidelines:
  • No.1 | | 3512 bytes | |

    PGP SIGNED MESSAGE
    Hash: SHA1

    Danny Vint writes:

    [not happy depending on optionality of following 'schemaLocation' hint]

    Let's go back to your requirements.

    Here is a minimal example of your (1) -- (3):

    (1) ACRD.xsd:
    <xs:schema targetNamespace="http://www.example.com/ACRD">
    <xs:complexType name="ACType">
    <xs:sequence>
    <xs:element name="AElt1"/>
    <xs:element name="AElt2"/>
    </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="ASType">
    <xs:restriction base="xs:token">
    <xs:enumeration value="red"/>
    <xs:enumeration value="white"/>
    <xs:enumeration value="blue"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:schema>

    (2) ACME.xsd:
    <xs:schema xmlns:ac="http://www.example.com/ACRD"
    targetNamespace="http://www.example.com/ACME">
    <xs:import namespace="http://www.example.com/ACRD"
    schemaLocation="ACRD.xsd"/>
    <xs:element name="MyE" type="ac:ASType"/>
    </xs:schema>

    (3) AA.xsd:
    <xs:schema targetNamespace="http://www.example.com/ACRD"
    xmlns:ac="http://www.example.com/ACRD"
    xmlns:my="http://www.example.com/ACME">
    <xs:import namespace="http://www.example.com/ACME"
    schemaLocation="ACME.xsd"/>
    <xs:redefine schemaLocation="ACRD.xsd">
    <xs:complexType name="ACType">
    <xs:complexContent>
    <xs:extension base="ac:ACType">
    <xs:sequence>
    <xs:element ref="my:MyE"/>
    </xs:sequence>
    </xs:extension>
    </xs:complexContent>
    </xs:complexType>
    </xs:redefine>
    </xs:schema>

    So, as you already observed, this works with XSV, but not with all
    tools.

    The problem arises when ACRD.xsd is processed twice, producing two
    conflicting definitions of ACType.

    So, to fix this, we want to prevent the double processing. Proposed
    solution (I don't have access to the tool you're having trouble with):
    remove the offending hint.

    That is, change ACME.xsd:
    <xs:schema xmlns:ac="http://www.example.com/ACRD"
    targetNamespace="http://www.example.com/ACME">
    <xs:import namespace="http://www.example.com/ACRD"/>
    <xs:element name="MyE" type="ac:ASType"/>
    </xs:schema>

    This is still a valid schema document. And now processing AA.xsd
    should not provoke any conflicts, as only the redefined type
    definition will be created.

    Hope this helps,

    ht
    - --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail: ht (AT) inf (DOT) ed.ac.uk
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
    PGP SIGNATURE
    Version: GnuPG v1.2.6 (GNU/Linux)

    uq5THzzXuL83hDTdyPv7lv4=
    =trT+
    PGP SIGNATURE

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

    [Un]Subscribe/change address:
    unsubscribe: xml-dev-unsubscribe (AT) lists (DOT) xml.org
    subscribe: xml-dev-subscribe (AT) lists (DOT) xml.org
    List archive:
    List Guidelines:

Re: Redefine and Import used together - is this valid?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "XML"

EMSDN.COM