xml schema: limitations on <redefine>?

Discussion in 'XML' started by Michael Bane, Sep 11, 2003.

  1. Michael Bane

    Michael Bane Guest

    Am I right in thinking that...

    1) in <redefine> I can either extend OR restrict a type but not both?

    2) in <redefine> it's not possible to change a type from say
    <xs:string> to <xs:integer>?

    3) if I have schema1.xsd with

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.cs.man.ac.uk/cnc/schema/gcf"
    xmlns="http://www.cs.man.ac.uk/cnc/schema/gcf"
    attributeFormDefault="unqualified">
    <xs:complexType name="pname">
    <xs:sequence>
    <xs:element name="first" type="xs:integer" />
    <xs:element name="last" type="xs:string" />
    </xs:sequence>
    </xs:complexType>
    <xs:element name="customer" type="pname" />
    </xs:schema>

    and then schema2.xsd redefines 'pname' viz:

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.cs.man.ac.uk/cnc/schema/gcf"
    xmlns="http://www.cs.man.ac.uk/cnc/schema/gcf"
    attributeFormDefault="unqualified">

    <xs:redefine schemaLocation="redefined.xsd">
    <xs:complexType name="pname">
    <xs:complexContent>
    <xs:extension base="pname">
    <xs:sequence>
    <xs:element name="country" />
    </xs:sequence>
    </xs:extension>
    </xs:complexContent>
    </xs:complexType>
    </xs:redefine>

    <xs:element name="author" type="pname" />
    </xs:schema>

    am I right in thinking that type 'pname' then has three child
    elements, 'first', 'last' and 'country'? and therefore that 'author'
    has these 3 fields? In which case, why does XMLspy (version 4.4) only
    show 'author' with the original 2 fields? Is there a free equilavent
    to XMLspy (particularly for graphical representation of schema)?

    Many thanks!
    Michael Bane
    http://www.cs.man.ac.uk/~bane
     
    Michael Bane, Sep 11, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page