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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:10:22+00:00 2026-06-13T10:10:22+00:00

I ‘m trying to create a unique element. Here is a part of my

  • 0

I ‘m trying to create a unique element. Here is a part of my code.

<complexType name="DeliveryOrder">
    <sequence>
        <element name="Depot" type="tns:County" minOccurs="1" maxOccurs="1"></element>
        <element name="CustomerDetails" type="tns:CustomerDetails" minOccurs="1" maxOccurs="1"></element>
        <element name="ItemsToBeDelivered"
            type="tns:ItemsToBeDelivered" maxOccurs="unbounded" minOccurs="1">
        </element>
    </sequence>
</complexType>

<complexType name="CustomerDetails">
    <sequence>
        <element name="FirstName">
            <simpleType>
                <restriction base="string">
                    <pattern value="[a-zA-Z][a-z][a-z]*"></pattern>
                </restriction>
            </simpleType>
        </element>
        <element name="Surname">
            <simpleType>
                <restriction base="string">
                    <pattern value="[a-z{^}A-Z][a-z][a-z]*"></pattern>
                </restriction>
            </simpleType>
        </element>
        <element name="AddressLine1">
            <simpleType>
                <restriction base="string">
                    <minLength value="4"></minLength>
                    <whiteSpace value="collapse"></whiteSpace>
                </restriction>
            </simpleType>
        </element>
        <element name="AddressLine2">
            <simpleType>
                <restriction base="string">
                    <minLength value="4"></minLength>
                    <whiteSpace value="collapse"></whiteSpace>
                </restriction>
            </simpleType>
        </element>
        <element name="AddressLine3" type="string">
        </element>
        <element name="County" type="tns:County" maxOccurs="1" minOccurs="1"></element>
    </sequence>
</complexType>

<complexType name="County">
    <choice>
        <element name="CountyName">
            <simpleType>
                <restriction base="string">
                    <enumeration value="Dublin"></enumeration>
                    <enumeration value="Cork"></enumeration>
                    <enumeration value="Kildare"></enumeration>
                    <enumeration value="Waterford"></enumeration>
                    <enumeration value="Wicklow"></enumeration>
                </restriction>
            </simpleType>
        </element>
    </choice>
</complexType>

<complexType name="DaysForDelivery">
    <sequence>
        <element name="Day">
            <simpleType>
                <restriction base="string">
                    <enumeration value="Monday"></enumeration>
                    <enumeration value="Tuesday"></enumeration>
                    <enumeration value="Wednesday"></enumeration>
                    <enumeration value="Thursday"></enumeration>
                    <enumeration value="Friday"></enumeration>
                </restriction>
            </simpleType>
        </element>
    </sequence>
</complexType>

<element name="DeliveryOrder" type="tns:DeliveryOrder"></element>

<complexType name="ItemsToBeDelivered">
    <sequence>
        <element name="DaysForDelivery" type="tns:DaysForDelivery"
            maxOccurs="unbounded" minOccurs="1">
        </element>
        <element name="Item" type="tns:Item" maxOccurs="unbounded" minOccurs="1"></element>
    </sequence>
</complexType>

<complexType name="Item">
    <sequence>
        <element name="Description">
            <simpleType>
                <restriction base="string">
                    <enumeration
                        value="Regular Milk - 1 litre carton.">
                    </enumeration>
                    <enumeration
                        value="Low Fat Milk - 1 litre carton.">
                    </enumeration>
                    <enumeration
                        value="Strawberry Yoghurt - 100ml pot">
                    </enumeration>
                    <enumeration
                        value="Raspberry Yoghurt - 100ml pot">
                    </enumeration>
                    <enumeration value="Cream - 125ml carton"></enumeration>
                    <enumeration value="Cream - 250ml carton"></enumeration>
                </restriction>
            </simpleType>
        </element>
        <element name="Quantity">
            <simpleType>
                <restriction base="int">
                    <minInclusive value="1"></minInclusive>
                </restriction>
            </simpleType>
        </element>
    </sequence>
</complexType>

So, I want the element “Day” from “DaysForDelivery” to be unique.
eg: I can have on Monday an X item, and after that to not be able to use Monday again.
I know that I have to use the unique tag, and I tooked a look at many examples, but I mess it up with the xpaths.

