String字符串类型xml

<?xml version="1.0" encoding="UTF-8"?>
<workorder>
  <basic:id>工单单号</basic:id>

  <basic:title>申请单标题</basic:title>

</workorder>

使用dom4j解析:DocumentHelper.parseText(condition);

出现如下错误

Error on line 1 of document : The prefix "basic" for element "basic:id" is not bound. Nested exception: The prefix "basic" for element "basic:id" is not bound.

解决办法:

1.在root节点添加属性: xmlns:basic="dom4j The prefix “xxx” for element "xxx:yyy" is not boundhttp://www.example.com"

root节点变成<workorder xmlns:basic="dom4j The prefix “xxx” for element "xxx:yyy" is not boundhttp://www.example.com">

2.删掉前缀basic只留下id(个人感觉这是废话)。

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2021-12-10
猜你喜欢
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
相关资源
相似解决方案