Query on elementFormDefault & Restrictions (using AltovaXmlSpy)

Discussion in 'XML' started by dickster, Feb 16, 2006.

  1. dickster

    dickster Guest

    I have a query surrounding about elementFormDefault

    I have abbreviated the schemas - and hopefully have included all the
    relevant information

    I get the following error message (AltovaXmlSpy-when I click validate)
    in Schema1.xsd:
    "The content model of complex type '{no name}' is not a valid
    restriction of the content model of complex type 'origo:TimePeriod'"

    What does this mean? - when I switch elementFormDefault to "qualified"
    I DONT GET ANY ERROR MESSAGE :-|

    ---------------------------------------------------------------------------------------
    Schema1.xsd
    ---------------------------------------------------------------------------------------
    <xsd:schema
    xmlns:eek:rigo="http://www.origoservices.com"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.origoservices.com"
    elementFormDefault="unqualified"
    attributeFormDefault="unqualified">

    <xsd:include schemaLocation="Schema2.xsd"/>

    <xsd:complexType name="product">
    <xsd:sequence>
     
    dickster, Feb 16, 2006
    #1
    1. Advertising

  2. dickster wrote:

    > I have a query surrounding about elementFormDefault


    > I get the following error message (AltovaXmlSpy-when I click validate)
    > in Schema1.xsd:
    > "The content model of complex type '{no name}' is not a valid
    > restriction of the content model of complex type 'origo:TimePeriod'"
    >
    > What does this mean? - when I switch elementFormDefault to "qualified"
    > I DONT GET ANY ERROR MESSAGE :-|


    You might want to use that then, if you want to define elements in a
    namespace then using elementFormDefault="qualified" is usually what you
    want and need to easily and consistently define your elements in the
    target namespace specified.



    > <xsd:schema
    > xmlns:eek:rigo="http://www.origoservices.com"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    > targetNamespace="http://www.origoservices.com"
    > elementFormDefault="unqualified"
    > attributeFormDefault="unqualified">



    > <xsd:element name="start_date" type="origo:Date"/>


    If you use elementFormDefault="unqualified" then I think you need
    <xsd:element name="origo:start_date"
    to fit the definitions in the other included schema.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 16, 2006
    #2
    1. Advertising

  3. dickster writes:

    > I have a query surrounding about elementFormDefault
    >
    > I have abbreviated the schemas - and hopefully have included all the
    > relevant information
    >
    > I get the following error message (AltovaXmlSpy-when I click validate)
    > in Schema1.xsd:
    > "The content model of complex type '{no name}' is not a valid
    > restriction of the content model of complex type 'origo:TimePeriod'"


    The base complex type includes an element declaration which accepts
    EIIs whose expanded name is {http://www.origoservices.com, start_date}

    Your restriction attempts to restrict that with an element declaration
    which accepts EIIs whose expanded name is {[none],start_date}.

    The difference arises because only elementFormDefault is 'qualified'
    in the base schema document and 'unqualified' in yours, and that's
    what determines whether element declarations within complex type
    definitions acquire the target namespace of the enclosing schema
    document.

    ht
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Feb 20, 2006
    #3
  4. dickster

    dickster Guest

    Thanks for your reply Martin.

    When I keep the elementFormDefault attribute consistent between each
    Schema it works fine.

    dickster
     
    dickster, Feb 20, 2006
    #4
    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.
Similar Threads
  1. Replies:
    0
    Views:
    536
  2. Dan Platton

    character restrictions in names

    Dan Platton, Aug 27, 2003, in forum: Java
    Replies:
    0
    Views:
    304
    Dan Platton
    Aug 27, 2003
  3. Dan Platton

    character restrictions in names

    Dan Platton, Aug 27, 2003, in forum: Java
    Replies:
    0
    Views:
    308
    Dan Platton
    Aug 27, 2003
  4. Rick Osborn
    Replies:
    5
    Views:
    523
    zn├┤rt
    Feb 23, 2004
  5. daz_oldham
    Replies:
    6
    Views:
    72,546
    andyC
    Jan 18, 2008
Loading...

Share This Page