Skip to content

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

@abdulowork

Description

@abdulowork

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?

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