xml解析为“& amp",“& reg",但仍然出现错误 [英] xml parsing with "&", "®", but still getting errors

查看:272
本文介绍了xml解析为“& amp",“& reg",但仍然出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在任何地方,帖子都告诉我使用html实体转义xml特殊字符,但是我仍然遇到XML解析错误.我收到的错误消息是身份不明的实体",它出现在& amp;处.和& reg;标记(无空格).我该如何解决这个问题,为什么仍会引发错误?

Everywhere I look, posts are telling me to escape xml special characters with their html entity, but I'm still getting XML parsing errors. The error message I'm receiving is "unidentified entity", and it occurs at the &amp ; and &reg ; marks (without the spaces). How can I fix this and why would this still be throwing errors?

<?xml version="1.0" encoding="UTF-8"?>
<maps>
    <location id="tx">
        <item label="Lobby &amp; Entrance" xpos="125" ypos="112" />
        <item label="Restaurant &amp; Bar" xpos="186" ypos="59" />
        <item label="Swimming Pool" xpos="183" ypos="189" />
        <item label="Nautilus Gym&reg;" xpos="154" ypos="120" />
    </location>
</maps>

推荐答案

替换: &reg; by:&#174;&amp;通过:&#38;

Replace: &reg; by: &#174; and &amp; by: &#38;

您的XML将是有效的

这篇关于xml解析为“&amp; amp",“&amp; reg",但仍然出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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