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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:44:16+00:00 2026-05-29T20:44:16+00:00

I have two schema files one is imported from the other. When executing the

  • 0

I have two schema files one is imported from the other. When executing the code in Eclipse schemas are found but when executing the code from jar schema files are not found

here is the code

SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);

        SchemaFactory schemaFactory = SchemaFactory
                .newInstance("http://www.w3.org/2001/XMLSchema");
        try {
            factory.setSchema(schemaFactory.newSchema(new Source[] {
                    new StreamSource(getClass().getResource("Liso.xsd")
                            .getFile()),
                    new StreamSource(getClass().getResource("LisoXml.xsd")
                            .getFile()) }));
                this.saxParser = factory.newSAXParser();
        } catch (SAXException se) {
            System.out.println("SCHEMA : " + se.getMessage()); // problem in the XSD itself
        }

and here is the error I get

SCHEMA : schema_reference.4: Failed to read schema document 'file:/C:/Tools/lib/LisoTools.jar!/com/xerox/liso/xml/Liso.xsd', because 1) could not find the do
cument; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

Thanks

  • 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-29T20:44:19+00:00Added an answer on May 29, 2026 at 8:44 pm

    If Liso.xsd is importing LisoXml.xsd, then it is just sufficient to define Liso.xsd to the schema factory as shown below. The api is smart enough the load the imported/included schema(s).

    SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema")
    Schema compiledSchema = schemaFactory.newSchema(getClass().getClassLoader().getResource("Liso.xsd"))
    

    I verified this worked on both 1.5 and 1.6. On 1.6, you might hit in to this issue as well if using DOM.

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

Sidebar

Related Questions

i am facing one problem i have two xml files. Plugins.xml <SolutionProfile xmlns=http://schemas.microsoft.com/pag/cab-profile> <Modules>
I have two XML files with two different XSD schemas and different namespaces. They
I have a super-simple query in a star schema. One fact, two dimensions. I
Hallo all, I have two files, one called part1.txt and another one called part2.txt,
I have two xml files and I need to create one xsd for both.
I have two xsd files to validate a xml. But the problem is my
fI have created two layout files. First one is main.xml <?xml version=1.0 encoding=utf-8?> <LinearLayout
I have an XML document containing types from 2 XML schemas. One (theirs.xsd) is
I have two tables, both named as say, Employee in two different schema HR
I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine

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.