- Javax.xml.bind classes
- Home
- Binder
- DatatypeConverter
- JAXB
- JAXBContext
- JAXBElement
- JAXBElement.GlobalScope
- JAXBIntrospector
- Marshaller.Listener
- SchemaOutputResolver
- Unmarshaller.Listener
- Javax.xml.bind.util classes
- JAXBResult
- JAXBSource
- ValidationEventCollector
- Javax.xml.parsers classes
- DocumentBuilder
- DocumentBuilderFactory
- SAXParser
- SAXParserFactory
- Javax.xml.soap classes
- AttachmentPart
- MessageFactory
- MimeHeader
- MimeHeaders
- SAAJMetaFactory
- SOAPConnection
- SOAPConnectionFactory
- SOAPFactory
- SOAPMessage
- SOAPPart
- Javax.xml.validation classes
- Schema
- SchemaFactory
- TypeInfoProvider
- Validator
- ValidatorHandler
- Javax.xml.xpath classes
- XPathConstants
- XPathFactory
- Java Useful Resources
- Java - Quick Guide
- Java - Useful Resources
SAXParserFactory setNamespaceAware() Method
Description
The Javax.xml.parsers.SAXParserFactory.setNamespaceAware(boolean awareness) method specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to false.
Declaration
Following is the declaration for Javax.xml.parsers.SAXParserFactory.setNamespaceAware() method
public void setNamespaceAware(boolean awareness)
Parameters
awareness − true if the parser produced by this code will provide support for XML namespaces; false otherwise.
Return Value
This method does not return a value.
Exception
NA
Example
The following example shows the usage of Javax.xml.parsers.SAXParserFactory.setNamespaceAware() 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 namespace aware System.out.println("" + factory.isNamespaceAware()); // change this setting factory.setNamespaceAware(true); // check if our factory parsers are namespace aware System.out.println("" + factory.isNamespaceAware()); } 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
To Continue Learning Please Login
Login with Google