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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:30:03+00:00 2026-05-26T23:30:03+00:00

I have multiple XML descriptor files in my actual project and I’m having troubles

  • 0

I have multiple XML descriptor files in my actual project and I’m having troubles with creating corresponding XSDs.

I have my custom types in XML, for example:

<A>
  <B>
    ...
  </B>
</A>

I need to create template blocks in my XML file. These blocks may contain any elements of my custom types. However, there is a slight difference between an element in the templates and elements elsewhere: they may have a Parameter element

<Template>
  <Parameter />
  <A>
    <Parameter />
    <B>
      <Parameter />
      ...
    </B>
  </A>
</Template>

As far as I know, it is impossible for to declare that the <Parameter> element can appear anywhere inside <Template> (including the child nodes). But I can do this by defining <Parameter> as an element of all of my type definitions.

However I want to restrict the <Parameter> so that it can only appear when its parent is inside a <Template> element. Is it possible to put the <Parameter> in a type definition but restrict its appearance to when its parent is in the scope of a <Template> tag?

How can I write this in XSD?

  • 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-26T23:30:04+00:00Added an answer on May 26, 2026 at 11:30 pm

    After investigation I don’t believe this is possible. There are a number of relevant questions on SO that relate to this, and the general advice is that elements of an XSD can’t be dependent on other elements of an XSD.

    Instead, you may need to consider some alternative approaches or workarounds.

    Without knowing your requirement it’s difficult to consider what else might work for you, but perhaps you could tie the Template and Parameter more closely together, and less closely with the other elements. Foe example, a Template might have a Parameter, another Template, and an element (the A, B, etc):

    Define a Template like this:

    <Template>
        <xsd:Sequence>
            <Parameter />
            <xsd:ComplexType />
            <Template />
        </xsd:Sequence>
    </Template>
    

    And then each element does not need to be modified, but instead the Template type stores the structure.

    <Template>
        <Parameter />
        <A>
        <Template>
            <Parameter />
            <B>
            <Template>
                <Parameter />
                < .. anything else .. />
            </Template>
        </Template>
    </Template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder with multiple XML files. I need to bulk insert each
i have multiple Xml files, in a List<File> . What i want is to
I have set up multiple targets in a single xml file. I expect all
I have an XML schema that includes multiple addresses: <xs:element name=personal_address maxOccurs=1> <!-- address
I have a maven pom.xml file with multiple instances of a same goal defined
I have an XML file (on the left) and I want to create multiple
I have a XML document with my data in it, multiple entries for the
I have multiple configuration files describing Addins to my system. I'm looking for a
What is the correct way to split Spring's configuration to multiple xml files? At
I have a main pom.xml which has multiple modules. These modules need to generate

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.