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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:52:22+00:00 2026-05-23T09:52:22+00:00

Is there a way in an xsd schema to require that an element have

  • 0

Is there a way in an xsd schema to require that an element have another element somewhere as a descendant?

For example, element parent requires a descendant desc. This is valid:

<parent>
  <a>
   <b>
     <desc></desc>
   </b>
  </a>
</parent>

As is this:

<parent>
  <c>
    <desc></desc>
  </c>
</parent>

but this isn’t:

<a>
  <parent>
    <b/>
  </parent>
</a>

The potential child elements for parent are many and complicates, so it would be difficult to enumerate every possible valid configuration.

Something like the key/selector schema elements seems like it would work, where I could provide an xpath expression defining the valid locations for desc element, but all of the examples I’ve found are aimed at matching up the value of attributes.

  • 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-23T09:52:23+00:00Added an answer on May 23, 2026 at 9:52 am

    No, (almost) all XML Schema validation is shallow, called “local” in the spec. Here’s one excerpt that emphasizes type validation as “local” validation.

    Element Validated by Type If an
    element information item is ·valid·
    with respect to a ·type definition· as
    per Element Locally Valid (Type)
    (§3.3.4), [it is marked as] ·validated·.

    The only exception is for the identity constraints like uniqueness and key-references which have a broad scope in an XML document but narrow uses.

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

Sidebar

Related Questions

In current w3c version of XSD, is there a way to refer to parent
Is there a way to generate XML Schema(xsd) with documentation( <xsd:annotation> / <xsd:documentation> )
I have a gigantic QuickBooks SDK .XSD schema file which defines XML requests/responses that
I have a DTD that I need to convert to an XSD (XML schema)
Is there a standard way to convert an XSD to an input form (ASP.NET
Maybe it's me, but it appears that if you have an XSD <?xml version=1.0
how can I generate a xsd schema for a c# type (in code). There
I am running Visual Studio 2010. I have a XSD schema and want to
Taking the W3C vehicle XSD as an example: <schema xmlns=http://www.w3.org/2001/XMLSchema targetNamespace=http://cars.example.com/schema xmlns:target=http://cars.example.com/schema> <complexType name=Vehicle
I have XSD Schema with the following structure: ElementA has only one ElementB and

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.