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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:46:12+00:00 2026-05-18T01:46:12+00:00

I believe this has to do with keyref but I’m not for sure, and

  • 0

I believe this has to do with keyref but I’m not for sure, and I am really not sure that it can be done at all.

For example, say I have myElement1 and myElement2. If there are no myElement2 in the XML file, then myElement1 must exist, otherwise it is optional.

Is there any way to force this type of validation in my XSD file?

  • 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-18T01:46:13+00:00Added an answer on May 18, 2026 at 1:46 am

    Similar questions have been asked several times .. in stackoverflow or any tech blogs ..

    but the answer is always not possible,

    cases like :

    (a) validating Element depending on the value or presence of any other element/attribute
    (b) validating value of an element depending on the value or presence of any other element/attribute
    (c) validating attribute depending on the value or presence of any other element/attribute
    (d) defining elements/attributes of same name having different Types/DataTypes under same scope
    (e) validating child elements on the basis of value or presence of any other Elements/Attributes

    all the above mentioned cases are not possible to achieve ..

    but if you can implement some transformation thing .. then you can get help.
    what I mean to say is “first go through transformation and modify the XML as per your requirement,

    example :: if the particular field is expected with some value .. pass the XML as it is if the condition is satisfied and don’t pass if it doesn’t ..
    in the next block XSD is going to validate and obviously errors out 🙂 you can figure out that it is missing your custom validation ..

    anyway the intention is to block or Pass the xml according to the data .. and that is what you are doing ..

    Note: Schematron has been come into good practice recently! Here is the tutorial: http://zvon.org/xxl/SchematronTutorial/General/contents.html

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

Sidebar

Related Questions

I have been told and I'm not sure I believe this: Removing white space
I believe there is a way to do this, but I'm not familiar with
Should links on a web page ALWAYS be underlined? I do not believe this
(I've tried this in MySql) I believe they're semantically equivalent. Why not identify this
I found this solution which works, but I find it hard to believe there
There gotta be an easy way to do this, I can't believe there's none.
I am writing a basic web app, this has some list elements that I
I realise this question has been asking before, but I've yet to find an
EDIT: Modified title and added update. UPDATE : We no longer believe this is
I had this answer on another post I asked: I believe the VS designer

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.