📄 documentbuilderfactory.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><!--JBuilder QuickDoc-->
<HEAD>
<TITLE>Class javax.xml.parsers.DocumentBuilderFactory</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
</HEAD>
<BODY>
<H2>
<FONT SIZE="-1">javax.xml.parsers</FONT>
<BR>Class DocumentBuilderFactory</H2>
<DL>
<DT>public abstract class <B>DocumentBuilderFactory</B>
</DL>
<DL><DD>Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents. An implementation of the <code>DocumentBuilderFactory</code> class is <em>NOT</em> guaranteed to be thread safe. It is up to the user application to make sure about the use of the <code>DocumentBuilderFactory</code> from more than one thread. Alternatively the application can have one instance of the <code>DocumentBuilderFactory</code> per thread. An application can use the same instance of the factory to obtain one or more instances of the <code>DocumentBuilder</code> provided the instance of the factory isn't being used in more than one thread at a time.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Version:</B><DD>1.0</DD>
<DT><B>Since:</B><DD>JAXP 1.0</DD>
</DL>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF"><TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B>
</FONT></TD></TR></TABLE>
<H3>newInstance</H3>
<PRE>
public static DocumentBuilderFactory <B>newInstance</B>()</PRE>
<DL><DD>Obtain a new instance of a <code>DocumentBuilderFactory</code>. This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine the <code>DocumentBuilderFactory</code> implementation class to load: <ul> <li> Use the <code>javax.xml.parsers.DocumentBuilderFactory</code> system property. </li> <li> Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard <code>java.util.Properties </code> format and contains the fully qualified name of the implementation class with the key being the system property defined above. </li> <li> Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file <code>META-INF/services/javax.xml.parsers.DocumentBuilderFactory</code> in jars available to the runtime. </li> <li> Platform default <code>DocumentBuilderFactory</code> instance. </li> </ul> Once an application has obtained a reference to a <code>DocumentBuilderFactory</code> it can use the factory to configure and obtain parser instances.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Throws:</B><DD><CODE>FactoryConfigurationError</CODE> - if the implementation is not available or cannot be instantiated.</DD>
</DL>
<HR>
<H3>newDocumentBuilder</H3>
<PRE>
public abstract DocumentBuilder <B>newDocumentBuilder</B>()</PRE>
<DL><DD>Creates a new instance of a <A HREF="javax.xml.parsers.DocumentBuilder">javax.xml.parsers.DocumentBuilder</A> using the currently configured parameters.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>A new instance of a DocumentBuilder.</DD>
<DT><B>Throws:</B><DD><CODE>ParserConfigurationException</CODE> - if a DocumentBuilder cannot be created which satisfies the configuration requested.</DD>
</DL>
<HR>
<H3>setNamespaceAware</H3>
<PRE>
public void <B>setNamespaceAware</B>(boolean awareness)</PRE>
<DL><DD>Specifies that the parser produced by this code will provide support for XML namespaces. By default the value of this is set to <code>false</code><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>awareness</CODE> - true if the parser produced will provide support for XML namespaces; false otherwise.</DD>
</DL>
<HR>
<H3>setValidating</H3>
<PRE>
public void <B>setValidating</B>(boolean validating)</PRE>
<DL><DD>Specifies that the parser produced by this code will validate documents as they are parsed. By default the value of this is set to <code>false</code>.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>validating</CODE> - true if the parser produced will validate documents as they are parsed; false otherwise.</DD>
</DL>
<HR>
<H3>setIgnoringElementContentWhitespace</H3>
<PRE>
public void <B>setIgnoringElementContentWhitespace</B>(boolean whitespace)</PRE>
<DL><DD>Specifies that the parsers created by this factory must eliminate whitespace in element content (sometimes known loosely as 'ignorable whitespace') when parsing XML documents (see XML Rec 2.10). Note that only whitespace which is directly contained within element content that has an element only content model (see XML Rec 3.2.1) will be eliminated. Due to reliance on the content model this setting requires the parser to be in validating mode. By default the value of this is set to <code>false</code>.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>whitespace</CODE> - true if the parser created must eliminate whitespace in the element content when parsing XML documents; false otherwise.</DD>
</DL>
<HR>
<H3>setExpandEntityReferences</H3>
<PRE>
public void <B>setExpandEntityReferences</B>(boolean expandEntityRef)</PRE>
<DL><DD>Specifies that the parser produced by this code will expand entity reference nodes. By default the value of this is set to <code>true</code><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>expandEntityRef</CODE> - true if the parser produced will expand entity reference nodes; false otherwise.</DD>
</DL>
<HR>
<H3>setIgnoringComments</H3>
<PRE>
public void <B>setIgnoringComments</B>(boolean ignoreComments)</PRE>
<DL><DD>Specifies that the parser produced by this code will ignore comments. By default the value of this is set to <code>false </code><DL><DD></DD></DL></DD>
</DL>
<DL></DL>
<HR>
<H3>setCoalescing</H3>
<PRE>
public void <B>setCoalescing</B>(boolean coalescing)</PRE>
<DL><DD>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. By default the value of this is set to <code>false</code><DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>coalescing</CODE> - true if the parser produced will convert CDATA nodes to Text nodes and append it to the adjacent (if any) text node; false otherwise.</DD>
</DL>
<HR>
<H3>isNamespaceAware</H3>
<PRE>
public boolean <B>isNamespaceAware</B>()</PRE>
<DL><DD>Indicates whether or not the factory is configured to produce parsers which are namespace aware.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>true if the factory is configured to produce parsers which are namespace aware; false otherwise.</DD>
</DL>
<HR>
<H3>isValidating</H3>
<PRE>
public boolean <B>isValidating</B>()</PRE>
<DL><DD>Indicates whether or not the factory is configured to produce parsers which validate the XML content during parse.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>true if the factory is configured to produce parsers which validate the XML content during parse; false otherwise.</DD>
</DL>
<HR>
<H3>isIgnoringElementContentWhitespace</H3>
<PRE>
public boolean <B>isIgnoringElementContentWhitespace</B>()</PRE>
<DL><DD>Indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>true if the factory is configured to produce parsers which ignore ignorable whitespace in element content; false otherwise.</DD>
</DL>
<HR>
<H3>isExpandEntityReferences</H3>
<PRE>
public boolean <B>isExpandEntityReferences</B>()</PRE>
<DL><DD>Indicates whether or not the factory is configured to produce parsers which expand entity reference nodes.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>true if the factory is configured to produce parsers which expand entity reference nodes; false otherwise.</DD>
</DL>
<HR>
<H3>isIgnoringComments</H3>
<PRE>
public boolean <B>isIgnoringComments</B>()</PRE>
<DL><DD>Indicates whether or not the factory is configured to produce parsers which ignores comments.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>true if the factory is configured to produce parsers which ignores comments; false otherwise.</DD>
</DL>
<HR>
<H3>isCoalescing</H3>
<PRE>
public boolean <B>isCoalescing</B>()</PRE>
<DL><DD>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.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Returns:</B><DD>true if the factory is configured to produce parsers which converts CDATA nodes to Text nodes and appends it to the adjacent (if any) Text node; false otherwise.</DD>
</DL>
<HR>
<H3>setAttribute</H3>
<PRE>
public abstract void <B>setAttribute</B>(String name,
Object value)</PRE>
<DL><DD>Allows the user to set specific attributes on the underlying implementation.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of the attribute.</DD>
<DD><CODE>value</CODE> - The value of the attribute.</DD>
<DT><B>Throws:</B><DD><CODE>IllegalArgumentException</CODE> - thrown if the underlying implementation doesn't recognize the attribute.</DD>
</DL>
<HR>
<H3>getAttribute</H3>
<PRE>
public abstract Object <B>getAttribute</B>(String name)</PRE>
<DL><DD>Allows the user to retrieve specific attributes on the underlying implementation.<DL><DD></DD></DL></DD>
</DL>
<DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of the attribute.</DD>
<DT><B>Returns:</B><DD>value The value of the attribute.</DD>
<DT><B>Throws:</B><DD><CODE>IllegalArgumentException</CODE> - thrown if the underlying implementation doesn't recognize the attribute.</DD>
</DL>
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -