Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3234238
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:22:05+00:00 2026-05-17T17:22:05+00:00

I have following XML schema: <?xml version=1.0 encoding=UTF-8 standalone=no?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element name=content type=contentType/>

  • 0

I have following XML schema:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="content" type="contentType"/>

    <xs:complexType name="contentType">
        <xs:complexContent>
            <xs:extension base="versionedElementType">  
                <xs:sequence>   
                    <xs:element name="item" type="itemType" minOccurs="1" maxOccurs="unbounded" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="itemType" mixed="true"> 
        <xs:complexContent>
            <xs:extension base="itemTypeBase">
                    <xs:sequence>   
                        <xs:element name="order" type="xs:unsignedInt"/>
                        <xs:element name="id" type="xs:string"/>
                    </xs:sequence>
            </xs:extension> 
        </xs:complexContent>
    </xs:complexType>

    <!-- Simple type convert to complex type -->
    <xs:complexType name="itemTypeBase" mixed="true">
        <xs:simpleContent>  
            <xs:extension base="itemDescriptionType">
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <!-- Simple type -string restriction -->
    <xs:simpleType name="itemDescriptionType" >
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="64"/>
        </xs:restriction>   
    </xs:simpleType>


    <xs:complexType name="versionedElementType">
        <xs:attribute name="version" type="xs:string" use="required"/>
    </xs:complexType>

</xs:schema>

which I use to validate this XML instance (I want to mix the text in the ‘item’ element with sub-elements ‘order’ and ‘id’):

<?xml version="1.0" encoding="UTF-8"?>
<content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="Content.xsd"
         version ="1.0">

  <item>Description here...
  <order>2</order>
  <id>2</id>
  </item>  
</content>

Whatever I did the validation still says taht there is an error:

The content type of a derived type and that of its base must both be mixed or both be element-only. Type ‘itemType’ is mixed, but its base type is not.

But I can see that both types – itemType and itemTypeBase are MIXED!!

Thanks a lot
STeN

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:22:06+00:00Added an answer on May 17, 2026 at 5:22 pm

    First of all the error which I see if I open your schema in Visual Studio 2010 is:

    The derived type and the based type
    must have the same content type.

    In you current schema the type itemTypeBase is defined with respect of the <xs:simpleContent> and derived type itemType with the respect of <xs:complexContent> which is not allowed. Either you allow no sub-elements and use <xs:simpleContent> or you do use child elements and use <xs:complexContent>.

    I personally don’t like and don’t use mixed types. If I understand you correct you want to make some restrictions in the text from the content. You want to have the content length between 1 and 64 characters. But <order>2</order>, <id>2</id> and all whitespace, inclusive the new line characters, are also a part of the content. If you want that <item> has simple content, then you can not insert child elements inside.

    So the pragmatical solution would be go away from the mixed model and use the XML document in the form

    <?xml version="1.0" encoding="utf-8"?>
    <content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="Content.xsd"
             version ="1.0">
        <item>
            <description>Description here...</description>
            <order>2</order>
            <id>2</id>
        </item>
    </content>
    

    where Content.xsd is

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    
        <xs:element name="content" type="contentType"/>
    
        <xs:complexType name="contentType">
            <xs:sequence>   
                <xs:element name="item" type="itemType"
                            minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
            <xs:attribute name="version" type="xs:string" use="required"/>
        </xs:complexType>
    
        <xs:complexType name="itemType"> 
            <xs:sequence>
                <xs:element name="description" type="itemDescriptionType"/>
                <xs:element name="order" type="xs:unsignedInt"/>
                <xs:element name="id" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    
        <xs:simpleType name="itemDescriptionType" >
            <xs:restriction base="xs:string">
                <xs:minLength value="1"/>
                <xs:maxLength value="64"/>
            </xs:restriction>   
        </xs:simpleType>
    
    </xs:schema>
    

    All will be very simple and clear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following .xsd code: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema id=MyDataSet> <xs:element name=Row>
I have the following xml schema: <?xml version=1.0 encoding=utf-8?> <xsd:schema xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:xsd=http://www.w3.org/2001/XMLSchema attributeFormDefault=unqualified
I have the following start of an XSD: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:no=http://www.sychophants.com>
I have the following schema: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:m=http://ws.mypackage.com xmlns:xmime=http://www.w3.org/2005/05/xmlmime elementFormDefault=qualified targetNamespace=http://ws.mypackage.com
I have the following in my dispatcher-servlet.xml <?xml version=1.0 encoding=UTF-8?> <beans xmlns=http://www.springframework.org/schema/beans xmlns:mvc=http://www.springframework.org/schema/mvc xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
I have the following XML Document: <?xml version=\1.0\ encoding=\UTF-8\?> <atom:entry xmlns:atom=\http://www.w3.org/2005/Atom\ xmlns:apps=\http://schemas.google.com/apps/2006\ xmlns:gd=\http://schemas.google.com/g/2005\> <apps:property
I have the following xml - <Surveys xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=ImmForm XML Schema NHS Direct.xsd><Svy SurveyName=WeeklyFluSurveillance2012/13-NHSDirectWeek40w/e07/10/2012
I have the following XML document <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' xmlns:issues='http://schemas.google.com/projecthosting/issues/2009' gd:etag='W/DEAERH47eCl7ImA9WhZTFEQ.'><id>http://code.google.com/feeds/issues/p/chromium/issues/full/921</id><published>2008-09-03T22:51:22.000Z</published><updated>2011-03-19T01:05:05.000Z</updated><title>Incorrect rendering</title><content
I have the following XML: <?xml version=1.0?> <coll xmlns=http://www.example.org/coll xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.example.org/coll coll.xsd> <collection> <item
I have the following xsd files: SchemaA <?xml version=1.0 encoding=utf-8?> <xs:schema targetNamespace=http://schemaA elementFormDefault=qualified xmlns=http://schemaA

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.