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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:54:46+00:00 2026-05-31T18:54:46+00:00

Here is a schema file, midi.xsd that defines a type, note , used to

  • 0

Here is a schema file, midi.xsd that defines a type, note, used to store MIDI note values:

<?xml version="1.0" encoding="utf-8"?>

<xs:schema elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="note">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="127"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>

Here is another schema file, octaves.xsd which uses midi.xsd to help define the layout to be enforced on an XML file containing data about octaves:

<?xml version="1.0" encoding="utf-8"?>

<xs:schema elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:include schemaLocation="midi.xsd"/>

  <xs:element name="octaves">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="octave">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="name" type="xs:string" />

              <xs:element name="midi">
                <xs:complexType>
                  <xs:sequence>

                    <xs:element name="value" type="xs:integer" />
                    <xs:element name="from" type="note" />
                    <xs:element name="to" type="note" />

                  </xs:sequence>
                </xs:complexType>
              </xs:element>

            </xs:sequence>

            <xs:attribute name="index" type="xs:integer" />

          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>

This is fine, and works exactly as you would expect it to, except that I have another requirement: I want note to be in its own namespace, midi, so that

<xs:element name="from" type="note" />

becomes

<xs:element name="from" type="midi:note" />

Try as I might, I cannot get this to work. My attempts have included use of the targetNamespace attribute in various places, the import element, and liberal use of xmlns:midi="...", but to no avail. I’d post one of these attempts here, were it not so cringe-worthy.

Could some kind soul point me in the right direction? I’m pretty sure the problem is to do with the fact that midi.xsd is a local file; it has never been, and never will be, hosted on a web server.

  • 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-31T18:54:47+00:00Added an answer on May 31, 2026 at 6:54 pm

    Change midi.xsd to be:

    <xs:schema elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetnamespace="/my/midi/namespace">
    

    And then change octaves.xsd to say:

    <xs:schema elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:midi="/my/midi/namespace">
    
       <xs:import namespace="/my/midi/namespace" schemaLocation="midi.xsd"/>
    
       ...
    
       <xs:element name="from" type="midi:note" />
    

    Note the use of xs:import rather than <xs:include> The two are very different – you use import for bringing in other namespaces, and include for inline inclusion of other schema files into the current namespace.

    Note also that /my/midi/namespace can be anything you want, it’s an arbitrary identifier.

    I’m pretty sure the problem is to do with the fact that midi.xsd is a local file

    Nope, not relevant.

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

Sidebar

Related Questions

Here is my security-context.xml file <?xml version=1.0 encoding=UTF-8?> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:sec=http://www.springframework.org/schema/security xmlns:aop=http://www.springframework.org/schema/aop xsi:schemaLocation=http://www.springframework.org/schema/beans
Here are the excerpts of my Spring context .xml file. <?xml version=1.0 encoding=UTF-8?> <beans:beans
Here is my schema and xml file contents. When I want to validate my
I am trying to create an XSD schema file from an existing XML file
I am working on a C# application that involves using XML schema file as
I have an XML file that is validating against a schema. However on our
I'm searching the XSD (XML Schema) for the Microsoft .NET application configuration files. Till
I'm trying to load an XSD file as a Schema instance in my application
Here is my situation: I have my mvc-config.xml file for my web service set
Here is my current setup: Database Role - MyDbRole Schema - MySchema User -

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.