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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:57:36+00:00 2026-06-10T14:57:36+00:00

In my schema file below, I have an element Stat which extends Entity .

  • 0

In my schema file below, I have an element Stat which extends Entity. As far as I am aware, I follow w3’s example, but when I go to parse the schema (and the xml that uses the schema) with through java’s DocumentBuilderFactory and SchemaFactory I get this exception:

org.xml.sax.SAXParseException; systemId: file:/schema/characterschema.xsd; 
    src-resolve.4.2: Error resolving component 'cg:Entity'. It was detected that
    'cg:Entity' is in namespace 'http://www.schemas.theliraeffect.com/chargen/entity',
    but components from this namespace are not referenceable from schema document
    'file:/home/andrew/QuasiWorkspace/CharacterGenerator/./schema/characterschema.xsd'.
    If this is the incorrect namespace, perhaps the prefix of 'cg:Entity' needs
    to be changed. If this is the correct namespace, then an appropriate 'import'
    tag should be added to '/schema/characterschema.xsd'.

So, it seems that I cannot see my namespace within my schema. Do I need to import my schema into itself or am I completely misreading this exception? Could it be that I am declaring my schema incorrectly?

This is my schema for reference:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:cg="http://www.schemas.theliraeffect.com/chargen/entity"
    elementFormDefault="qualified">

    <xs:element name="Entity">
        <xs:complexType>
            <xs:attribute name="id" type="xs:string" use="required"/>                    
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="description" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="Stat">
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="cg:Entity">
                    <xs:sequence>
                        <xs:element name="table" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>                        
                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>
</xs:schema>
  • 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-06-10T14:57:38+00:00Added an answer on June 10, 2026 at 2:57 pm

    There are two problems with your schema. First, you don’t declare a targetNamespace so the Entity and Stat elements you are defining are not in a namespace. Second, a type can’t extend an element, only another type.

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:cg="http://www.schemas.theliraeffect.com/chargen/entity"
        targetNamespace="http://www.schemas.theliraeffect.com/chargen/entity"
        elementFormDefault="qualified">
    
        <xs:complexType name="EntityType">
            <xs:attribute name="id" type="xs:string" use="required"/>                    
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="description" type="xs:string"/>
        </xs:complexType>
    
        <xs:element name="Entity" type="cg:EntityType" />
    
    
        <xs:complexType name="StatType">
            <xs:complexContent>
                <xs:extension base="cg:EntityType">
                    <xs:sequence>
                        <xs:element name="table" type="xs:string" minOccurs="0"
                               maxOccurs="unbounded"/>                        
                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    
        <xs:element name="Stat" type="cg:StatType" />
    </xs:schema>
    

    Here I’m defining two types, one of which extends the other, and two top level elements of the respective types. All the top-level types and elements are defined into the targetNamespace of the schema, and the nested table element inside StatType is also in this namespace because of the elementFormDefault="qualified" – without this the Entity and Stat elements would be in the http://www.schemas.theliraeffect.com/chargen/entity namespace but the table element would be in no namespace.

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

Sidebar

Related Questions

I have xsd schema file which I can't change. Here is an excerpt that
I have flat file schema (description below), I am getting flat file(description below) through
We have a legacy schema file which has the following column names, would like
I've got a XML Schema (xsd file) snippet bellow, in which I want the
I have an XML Schema Definition file .XSD who's elements are in Spanish. I
I can generate my models and schema.yml file based on an existing database. But
I have an XML Schema that mostly makes sense, but I encountered a bit
I have defined a xml schema as below <?xml version=1.0 encoding=utf-8?> <xs:schema id=PacketTemplate targetNamespace=http://tempuri.org/PacketTemplate.xsd
I have an XML file that is validating against a schema. However on our
I have a feature which provisions a custom Default.aspx file to my publishing site

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.