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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:00:47+00:00 2026-05-16T23:00:47+00:00

Please enlighten me why XML Spy thinks this is valid . FYI, this specifies

  • 0

Please enlighten me why XML Spy thinks this is valid. FYI, this specifies an SQL query. Here the XML:

 <sideBar title="LabelSearch">
  <searchLabel table="ID=*.companies">
   <filter accessRight="r">
    <and>
     <filterElement argument="companies.Type" operator="=" value="Client"/>
    </and>
   </filter>
  </searchLabel>
 </sideBar>

The problem: I should not be allowed to put in only one filterElement inside the “and” tag, but at least two. If I only have one filterElement, I should use it without the surrounding “and” tag. Here the XSD:

 <xs:complexType name="filterGroupType">
  <xs:sequence>
   <xs:choice>
    <xs:element name="or" type="filterGroupOrType"/>
    <xs:element name="and" type="filterGroupAndType"/>
    <xs:element name="filterElement" type="filterType"/>
   </xs:choice>
  </xs:sequence>
  <xs:attribute name="accessRight" type="accessRightSimpleType" use="required"/>
 </xs:complexType>
 <xs:complexType name="filterGroupAndType">
  <xs:sequence minOccurs="2" maxOccurs="unbounded">
   <xs:element name="or" type="filterGroupOrType" minOccurs="0"/>
   <xs:element name="filterElement" type="filterType" minOccurs="0"/>
  </xs:sequence>
 </xs:complexType>
 <xs:complexType name="filterGroupOrType">
  <xs:sequence minOccurs="2" maxOccurs="unbounded">
   <xs:element name="and" type="filterGroupAndType" minOccurs="0"/>
   <xs:element name="filterElement" type="filterType" minOccurs="0"/>
  </xs:sequence>
 </xs:complexType>
 <xs:complexType name="filterType">
  <xs:attribute name="argument" type="xs:string" use="required"/>
  <xs:attribute name="operator" type="operatorSimpleType" use="required"/>
  <xs:attribute name="value" type="xs:anySimpleType"/>
  <xs:attribute name="field" type="fieldTitleSimpleType"/>
 </xs:complexType>

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-16T23:00:48+00:00Added an answer on May 16, 2026 at 11:00 pm

    Briefly

    1. Document is valid because elements have minOccurs="0".
    2. Use <xs:choice> instead of <xs:sequence>.

    A bit longer answer.

    Just like @Damien said, that XML is valid because this part of your schema allows "empty" sequences.

    <xs:sequence minOccurs="2" maxOccurs="unbounded">
      <xs:element name="or" type="filterGroupOrType" minOccurs="0"/>
      <xs:element name="filterElement" type="filterType" minOccurs="0"/>
    </xs:sequence>
    

    With <xs:sequence minOccurs="2" maxOccurs="unbounded"> You define that "this sequence must appear at least twice". At the same time <xs:element name="or" type="filterGroupOrType" minOccurs="0"/> Allows these elements within the sequence to be absent. Metaphorically it is like saying "You must order a meal twice but you don’t have to eat any of the meals you ordered."

    Instead if you want to always have at least 2 child elements and these children can be<filterElement> or <or> elements in any order, you should use <xs:choice> with minOccurs="1"

    <xs:choice minOccurs="2" maxOccurs="unbounded">
      <xs:element name="or" type="filterGroupOrType" minOccurs="1"/>
      <xs:element name="filterElement" type="filterType" minOccurs="1"/>
    </xs:choice>
    

    The default value for minOccurs is 1 so you can leave it out and keep your code cleaner and shorter. <xs:choice> selects one of its children and repeats choosing at least minOccurs times. If at least one of choices can has minOccurs="0" then the choice will also allow "empty" selections.

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

Sidebar

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.