xml - XML错误:AttValue:应为 "or '

标签 xml

我的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添加结束标记。
  • &替换&amp;


  • 这是您的XML,格式正确:
    <local_weather>
        <local_counties>
            <county id ="1">
                <name> Suffolk </name>
                <location>
                    api.openweathermap.org/data/2.5/weather?q=Ipswich,uk&amp;APPID=6ce0e1da2bbce97fe9e735c3a2009c71  
                </location>
                <name> Norfolk </name>
                <location>
                    api.openweathermap.org/data/2.5/weather?q=Norwich,uk&amp;APPID=da4be448d33cb1b0d8b5bdaa4daca4f7
                </location>
                <name> Essex </name>
                <location>
                    api.openweathermap.org/data/2.5/weather?q=Chelmsford,uk&amp;APPID&amp;APPID=9fa167ffbd810a6cdbf0fe73597d92fe
                </location>
                <name> Cambridgeshire </name>
                <location>
                    api.openweathermap.org/data/2.5/weather?q=Peterborough,uk&amp;APPID&amp;APPID=2dcefd34930d723d95c0c3d910f90c3d
                </location>
            </county>
      </local_counties>
    </local_weather>
    

    关于xml - XML错误:AttValue:应为 "or ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39620786/

    相关文章:

    javascript - 我需要学习什么语言才能为我的爱普生收据打印机制作脚本? (包括手动链接)

    c# - 尽管以 UTF-8 编写 XML,但在 XmlElement 中转义 Unicode 字符串

    json - xslt 3.0 json-to-xml 和 xml-to-json 转换

    c# - XmlException : Text node cannot appear in this state

    Android Studio 的项目预览在新项目中是空白的

    xml - 使用 XSLT 对 XML 进行排序 - 整个 XML 模式未知

    java - 在java中从XML文件访问参数

    xml - 通过 XML 在 TestNG 中的套件之前运行方法

    .net - C# 中的 XML 序列化

    c# - 解析 XML 的高效方法