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

  • Home
  • SEARCH
  • 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 3396710
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:26:25+00:00 2026-05-18T04:26:25+00:00

I am taking my first steps in XML-schema land, using XSD, and I’m trying

  • 0

I am taking my first steps in XML-schema land, using XSD, and I’m trying to figure out how to add a constraint such that an attribute (defined with a fixed value) may only be present on one element in an unbounded set of elements.

Here’s an example

<Object>
    <Element>Value1</Element>
    <Element>Value2</Element>
    <Element Default="true">Value3</Element>
    <Element>Value4</Element>
    <Element>Value5</Element>
</Object>

I’d like to constrain the Default attribute such that it cannot appear on more than one Element.

Here’s the XSD schema for the above:

<xs:element name="Object">
    <xs:complexType>
        <xs:element name="Element" maxOccurs="unbounded">
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="Default" fixed="true"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:element>
    </xs:complexType>
</xs:element>

I’ve tried messing with xs:unique, xs:selector and xs:field, but reached no meaningful results, not sure if that’s the correct approach.

Thanks!

  • 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-18T04:26:25+00:00Added an answer on May 18, 2026 at 4:26 am

    I tried my best to design one xsd for you. The possible way to achieve the requirement is to define element element more than ones, but this is not allowed under XSD causing a popular error “trying to make XSD Ambiguous”

    So your requirement is certainly impossible to achieve as is.

    I would like to suggest to define different Element names.

    example :: define DefElement with attribute and unbounded Elements without attribute. It would work for you.

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

Sidebar

Related Questions

I am taking my first teetering steps with submitting Html forms using jQuery. All
I'm trying to integrate my project with Facebook. I'm taking baby steps at first
I am taking my first steps programming in Lua and get this error when
I am taking my first steps with MsTest and Moq and would like to
I'm just taking my first steps with Azure and the first thing I see
I am taking my first steps (or perhaps my last steps) in GTK# on
I'm taking my first steps with JPA (Hibernate). The overall idea is to connect
I am taking my first steps in Android and am starting with a very
I'm taking my first steps with nant and nantcontrib so please bear with me!
I am taking my first steps in the world of iPhone/iPad development with MonoTouch

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.