After upgrading dom4j to 2.1.3 from 1.5.2 I am getting

java.lang.IllegalArgumentException: Illegal character in name 11474

if my name has number like below:

{"11474" : [{"name" : "dept",
"type" : "9",
"value" : "003|Engineering"},{"name" : "empid",
"type" : "5",
"value" : "spadmin"},{"name" : "empName",
"type" : "5",
"value" : "Administrator, Service Delivery"},{"name" : "reason",
"type" : "12",
"value" : "0"}]}

This was working fine in previous dom4j 1.5.2. If I add a prefix to 11474 like "string_11474", it is working fine.

{"string_11474" : [{"name" : "dept",
"type" : "9",
"value" : "003|Engineering"},{"name" : "empid",
"type" : "5",
"value" : "spadmin"},{"name" : "empName",
"type" : "5",
"value" : "Administrator, Service Delivery"},{"name" : "reason",
"type" : "12",
"value" : "0"}]}

But I am getting this data from external application which I cannot control. How to resolve this issue? With this I am not able to upgrade from dom4j 1.5.2 to 2.1.3

If the tag has numeric I am getting the exception but it was working fine in 1.5.2

1

There are 1 best solutions below

0
On

dom4j 1.x didn't validate the Element name, dom4j 2.x added it. I don't think dom4j 2.x promised any backwards compatible behavior.