How to not escape ampersand in the attribute of an element?
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 182
- Forks
- 99
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 8
Description
Hi!
I am trying to create an element with attribute that looks like:
<MyElement
myAttribute = "Hello World">
</MyElement>
which I am doing the the following code:
my_attribute = REXML::Text.new('Hello World')
my_element = REXML::Element.new('MyElement')
my_element.attributes['myAttribute'] = my_attribute
my_element.to_s
and I get Hello&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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the REXML::Text.new call and the Element attribute serialization shown in the issue, including the raw flag and element context behavior. Trace how the attribute value is escaped and compare the result with the requested Hello World output; done means the intended serialization behavior is established and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100