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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:35:44+00:00 2026-06-01T04:35:44+00:00

This problem is taking me too long to fix I could use some guidance

  • 0

This problem is taking me too long to fix

I could use some guidance

I’m trying to define a game board and i want to be
sure each house can only exist once, meaning it has a
set of coordinates unique.

I don’t understand why my code accepts repeated values of Coordinates

<xs:element name="Board">
    <xs:complexType>
        <xs:sequence minOccurs="3" maxOccurs="unbounded">
            <xs:element name="house" type="Tile">
                <xs:unique name="tileKey">
                    <xs:selector xpath="./Point"/>
                    <xs:field xpath="x"/>
                    <xs:field xpath="y"/>
                </xs:unique>                
            </xs:element>           
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:complexType name="Tile">
    <xs:sequence>
        <xs:element name="Point" type="Coords"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="Coords">
    <xs:sequence>
        <xs:element name="x" type="xs:int"/>
        <xs:element name="y" type="xs:int"/>
    </xs:sequence>
</xs:complexType>

If i have 3 houses with x and y 0 the xml is valid.
What am I doing wrong?

output is something like

<Board>
<house>
    <Point>
        <x>0</x>
        <y>0</y>
    </Point>
</house>
</Board>

Thank you for your help

  • 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-06-01T04:35:46+00:00Added an answer on June 1, 2026 at 4:35 am

    Your unique validation is only applying to the points within a house (of which there can only be one by your schema definition, so the validation would never trigger). If you want to validate across all points in all house tags, you need to move your unique check out one level:

    <xs:element name="Board">
      <xs:complexType>
        <xs:sequence minOccurs="3" maxOccurs="unbounded">
          <xs:element name="house" type="Tile">
          </xs:element>           
        </xs:sequence>
      </xs:complexType>
      <xs:unique name="tileKey">
        <xs:selector xpath="./house/Point"/>
        <xs:field xpath="x"/>
        <xs:field xpath="y"/>
      </xs:unique>                
    </xs:element>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some queries that are taking too long (300ms) now that the DB
I have a webpage that is taking way too long and need to optimize
This problem may be a bit too vast and nebulous for this space, but
This problem has bugged me so many times and i have now decided to
This problem is very strange and I'm hoping someone can help me. For the
This problem is happening for me on IE8 and Chrome which makes me think
This problem is baffling me: BEGIN; INSERT INTO sub_users(user_id, email) SELECT user_id FROM users
This problem pops around the network for years, I've found no good solution yet.
This problem is not readily reproducible in a simple example here but was wondering
This problem is similar to when creating alternate colour table-rows, only we are dealing

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.