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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:51:30+00:00 2026-05-28T19:51:30+00:00

I have an xml query which should be xsd validated …(impossible ??) Unfortunately the

  • 0

I have an xml query which should be xsd validated …(impossible ??)

Unfortunately the xsd schema for the xml contains an xsd:choice between two sequences.

but i am specifying both these sequences in my xml query.

this is causing the xsd to fail the xml, any direction as to how i override this check ?

Provided:

1. The XSD schema is standardized & cannot be altered.

2. Any change must be done at the C# code behind where i am applying the validation.

the same has been asked in :

Ignore element order while validating XML against XSD

but the answer there was to modify the xsd schema, which was the accepted answer by the user.

update1

the xml is similar to this :

...
<elem>
    <subElemA>textValA</subElemA>
    <subElemB>textValA</subElemB>
<elem>
...

but the XSD says :

...
<xsd:choice>
    <xsd:element name="subElemA" minOccurs="0" maxOccurs="1">
    </xsd:element>
    <xsd:element name="subElemB" minOccurs="0" maxOccurs="1">
    </xsd:element>
</xsd:choice>
...

& if i were to remove either subElemA OR subElemB from the xml, then the xml will schema validate successfully.

update2

i am hoping to find a solution which involves tweaking my schema validation code to allow the schema validator to bypass this check; Code for schema validation :

   XmlReaderSettings setting = new XmlReaderSettings();
   setting.ConformanceLevel = ConformanceLevel.Document;
   setting.IgnoreComments = true;
   setting.IgnoreWhitespace = true;
   setting.IgnoreProcessingInstructions = true;
   setting.ValidationType = ValidationType.Schema;
   setting.Schemas.Add(defaultNameSpace, schemaLocation.AbsoluteUri);
   setting.ValidationEventHandler += new ValidationEventHandler(this.SchemaValidationCallBack);
   MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(xmlToValidate));
   XmlReader reader = XmlReader.Create(ms, setting);
   while (reader.Read());
  • 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-28T19:51:31+00:00Added an answer on May 28, 2026 at 7:51 pm

    It’s likely that what you’re attempting to do isn’t possible. From the validator’s perspective, the XML schema is the contract that you’re attempting to verify. If your document is inconsistent with that contract, then the validator can’t accept it (otherwise it would be going against what you’ve asked it to do).

    If you really need to accept this XML document, the way you would instruct the validator to accept it would be to change the contract its trying to enforce (the schema). The best way to accomplish this would be to work with your third party to help them resolve conflicts between their schema and the instance documents they’re providing. Without doing this, anyone else attempting to fulfill the contract is going to run into the same problems you are.

    If that’s not possible, you could circumvent the system by creating a local schema file that has been modified to allow the instance document to be validated. Instead of loading the customers schema into your validator, load your alternate implementation instead. This would allow you to validate the document without the third party updating the official schema. This can easily turn into a maintenance issue as your local copy may become out-of-sync with changes in the original schema, however if they’re unwilling to change the schema for this instance document, it is possible the schema isn’t changing frequently anyway.

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

Sidebar

Related Questions

I have an xml file which contains query details like <queries> <query> <name>GetStudentById</name> <statement>select
I have a (disconnected) typed Dataset in an XML, which I query in LINQ:
I have a simple XML file here which I converted to XSD with xsd.exe
I have the following XML LINQ query from my XDocument. var totals = (from
I have written a LINQ to XML query that does what I want, but
I have a pretty simple Linq to XML query: var q = from c
I'm having an issue getting a LINQ query to work. I have this XML:
I have a query that I am generating the XML from in Oracle using
I am having extreme difficulty constructing a query which returns an XML style hierarchy.
I have this XML file, from which I'd like to count the number of

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.