XML 错误:AttValue:"或 ' 预期 [英] XML error: AttValue: " or ' expected

查看:31
本文介绍了XML 错误:AttValue:"或 ' 预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 XML 有点生疏,但我正在尝试用 XML 创建一个本地天气基于 Web 的 api.然而,它还没有完成,但我在测试时遇到了一个错误,这是

My XML is a bit rusty, but I'm trying to create a local weather web-based api in XML. It is not finished however, but I have run into an error whilst testing it out, which is

第 3 行第 16 列错误:AttValue:" 或 ' 预期.

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 格式良好:

There are three corrections necessary to make your XML well-formed:

  1. 更改为 .
  2. county 添加结束标记.
  3. & 替换为 &amp;.
  1. Change <county id= 1 > to <county id="1">.
  2. Add an end tag for county.
  3. Replace & with &amp;.

<小时>

这是您的 XML 更正为格式正确:


Here is your XML corrected to be well-formed:

<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 错误:AttValue:&quot;或 ' 预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