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

The Archive Base Latest Questions

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

I want to specify that either fieldname or freetext must always be present in

  • 0

I want to specify that either fieldname or freetext must always be present in XML files that apply to this XSD. Is there a way to do that?

<xs:complexType name="tSome">
<xs:sequence>
  <!-- either one of the two below has to be present. -->
  <xs:element name="fieldname" type="xs:string" />
  <xs:element name="freetext" type="xs:string" />
  <!-- this one below must always be present -->
  <xs:element name="dbtablename" type="xs:string" />
</xs:sequence>
</xs:complexType>
  • 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-14T03:23:28+00:00Added an answer on May 14, 2026 at 3:23 am

    There is a Choice Indicator in XML Schema, which allows you to take one of the contained elements, but not two or more. If you want any 2 of 3, I suggest doing something like this:

    <xs:choice>
      <xs:element name="fieldname" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="freetext" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="dbtablename" type="xs:string" minOccurs="0" maxOccurs="1" />
    </xs:choice>
    <xs:choice>
      <xs:element name="fieldname" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="freetext" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="dbtablename" type="xs:string" minOccurs="0" maxOccurs="1" />
    </xs:choice>
    

    (Maybe maxOccurs will prevent you from choosing one and the same element twice.)
    If that does not work, nothing will I think.

    Edited: I didn’t correctly understand the question the first time. If you want dbtablename to always be present with any one of fieldname or freetext, then this is the answer:

    <xs:complexType name="tSome">
    <xs:sequence>
      <xs:choice>
        <xs:element name="fieldname" type="xs:string" />
        <xs:element name="freetext" type="xs:string" />
      </xs:choice>
      <xs:element name="dbtablename" type="xs:string" />
    </xs:sequence>
    </xs:complexType>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I want to specify all files that end with Test.dll, also known as
Is there a way to specify that I want the bars of a stacked
I have a Java WebStart application for which I want to specify that the
I would like to specify that I want FEATURE_INDETERMINATE_PROGRESS for my Activity . It
I want to specify the FileSystemWatcher to check the files in the system has
Can I specify I want the preceding character to be either (NOT A DIGIT)
In my requirements.txt file I want to specify that my app needs Django version
ASP.NET For each appSetting I use, I want to specify a value that will
How do I specify that there are several options for a string in a
I want to specify an argument in an attribute, like this: [OutputCache(Duration = GlobalSettings.GlobalVar)]

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.