Java 教程是为 JDK 8 编写的。本页中描述的示例和实践未利用在后续版本中引入的改进。
处理限制定义
            
The following list describes the JAXP XML Processing Limits supported in the JDK. 
These limits can be specified through the factory APIs, system properties, and the 
jaxp.properties file.
entityExpansionLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit | 
| 定义 | Limit the number of entity expansions. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 64000 | 
| System property | jdk.xml.entityExpansionLimit | 
| Since | 7u45, 8 | 
 
elementAttributeLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/elementAttributeLimit | 
| 定义 | Limit the number of attributes an element can have. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 10000 | 
| System property | jdk.xml.elementAttributeLimit | 
| Since | 7u45, 8 | 
maxOccurLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/maxOccurLimit | 
| 定义 | Limit the number of content model nodes that may be created 
when building a grammar for a W3C  XML Schema that contains maxOccurs attributes 
with values other than "unbounded". | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 5000 | 
| System property | jdk.xml.maxOccurLimit | 
| Since | 7u45, 8 | 
totalEntitySizeLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/totalEntitySizeLimit | 
| 定义 | Limit the total size of all entities that include general and parameter entities. The size is calculated as an aggregation of all entities. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 5x10^7 | 
| System property | jdk.xml.totalEntitySizeLimit | 
| Since | 7u45, 8 | 
maxGeneralEntitySizeLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/maxGeneralEntitySizeLimit | 
| 定义 | Limit the maximum size of any general entities. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 0 | 
| System property | jdk.xml.maxGeneralEntitySizeLimit | 
| Since | 7u45, 8 | 
maxParameterEntitySizeLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/maxParameterEntitySizeLimit | 
| 定义 | Limit the maximum size of any parameter entities, including the result of nesting multiple parameter entities. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 1000000 | 
| System property | jdk.xml.maxParameterEntitySizeLimit | 
| Since | 7u45, 8 | 
entityReplacementLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/entityReplacementLimit | 
| 定义 | Limit the total number of nodes in all entity references. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 3000000 | 
| System property | jdk.xml.entityReplacementLimit | 
| Since | 7u111, 8u101 | 
maxElementDepth
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/maxElementDepth | 
| 定义 | Limit the maximum element depth. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 0 | 
| System property | jdk.xml.maxElementDepth | 
| Since | 7u65, 8u11 | 
maxXMLNameLimit
| Attribute | 描述 | 
| Name | http://www.oracle.com/xml/jaxp/properties/maxXMLNameLimit | 
| 定义 | Limit the maximum size of XML names, including element name, attribute name
and namespace prefix and URI. | 
| 值 | A positive integer. A value less than or equal to 0 indicates no limit. If the value is not
an integer, a NumericFormatException is thrown. | 
| Default value | 1000 | 
| System property | jdk.xml.maxXMLNameLimit | 
| Since | 7u91, 8u65 | 
Legacy System Properties
These properties, which were introduced since JDK 5.0 and 6, continue to be supported for backward compatibility.
| System Property | Since | New System Property | 
| entityExpansionLimit | 1.5 | jdk.xml.entityExpansionLimit | 
| elementAttributeLimit | 1.5 | jdk.xml.elementAttributeLimit | 
| maxOccurLimit | 1.6 | jdk.xml.maxOccur | 
{java.home}/lib/jaxp.properties
The system properties can be specified in the jaxp.properties file to define the behavior for all invocations of the JDK or JRE. The format is system-property-name=value. 例如:
jdk.xml.maxGeneralEntitySizeLimit=1024