Skip to content

Commit

Permalink
Fix serialization of ATTLIST is incorrect (#234)
Browse files Browse the repository at this point in the history
GitHub: fix #233

Changed so that "<!ATTLIST" is added to AttDecl contents - simliar to
how it already was with "<!ENTITY"
Updated a test case to test for this
  • Loading branch information
OlofKalufs authored Jan 20, 2025
1 parent a4bf93a commit 107e273
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rexml/parsers/baseparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def pull_event
md = @source.match(Private::ATTLISTDECL_END, true)
raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil?
element = md[1]
contents = md[0]
contents = "<!ATTLIST" + md[0]

pairs = {}
values = md[0].strip.scan( ATTDEF_RE )
Expand Down
1 change: 1 addition & 0 deletions test/test_core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ def test_attlist_decl
]>
<a xmlns:three='xxx' three='yyy'><one:b/><three:c/></a>
EOL
assert_equal '<!ATTLIST blah xmlns CDATA "foo">', doc.doctype.children[0].to_s.gsub(/\s+/, " ")
assert_equal 'gobble', doc.root.attributes['bar']
assert_equal 'xxx', doc.root.elements[2].namespace
assert_equal 'two', doc.root.elements[1].namespace
Expand Down

0 comments on commit 107e273

Please sign in to comment.