dpmwy80068 2019-01-28 15:41
浏览 60
已采纳

Golang xml。解组任意元素

XML with arbitrary number of arbitrarily named elements:

<modules>
<elt1><version>1.2.3</version></elt1>
<eltN><version>4.5.6</version></eltN>
</modules>

How to parse this into a map[string]string for elementname to version? All Unmarshall examples that I found, assume static element names.

  • 写回答

1条回答 默认 最新

  • dsgoj7457 2019-01-28 15:51
    关注

    You could use xml.Decoder instead: Example, which severely lacks error handling.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?