开发者

Ignore embedded quotes in ruby

开发者 https://www.devze.com 2023-02-16 21:04 出处:网络
I\'m not exactly sure what is happening, but the xml file I am writing to has this: This "is&a开发者_StackOverflow社区mp;quot; now my String

I'm not exactly sure what is happening, but the xml file I am writing to has this:

This "is&a开发者_StackOverflow社区mp;quot; now my String

when it should look like this:

This "is" now my String

Here is the code, except I don't have access to the actual string at compile time. Is there a way to tell the assetName variable to treat embedded quotes as quotes? Thanks.

assetName = 'This "is" now my String'

response.search("property[name=next]").first.andand["value"]  = assetName


In XML, quotes may never appear in attributes, regardless of the style of the quotes used for the attributes. It is likely that your XML library is escaping these quotes for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消