Javax.xml.Parsers.DocumentBuilderFactory Class



Introduction

The javax.xml.Parsers.DocumentBuilderFactory class defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents.

Class declaration

Following is the declaration for javax.xml.Parsers.DocumentBuilderFactory class −

public abstract class DocumentBuilderFactory
   extends Object

Class constructors

S.N. Constructor & Description
1 protected DocumentBuilderFactory()

This is the protected constructor to prevent instantiation.

Class methods

S.N. Method & Description
1 abstract Object getAttribute(String name)

This method allows the user to retrieve specific attributes on the underlying implementation.

2 abstract boolean getFeature(String name)

This method gets the state of the named feature.

3 Schema getSchema()

This method gets the Schema object specified through the setSchema(Schema schema) method.

4 boolean isCoalescing()

This method indicates whether or not the factory is configured to produce parsers which converts CDATA nodes to Text nodes and appends it to the adjacent (if any) Text node.

5 boolean isExpandEntityReferences()

This method indicates whether or not the factory is configured to produce parsers which expand entity reference nodes.

6 boolean isIgnoringComments()

This method indicates whether or not the factory is configured to produce parsers which ignores comments.

7 boolean isIgnoringElementContentWhitespace()

This method indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.

8 boolean isNamespaceAware()

This method indicates whether or not the factory is configured to produce parsers which are namespace aware.

9 boolean isValidating()

This method indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.

10 boolean isXIncludeAware()

This method gets state of XInclude processing.

11 abstract DocumentBuilder newDocumentBuilder()

This method creates a new instance of a DocumentBuilder using the currently configured parameters.

12 static DocumentBuilderFactory newInstance()

This method obtains a new instance of a DocumentBuilderFactory

13 static DocumentBuilderFactory newInstance(String factoryClassName, ClassLoader classLoader)

This method obtains a new instance of a DocumentBuilderFactory from class name.

14 abstract void setAttribute(String name, Object value)

This method allows the user to set specific attributes on the underlying implementation.

15 void setCoalescing(boolean coalescing)

This method specifies that the parser produced by this code will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node.

16 void setExpandEntityReferences(boolean expandEntityRef)

This method specifies that the parser produced by this code will expand entity reference nodes.

17 abstract void setFeature(String name, boolean value)

This method set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.

18 void setIgnoringComments(boolean ignoreComments)

This method specifies that the parser produced by this code will ignore comments.

19 void setIgnoringElementContentWhitespace(boolean whitespace)

This method specifies that the parsers created by this factory must eliminate whitespace in element content (sometimes known loosely as 'ignorable whitespace') when parsing XML documents.

20 void setNamespaceAware(boolean awareness)

This method specifies that the parser produced by this code will provide support for XML namespaces.

21 void setSchema(Schema schema)

This method set the Schema to be used by parsers created from this factory.

22 void setValidating(boolean validating)

This method specifies that the parser produced by this code will validate documents as they are parsed.

23 void setXIncludeAware(boolean state)

This method set state of XInclude processing.

Methods inherited

This class inherits methods from the following classes −

java.lang.Object

Advertisements