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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:38:44+00:00 2026-05-11T06:38:44+00:00

I see in my application that xinclude inside my parsed XML file does not

  • 0

I see in my application that xinclude inside my parsed XML file does not work within my Java XSLT conversion.

However, although I do:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setXIncludeAware(true); 

I’m not specifically setting the transformer factory as System.getProperty('javax.xml.transform.TransformerFactory') returns ‘null’.

My question: does the default Java (1.6 or 6) support xinclude or do I have to add an alternative XSLT parser such as Apache Xerces?

  • 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. 2026-05-11T06:38:45+00:00Added an answer on May 11, 2026 at 6:38 am

    According to the spec, support has been there since Java 1.5 (5). I believe XInclude support relies on namespace awareness, which is turned off by default for backwards compatibility reasons.

    public class XIncludeDemo {      private static final String XML = '<?xml version=\'1.0\'?>\n'             + '<data xmlns=\'foo\' xmlns:xi=\'http://www.w3.org/2001/XInclude\'>\n'             + '<xi:include href=\'include.txt\' parse=\'text\'/>\n'             + '</data>\n';      private static final String INCLUDE = 'Hello, World!';      public static void main(String[] args) throws Exception {         // data         final InputStream xmlStream = new ByteArrayInputStream(XML                 .getBytes('UTF-8'));         final InputStream includeStream = new ByteArrayInputStream(INCLUDE                 .getBytes('UTF-8'));         // document parser         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();         factory.setXIncludeAware(true);         factory.setNamespaceAware(true);         DocumentBuilder docBuilder = factory.newDocumentBuilder();         if (!docBuilder.isXIncludeAware()) {             throw new IllegalStateException();         }         docBuilder.setEntityResolver(new EntityResolver() {             @Override             public InputSource resolveEntity(String publicId, String systemId)                     throws SAXException, IOException {                 if (systemId.endsWith('include.txt')) {                     return new InputSource(includeStream);                 }                 return null;             }         });         Document doc = docBuilder.parse(xmlStream);         // print result         Source source = new DOMSource(doc);         Result result = new StreamResult(System.out);         TransformerFactory transformerFactory = TransformerFactory                 .newInstance();         Transformer transformer = transformerFactory.newTransformer();         transformer.transform(source, result);     }  } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 67k
  • Answers 67k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer What you have described would require ISerializable (custom serialization) with… May 11, 2026 at 12:00 pm
  • added an answer Most of the Ajax toolkit controls seem to have very… May 11, 2026 at 12:00 pm
  • added an answer They only come into play when the program crashes. PDB's… May 11, 2026 at 12:00 pm

Related Questions

In my multithreaded application and I see heavy lock contention in it, preventing good
I want to use the Date::ABBR_MONTHS constant in my rails application. I see the
I would like to see the threads currently active in my application while debugging
I can see line numbers in my error logs in our development environment, in
Can my webmethod only return strings like I see in all the asp.net site
I would like to see errors in my terminal colorfully like:
In Visual Studio 2008, I can see all my project files in my Solution
I have marked my DLL as vsdraCOM, and I can see it in the
I want to see the stack trace in any function of my code, so
EDIT: See my working code in the answers below. In brief: I have a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.