SAXParser isNamespaceAware() Method



Description

The Javax.xml.parsers.SAXParser.isNamespaceAware() method indicates whether or not this parser is configured to understand namespaces.

Declaration

Following is the declaration for Javax.xml.parsers.SAXParser.isNamespaceAware() method

public abstract boolean isNamespaceAware()

Parameters

NA

Return Value

This method returns true if this parser is configured to understand namespaces; false otherwise.

Exception

NA

Example

The following example shows the usage of Javax.xml.parsers.SAXParser.isNamespaceAware() method.

package com.tutorialspoint;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class SaxParserDemo {

   public static void main(String[] args) {

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

      try {

         // get a new SAXParser
         SAXParser parser = factory.newSAXParser();

         // check if parser is name space aware
         System.out.println("" + parser.isNamespaceAware());

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

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

false

javax_xml_parsers_saxparser.htm
Advertisements