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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:45:01+00:00 2026-05-12T10:45:01+00:00

I have one xsd file I’d rather not modify (Exceptions.xsd): <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns=http://me.com/Exceptions.xsd targetNamespace=http://me.com/Exceptions.xsd

  • 0

I have one xsd file I’d rather not modify (Exceptions.xsd):

<xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns="http://me.com/Exceptions.xsd" 
        targetNamespace="http://me.com/Exceptions.xsd" 
        elementFormDefault="qualified" 
        attributeFormDefault="unqualified"
>
    <xs:element name="Exception" type="ExceptionType" />

    <xs:complexType name="ExceptionType">
        <xs:sequence>
            <xs:element name="Code" type="xs:string" minOccurs="0"/>
            <xs:element name="Message" type="xs:string"/>
            <xs:element name="TimeStamp" type="xs:dateTime"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

I want to create a new element with an other name that implements that ExceptionType (ExceptionsExtensions.xsd – Alternative 1).

<xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns="http://me.com/Exceptions.xsd" 
        targetNamespace="http://me.com/Exceptions.xsd" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation=
                " 
                http://me.com/Exceptions.xsd Exceptions.xsd
                "
        elementFormDefault="qualified" 
        attributeFormDefault="unqualified">

    <xs:element name="SpecificException" type="ExceptionType" />
</xs:schema>

I get the error message: Type ‘http://me.com/Exceptions.xsd:ExceptionType‘ is not declared.

However, if I would do this (ExceptionExtensions.xsd – Alternative 2):

<xs:schema 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns="http://me.com/Exceptions.xsd" 
    targetNamespace="http://me.com/Exceptions.xsd" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation=
            " 
            http://me.com/Exceptions.xsd Exceptions.xsd
            "
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified">

    <xs:element name="SpecificException">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="innerException">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:any namespace="http://me.com/Exceptions.xsd" />                         
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

I can validate

<?xml version="1.0" encoding="utf-8"?>
<SpecificException xmlns="http://me.com/Exceptions.xsd">
    <innerException>
        <Exception>
            <Code>12</Code>
            <Message>Message</Message>
            <TimeStamp>2009-08-27T11:30:00</TimeStamp>
        </Exception>
    </innerException>
</SpecificException>

So in Alternative 1 it CANNOT find the ExceptionType which is declared in Exceptions.xsd, but in Alternative 2 it CAN find the Exception-element which is declared in Exceptions.xsd.

Why doesn’t Alternative 1 work?

Kind regards,
Guillaume Hanique

  • 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-12T10:45:01+00:00Added an answer on May 12, 2026 at 10:45 am

    In your “Alternative 1”, you’re referencing “ExceptionType” – but it’s not declared anywhere in that file.

    Just because two files share the same namespace doesn’t mean File A can depends on stuff in File B – you will need to connect the two!

    Add an <xsd:include> to your second file:

    <xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns="http://me.com/Exceptions.xsd" 
        targetNamespace="http://me.com/Exceptions.xsd" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://me.com/Exceptions.xsd Exceptions.xsd"
        elementFormDefault="qualified" 
        attributeFormDefault="unqualified">
    
      <xs:include schemaLocation="exceptiontype.xsd"/>
    
      <xs:element name="SpecificException" type="ExceptionType" />
    </xs:schema>
    

    That should do the trick!

    Marc

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

Sidebar

Related Questions

I have one schema file that I'm using to generate java files. I want
If i have xsd file in the following directories src/main/resources/xsd src/main/resources/schema/common src/main/resources/schema/soap How can
I have an XSD file which contains the schema for my XML. The XSD
I have an XSD file such as: <xs:schema targetNamespace=...> <xs: import namespace=...> <xs: import
I have one xsd file ,I used xmlpad to validate this xsd against xml
I have an XSL that is transforming one XSD into another XSD that has
I have one XML request which I need to modify (to XML) and then
I have an .xsd file stored as a resource in my vb.net project. I
I am trying to convert xsd file to the .net class. I have searched
I have an XSD file with an enumerated type. I'd like to create an

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.