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

  • Home
  • SEARCH
  • 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 8065883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:48:34+00:00 2026-06-05T11:48:34+00:00

I’m trying to validate an XML against an XSD which internally refers to another

  • 0

I’m trying to validate an XML against an XSD which internally refers to another XSD (using include statement).

as,

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

Now while validating my XML against the xsd(schema1.xsd) like:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

    DocumentBuilder builder;
    try {
        builder = factory.newDocumentBuilder();

        Document document = builder.parse(new InputSource(new StringReader(
                inputXml)));
        TransformerFactory tranFactory = TransformerFactory.newInstance();
        Transformer aTransformer = tranFactory.newTransformer();
        Source src = new DOMSource(document);
        Result xmlFile = new StreamResult(new File("xmlFileName.xml"));
        aTransformer.transform(src, xmlFile);
    } catch (Exception e) {
        // TODO: handle exception
    }

    File xmlFile = new File("xmlFileName.xml");
    SchemaFactory factory1 = SchemaFactory
            .newInstance("http://www.w3.org/2001/XMLSchema");

    File schemaLocation = new File("F:\\Project\\Automation\\XSDs\\schema1.xsd");
    Schema schema = factory1.newSchema(schemaLocation);

    Validator validator = schema.newValidator();

    Source source = new StreamSource(xmlFile);

    try {
        validator.validate(source);
        System.out.println(xmlFile.getName() + " is valid.");
        isXmlValid = true;
    } catch (SAXException ex) {
        System.out.println(xmlFile.getName() + " is not valid because ");
        System.out.println(ex.getMessage());
        isXmlValid = false;
    }

I get an error, “cvc-datatype-valid.1.2.1: ‘True’ is not a valid value for ‘boolean’.”

This is for an element which is defined in the schema2.xsd which schema1.xsd is referring.

Please tell me if I am doing something wrong.

  • 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-05T11:48:36+00:00Added an answer on June 5, 2026 at 11:48 am

    You are experiencing a case problem. ‘true’ is a valid value for xsd:boolean, but ‘True’ (which is apparently what is in the XML document) is not.

    The responses here (xsd:boolean element type accept "true" but not "True". How can I make it accept it?) provide some additional information and a possible alternate solution based on enumerated values (if you cannot change the True to true).

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

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.