• dom4j解析xml报错:Nested exception: org.xml.sax.SAXParseException: White space is required between the processing instruction target and data.


    采用dom4j方式解析string类型的xml

    xml:        String string="<?xmlversion="1.0" encoding="UTF-8"?><ROOT><HEAD><INFO><BUSINESSNO>T065205072015000097</BUSINESSNO><BUSINESSTYPE>T</BUSINESSTYPE></INFO></HEAD></ROOT>";
    时,报错:Nested exception: org.xml.sax.SAXParseException: White space is required between the processing instruction target and data.

    后来发现原来是xml格式有误。xmlversion应改为xml version.即xml和version之间应该有一个空格。

    改为

    string="<?xml version="1.0" encoding="UTF-8"?><ROOT><HEAD><INFO><BUSINESSNO>T065205072015000097</BUSINESSNO><BUSINESSTYPE>T</BUSINESSTYPE></INFO></HEAD></ROOT>";就OK了。

  • 相关阅读:
    类和对象
    关联查询
    重点函数
    三大范式
    主外键
    软件开发的项目周期
    什么是事务
    索引
    视图
    数据库对象
  • 原文地址:https://www.cnblogs.com/westward/p/5213100.html
Copyright © 2020-2023  润新知