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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:03:44+00:00 2026-06-07T15:03:44+00:00

How to prohibit duplicate tag in my restriction tag in my xml file? for

  • 0

How to prohibit duplicate tag in my restriction tag in my xml file?
for example in my xml file I have two locale tag,but it should be only one tag

this is my xml file :

    <app:string name="firstName">
        <app:restriction>
            <app:regex>^\w*$</app:regex>
            <app:type/>
            <app:locale/>
            <app:locale/>
        </app:restriction>
    </app:string>

and this is my xsd for string tag:

<xs:element name="string">
    <xs:complexType>
        <xs:complexContent>
            <xs:extension base="main:BaseType">
                <xs:sequence>
                    <xs:element name="restriction" type="main:StringRestriction" minOccurs="0"
                                maxOccurs="1"/>
                </xs:sequence>
                <xs:attribute name="lang" type="main:LocaleTypes"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:element>

<xs:complexType name="BaseType">
    <xs:attribute name="name" type="main:nameType" use="required"/>
    <xs:attribute name="readonly" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>

<xs:complexType name="StringRestriction">
    <xs:complexContent>
        <xs:extension base="main:RestrictionBase">
            <xs:sequence>
                <xs:choice maxOccurs="1">
                    <xs:element type="xs:string" name="locale"/>
                    <xs:element type="xs:string" name="type"/>
                    <xs:element type="xs:string" name="regex"/>
                    <xs:element type="xs:string" name="maxLen"/>
                    <xs:element type="xs:string" name="minLen"/>
                </xs:choice>
            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>
  • 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-07T15:03:46+00:00Added an answer on June 7, 2026 at 3:03 pm

    If I correctly understood you need a schema that force your restriction tag to contain tags without repetitions.

    if you substitute this:

    <xs:sequence>
        <xs:choice maxOccurs="1">
            <xs:element type="xs:string" name="locale"/>
            <xs:element type="xs:string" name="type"/>
            <xs:element type="xs:string" name="regex"/>
            <xs:element type="xs:string" name="maxLen"/>
            <xs:element type="xs:string" name="minLen"/>
        </xs:choice>
    </xs:sequence>
    

    with this:

    <xs:all minOccurs="0">
        <xs:element type="xs:string" name="locale"/>
        <xs:element type="xs:string" name="type"/>
        <xs:element type="xs:string" name="regex"/>
        <xs:element type="xs:string" name="maxLen"/>
        <xs:element type="xs:string" name="minLen"/>
    </xs:all>
    

    your schema won’t allow duplicated locale elements inside your restriction tag.
    You can see a summary here: http://www.w3schools.com/schema/el_all.asp
    Beside this, you can play with minOccurs and maxOccurs to force some elementes to always appear and other to be just optional.

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

Sidebar

Related Questions

I have XML like this: ... <link from=a to=b/> ... Is it possible to
I have next task - prohibit all users(except admin) to delete a content in
In my project, I prohibit a user every page only if he is already
Hello there once again... I came up with an strange idea but I have
This is a compiler error (slightly changed for readability). This one always puzzled me.
I have 2 loops, one for the sticky posts, and one for all the
I have an .xsd schema in SVN and it's copy in %VsInstallDir%\xml\Schemas. Schema folders
I have created a simple PHP web site with two areas - a public
Possible Duplicate: What's the most reliable way to prohibit a copy constructor in C++?
I have a project with autotools: automake, autoconf. I want to prohibit make from

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.