【问题标题】:How to read this xml? [duplicate]如何阅读这个xml? [复制]
【发布时间】:2012-01-27 10:46:42
【问题描述】:

可能重复:
How to read an XML file with Java?

关闭

【问题讨论】:

  • Here 你可以找到一个完整的 SAX 示例。如果不想使用 DTD,请忽略它。

标签: java xml


【解决方案1】:

只有一个带有grantee-template 标签名称的元素。你似乎期待两个。你真正要找的是它的两个孩子。

【讨论】:

    【解决方案2】:

    替换你的第一个语句

    NodeList granteeTemplate = doc.getElementsByTagName("grantee-template")
    

    NodeList granteeTemplate=doc.getDocumentElement().getChildNodes();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-06
      • 2016-02-26
      • 2012-02-11
      相关资源
      最近更新 更多