逃避属性 [英] escaping in attributes

查看:100
本文介绍了逃避属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要逃避,例如&安培;在属性中,如:


< foo bar =" [,\&] + $" />


因为这是一个正则表达式,并且不会被验证为

普通xml文件,所以我不能使用& amp; amp;为& ;. CDATA似乎在属性中也不起作用。

。关于如何解决这个问题的任何建议?


-Gisle-

解决方案

" />


由于这是一个正则表达式,并且不会被验证为

普通xml文件,因此我无法使用& amp; amp;为& ;. CDATA似乎在属性中也不起作用。

。关于如何解决这个问题的任何建议?


-Gisle-


* gi ***** @ gmail.com 在comp.text.xml中写道:

我需要逃避例如&安培;在属性中,如:

< foo bar =" [,\&] +


" />

由于这是一个正则表达式,不会被验证为正常的xml文件,我不能使用& amp; amp;为& ;. CDATA似乎在属性中也不起作用。关于如何解决这个问题的任何建议?




您可以使用& amp; amp;等;如果你真的不能使用& amp;然后你没有提供信息来确定你可以使用的信息。在任何

的情况下,你的问题不会是一个XML问题,因为使用XML& amp;

保证工作。

-

Bj?rn H?hrmann·mailto:bj **** @ hoehrmann.de· http://bjoern.hoehrmann.de

Weinh。海峡。 22·Telefon:+49(0)621/4309674· http://www.bjoernsworld.de

68309曼海姆·PGP Pub。 KeyID:0xA4357E78· http://www.websitedev.de/


I need to escape e.g. & within an attribute, as in:

<foo bar="[ ,\&]+$"/>

Since this is a regular expression and will not be validated as a
normal xml file, i cannot use &amp; for &. CDATA does not seem to work
in an attribute either. Any suggestions on how I can get around this?

-Gisle-

解决方案

"/>

Since this is a regular expression and will not be validated as a
normal xml file, i cannot use &amp; for &. CDATA does not seem to work
in an attribute either. Any suggestions on how I can get around this?

-Gisle-


* gi*****@gmail.com wrote in comp.text.xml:

I need to escape e.g. & within an attribute, as in:

<foo bar="[ ,\&]+


"/>

Since this is a regular expression and will not be validated as a
normal xml file, i cannot use &amp; for &. CDATA does not seem to work
in an attribute either. Any suggestions on how I can get around this?



You can use &amp; and such; if you really cannot use &amp; then you''ve
not provided information to determine what you could use instead. In any
case your question would not be an XML question, since with XML &amp; is
guranteed to work.
--
Bj?rn H?hrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/


这篇关于逃避属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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