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 6914759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:23:21+00:00 2026-05-27T09:23:21+00:00

Imagine I have a basic.xsd file defining some attribute myAttribute in some element myElement

  • 0

Imagine I have a basic.xsd file defining some attribute myAttribute in some element myElement as a xsd:string.

Now I would like to import this basic.xsd in my special.xsd and make the definition of myAttribute stricter, only allowing the value a or b. Some other implementer of the anotherSpecial.xsd might want to restrict the possible values to lorem and ipsum.

How can this be done? Can I make the attribute abstract?

  • 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-27T09:23:21+00:00Added an answer on May 27, 2026 at 9:23 am

    Attributes or elements cannot be “redefined”; so you will have to make sure that your attribute is of a simple type that is defined globally; whether the attribute is global or not, it’ll not make a difference. Attributes, unlike elements, cannot be marked as abstract.

    I’ll take it literally that you want to change the domain of values for an attribute associated with an element in basic.xsd, and nothing else. This is how I would do it:

    basic.xsd

    <?xml version="1.0" encoding="utf-8" ?>
    <!--XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com)-->
    <xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
        elementFormDefault="qualified"
        xmlns="http://tempuri.org/XMLSchema.xsd"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="myElement">
            <xsd:complexType>
                <xsd:simpleContent>
                    <xsd:extension base="xsd:string">
                        <xsd:attribute name="myAttribute" type="tmyAttribute"/>
                    </xsd:extension>
                </xsd:simpleContent>
            </xsd:complexType>
        </xsd:element>  
    
        <xsd:simpleType name="tmyAttribute">
            <xsd:restriction base="xsd:string"/>
        </xsd:simpleType>
    </xsd:schema>
    

    Valid sample XML:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
    <myElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" myAttribute="myAttribute1" xmlns="http://tempuri.org/XMLSchema.xsd">myElement1</myElement>
    

    special.xsd

    <?xml version="1.0" encoding="utf-8" ?>
    <!--XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com)-->
    <xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
        elementFormDefault="qualified"
        xmlns="http://tempuri.org/XMLSchema.xsd"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:redefine schemaLocation="basic.xsd">
            <xsd:simpleType name="tmyAttribute">
                <xsd:restriction base="tmyAttribute">
                    <xsd:enumeration value="a"/>
                    <xsd:enumeration value="b"/>
                </xsd:restriction>
            </xsd:simpleType>       
        </xsd:redefine>
    </xsd:schema>
    

    When validating against special.xsd, the above XML is now invalid; change the myAttribute attribute value in the sample XML to a, and it’ll work.

    If someone using this XSD has an issue with the redefine, as an e.g. tools that bind XSDs to code, then I would look at an XML Schema refactoring tool that can take your special.xsd and automatically converted to its equivalent format, without the xsd:redefine. What you would practically be doing is to keep the “intelectual property” that is in special.xsd separate from basic.xsd; while changes to the basic.xsd could automatically be maintained and made visible to the consumers of the special.xsd without one having to “recode” XSD over and over again…

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

Sidebar

Related Questions

Imagine I have table like this: id:Product:shop_id 1:Basketball:41 2:Football:41 3:Rocket:45 4:Car:86 5:Plane:86 Now, this
I have a pretty basic question that I imagine would require a join to
Probably a very basic beginner question. Imagine the following situation: I have an ASP.NET
Imagine we have a program trying to write to a particular file, but failing.
Imagine I have String in C#: I Don’t see ya.. I want to remove
Imagine I have the folling XML file: <a>before<b>middle</b>after</a> I want to convert it into
Imagine I have a property defined in global.asax. public List<string> Roles { get {
I have 3d mesh and I would like to draw each face a 2d
I want a basic: <input type=text /> And I would like the default value
imagine i have 3 Entities, Basic <- Sub <- SubSub . I want to

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.