SAXParserFactory setXIncludeAware() Method



Description

The Javax.xml.parsers.SAXParserFactory.setXIncludeAware(boolean state) method sets state of XInclude processing. If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0. XInclude processing defaults to false.

Declaration

Following is the declaration for Javax.xml.parsers.SAXParserFactory.setXIncludeAware() method

public void setXIncludeAware(boolean state)

Parameters

state − Set XInclude processing to true or false

Return Value

This method does not return a value.

Exception

UnsupportedOperationException − When implementation does not override this method

Example

The following example shows the usage of Javax.xml.parsers.SAXParserFactory.setXIncludeAware() method.

package com.tutorialspoint;

import javax.xml.parsers.SAXParserFactory;

public class SAXParserFactoryDemo {

   public static void main(String[] args) {

      // create a new SAXParserFactory
      SAXParserFactory factory = SAXParserFactory.newInstance();

      try {

         // check if our factory parsers are XInclude aware
         System.out.println("" + factory.isXIncludeAware());

         // change this setting
         factory.setXIncludeAware(true);

         // check if our factory parsers are XInclude aware
         System.out.println("" + factory.isXIncludeAware());

      } catch (Exception ex) {
         ex.printStackTrace();
      }

   }
}

If we compile the code and execute it, this will produce the following result −

false
true
javax_xml_parsers_saxparserfactory.htm
Advertisements