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 76k
  • Answers 76k
  • 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 Use this: http://www.w3schools.com/Xml/tryit.asp?filename=tryxml_parsertest2 It parses xml from a string and… May 11, 2026 at 3:00 pm
  • added an answer I just created a sample project using VS 2008 with… May 11, 2026 at 3:00 pm
  • added an answer Write a simple class containing all the properties your report… May 11, 2026 at 3:00 pm

Related Questions

I have a page in my application that refreshes some content (a list of
I want to build something like a network scanner, so that I see in
OK, I should start this off by saying I'm not sure this is necessarily
I have a Form in my application that displays some data. When I first

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.