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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:30:34+00:00 2026-06-17T16:30:34+00:00

I have such xsd type <xsd:simpleType name=carsEnum> <xsd:restriction base=xsd:string> <xsd:enumeration value=Seat/> <xsd:enumeration value=Opel/> </xsd:restriction>

  • 0

I have such xsd type

<xsd:simpleType name="carsEnum">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="Seat"/>
        <xsd:enumeration value="Opel"/>
    </xsd:restriction>
</xsd:simpleType>

Now I can use it in such way – <xsd:attribute name="carModel" type="carsEnum"/>

How I can rebuild carEnum to use any another string?

As an example –

< ... carModel="Seat"/>
< ... carModel="Some string"/>
< ... carModel="Opel"/>

Of cause I can make type carsEnum as usual String, but it’s rather comfortable to use such construction in IDE Idea, because it show tool tips.

  • 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-17T16:30:35+00:00Added an answer on June 17, 2026 at 4:30 pm

    If I summarize your question what I understand is you want to maintain a list of possible values of an element cars, also want to accept any values appearing outside that bounded list. This can be achieved in XSD using UNION. I have illustrated it with an example below.

    sample XML:

    <?xml version="1.0" encoding="utf-8"?>
    <cars>ssd</cars>
    

    XSD:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="cars" type="carsType"/>
      <xs:simpleType name="carsType">
        <xs:union memberTypes="carsEnum carsAnyString"/>
      </xs:simpleType>
      <xs:simpleType name="carsEnum">
        <xs:restriction base="xs:string">
          <xs:enumeration value="Seat"/>
          <xs:enumeration value="Opel"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType name="carsAnyString">
        <xs:restriction base="xs:string"/>
      </xs:simpleType>
    </xs:schema>
    

    In the above XSD, I am using multiple definitions of CAR, once as enum list and once as any string. Defining a UNION type combining these two, will be the type for cars.

    So <cars can have values like:
    Seat, Opel, anyOtherCar, AnyString2 ..

    I would also like to mention a way to control the value of ANY STRING. Above XSD can accept any string that means even special chars and numbers. We can restrict this by adding restriction pattern to only Alpha chars. Below is the XSD code:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="cars" type="carsType"/>
      <xs:simpleType name="carsType">
        <xs:union memberTypes="carsEnum carsAnyAlphaString"/>
      </xs:simpleType>
      <xs:simpleType name="carsEnum">
        <xs:restriction base="xs:string">
          <xs:enumeration value="Seat"/>
          <xs:enumeration value="Opel"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType name="carsAnyAlphaString">
        <xs:restriction base="xs:string">
          <xs:pattern value="[A-Za-z]*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>
    

    So possible values can be Seat, Opel, "Any string but no Number", "Any string but no special char"

    replacing

          `<xs:pattern value="[A-Za-z]*"/>`
    

    by

          <xs:pattern value="[A-Za-z]+"/>
    

    doesn’t allow null string.
    This is a way to redefine an element.. not being just stick to the enumeration list.

    Now you have pattern also with enumeration list. Hope it helps.

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

Sidebar

Related Questions

I have created a simple type <xsd:simpleType name=IntOrBlank> <xsd:union memberTypes=xsd:int> <xsd:simpleType> <xsd:restriction base=xsd:string> <xsd:enumeration
I have a default value specified in XSD as follows: <xs:complexType name=image> <xs:attribute name=path
I have the following xml types: <xsd:element name=FaxNumbers minOccurs=0> <xsd:complexType> <xsd:sequence> <xsd:element name=FaxNumber type=FaxNumber
In my schema I have some types that simply extend a simple XSD type
We have specific XML that has specific structure: <root> <element type=a> <value>someValueA</value> </element> <element
How to set enumeration restrictions for a complex type restriction?? i-e I want to
Suppose I have this (outrageously) simplified XML schema: <xsd:complexType name=Person> <xsd:sequence> <xsd:element ref=FirstName/> <xsd:element
I have an XSD file such as: <xs:schema targetNamespace=...> <xs: import namespace=...> <xs: import
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
i have such code (copy paste from wiki). Its multiplication of those big numbers

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.