jdk.xml.elementAttributeLimit
Java System Property accepts an integer value that limits how many attributes an XML element may have.jdk.xml.elementAttributeLimit
The java system property jdk.xml.elementAttributeLimit sets an upper limit on the number of attributes an XML element may have.
Here's an example of an XML document with a single tag, with an attribute named attribute
:
<?xml version="1.0" ?> <tag attribute="value" />
In our example above, we cannot have more attributes in that tag than the jdk.xml.elementAttributeLimit
system property allows.
Security Tip
Be careful when setting
jdk.xml.elementAttributeLimit
that you do not to set it too high. If you setjdk.xml.elementAttributeLimit
too high, it may result in resource exhaustion, or a denial of service.
You may see the following error message when you encounter the element attribute limit:
Element "tagName" has more than "10000" attributes, "10000" is the limit imposed by the JDK.
Here are some other XML java system properties:
java.xml.config.file
javax.xml.accessExternalDTD
jdk.xml.enableExtensionFunctions
jdk.xml.entityExpansionLimit
jdk.xml.maxXMLNameLimit
jaxp.properties
The jdk.xml.elementAttributeLimit
can be specified in the jaxp.properties
file, typically located in jvm's conf/jaxp.properties
of your JVM. You can
also create your own jaxp.properties
file which can be set via the java.xml.config.file
java system property.
Java has supported the jdk.xml.elementAttributeLimit
system property since version 1.5.
jdk.xml.elementAttributeLimit
on StartupYou can set the jdk.xml.elementAttributeLimit
java system property during startup of the java runtime using the -D
command line argument:
java -Djdk.xml.elementAttributeLimit=1000 MyAppMain
You may also be able to specify jdk.xml.elementAttributeLimit
via the JAVA_TOOL_OPTIONS
environment variable:
JAVA_TOOL_OPTIONS=-Djdk.xml.elementAttributeLimit=1000
jdk.xml.elementAttributeLimit
at RuntimeYou can set jdk.xml.elementAttributeLimit at runtime with the following Java code:
System.setProperty("jdk.xml.elementAttributeLimit", "1000");
WARNING: Depending on the property and JVM version using
setProperty
may or may not work if the JDK Java class that uses this variable has already been loaded. The value of the jdk.xml.elementAttributeLimit system property may be cached within an internal private static variable of the implementing class.
To read the value of jdk.xml.elementAttributeLimit at runtime, you can use this Java code:
String propertyValue = System.getProperty("jdk.xml.elementAttributeLimit"); if (propertyValue != null) { System.out.println("jdk.xml.elementAttributeLimit = " + propertyValue); } else { System.out.println("jdk.xml.elementAttributeLimit was null"); }