在xml报文的解析中,经常遇到因为xml不规范导致的错误
如:The element type is required in the attribute-list declaration.
等问提就是xml格式不规范,只需要将标签之间的空格去除即可
去掉所有的换行符 空格 制表符
String xml="
Pattern pa = Pattern.compile(">(\\s*|\n|\t|\r)<");
Matcher m = pa.matcher(xml);
xml = m.replaceAll("><");
用><代替> <,去除中间的空格等