diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index d87f281d..09dae861 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -425,6 +425,8 @@ def pull_event
else
raise REXML::ParseException.new("Malformed node: Started with '/um, true)
diff --git a/test/parse/test_document_type_declaration.rb b/test/parse/test_document_type_declaration.rb
index cc37ad3f..b0a4551e 100644
--- a/test/parse/test_document_type_declaration.rb
+++ b/test/parse/test_document_type_declaration.rb
@@ -310,6 +310,15 @@ def test_notation_attlist
doctype.children.collect(&:class))
end
+ def test_instruction_element
+ doctype = parse(<<-INTERNAL_SUBSET)
+
+
+ INTERNAL_SUBSET
+ assert_equal([REXML::Instruction, REXML::ElementDecl],
+ doctype.children.collect(&:class))
+ end
+
private
def parse(internal_subset)
super(<<-DOCTYPE)
diff --git a/test/parse/test_processing_instruction.rb b/test/parse/test_processing_instruction.rb
index 723a8cd0..1d0b8452 100644
--- a/test/parse/test_processing_instruction.rb
+++ b/test/parse/test_processing_instruction.rb
@@ -81,6 +81,24 @@ def test_xml_declaration_not_at_document_start
DETAIL
end
+ def test_xml_declaration_in_internal_subset
+ exception = assert_raise(REXML::ParseException) do
+ parse(<<-XML)
+
+]>
+
+ XML
+ end
+ assert_equal(<<-DETAIL.chomp, exception.to_s)
+Malformed XML: XML declaration is not at the start
+Line: 2
+Position: 35
+Last 80 unconsumed characters:
+ version="1.0"?>
+ DETAIL
+ end
+
def test_xml_declaration_missing_spaces
exception = assert_raise(REXML::ParseException) do
parser = REXML::Parsers::BaseParser.new('')
@@ -229,6 +247,19 @@ def test_after_root
assert_equal("abc", events[:processing_instruction])
end
+ def test_in_internal_subset
+ doc = parse(<<-XML)
+
+
+]>
+
+ XML
+ instruction = doc.doctype.children.first
+ assert_equal(["x", "y"],
+ [instruction.target, instruction.content])
+ end
+
def test_content_question
document = REXML::Document.new("")
assert_equal("con?tent", document.root.children.first.content)