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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:46:29+00:00 2026-05-29T05:46:29+00:00

This is my first question on stackoverflow (I have usually been able to figure

  • 0

This is my first question on stackoverflow (I have usually been able to figure out my problems with the answers already here).

This is similar to these questions, but I think my question is a little different (also, XSD is really hard):

  • XSD: How to restrict enumeration values of a derived complex type?
  • Enumeration of a complex type

I am trying to define a restricted set of “types” that represent parameter data types. E.g.

    - Binary bit-mapped    B/BM    1 byte
    - Unsigned Integer     U/I     2 bytes
    - Alphanumeric         ALPHA   1 byte
    - etc...

So I have come up with the following xsd:

<xs:complexType name="parameterDataType" abstract="true">
    <xs:sequence>
        <xs:element name="type" type="xs:string" />
        <xs:element name="abbreviation" type="xs:string" />
        <xs:element name="length" type="xs:positiveInteger" />
    </xs:sequence>
</xs:complexType>

<xs:complexType name="binaryBitMappedType">
    <xs:complexContent>
        <xs:restriction base="parameterDataType">
            <xs:sequence>
                <xs:element name="type" type="xs:string" fixed="Binary Bit-Mapped" />
                <xs:element name="abbreviation" type="xs:string" fixed="B/BM" />
                <xs:element name="length" type="xs:positiveInteger" fixed="1" />
            </xs:sequence>
        </xs:restriction>
    </xs:complexContent>
</xs:complexType>
etc...

NOTE WELL: I also tried this with a sequence and “type, abbreviation, length” being xs:attributes, so if that’s a better solution let me know.

This works fine but it requires the XML to redefine the element as their restricted values (otherwise it is not valid), a bit like so:

<message>
    <id>123</id>
    <name>Some status type message</name>
    <dataType xsi:type="binaryBitMappedType">
        <type>Binary Bit-Mapped</type>
        <abbreviation>B/BM</abbreviation>
        <length>1</length>
    </dataType>
    ...etc
</message>
<message>
    <id>321</id>
    <name>A DIFFERENT status type message</name>
    <dataType xsi:type="binaryBitMappedType">
        <type>Binary Bit-Mapped</type>
        <abbreviation>B/BM</abbreviation>
        <length>1</length>
    </dataType>
    ...etc
</message>
<message>
    <id>456</id>
    <name>a continuous value type message</name>
    <dataType xsi:type="unsignedIntegerType">
        <type>Unsigned Integer</type>
        <abbreviation>U/I</abbreviation>
        <length>2</length>
    </dataType>
    ...etc
</message>

Is there a way to avoid having to redefine these values in the XML (can the definition be pulled in from the XSD, or assumed from the XSD?) Alternatively, can the definitions be provided in their own XML file and then those be “imported” in based on the xsi:type?

Something a little more like this?

<message>
    <id>123</id>
    <name>Some status type message</name>
    <dataType xsi:type="binaryBitMappedType" /> <!-- don't have to repeat the dataType contents -->
    ...etc
</message>
<message>
    <id>321</id>
    <name>A DIFFERENT status type message</name>
    <dataType xsi:type="binaryBitMappedType" /> <!-- don't have to repeat the dataType contents -->
    ...etc
</message>

Or am I on a hiding to nothing? Thanks in advance

  • 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-29T05:46:30+00:00Added an answer on May 29, 2026 at 5:46 am

    The general rule in XSD 1.0 is that you can’t define co-constraints: that is, the valid values of one element are entirely independent of the valid values of any other element.

    In XSD 1.1 you can do what you like, using assertions.

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

Sidebar

Related Questions

Greetings to all! This is my first question here on stackoverflow. I have a
Hey stackoverflow - This is my first question here. I have 2 tables in
this is my first question here in stackoverflow. I have two processes, a root
this is my first question to stackoverflow so here it goes... I use cruise
this is my first question.. so, here we go. i have a site, 100%
This is my first question on StackOverflow and I've already visited every single question
Since this is my first question here on stackoverflow I hope my question is
This is my first question here on stackoverflow, so I hope that I am
This is my first question here on StackOverflow, and quite frankly I'm fairly new
This is my first question asked here at stackoverflow, so bear with me please

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.