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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:37:15+00:00 2026-05-15T05:37:15+00:00

I have the following XML sequence <property name=a value=x /> <property name=b value=xx />

  • 0

I have the following XML sequence

<property name="a"  value="x" />
<property name="b"  value="xx" />

I want to limit "a" to a list of values, like [ x, y, z] and "b" to another list like [xx, yy, zz]

Is it possible to do this using XSD, and if it is how?

If this is not possible, how do you recommend to change the XML format in order to make it ready for XSD validation? (I do have more than two property name/value pairs)

  • 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-15T05:37:15+00:00Added an answer on May 15, 2026 at 5:37 am

    XSD accomplishes what you want (conditional validation) using nesting.

    So while you can’t use XSD to make the values of one attribute conditional upon the values of another (as Fyodor Soikin says in his answer), you can use XSD to make the values of an attribute conditional upon the element itself:

    <propertyNameA value="x"/>
    <propertyNameB value="xx"/>
    

    In this case each property is its own element, and each “value” attribute has its own enumeration.

    It gives you the added benefit of being able to restrict how many of each named property you can have, but the disadvantage is you need to manage more elements.

    Depending on the specifics of your situation, using XSD this way might be the best option, or it might be better to implement another system that can do the name/value validation you need.

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

Sidebar

Related Questions

I have following xml and I want to fetch the value of node which
I have the following complex type in my XML schema: <xs:complexType name=Widget mixed=true> <xs:sequence>
Lets say I have a schema that defines the following XML: <Values> <Add Key=Key1>Value
I've got something like the following XML file. <credits> <property name=tag> <item>v0003</item> </property> <property
I have following xml as a response to a service not i want to
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
I have the following XML: <customer> <name>John Paul</name> <cpf_cnpj>1376736333334</cpf_cnpj> </customer> The <cpf_cnpj> element must
I have a WebService with following wsdl file: <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name=BBAppWebAccessService targetNamespace=com.test xmlns:ns1=http://schemas.xmlsoap.org/soap/http
I have the following xml: <product> <name>beef</name> <category>food</category> <unknownfield1>..</unknownfield1> <unknownfield2>..</unknownfield2> </product> I need to
I have following XML generated by serializing a boost::posix_time::ptime structure. I want to create

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.