文档

Java™ 教程-Java Tutorials 中文版
处理限制定义
Trail: Java API for XML Processing (JAXP)
Lesson: Processing Limits

处理限制定义

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

Previous page: Processing Limits
Next page: Scope and Order