镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

How to not escape ampersand in the attribute of an element? #35

Description

@timofeys1

Hi!

I am trying to create an element with attribute that looks like:

<MyElement
    myAttribute = "Hello&#10;World">
</MyElement>

which I am doing the the following code:

my_attribute = REXML::Text.new('Hello&#10;World')

my_element = REXML::Element.new('MyElement')
my_element.attributes['myAttribute'] = my_attribute

my_element.to_s

and I get Hello&amp;amp;#10;World in the attribute. I also tried using the raw flag for the Text and the { :raw => :all } context for the Element but that removes only a single amp;.

Am I missing something? How can I get to my desired output?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions