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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:31:47+00:00 2026-05-23T11:31:47+00:00

Short-form question: Can an xsd:enumeration tag have a required attribute, as in any tag

  • 0

Short-form question: Can an xsd:enumeration tag have a required attribute, as in any tag that uses this enumeration MUST use the specific enumeration value at least once?

Details: For example, let’s say that I have already defined a fruit xml tag in my xsd. The fruit tag has an attribute whose value is the enumeration FruitType. It is define as such:

<xsd:simpleType name="FruitType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Apple" />
<xsd:enumeration value="Banana" />
<xsd:enumeration value="Peach" />
<xsd:enumeration value="Orange" />
</xsd:restriction>
</xsd:simpleType>

I want to make the Apple enumeration value required such that the user must have at least one fruit tag with the attribute Apple. Is it possible to use such a tag in xsd enumeration? I thought that maybe we can put use=”required” or minOccurs=”1″ in the xsd:enumeration tag. Please let me know.

Thank you!

  • 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-23T11:31:47+00:00Added an answer on May 23, 2026 at 11:31 am

    What do you mean by “the user must have at least one fruit tag with the attribute Apple”. Do you mean this value must appear somewhere in each instance document if the document is to be valid? Or within some narrower scope (say within a FruitBasket element)? In both cases, that’s not a property of the enumeration type, it’s a constraint on the element or document in question.

    I don’t think there’s any way of doing this in XSD 1.0. In XSD 1.1, like most things, it can be done with assertions. For example

    <xs:element name="FruitBasket">
      ...
      <xs:assert test=".//Fruit = 'Apple'"/>
    </xs:element>
    

    XSD 1.1 is currently implemented in Xerces and Saxon.

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

Sidebar

Related Questions

The short version of this question is: How can I take data that only
I didn’t found short form for this question as subject… Is it possible to
This question can have different answers because everyone would do it his own way.
I'm trying to create an Advanced Searching form that sort of look like this
I have a form with some controls. (Actually, this is a sort of ongoing
I know this question has been asked several times, but I can't quite seem
This question is so basic that I'm almost embarrassed to ask it, but it's
(Apologies in advance if this question is short on details, I'll watch the comments
This is SQL Server question but I would appreciate the answers form other DBMS
I have a noob question but he, i'm learning :-) I'm making a form

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.