with fix when no xml3 tag : https://go.dev/play/p/DaW7z7woHeW

Le mercredi 29 novembre 2023 à 10:03:23 UTC+1, Jérôme LAFORGE a écrit :

> Thx Jason.
>
> If helps someone, plz find how I manage this: 
> https://go.dev/play/p/kLwRB3fuJdK
>
>
> Le mercredi 29 novembre 2023 à 03:26:27 UTC+1, Jason E. Aten a écrit :
>
>> Perhaps you can adapt this to your needs.
>>
>> https://github.com/glycerine/xml2csv
>>
>> by taking just the xml parsing part, and then doing what you want with 
>> the tree of tags.
>>
>> On Tuesday, November 28, 2023 at 3:00:18 PM UTC Jérôme LAFORGE wrote:
>>
>>> Hello,
>>> The playground: https://go.dev/play/p/EQTHwGlKQDt
>>>
>>> I have this xml
>>> data := []byte(`<xml1>
>>> <xml2>hello</xml2>
>>> <xml3><xml4>foobar</xml4></xml3>
>>> </xml1>`)
>>>
>>> That, I want to unmarhsall into xmlBody struct:
>>> type (
>>> xml3 struct {
>>> Data string `xml:",innerxml"`
>>> }
>>>
>>> xmlBody struct {
>>> XML2 string `xml:"xml2"`
>>> XML3 xml3   `xml:"xml3"`
>>> }
>>> )
>>>
>>> Unfortunately, I am not able to get <xml3><xml4>foobar</xml4></xml3> as 
>>> string in x.XML3.Data.
>>>
>>> Thanks in advance for your help.
>>>
>>>
>>>
>>>
>>>

-- 
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/724c1328-e3ee-4efc-addc-0f8265636d58n%40googlegroups.com.

Reply via email to