Thanks~ I have solved this problem


------------------ 原始邮件 ------------------
发件人: "Kurtis Rader"<kra...@skepticism.us&gt;; 
发送时间: 2022年8月11日(星期四) 上午10:49
收件人: "Beyond"<1215894...@qq.com&gt;; 
抄送: "golang-nuts"<golang-nuts@googlegroups.com&gt;; 
主题: Re: [go-nuts] Re: How to Unmarshal an XML document to a Map[string]string



On Wed, Aug 10, 2022 at 6:51 PM 'wentao Xiong' via golang-nuts 
<golang-nuts@googlegroups.com&gt; wrote:

Hello~ Why I code it hits: could not import xml (no required module provides 
package "xml")?




Note that you are replying to a discussion thread that is ten years old. It is 
better to start a&nbsp;new&nbsp;discussion thread in this&nbsp;type of 
situation. You also did not show us a minimal reproduction of your problem. 
Having said that, you would import that package by adding this to your program:


&nbsp; &nbsp; import "encoding/xml"


See https://pkg.go.dev/encoding/xml.


&nbsp;
在2012年8月21日星期二 UTC+8 20:49:16<nvcnvn&gt; 写道:

thank you, I will try it.

Vào 02:12:03 UTC+7 Thứ ba, ngày 21 tháng tám năm 2012, clba...@gmail.com đã 
viết:check out:&nbsp;https://github.com/clbanning/x2j

On Friday, November 18, 2011 7:33:38 AM UTC-6, Nguyên Nguyễn Văn Cao wrote:Is 
there any way read an XML document and but it to a
map[string]string? I have read about xml package but there only
example with struct.
For example:
#######################
<?xml version="1.0" encoding="UTF-8" ?&gt;
<langs&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<en&gt;English</en&gt;
</langs&gt;
#######################
or this file:
#######################
<?xml version="1.0" encoding="UTF-8" ?&gt;
<langs&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<lang 
name="en"&gt;English</lang&gt;
</langs&gt;
#######################
I hope by some magical with xml pkg, I get a map: map["en"] ==
"English"

P/s: I can put it to a struct, after that loop over the struct range
and generate a map, but I need to find if there is one simple way!




 

 -- 
 You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to golang-nuts+unsubscr...@googlegroups.com.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/56f09282-9152-439b-8f8e-6a8e0a8ac37dn%40googlegroups.com.
 



-- 
Kurtis RaderCaretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/tencent_60C87AB62CC10F8D1D789B43A8E941363806%40qq.com.

Reply via email to