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 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
  • 1 View
  • 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

Related Questions

I have an application that checks to see if a user exists (if not
Well It's not a big question, obviously. But you see, an application that is
I'm currently developing a C-module for a Java-application that needs some performance improvements (see
I have an application that needs to poll a webservice to see if the
I have application that is up more than 3 days. I can see in
Sometime I see many application such as msn, windows media player etc that are
I'm trying to secure an application so that users can only see objects which
I see that apple has implemented a max size for the actual application but
I created the setup project for the application and I can see that the
It's common to see a UISearchBar in an application, that upon a click, will

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.