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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:48:20+00:00 2026-05-13T14:48:20+00:00

Suppose in XSD we have an element ‘answer’ defined: <xs:element name=answer minOccurs=1 maxOccurs=1> <xs:complexType>

  • 0

Suppose in XSD we have an element ‘answer’ defined:

                <xs:element name="answer" minOccurs="1" maxOccurs="1">
                  <xs:complexType>
                    <xs:attribute name="name" use="required">
                      <xs:simpleType>
                        <xs:restriction base="answer"/>
                      </xs:simpleType>
                    </xs:attribute>
                  </xs:complexType>
                </xs:element>

in the same document we have an element ‘language’ defined as:

                <xs:element name="language" minOccurs="1" maxOccurs="1">
                  <xs:complexType>
                    <xs:attribute name="name" use="required">
                      <xs:simpleType>
                        <xs:restriction base="answer"/>
                      </xs:simpleType>
                    </xs:attribute>
                  </xs:complexType>
                </xs:element>

Both of these have an entry <xs:restriction base="answer"/>
where the “answer” is an enumeration of predefined values.

So, I need to validate that if exists the “answer” node with name = ‘some_answer’
there is also exists the “answer” node with name = ‘some_answer’

Example:

<answer name="some_answer"/>
<language name="some_answer"/>
  • 1 1 Answer
  • 3 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-13T14:48:20+00:00Added an answer on May 13, 2026 at 2:48 pm

    I haven’t tried it, but that should be possible using the key and keyref elements in the XML schema. You need to define key/keyref relationships in both directions though.

    The relationship from language -> answer is defined like this:

    <xs:key name="answerKey">
     <xs:selector xpath="/answer"/>
     <xs:field xpath="@name"/>
    </xs:key>
    
    <xs:keyref name="languageRef" refer="answerKey">
     <xs:selector xpath="/language"/>
     <xs:field xpath="@name"/>
    </xs:keyref>
    

    And then you define it in the other direction as well:

    <xs:key name="languageKey">
     <xs:selector xpath="/language"/>
     <xs:field xpath="@name"/>
    </xs:key>
    
    <xs:keyref name="answerRef" refer="languageKey">
     <xs:selector xpath="/answer"/>
     <xs:field xpath="@name"/>
    </xs:keyref>
    

    See http://www.w3.org/TR/xmlschema-0/#specifyingUniqueness and http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#element-keyref

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

Sidebar

Related Questions

Suppose I have some schema: <xsd:schema ...> <xsd:element name=foo> <xsd:complexType> <xsd:sequence> <xsd:element name=fooElement type=xs:string
Suppose I have this (outrageously) simplified XML schema: <xsd:complexType name=Person> <xsd:sequence> <xsd:element ref=FirstName/> <xsd:element
Suppose I have an XSD file having below lines of code; <xsd:simpleType name=test> <xsd:restriction
Suppose we have the name written in any none-latin letters - languages, like Arabic,
Suppose I have a grid of squared defined like so in a class: Square
Suppose I have the following XML, how should I update my XSD schema (described
suppose i have a .on() function wherein i select multiple ids $(#i, #am, #your,
Suppose I have a large list of words. For an example: >>> with open('/usr/share/dict/words')
Suppose I have a pure virtual method in the base interface that returns to
Suppose I have a static method of my class that returns an object of

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.