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 believe this is a permissions issue, but not sure how to fix it.
I believe this has been answered before but how can I have buttons /
I believe this questions has been asked in some or the other way but
While I'm perfectly willing to believe that this has been asked elsewhere, I haven't
I can't believe how unbelievably complicated this has been... I have the following XML...
I am sure this has been asked before, but I have yet to find
I believe this question has been asked here for a while but there wasn't
I cannot believe this question has not been asked before! Maybe I do not
I believe this has been asked before but no concrete answer has been determined.
I'm getting a java.awt.FontFormatException: Unrecognised Font Format error, and I believe this has been

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.