From 8881bd52afefd9e21b1092048ba3038def3362f9 Mon Sep 17 00:00:00 2001 From: Watson Date: Fri, 19 Jul 2024 12:06:42 +0900 Subject: [PATCH 01/19] Add more invalid test cases for parsing entitly declaration This patch will add the test cases to verify that it raises an exception properly when parsing malformed entity declaration. Fix test class names --- test/parse/test_entity_declaration.rb | 233 ++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 72f26afe..ac72d30b 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -23,6 +23,239 @@ def parse(internal_subset) end public + + class TestGeneralEntityDeclaration < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-GEDecl + class TestEntityDefinition < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityDef + class TestEntityValue < self + def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 61 +Last 80 unconsumed characters: + valid-name invalid-entity-value > ]> + DETAIL + end + + def test_invalid_entity_value + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 46 +Last 80 unconsumed characters: + valid-name \"% &\" > ]> + DETAIL + end + + class TestExternalId < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID + class TestSystemLiteral < self + def test_no_quote_in_system + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 70 +Last 80 unconsumed characters: + valid-name SYSTEM invalid-system-literal > ]> + DETAIL + end + + def test_no_quote_in_public + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 92 +Last 80 unconsumed characters: + valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal > ]> + DETAIL + end + end + + class TestPubidLiteral < self + def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 92 +Last 80 unconsumed characters: + valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\" > ]> + DETAIL + end + + def test_invalid_pubid_char + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar + exception = assert_raise(REXML::ParseException) do + # U+3042 HIRAGANA LETTER A + REXML::Document.new(" ]>") + end + assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) +Malformed entity declaration +Line: 1 +Position: 76 +Last 80 unconsumed characters: + valid-name PUBLIC \"\u3042\" \"valid-system-literal\" > ]> + DETAIL + end + end + end + + class TestNDataDeclaration < self + def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 123 +Last 80 unconsumed characters: + valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" invalid-ndata val + DETAIL + end + end + end + end + end + + class TestParsedEntityDeclaration < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl + class ParsedEntityDefinition < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef + class TestEntityValue < self + class TestEntityValue < self + def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 63 +Last 80 unconsumed characters: + % valid-name invalid-entity-value > ]> + DETAIL + end + + def test_invalid_entity_value + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 48 +Last 80 unconsumed characters: + % valid-name \"% &\" > ]> + DETAIL + end + end + end + + class TestExternalId < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID + class TestSystemLiteral < self + def test_no_quote_in_system + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 72 +Last 80 unconsumed characters: + % valid-name SYSTEM invalid-system-literal > ]> + DETAIL + end + + def test_no_quote_in_public + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 94 +Last 80 unconsumed characters: + % valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal > ]> + DETAIL + end + end + + class TestPubidLiteral < self + def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 94 +Last 80 unconsumed characters: + % valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\" > ]> + DETAIL + end + + def test_invalid_pubid_char + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar + exception = assert_raise(REXML::ParseException) do + # U+3042 HIRAGANA LETTER A + REXML::Document.new(" ]>") + end + assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) +Malformed entity declaration +Line: 1 +Position: 78 +Last 80 unconsumed characters: + % valid-name PUBLIC \"\u3042\" \"valid-system-literal\" > ]> + DETAIL + end + end + end + end + + def test_unnecessary_ndata_declaration + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 89 +Last 80 unconsumed characters: + % valid-name \"valid-entity-value\" \"NDATA\" valid-ndata-value > ]> + DETAIL + end + end + def test_empty exception = assert_raise(REXML::ParseException) do parse(<<-INTERNAL_SUBSET) From 77b23ae99ccc6b9cc2ed0dee8744b50579d69019 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 11:33:33 +0900 Subject: [PATCH 02/19] Remove redundant test class --- test/parse/test_entity_declaration.rb | 32 +++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index ac72d30b..e2225439 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -145,34 +145,32 @@ class TestParsedEntityDeclaration < self class ParsedEntityDefinition < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef class TestEntityValue < self - class TestEntityValue < self - def test_no_quote - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 63 Last 80 unconsumed characters: % valid-name invalid-entity-value > ]> - DETAIL - end + DETAIL + end - def test_invalid_entity_value - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + def test_invalid_entity_value + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(' ]>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 48 Last 80 unconsumed characters: % valid-name \"% &\" > ]> - DETAIL - end + DETAIL end end From b01f4c49acaf489effb63714a82632246231a94b Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 11:35:53 +0900 Subject: [PATCH 03/19] Fix comment position --- test/parse/test_entity_declaration.rb | 35 ++++++++++++--------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index e2225439..d7687a60 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -24,13 +24,13 @@ def parse(internal_subset) public + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-GEDecl class TestGeneralEntityDeclaration < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-GEDecl + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityDef class TestEntityDefinition < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityDef + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue class TestEntityValue < self def test_no_quote - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -44,7 +44,6 @@ def test_no_quote end def test_invalid_entity_value - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -57,11 +56,11 @@ def test_invalid_entity_value DETAIL end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID class TestExternalId < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral class TestSystemLiteral < self def test_no_quote_in_system - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -75,7 +74,6 @@ def test_no_quote_in_system end def test_no_quote_in_public - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -89,9 +87,10 @@ def test_no_quote_in_public end end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar class TestPubidLiteral < self def test_no_quote - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -105,7 +104,6 @@ def test_no_quote end def test_invalid_pubid_char - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar exception = assert_raise(REXML::ParseException) do # U+3042 HIRAGANA LETTER A REXML::Document.new(" ]>") @@ -121,9 +119,9 @@ def test_invalid_pubid_char end end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl class TestNDataDeclaration < self def test_no_quote - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -140,13 +138,13 @@ def test_no_quote end end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl class TestParsedEntityDeclaration < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef class ParsedEntityDefinition < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue class TestEntityValue < self def test_no_quote - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -160,7 +158,6 @@ def test_no_quote end def test_invalid_entity_value - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -174,11 +171,11 @@ def test_invalid_entity_value end end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID class TestExternalId < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral class TestSystemLiteral < self def test_no_quote_in_system - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -192,7 +189,6 @@ def test_no_quote_in_system end def test_no_quote_in_public - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -206,9 +202,10 @@ def test_no_quote_in_public end end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar class TestPubidLiteral < self def test_no_quote - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end @@ -222,7 +219,6 @@ def test_no_quote end def test_invalid_pubid_char - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar exception = assert_raise(REXML::ParseException) do # U+3042 HIRAGANA LETTER A REXML::Document.new(" ]>") @@ -240,7 +236,6 @@ def test_invalid_pubid_char end def test_unnecessary_ndata_declaration - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef exception = assert_raise(REXML::ParseException) do REXML::Document.new(' ]>') end From 7047bd86a65c65fe1bb3016f33c44be66ac6e497 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 11:43:36 +0900 Subject: [PATCH 04/19] Remove useless spaces --- test/parse/test_entity_declaration.rb | 82 +++++++++++++-------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index d7687a60..a71e4764 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -32,27 +32,27 @@ class TestEntityDefinition < self class TestEntityValue < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 61 +Position: 59 Last 80 unconsumed characters: - valid-name invalid-entity-value > ]> + valid-name invalid-entity-value>]> DETAIL end def test_invalid_entity_value exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 46 +Position: 44 Last 80 unconsumed characters: - valid-name \"% &\" > ]> + valid-name \"% &\">]> DETAIL end @@ -62,27 +62,27 @@ class TestExternalId < self class TestSystemLiteral < self def test_no_quote_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 70 +Position: 68 Last 80 unconsumed characters: - valid-name SYSTEM invalid-system-literal > ]> + valid-name SYSTEM invalid-system-literal>]> DETAIL end def test_no_quote_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 92 +Position: 90 Last 80 unconsumed characters: - valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal > ]> + valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> DETAIL end end @@ -92,28 +92,28 @@ def test_no_quote_in_public class TestPubidLiteral < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 92 +Position: 90 Last 80 unconsumed characters: - valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\" > ]> + valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\">]> DETAIL end def test_invalid_pubid_char exception = assert_raise(REXML::ParseException) do # U+3042 HIRAGANA LETTER A - REXML::Document.new(" ]>") + REXML::Document.new("]>") end assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) Malformed entity declaration Line: 1 -Position: 76 +Position: 74 Last 80 unconsumed characters: - valid-name PUBLIC \"\u3042\" \"valid-system-literal\" > ]> + valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> DETAIL end end @@ -123,12 +123,12 @@ def test_invalid_pubid_char class TestNDataDeclaration < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 123 +Position: 122 Last 80 unconsumed characters: valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" invalid-ndata val DETAIL @@ -146,27 +146,27 @@ class ParsedEntityDefinition < self class TestEntityValue < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 63 +Position: 61 Last 80 unconsumed characters: - % valid-name invalid-entity-value > ]> + % valid-name invalid-entity-value>]> DETAIL end def test_invalid_entity_value exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 48 +Position: 46 Last 80 unconsumed characters: - % valid-name \"% &\" > ]> + % valid-name \"% &\">]> DETAIL end end @@ -177,27 +177,27 @@ class TestExternalId < self class TestSystemLiteral < self def test_no_quote_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 72 +Position: 70 Last 80 unconsumed characters: - % valid-name SYSTEM invalid-system-literal > ]> + % valid-name SYSTEM invalid-system-literal>]> DETAIL end def test_no_quote_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 94 +Position: 92 Last 80 unconsumed characters: - % valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal > ]> + % valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> DETAIL end end @@ -207,28 +207,28 @@ def test_no_quote_in_public class TestPubidLiteral < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 94 +Position: 92 Last 80 unconsumed characters: - % valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\" > ]> + % valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\">]> DETAIL end def test_invalid_pubid_char exception = assert_raise(REXML::ParseException) do # U+3042 HIRAGANA LETTER A - REXML::Document.new(" ]>") + REXML::Document.new("]>") end assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) Malformed entity declaration Line: 1 -Position: 78 +Position: 76 Last 80 unconsumed characters: - % valid-name PUBLIC \"\u3042\" \"valid-system-literal\" > ]> + % valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> DETAIL end end @@ -237,14 +237,14 @@ def test_invalid_pubid_char def test_unnecessary_ndata_declaration exception = assert_raise(REXML::ParseException) do - REXML::Document.new(' ]>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 89 +Position: 87 Last 80 unconsumed characters: - % valid-name \"valid-entity-value\" \"NDATA\" valid-ndata-value > ]> + % valid-name \"valid-entity-value\" \"NDATA\" valid-ndata-value>]> DETAIL end end From 98e0d8fcc7cf6ed30510ff49b34f04bc02431725 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 11:53:25 +0900 Subject: [PATCH 05/19] Fix test name --- test/parse/test_entity_declaration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index a71e4764..a39f0655 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -43,7 +43,7 @@ def test_no_quote DETAIL end - def test_invalid_entity_value + def test_prohibited_character exception = assert_raise(REXML::ParseException) do REXML::Document.new(']>') end @@ -157,7 +157,7 @@ def test_no_quote DETAIL end - def test_invalid_entity_value + def test_prohibited_character exception = assert_raise(REXML::ParseException) do REXML::Document.new(']>') end From daaf61527918e8341c3c36c8e6d85c1329573d64 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 11:55:27 +0900 Subject: [PATCH 06/19] Fix class name --- test/parse/test_entity_declaration.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index a39f0655..f0001f63 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -57,7 +57,7 @@ def test_prohibited_character end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID - class TestExternalId < self + class TestExternalID < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral class TestSystemLiteral < self def test_no_quote_in_system @@ -89,7 +89,7 @@ def test_no_quote_in_public # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar - class TestPubidLiteral < self + class TestPublicIDLiteral < self def test_no_quote exception = assert_raise(REXML::ParseException) do REXML::Document.new(']>') @@ -120,7 +120,7 @@ def test_invalid_pubid_char end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl - class TestNDataDeclaration < self + class TestNotationDataDeclaration < self def test_no_quote exception = assert_raise(REXML::ParseException) do REXML::Document.new(']>') @@ -141,7 +141,7 @@ def test_no_quote # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl class TestParsedEntityDeclaration < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef - class ParsedEntityDefinition < self + class TestParsedEntityDefinition < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue class TestEntityValue < self def test_no_quote @@ -172,7 +172,7 @@ def test_prohibited_character end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID - class TestExternalId < self + class TestExternalID < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral class TestSystemLiteral < self def test_no_quote_in_system @@ -204,7 +204,7 @@ def test_no_quote_in_public # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar - class TestPubidLiteral < self + class TestPublicIDLiteral < self def test_no_quote exception = assert_raise(REXML::ParseException) do REXML::Document.new(']>') From aa634ff2dabfc4318b640f05bf5e1fb23b22dbd2 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 12:06:24 +0900 Subject: [PATCH 07/19] Remove unnecessary quote around NDATA --- test/parse/test_entity_declaration.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index f0001f63..5f58fff0 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -237,14 +237,14 @@ def test_invalid_pubid_char def test_unnecessary_ndata_declaration exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 87 +Position: 85 Last 80 unconsumed characters: - % valid-name \"valid-entity-value\" \"NDATA\" valid-ndata-value>]> + % valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> DETAIL end end From 9ecad7cec80790b169314c0765f1652d53d3739f Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 12:24:52 +0900 Subject: [PATCH 08/19] Add test for Name --- test/parse/test_entity_declaration.rb | 41 ++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 5f58fff0..1442385d 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -26,6 +26,22 @@ def parse(internal_subset) # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-GEDecl class TestGeneralEntityDeclaration < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name + class TestName < self + def test_prohibited_character + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 61 +Last 80 unconsumed characters: + invalid&name \"valid-entity-value\">]> + DETAIL + end + end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityDef class TestEntityDefinition < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue @@ -121,16 +137,17 @@ def test_invalid_pubid_char # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl class TestNotationDataDeclaration < self - def test_no_quote + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar + def test_prohibited_character exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new(']>') end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 -Position: 122 +Position: 109 Last 80 unconsumed characters: - valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" invalid-ndata val + valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" NDATA invalid&nam DETAIL end end @@ -142,6 +159,22 @@ def test_no_quote class TestParsedEntityDeclaration < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef class TestParsedEntityDefinition < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name + class TestName < self + def test_prohibited_character + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 63 +Last 80 unconsumed characters: + % invalid&name \"valid-entity-value\">]> + DETAIL + end + end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue class TestEntityValue < self def test_no_quote From 7c1c59dc2d9cbde5d7b06fee7e5f44b0e1cec321 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 12:39:10 +0900 Subject: [PATCH 09/19] Fix nest of test class --- test/parse/test_entity_declaration.rb | 124 +++++++++++++------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 1442385d..e2dcb3e8 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -71,85 +71,85 @@ def test_prohibited_character valid-name \"% &\">]> DETAIL end + end - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID - class TestExternalID < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral - class TestSystemLiteral < self - def test_no_quote_in_system - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID + class TestExternalID < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-SystemLiteral + class TestSystemLiteral < self + def test_no_quote_in_system + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 68 Last 80 unconsumed characters: valid-name SYSTEM invalid-system-literal>]> - DETAIL - end + DETAIL + end - def test_no_quote_in_public - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + def test_no_quote_in_public + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 90 Last 80 unconsumed characters: valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> - DETAIL - end + DETAIL end + end - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar - class TestPublicIDLiteral < self - def test_no_quote - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidChar + class TestPublicIDLiteral < self + def test_no_quote + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 90 Last 80 unconsumed characters: valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\">]> - DETAIL - end + DETAIL + end - def test_invalid_pubid_char - exception = assert_raise(REXML::ParseException) do - # U+3042 HIRAGANA LETTER A - REXML::Document.new("]>") - end - assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) + def test_invalid_pubid_char + exception = assert_raise(REXML::ParseException) do + # U+3042 HIRAGANA LETTER A + REXML::Document.new("]>") + end + assert_equal(<<-DETAIL.force_encoding('utf-8').chomp, exception.to_s.force_encoding('utf-8')) Malformed entity declaration Line: 1 Position: 74 Last 80 unconsumed characters: valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> - DETAIL - end + DETAIL end end + end - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl - class TestNotationDataDeclaration < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar - def test_prohibited_character - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NDataDecl + class TestNotationDataDeclaration < self + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar + def test_prohibited_character + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 109 Last 80 unconsumed characters: valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" NDATA invalid&nam - DETAIL - end + DETAIL end end end @@ -157,24 +157,24 @@ def test_prohibited_character # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl class TestParsedEntityDeclaration < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef - class TestParsedEntityDefinition < self - # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name - class TestName < self - def test_prohibited_character - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Name + class TestName < self + def test_prohibited_character + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 63 Last 80 unconsumed characters: % invalid&name \"valid-entity-value\">]> DETAIL - end end + end + # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDef + class TestParsedEntityDefinition < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue class TestEntityValue < self def test_no_quote @@ -266,19 +266,19 @@ def test_invalid_pubid_char end end end - end - def test_unnecessary_ndata_declaration - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) + def test_unnecessary_ndata_declaration + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration Line: 1 Position: 85 Last 80 unconsumed characters: % valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> DETAIL + end end end From 478208469566827458bb871ec132451c5f660cfa Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 12:46:22 +0900 Subject: [PATCH 10/19] Add test for unnecessary ndata declaration --- test/parse/test_entity_declaration.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index e2dcb3e8..d9e86f1d 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -71,6 +71,19 @@ def test_prohibited_character valid-name \"% &\">]> DETAIL end + + def test_unnecessary_ndata_declaration + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 83 +Last 80 unconsumed characters: + valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID @@ -202,6 +215,19 @@ def test_prohibited_character % valid-name \"% &\">]> DETAIL end + + def test_unnecessary_ndata_declaration + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 85 +Last 80 unconsumed characters: + % valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID From f7d4a0894c59852d0a263f9c61d665304007f268 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 14:00:14 +0900 Subject: [PATCH 11/19] Remove redundant test --- test/parse/test_entity_declaration.rb | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index d9e86f1d..c4ba525a 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -215,19 +215,6 @@ def test_prohibited_character % valid-name \"% &\">]> DETAIL end - - def test_unnecessary_ndata_declaration - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Malformed entity declaration -Line: 1 -Position: 85 -Last 80 unconsumed characters: - % valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> - DETAIL - end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID From c211ab51ff7af2a17f1a276f637b3b9e215ad488 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 14:02:49 +0900 Subject: [PATCH 12/19] Adjust the position of test and rename the method --- test/parse/test_entity_declaration.rb | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index c4ba525a..62765858 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -71,19 +71,6 @@ def test_prohibited_character valid-name \"% &\">]> DETAIL end - - def test_unnecessary_ndata_declaration - exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') - end - assert_equal(<<-DETAIL.chomp, exception.to_s) -Malformed entity declaration -Line: 1 -Position: 83 -Last 80 unconsumed characters: - valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> - DETAIL - end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID @@ -165,6 +152,19 @@ def test_prohibited_character DETAIL end end + + def test_entity_value_and_notation_data_declaration + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 83 +Last 80 unconsumed characters: + valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> + DETAIL + end end end @@ -280,7 +280,7 @@ def test_invalid_pubid_char end end - def test_unnecessary_ndata_declaration + def test_entity_value_and_notation_data_declaration exception = assert_raise(REXML::ParseException) do REXML::Document.new(']>') end From 635af12b632af01541b0a4cc8ceab886dd54cdac Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 14:22:06 +0900 Subject: [PATCH 13/19] Add mixed quote tests --- test/parse/test_entity_declaration.rb | 104 ++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 62765858..8cf6d967 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -71,6 +71,19 @@ def test_prohibited_character valid-name \"% &\">]> DETAIL end + + def test_mixed_quote + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 61 +Last 80 unconsumed characters: + valid-name \"invalid-entity-value'>]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID @@ -102,6 +115,32 @@ def test_no_quote_in_public valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> DETAIL end + + def test_mixed_quote_in_system + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 70 +Last 80 unconsumed characters: + valid-name SYSTEM 'invalid-system-literal\">]> + DETAIL + end + + def test_mixed_quote_in_public + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 92 +Last 80 unconsumed characters: + valid-name PUBLIC \"valid-pubid-literal\" \"invalid-system-literal'>]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral @@ -133,6 +172,19 @@ def test_invalid_pubid_char valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> DETAIL end + + def test_mixed_quote + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 92 +Last 80 unconsumed characters: + valid-name PUBLIC \"invalid-pubid-literal' \"valid-system-literal\">]> + DETAIL + end end end @@ -215,6 +267,19 @@ def test_prohibited_character % valid-name \"% &\">]> DETAIL end + + def test_mixed_quote + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 63 +Last 80 unconsumed characters: + % valid-name 'invalid-entity-value\">]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-ExternalID @@ -246,6 +311,32 @@ def test_no_quote_in_public % valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> DETAIL end + + def test_mixed_quote_in_system + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 72 +Last 80 unconsumed characters: + % valid-name SYSTEM \"invalid-system-literal'>]> + DETAIL + end + + def test_mixed_quote_in_public + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 94 +Last 80 unconsumed characters: + % valid-name PUBLIC \"valid-pubid-literal\" 'invalid-system-literal\">]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral @@ -277,6 +368,19 @@ def test_invalid_pubid_char % valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> DETAIL end + + def test_mixed_quote + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 94 +Last 80 unconsumed characters: + % valid-name PUBLIC 'invalid-pubid-literal\" \"valid-system-literal\">]> + DETAIL + end end end From 96c1d9c4df6cfba585a16865964f3f4d10869eb7 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 14:38:28 +0900 Subject: [PATCH 14/19] Add test for spaces --- test/parse/test_entity_declaration.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 8cf6d967..444d3c11 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -218,6 +218,19 @@ def test_entity_value_and_notation_data_declaration DETAIL end end + + def test_no_space + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 102 +Last 80 unconsumed characters: + valid-namePUBLIC\"valid-pubid-literal\"\"valid-system-literal\"NDATAvalid-name>]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PEDecl @@ -397,6 +410,19 @@ def test_entity_value_and_notation_data_declaration DETAIL end end + + def test_no_space + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 67 +Last 80 unconsumed characters: + %valid-nameSYSTEM\"valid-system-literal\">]> + DETAIL + end end def test_empty From 7e9583709c93d0d6140e613a9a0a78e47c9a1481 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 18:43:30 +0900 Subject: [PATCH 15/19] Fix test name Co-authored-by: takuya kodama --- test/parse/test_entity_declaration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 444d3c11..9f82eb7e 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -159,7 +159,7 @@ def test_no_quote DETAIL end - def test_invalid_pubid_char + def test_prohibited_pubid_character exception = assert_raise(REXML::ParseException) do # U+3042 HIRAGANA LETTER A REXML::Document.new("]>") From 8b42c31ec274ca3b02dbf3d7ad04eb99accba12c Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 23 Jul 2024 18:56:21 +0900 Subject: [PATCH 16/19] Add tests for no literal case --- test/parse/test_entity_declaration.rb | 78 +++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 9f82eb7e..0df7add7 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -141,6 +141,32 @@ def test_mixed_quote_in_public valid-name PUBLIC \"valid-pubid-literal\" \"invalid-system-literal'>]> DETAIL end + + def test_no_literal_in_system + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 45 +Last 80 unconsumed characters: + valid-name SYSTEM>]> + DETAIL + end + + def test_no_literal_in_public + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 67 +Last 80 unconsumed characters: + valid-name PUBLIC \"valid-pubid-literal\">]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral @@ -185,6 +211,19 @@ def test_mixed_quote valid-name PUBLIC \"invalid-pubid-literal' \"valid-system-literal\">]> DETAIL end + + def test_no_literal + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 45 +Last 80 unconsumed characters: + valid-name PUBLIC>]> + DETAIL + end end end @@ -350,6 +389,32 @@ def test_mixed_quote_in_public % valid-name PUBLIC \"valid-pubid-literal\" 'invalid-system-literal\">]> DETAIL end + + def test_no_literal_in_system + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 47 +Last 80 unconsumed characters: + % valid-name SYSTEM>]> + DETAIL + end + + def test_no_literal_in_public + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 69 +Last 80 unconsumed characters: + % valid-name PUBLIC \"valid-pubid-literal\">]> + DETAIL + end end # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-PubidLiteral @@ -394,6 +459,19 @@ def test_mixed_quote % valid-name PUBLIC 'invalid-pubid-literal\" \"valid-system-literal\">]> DETAIL end + + def test_no_literal + exception = assert_raise(REXML::ParseException) do + REXML::Document.new(']>') + end + assert_equal(<<-DETAIL.chomp, exception.to_s) +Malformed entity declaration +Line: 1 +Position: 47 +Last 80 unconsumed characters: + % valid-name PUBLIC>]> + DETAIL + end end end From 8b245cb0b791badfe00367ac1e91d679c8a76a16 Mon Sep 17 00:00:00 2001 From: Watson Date: Wed, 24 Jul 2024 09:39:25 +0900 Subject: [PATCH 17/19] Fix test name Co-authored-by: takuya kodama --- test/parse/test_entity_declaration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index 0df7add7..d6e99e46 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -433,7 +433,7 @@ def test_no_quote DETAIL end - def test_invalid_pubid_char + def test_prohibited_pubid_character exception = assert_raise(REXML::ParseException) do # U+3042 HIRAGANA LETTER A REXML::Document.new("]>") From 556487bbc56fa29d4f93e622f6d6226b115c660f Mon Sep 17 00:00:00 2001 From: Watson Date: Wed, 24 Jul 2024 10:42:24 +0900 Subject: [PATCH 18/19] Replace " to ' --- test/parse/test_entity_declaration.rb | 62 +++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index d6e99e46..aa6c9168 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -30,7 +30,7 @@ class TestGeneralEntityDeclaration < self class TestName < self def test_prohibited_character exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -48,7 +48,7 @@ class TestEntityDefinition < self class TestEntityValue < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -61,7 +61,7 @@ def test_no_quote def test_prohibited_character exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -74,7 +74,7 @@ def test_prohibited_character def test_mixed_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -92,7 +92,7 @@ class TestExternalID < self class TestSystemLiteral < self def test_no_quote_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -105,7 +105,7 @@ def test_no_quote_in_system def test_no_quote_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -118,7 +118,7 @@ def test_no_quote_in_public def test_mixed_quote_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -131,7 +131,7 @@ def test_mixed_quote_in_system def test_mixed_quote_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -144,7 +144,7 @@ def test_mixed_quote_in_public def test_no_literal_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -157,7 +157,7 @@ def test_no_literal_in_system def test_no_literal_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -174,7 +174,7 @@ def test_no_literal_in_public class TestPublicIDLiteral < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -201,7 +201,7 @@ def test_prohibited_pubid_character def test_mixed_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -214,7 +214,7 @@ def test_mixed_quote def test_no_literal exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -232,7 +232,7 @@ class TestNotationDataDeclaration < self # https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-NameChar def test_prohibited_character exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -246,7 +246,7 @@ def test_prohibited_character def test_entity_value_and_notation_data_declaration exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -260,7 +260,7 @@ def test_entity_value_and_notation_data_declaration def test_no_space exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -278,7 +278,7 @@ class TestParsedEntityDeclaration < self class TestName < self def test_prohibited_character exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -296,7 +296,7 @@ class TestParsedEntityDefinition < self class TestEntityValue < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -309,7 +309,7 @@ def test_no_quote def test_prohibited_character exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -322,7 +322,7 @@ def test_prohibited_character def test_mixed_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -340,7 +340,7 @@ class TestExternalID < self class TestSystemLiteral < self def test_no_quote_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -353,7 +353,7 @@ def test_no_quote_in_system def test_no_quote_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -366,7 +366,7 @@ def test_no_quote_in_public def test_mixed_quote_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -379,7 +379,7 @@ def test_mixed_quote_in_system def test_mixed_quote_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -392,7 +392,7 @@ def test_mixed_quote_in_public def test_no_literal_in_system exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -405,7 +405,7 @@ def test_no_literal_in_system def test_no_literal_in_public exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -422,7 +422,7 @@ def test_no_literal_in_public class TestPublicIDLiteral < self def test_no_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -449,7 +449,7 @@ def test_prohibited_pubid_character def test_mixed_quote exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -462,7 +462,7 @@ def test_mixed_quote def test_no_literal exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -477,7 +477,7 @@ def test_no_literal def test_entity_value_and_notation_data_declaration exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration @@ -491,7 +491,7 @@ def test_entity_value_and_notation_data_declaration def test_no_space exception = assert_raise(REXML::ParseException) do - REXML::Document.new(']>') + REXML::Document.new("]>") end assert_equal(<<-DETAIL.chomp, exception.to_s) Malformed entity declaration From 4bada108540bf7f32366335fb6b2e27a62630be2 Mon Sep 17 00:00:00 2001 From: Watson Date: Wed, 24 Jul 2024 10:47:47 +0900 Subject: [PATCH 19/19] Remove unnecessary escape in here document --- test/parse/test_entity_declaration.rb | 50 +++++++++++++-------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/test/parse/test_entity_declaration.rb b/test/parse/test_entity_declaration.rb index aa6c9168..daaf5ed2 100644 --- a/test/parse/test_entity_declaration.rb +++ b/test/parse/test_entity_declaration.rb @@ -37,7 +37,7 @@ def test_prohibited_character Line: 1 Position: 61 Last 80 unconsumed characters: - invalid&name \"valid-entity-value\">]> + invalid&name "valid-entity-value">]> DETAIL end end @@ -68,7 +68,7 @@ def test_prohibited_character Line: 1 Position: 44 Last 80 unconsumed characters: - valid-name \"% &\">]> + valid-name "% &">]> DETAIL end @@ -81,7 +81,7 @@ def test_mixed_quote Line: 1 Position: 61 Last 80 unconsumed characters: - valid-name \"invalid-entity-value'>]> + valid-name "invalid-entity-value'>]> DETAIL end end @@ -112,7 +112,7 @@ def test_no_quote_in_public Line: 1 Position: 90 Last 80 unconsumed characters: - valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> + valid-name PUBLIC "valid-pubid-literal" invalid-system-literal>]> DETAIL end @@ -125,7 +125,7 @@ def test_mixed_quote_in_system Line: 1 Position: 70 Last 80 unconsumed characters: - valid-name SYSTEM 'invalid-system-literal\">]> + valid-name SYSTEM 'invalid-system-literal">]> DETAIL end @@ -138,7 +138,7 @@ def test_mixed_quote_in_public Line: 1 Position: 92 Last 80 unconsumed characters: - valid-name PUBLIC \"valid-pubid-literal\" \"invalid-system-literal'>]> + valid-name PUBLIC "valid-pubid-literal" "invalid-system-literal'>]> DETAIL end @@ -164,7 +164,7 @@ def test_no_literal_in_public Line: 1 Position: 67 Last 80 unconsumed characters: - valid-name PUBLIC \"valid-pubid-literal\">]> + valid-name PUBLIC "valid-pubid-literal">]> DETAIL end end @@ -181,7 +181,7 @@ def test_no_quote Line: 1 Position: 90 Last 80 unconsumed characters: - valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\">]> + valid-name PUBLIC invalid-pubid-literal "valid-system-literal">]> DETAIL end @@ -195,7 +195,7 @@ def test_prohibited_pubid_character Line: 1 Position: 74 Last 80 unconsumed characters: - valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> + valid-name PUBLIC "\u3042" "valid-system-literal">]> DETAIL end @@ -208,7 +208,7 @@ def test_mixed_quote Line: 1 Position: 92 Last 80 unconsumed characters: - valid-name PUBLIC \"invalid-pubid-literal' \"valid-system-literal\">]> + valid-name PUBLIC "invalid-pubid-literal' "valid-system-literal">]> DETAIL end @@ -239,7 +239,7 @@ def test_prohibited_character Line: 1 Position: 109 Last 80 unconsumed characters: - valid-name PUBLIC \"valid-pubid-literal\" \"valid-system-literal\" NDATA invalid&nam + valid-name PUBLIC "valid-pubid-literal" "valid-system-literal" NDATA invalid&nam DETAIL end end @@ -253,7 +253,7 @@ def test_entity_value_and_notation_data_declaration Line: 1 Position: 83 Last 80 unconsumed characters: - valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> + valid-name "valid-entity-value" NDATA valid-ndata-value>]> DETAIL end end @@ -267,7 +267,7 @@ def test_no_space Line: 1 Position: 102 Last 80 unconsumed characters: - valid-namePUBLIC\"valid-pubid-literal\"\"valid-system-literal\"NDATAvalid-name>]> + valid-namePUBLIC"valid-pubid-literal""valid-system-literal"NDATAvalid-name>]> DETAIL end end @@ -285,7 +285,7 @@ def test_prohibited_character Line: 1 Position: 63 Last 80 unconsumed characters: - % invalid&name \"valid-entity-value\">]> + % invalid&name "valid-entity-value">]> DETAIL end end @@ -316,7 +316,7 @@ def test_prohibited_character Line: 1 Position: 46 Last 80 unconsumed characters: - % valid-name \"% &\">]> + % valid-name "% &">]> DETAIL end @@ -329,7 +329,7 @@ def test_mixed_quote Line: 1 Position: 63 Last 80 unconsumed characters: - % valid-name 'invalid-entity-value\">]> + % valid-name 'invalid-entity-value">]> DETAIL end end @@ -360,7 +360,7 @@ def test_no_quote_in_public Line: 1 Position: 92 Last 80 unconsumed characters: - % valid-name PUBLIC \"valid-pubid-literal\" invalid-system-literal>]> + % valid-name PUBLIC "valid-pubid-literal" invalid-system-literal>]> DETAIL end @@ -373,7 +373,7 @@ def test_mixed_quote_in_system Line: 1 Position: 72 Last 80 unconsumed characters: - % valid-name SYSTEM \"invalid-system-literal'>]> + % valid-name SYSTEM "invalid-system-literal'>]> DETAIL end @@ -386,7 +386,7 @@ def test_mixed_quote_in_public Line: 1 Position: 94 Last 80 unconsumed characters: - % valid-name PUBLIC \"valid-pubid-literal\" 'invalid-system-literal\">]> + % valid-name PUBLIC "valid-pubid-literal" 'invalid-system-literal">]> DETAIL end @@ -412,7 +412,7 @@ def test_no_literal_in_public Line: 1 Position: 69 Last 80 unconsumed characters: - % valid-name PUBLIC \"valid-pubid-literal\">]> + % valid-name PUBLIC "valid-pubid-literal">]> DETAIL end end @@ -429,7 +429,7 @@ def test_no_quote Line: 1 Position: 92 Last 80 unconsumed characters: - % valid-name PUBLIC invalid-pubid-literal \"valid-system-literal\">]> + % valid-name PUBLIC invalid-pubid-literal "valid-system-literal">]> DETAIL end @@ -443,7 +443,7 @@ def test_prohibited_pubid_character Line: 1 Position: 76 Last 80 unconsumed characters: - % valid-name PUBLIC \"\u3042\" \"valid-system-literal\">]> + % valid-name PUBLIC "\u3042" "valid-system-literal">]> DETAIL end @@ -456,7 +456,7 @@ def test_mixed_quote Line: 1 Position: 94 Last 80 unconsumed characters: - % valid-name PUBLIC 'invalid-pubid-literal\" \"valid-system-literal\">]> + % valid-name PUBLIC 'invalid-pubid-literal" "valid-system-literal">]> DETAIL end @@ -484,7 +484,7 @@ def test_entity_value_and_notation_data_declaration Line: 1 Position: 85 Last 80 unconsumed characters: - % valid-name \"valid-entity-value\" NDATA valid-ndata-value>]> + % valid-name "valid-entity-value" NDATA valid-ndata-value>]> DETAIL end end @@ -498,7 +498,7 @@ def test_no_space Line: 1 Position: 67 Last 80 unconsumed characters: - %valid-nameSYSTEM\"valid-system-literal\">]> + %valid-nameSYSTEM"valid-system-literal">]> DETAIL end end