我有这个 xml 文件,我似乎无法将任何数据解组到结构中。有人可以在这里帮助我。只是我以前从未使用过 xml,在 xml 之前总是更喜欢 json。刚刚用我的代码编辑了这篇文章,它仍然给了我空的结构值
<Envelope>
<Data>
<Order>
<DeliveryData>
<del_country>BELGIQUE/BELGIE</del_country>
<del_country_code>BE</del_country_code>
<del_company>False</del_company>
<del_name>ADAM</del_name>
<del_contact></del_contact>
<del_firstName></del_firstName>
<del_addressLine1>Durasweg 33</del_addressLine1>
<del_addressLine2></del_addressLine2>
<del_areaCode>1000</del_areaCode>
<del_city>BRUXELLES</del_city>
<del_country>BE</del_country>
<del_language>FR</del_language>
<del_modeCode>71</del_modeCode>
<phone1>0032872180808</phone1>
<email></email>
<inv_third>438802</inv_third>
<OrderID>15787978</OrderID>
<ParcelID>NE1578797801</ParcelID>
<OrderDate>16/09/2014 14:22:54</OrderDate>
<Shipping_date>16/09/2014 14:26:55</Shipping_date>
</DeliveryData>
</Order>
</Data>
type DeliveryData struct {
XMLName xml.Name `xml:"DeliveryData"`
Country string `xml:"del_country"`
}
type Envelope struct {
XMLName xml.Name `xml:"Envelope"`
Data Data `xml:"Data"`
}
type Data struct {
XMLName xml.Name `xml:Data`
Orders []Order `xml:Order`
}
type Order struct {
XMLName xml.Name `xml:"Order"`
DeliveryData DeliveryData `xml:"DeliveryData"`
}
相关分类