我的XML有点使用rust ,但是我试图用XML创建一个基于本地天气网络的api。但是还没有完成,但是在测试时遇到了错误,这是
error on line 3 at column 16: AttValue: " or ' expected.
我的代码:
<local_weather>
<local_counties>
<county id = 1>
<name> Suffolk </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Ipswich,uk&APPID=6ce0e1da2bbce97fe9e735c3a2009c71
</location>
<name> Norfolk </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Norwich,uk&APPID=da4be448d33cb1b0d8b5bdaa4daca4f7
</location>
<name> Essex </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Chelmsford,uk&APPID&APPID=9fa167ffbd810a6cdbf0fe73597d92fe
</location>
<name> Cambridgeshire </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Peterborough,uk&APPID&APPID=2dcefd34930d723d95c0c3d910f90c3d
</location>
</local_counties>
</local_weather>
最佳答案
要使您的XML well-formed ,需要进行三处更正:
<county id= 1 >
更改为<county id="1">
。 county
添加结束标记。 &
替换&
。 这是您的XML,格式正确:
<local_weather>
<local_counties>
<county id ="1">
<name> Suffolk </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Ipswich,uk&APPID=6ce0e1da2bbce97fe9e735c3a2009c71
</location>
<name> Norfolk </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Norwich,uk&APPID=da4be448d33cb1b0d8b5bdaa4daca4f7
</location>
<name> Essex </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Chelmsford,uk&APPID&APPID=9fa167ffbd810a6cdbf0fe73597d92fe
</location>
<name> Cambridgeshire </name>
<location>
api.openweathermap.org/data/2.5/weather?q=Peterborough,uk&APPID&APPID=2dcefd34930d723d95c0c3d910f90c3d
</location>
</county>
</local_counties>
</local_weather>
关于xml - XML错误:AttValue:应为 "or ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39620786/