在XML文档中包含带有查询字符串的URL [英] Including a URL with query string in an XML document

查看:124
本文介绍了在XML文档中包含带有查询字符串的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个XML文档:

 <?xml version =1.0encoding =UTF-8 ?> 
<根>
< Item>
< URL> http://www.mysite.com/page?id = 1< / URL>
< / Item>
< / Root>

当我尝试查看文档时,我收到一条错误:


XML解析错误:格式不正确


= 登录查询字符串。我尝试将 = 符号更改为%3D ,但是我在%得到相同的错误

解决方案div>

您可以尝试< URL><![CDATA [http://www.mysite.com/page?id=1]]>< / URL>



XML文档中的所有文本都将由解析器解析。
但解析器将忽略CDATA部分中的文本。您可以在这里找到更多。


So I have this XML doc:

<?xml version="1.0" encoding="UTF-8"?>
<Root>
    <Item>
        <URL>http://www.mysite.com/page?id=1</URL>
    </Item>
</Root>

When I try and view the document, I get an error saying:

XML Parsing Error: not well-formed

at the = sign in the query string. I tried changing the = sign to %3D, but I get the same error at %

What am I supposed to do here?

解决方案

You can try <URL><![CDATA[http://www.mysite.com/page?id=1]]></URL>

All text in an XML document will be parsed by the parser. But text inside a CDATA section will be ignored by the parser. you can find more here.

这篇关于在XML文档中包含带有查询字符串的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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