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

The Archive Base Latest Questions

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

In using XML Schema 1.1, I’d like to define an attribute group that occurs

  • 0

In using XML Schema 1.1, I’d like to define an attribute group that occurs entirely together, i.e. all the attributes in the attributeGroup are either present or not-present. In the following example, I’d like <anelement> to have both attributes (attr_one and attr_two) present or neither attribute present, never only a single attribute present.

<attributeGroup name="attrgroup">
  <attribute name="attr_one" />
  <attribute name="attr_one" />
</attributeGroup>

<element name="anelement">
  <complexType>
    <attributeGroup ref="attrgroup" />
  </complexType>
</element>

As I understand it, XML Schema 1.0 cannot specify these attribute relationships (correct?). What is the best way to specify them in XSD 1.1? I figure that I can use assert to specify the relationship, something like the following:

<element name="anelement">
  <complexType>
    <attributeGroup ref="attrgroup" />
    <assert test="(@attr_one and @attr_two) or not(@attr_one or @attr_two)" />
  </complexType>
</element>

But I was hoping there was something added to 1.1 that would allow me to specify the relationship using the existing language, e.g. a use attribute on attributeGroups. What is the best way to specify this relationship in XML Schema 1.1?

  • 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-23T12:29:48+00:00Added an answer on May 23, 2026 at 12:29 pm

    Assertions are the way to do this. A simpler formulation is

    test="exists(@attr_one) = exists(@attr_two)"
    

    or you could do

    test="count(@attr_one|@attr_two) != 1"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create program that creates a XML schema like below using System.Xml.XmlSchema
I would like to produce C# helper files from the KML2.2 xml schema using
I am working on a C# application that involves using XML schema file as
I have some C# code that walks XML schemata using the Xml.Schema classes from
I am using classes that were generated from an XML schema using the xsd.exe
Is it possible to define in XML schema that there must be some certain
I'm using xml for my application. And I used xml schema. In that schema
We are using XML to define a schema for controlling the contents which can
I'm trying to create XML Schema using lxml. For the begining something like this:
Is it best to create sharepoint lists in a feature using xml (schema.xml) or

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.