search

Home  >  Q&A  >  body text

如何用java解析单节点xml字符串

SQL SERVER中“SELECT 字段 FROM 表名 FOR XML AUTO” 生成如下格式字符串:

<R attr1="xxx" attr2="xxx" />

dom4j等需要获取root元素,而该字符串中没有root元素,有没有其他简单的方案?

阿神阿神2880 days ago944

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-17 11:41:38

    Xerces Java Parser
    JAXB

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 11:41:38

    dom4j is an excellent encapsulation of DOM. for ease of use. You can try to start from the original dom. Solve problems.
    Other analysis:
    dom
    jdom
    sax

    reply
    0
  • Cancelreply