Thank you 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-06-13T10:10:24+00:00Added an answer on June 13, 2026 at 10:10 am

    UPDATED: Here is the modified XSD:

    <?xml version="1.0" encoding="utf-8" ?>
    <!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
    <schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns:tns="http://tempuri.org/XMLSchema.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
        <complexType name="DeliveryOrder">
            <sequence>
                <element name="Depot" type="tns:County" minOccurs="1" maxOccurs="1"></element>
                <element name="CustomerDetails" type="tns:CustomerDetails" minOccurs="1" maxOccurs="1"></element>
                <element name="ItemsToBeDelivered" type="tns:ItemsToBeDelivered" maxOccurs="unbounded" minOccurs="1">
                    <unique name="UQ">
                        <selector xpath="tns:DaysForDelivery/tns:Day"/>
                        <field xpath="."/>
                    </unique>
                </element>
            </sequence>
        </complexType>
        <complexType name="CustomerDetails">
            <sequence>
                <element name="FirstName">
                    <simpleType>
                        <restriction base="string">
                            <pattern value="[a-zA-Z][a-z][a-z]*"></pattern>
                        </restriction>
                    </simpleType>
                </element>
                <element name="Surname">
                    <simpleType>
                        <restriction base="string">
                            <pattern value="[a-z{^}A-Z][a-z][a-z]*"></pattern>
                        </restriction>
                    </simpleType>
                </element>
                <element name="AddressLine1">
                    <simpleType>
                        <restriction base="string">
                            <minLength value="4"></minLength>
                            <whiteSpace value="collapse"></whiteSpace>
                        </restriction>
                    </simpleType>
                </element>
                <element name="AddressLine2">
                    <simpleType>
                        <restriction base="string">
                            <minLength value="4"></minLength>
                            <whiteSpace value="collapse"></whiteSpace>
                        </restriction>
                    </simpleType>
                </element>
                <element name="AddressLine3" type="string">
                </element>
                <element name="County" type="tns:County" maxOccurs="1" minOccurs="1"></element>
            </sequence>
        </complexType>
    
        <complexType name="County">
            <choice>
                <element name="CountyName">
                    <simpleType>
                        <restriction base="string">
                            <enumeration value="Dublin"></enumeration>
                            <enumeration value="Cork"></enumeration>
                            <enumeration value="Kildare"></enumeration>
                            <enumeration value="Waterford"></enumeration>
                            <enumeration value="Wicklow"></enumeration>
                        </restriction>
                    </simpleType>
                </element>
            </choice>
        </complexType>
    
        <complexType name="DaysForDelivery">
            <sequence>
                <element name="Day">
                    <simpleType>
                        <restriction base="string">
                            <enumeration value="Monday"></enumeration>
                            <enumeration value="Tuesday"></enumeration>
                            <enumeration value="Wednesday"></enumeration>
                            <enumeration value="Thursday"></enumeration>
                            <enumeration value="Friday"></enumeration>
                        </restriction>
                    </simpleType>
                </element>
            </sequence>
        </complexType>
    
        <element name="DeliveryOrder" type="tns:DeliveryOrder"></element>
    
        <complexType name="ItemsToBeDelivered">
            <sequence>
                <element name="DaysForDelivery" type="tns:DaysForDelivery" maxOccurs="unbounded" minOccurs="1">
                </element>
                <element name="Item" type="tns:Item" maxOccurs="unbounded" minOccurs="1"></element>
            </sequence>
        </complexType>
    
        <complexType name="Item">
            <sequence>
                <element name="Description">
                    <simpleType>
                        <restriction base="string">
                            <enumeration value="Regular Milk - 1 litre carton.">
                            </enumeration>
                            <enumeration value="Low Fat Milk - 1 litre carton.">
                            </enumeration>
                            <enumeration value="Strawberry Yoghurt - 100ml pot">
                            </enumeration>
                            <enumeration value="Raspberry Yoghurt - 100ml pot">
                            </enumeration>
                            <enumeration value="Cream - 125ml carton"></enumeration>
                            <enumeration value="Cream - 250ml carton"></enumeration>
                        </restriction>
                    </simpleType>
                </element>
                <element name="Quantity">
                    <simpleType>
                        <restriction base="int">
                            <minInclusive value="1"></minInclusive>
                        </restriction>
                    </simpleType>
                </element>
            </sequence>
        </complexType>
    </schema>
    

    enter image description here

    Sample valid XML :

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
    <DeliveryOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/XMLSchema.xsd">
        <Depot>
            <CountyName>Dublin</CountyName>
        </Depot>
        <CustomerDetails>
            <FirstName>Firstname</FirstName>
            <Surname>Surname</Surname>
            <AddressLine1>AddressLine11</AddressLine1>
            <AddressLine2>AddressLine21</AddressLine2>
            <AddressLine3>AddressLine31</AddressLine3>
            <County>
                <CountyName>Dublin</CountyName>
            </County>
        </CustomerDetails>
        <ItemsToBeDelivered>
            <DaysForDelivery>
                <Day>Monday</Day>
            </DaysForDelivery>
            <DaysForDelivery>
                <Day>Tuesday</Day>
            </DaysForDelivery>
            <Item>
                <Description>Regular Milk - 1 litre carton.</Description>
                <Quantity>1</Quantity>
            </Item>
            <Item>
                <Description>Regular Milk - 1 litre carton.</Description>
                <Quantity>1</Quantity>
            </Item>
        </ItemsToBeDelivered>
    </DeliveryOrder>
    

    If you change Tuesday to Monday you get:

    Error occurred while loading [], line 22 position 17
    There is a duplicate key sequence 'Monday' for the 'http://tempuri.org/XMLSchema.xsd:UQ' key or  unique identity constraint.
    Document1.xml is invalid.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a RegEx expression that will successfully parse the following
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I was writing code for dragging mechanism which invokes to wait for small period
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am currently running into a problem where an element is coming back from
I have just tried to save a simple *.rtf file with some websites and
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I've got a string that has curly quotes in it. I'd like to replace
I downloaded PostgreSQL from the official website and ran the .dmg installer. After that

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.