moxml 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +1 -1
  3. data/.github/workflows/rake.yml +16 -13
  4. data/.github/workflows/release.yml +1 -0
  5. data/.github/workflows/round-trip.yml +74 -0
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +1 -0
  8. data/.rubocop_todo.yml +160 -38
  9. data/Gemfile +2 -1
  10. data/README.adoc +287 -20
  11. data/Rakefile +11 -0
  12. data/data/w3c_entities.json +2131 -0
  13. data/docs/ENTITY_SUPPORT_FOR_LUTAML_MODEL.md +102 -0
  14. data/docs/_guides/index.adoc +14 -12
  15. data/docs/_guides/node-api-consistency.adoc +572 -0
  16. data/docs/_guides/xml-declaration.adoc +5 -5
  17. data/docs/_pages/adapters/ox.adoc +30 -0
  18. data/docs/_pages/adapters/rexml.adoc +1 -1
  19. data/docs/_pages/configuration.adoc +43 -0
  20. data/docs/_pages/node-api-reference.adoc +128 -3
  21. data/docs/_tutorials/namespace-handling.adoc +21 -0
  22. data/examples/rss_parser/rss_parser.rb +1 -3
  23. data/lib/moxml/adapter/base.rb +26 -2
  24. data/lib/moxml/adapter/headed_ox.rb +5 -4
  25. data/lib/moxml/adapter/libxml.rb +18 -3
  26. data/lib/moxml/adapter/nokogiri.rb +26 -2
  27. data/lib/moxml/adapter/oga.rb +137 -20
  28. data/lib/moxml/adapter/ox.rb +29 -3
  29. data/lib/moxml/adapter/rexml.rb +54 -7
  30. data/lib/moxml/attribute.rb +6 -0
  31. data/lib/moxml/builder.rb +6 -0
  32. data/lib/moxml/config.rb +52 -1
  33. data/lib/moxml/context.rb +21 -2
  34. data/lib/moxml/doctype.rb +33 -0
  35. data/lib/moxml/document.rb +6 -1
  36. data/lib/moxml/document_builder.rb +45 -1
  37. data/lib/moxml/element.rb +10 -3
  38. data/lib/moxml/entity_reference.rb +29 -0
  39. data/lib/moxml/entity_registry.rb +278 -0
  40. data/lib/moxml/error.rb +5 -5
  41. data/lib/moxml/node.rb +22 -8
  42. data/lib/moxml/node_set.rb +10 -6
  43. data/lib/moxml/processing_instruction.rb +6 -0
  44. data/lib/moxml/version.rb +1 -1
  45. data/lib/moxml/xml_utils.rb +25 -2
  46. data/lib/moxml/xpath/errors.rb +1 -1
  47. data/lib/moxml.rb +1 -0
  48. data/spec/consistency/README.md +3 -1
  49. data/spec/consistency/round_trip_spec.rb +479 -0
  50. data/spec/examples/readme_examples_spec.rb +1 -1
  51. data/spec/fixtures/round-trips/metanorma/a.xml +66 -0
  52. data/spec/fixtures/round-trips/metanorma/bilingual-en.xml +7682 -0
  53. data/spec/fixtures/round-trips/metanorma/bilingual-fr.xml +7520 -0
  54. data/spec/fixtures/round-trips/metanorma/bilingual.presentation.xml +21211 -0
  55. data/spec/fixtures/round-trips/metanorma/collection1.xml +313 -0
  56. data/spec/fixtures/round-trips/metanorma/collection1nested.xml +291 -0
  57. data/spec/fixtures/round-trips/metanorma/collection_docinline.xml +544 -0
  58. data/spec/fixtures/round-trips/metanorma/collection_full.xml +1776 -0
  59. data/spec/fixtures/round-trips/metanorma/dummy.1.xml +295 -0
  60. data/spec/fixtures/round-trips/metanorma/dummy.xml +349 -0
  61. data/spec/fixtures/round-trips/metanorma/footnotes.xml +70 -0
  62. data/spec/fixtures/round-trips/metanorma/iho.xml +116 -0
  63. data/spec/fixtures/round-trips/metanorma/rice-amd.final.xml +186 -0
  64. data/spec/fixtures/round-trips/metanorma/rice-amd.final_1.xml +180 -0
  65. data/spec/fixtures/round-trips/metanorma/rice-en.final.norepo.xml +116 -0
  66. data/spec/fixtures/round-trips/metanorma/rice-en.final.xml +149 -0
  67. data/spec/fixtures/round-trips/metanorma/rice-en.final_1.xml +144 -0
  68. data/spec/fixtures/round-trips/metanorma/rice1-en.final.xml +120 -0
  69. data/spec/fixtures/round-trips/metanorma/rice2-en.final.xml +116 -0
  70. data/spec/fixtures/round-trips/metanorma/test_sectionsplit.xml +119 -0
  71. data/spec/fixtures/round-trips/niso-jats/bmj_sample.xml +1068 -0
  72. data/spec/fixtures/round-trips/niso-jats/element_citation.xml +7 -0
  73. data/spec/fixtures/round-trips/niso-jats/pnas_sample.xml +3768 -0
  74. data/spec/fixtures/round-trips/rfcxml/rfc8881.xml +45848 -0
  75. data/spec/fixtures/round-trips/rfcxml/rfc8994.xml +6607 -0
  76. data/spec/fixtures/round-trips/rfcxml/rfc9000.xml +9064 -0
  77. data/spec/fixtures/round-trips/rfcxml/rfc9043.xml +5527 -0
  78. data/spec/fixtures/round-trips/rfcxml/rfc9051.xml +14286 -0
  79. data/spec/fixtures/round-trips/rfcxml/rfc9110.xml +18156 -0
  80. data/spec/fixtures/round-trips/rfcxml/rfc9260.xml +9136 -0
  81. data/spec/fixtures/round-trips/rfcxml/rfc9293.xml +8300 -0
  82. data/spec/fixtures/round-trips/rfcxml/rfc9380.xml +8916 -0
  83. data/spec/fixtures/round-trips/rfcxml/rfc9420.xml +8927 -0
  84. data/spec/fixtures/w3c/namespaces/1.0/001.xml +7 -0
  85. data/spec/fixtures/w3c/namespaces/1.0/002.xml +8 -0
  86. data/spec/fixtures/w3c/namespaces/1.0/003.xml +7 -0
  87. data/spec/fixtures/w3c/namespaces/1.0/004.xml +7 -0
  88. data/spec/fixtures/w3c/namespaces/1.0/005.xml +7 -0
  89. data/spec/fixtures/w3c/namespaces/1.0/006.xml +7 -0
  90. data/spec/fixtures/w3c/namespaces/1.0/007.xml +20 -0
  91. data/spec/fixtures/w3c/namespaces/1.0/008.xml +20 -0
  92. data/spec/fixtures/w3c/namespaces/1.0/009.xml +19 -0
  93. data/spec/fixtures/w3c/namespaces/1.0/010.xml +19 -0
  94. data/spec/fixtures/w3c/namespaces/1.0/011.xml +20 -0
  95. data/spec/fixtures/w3c/namespaces/1.0/012.xml +19 -0
  96. data/spec/fixtures/w3c/namespaces/1.0/013.xml +5 -0
  97. data/spec/fixtures/w3c/namespaces/1.0/014.xml +3 -0
  98. data/spec/fixtures/w3c/namespaces/1.0/015.xml +3 -0
  99. data/spec/fixtures/w3c/namespaces/1.0/016.xml +3 -0
  100. data/spec/fixtures/w3c/namespaces/1.0/017.xml +3 -0
  101. data/spec/fixtures/w3c/namespaces/1.0/018.xml +3 -0
  102. data/spec/fixtures/w3c/namespaces/1.0/019.xml +3 -0
  103. data/spec/fixtures/w3c/namespaces/1.0/020.xml +3 -0
  104. data/spec/fixtures/w3c/namespaces/1.0/021.xml +6 -0
  105. data/spec/fixtures/w3c/namespaces/1.0/022.xml +6 -0
  106. data/spec/fixtures/w3c/namespaces/1.0/023.xml +6 -0
  107. data/spec/fixtures/w3c/namespaces/1.0/024.xml +6 -0
  108. data/spec/fixtures/w3c/namespaces/1.0/025.xml +3 -0
  109. data/spec/fixtures/w3c/namespaces/1.0/026.xml +3 -0
  110. data/spec/fixtures/w3c/namespaces/1.0/027.xml +3 -0
  111. data/spec/fixtures/w3c/namespaces/1.0/028.xml +3 -0
  112. data/spec/fixtures/w3c/namespaces/1.0/029.xml +4 -0
  113. data/spec/fixtures/w3c/namespaces/1.0/030.xml +4 -0
  114. data/spec/fixtures/w3c/namespaces/1.0/031.xml +4 -0
  115. data/spec/fixtures/w3c/namespaces/1.0/032.xml +5 -0
  116. data/spec/fixtures/w3c/namespaces/1.0/033.xml +4 -0
  117. data/spec/fixtures/w3c/namespaces/1.0/034.xml +3 -0
  118. data/spec/fixtures/w3c/namespaces/1.0/035.xml +8 -0
  119. data/spec/fixtures/w3c/namespaces/1.0/036.xml +8 -0
  120. data/spec/fixtures/w3c/namespaces/1.0/037.xml +8 -0
  121. data/spec/fixtures/w3c/namespaces/1.0/038.xml +8 -0
  122. data/spec/fixtures/w3c/namespaces/1.0/039.xml +10 -0
  123. data/spec/fixtures/w3c/namespaces/1.0/040.xml +9 -0
  124. data/spec/fixtures/w3c/namespaces/1.0/041.xml +8 -0
  125. data/spec/fixtures/w3c/namespaces/1.0/042.xml +4 -0
  126. data/spec/fixtures/w3c/namespaces/1.0/043.xml +7 -0
  127. data/spec/fixtures/w3c/namespaces/1.0/044.xml +7 -0
  128. data/spec/fixtures/w3c/namespaces/1.0/045.xml +7 -0
  129. data/spec/fixtures/w3c/namespaces/1.0/046.xml +10 -0
  130. data/spec/fixtures/w3c/namespaces/1.0/047.xml +4 -0
  131. data/spec/fixtures/w3c/namespaces/1.0/048.xml +5 -0
  132. data/spec/fixtures/w3c/namespaces/1.0/LICENSE.md +32 -0
  133. data/spec/fixtures/w3c/namespaces/1.0/README.adoc +42 -0
  134. data/spec/fixtures/w3c/namespaces/1.0/rmt-ns10.xml +156 -0
  135. data/spec/integration/shared_examples/node_wrappers/namespace_behavior.rb +14 -2
  136. data/spec/integration/shared_examples/w3c_namespace_examples.rb +10 -0
  137. data/spec/integration/w3c_namespace_spec.rb +69 -0
  138. data/spec/moxml/adapter/libxml_spec.rb +7 -1
  139. data/spec/moxml/adapter/oga_spec.rb +92 -0
  140. data/spec/moxml/config_spec.rb +75 -0
  141. data/spec/moxml/doctype_spec.rb +19 -3
  142. data/spec/moxml/entity_registry_spec.rb +184 -0
  143. data/spec/moxml/error_spec.rb +2 -2
  144. data/spec/moxml/namespace_uri_validation_spec.rb +140 -0
  145. data/spec/moxml/xpath/axes_spec.rb +3 -4
  146. data/spec/performance/xpath_benchmark_spec.rb +6 -54
  147. data/spec/support/w3c_namespace_helpers.rb +41 -0
  148. data/spec/unit/rexml_isolated_test.rb +271 -0
  149. metadata +99 -3
  150. data/.ruby-version +0 -1
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace name test: a perfectly good http URI -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns CDATA #IMPLIED>
6
+ ]>
7
+ <foo xmlns="http://example.org/namespace"/>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace name test: a syntactically plausible URI with a
3
+ fictitious scheme -->
4
+ <!DOCTYPE foo [
5
+ <!ELEMENT foo ANY>
6
+ <!ATTLIST foo xmlns CDATA #IMPLIED>
7
+ ]>
8
+ <foo xmlns="zarquon://example.org/namespace"/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace name test: a perfectly good http URI with a fragment -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns CDATA #IMPLIED>
6
+ ]>
7
+ <foo xmlns="http://example.org/namespace#apples"/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace name test: a relative URI (deprecated) -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns CDATA #IMPLIED>]
6
+ >
7
+ <foo xmlns="namespaces/zaphod"/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace name test: a same-document relative URI (deprecated) -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns CDATA #IMPLIED>
6
+ ]>
7
+ <foo xmlns="#beeblebrox"/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Namespace name test: an http IRI that is not a URI -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns CDATA #IMPLIED>
6
+ ]>
7
+ <foo xmlns="http://example.org/ros�"/>
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace inequality test: different capitalization -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns:a CDATA #IMPLIED
6
+ xmlns:b CDATA #IMPLIED
7
+ xmlns:c CDATA #IMPLIED>
8
+ <!ELEMENT bar ANY>
9
+ <!ATTLIST bar a:attr CDATA #IMPLIED
10
+ b:attr CDATA #IMPLIED
11
+ c:attr CDATA #IMPLIED>
12
+ ]>
13
+ <foo xmlns:a="http://example.org/wine"
14
+ xmlns:b="http://Example.org/wine"
15
+ xmlns:c="http://example.org/Wine">
16
+
17
+ <bar a:attr="1" b:attr="2" c:attr="3"/>
18
+
19
+ </foo>
20
+
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace inequality test: different escaping -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns:a CDATA #IMPLIED
6
+ xmlns:b CDATA #IMPLIED
7
+ xmlns:c CDATA #IMPLIED>
8
+ <!ELEMENT bar ANY>
9
+ <!ATTLIST bar a:attr CDATA #IMPLIED
10
+ b:attr CDATA #IMPLIED
11
+ c:attr CDATA #IMPLIED>
12
+ ]>
13
+ <foo xmlns:a="http://example.org/~wilbur"
14
+ xmlns:b="http://example.org/%7ewilbur"
15
+ xmlns:c="http://example.org/%7Ewilbur">
16
+
17
+ <bar a:attr="1" b:attr="2" c:attr="3"/>
18
+
19
+ </foo>
20
+
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace equality test: plain repetition -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns:a CDATA #IMPLIED
6
+ xmlns:b CDATA #IMPLIED
7
+ xmlns:c CDATA #IMPLIED>
8
+ <!ELEMENT bar ANY>
9
+ <!ATTLIST bar a:attr CDATA #IMPLIED
10
+ b:attr CDATA #IMPLIED
11
+ c:attr CDATA #IMPLIED>
12
+ ]>
13
+ <foo xmlns:a="http://example.org/~wilbur"
14
+ xmlns:b="http://example.org/~wilbur">
15
+
16
+ <bar a:attr="1" b:attr="2"/>
17
+
18
+ </foo>
19
+
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace equality test: use of character reference -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns:a CDATA #IMPLIED
6
+ xmlns:b CDATA #IMPLIED
7
+ xmlns:c CDATA #IMPLIED>
8
+ <!ELEMENT bar ANY>
9
+ <!ATTLIST bar a:attr CDATA #IMPLIED
10
+ b:attr CDATA #IMPLIED
11
+ c:attr CDATA #IMPLIED>
12
+ ]>
13
+ <foo xmlns:a="http://example.org/~wilbur"
14
+ xmlns:b="http://example.org/&#x7E;wilbur">
15
+
16
+ <bar a:attr="1" b:attr="2"/>
17
+
18
+ </foo>
19
+
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace equality test: use of entity reference -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns:a CDATA #IMPLIED
6
+ xmlns:b CDATA #IMPLIED
7
+ xmlns:c CDATA #IMPLIED>
8
+ <!ELEMENT bar ANY>
9
+ <!ATTLIST bar a:attr CDATA #IMPLIED
10
+ b:attr CDATA #IMPLIED
11
+ c:attr CDATA #IMPLIED>
12
+ <!ENTITY tilde "~">
13
+ ]>
14
+ <foo xmlns:a="http://example.org/~wilbur"
15
+ xmlns:b="http://example.org/&tilde;wilbur">
16
+
17
+ <bar a:attr="1" b:attr="2"/>
18
+
19
+ </foo>
20
+
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Namespace inequality test: equal after attribute value normalization -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo xmlns:a CDATA #IMPLIED
6
+ xmlns:b NMTOKEN #IMPLIED
7
+ xmlns:c CDATA #IMPLIED>
8
+ <!ELEMENT bar ANY>
9
+ <!ATTLIST bar a:attr CDATA #IMPLIED
10
+ b:attr CDATA #IMPLIED
11
+ c:attr CDATA #IMPLIED>
12
+ ]>
13
+ <foo xmlns:a="urn:xyzzy"
14
+ xmlns:b=" urn:xyzzy ">
15
+
16
+ <bar a:attr="1" b:attr="2"/>
17
+
18
+ </foo>
19
+
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Bad QName syntax: multiple colons -->
3
+ <foo>
4
+ <bar a:b:attr="1"/>
5
+ </foo>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Bad QName syntax: colon at end -->
3
+ <foo: />
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Bad QName syntax: colon at start -->
3
+ <:foo />
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Bad QName syntax: xmlns: -->
3
+ <foo xmlns:="http://example.org/namespace" />
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: no namespaces -->
3
+ <foo/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: default namespace -->
3
+ <foo xmlns="http://example.org/namespace"/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: prefixed element -->
3
+ <a:foo xmlns:a="http://example.org/namespace"/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: prefixed attribute -->
3
+ <foo xmlns:a="http://example.org/namespace" a:attr="1"/>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: default namespace and unbinding -->
3
+ <foo xmlns="http://example.org/namespace">
4
+ <foo xmlns=""/>
5
+ </foo>
6
+
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: default namespace and rebinding -->
3
+ <foo xmlns="http://example.org/namespace">
4
+ <foo xmlns="http://example.org/other-namespace"/>
5
+ </foo>
6
+
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Illegal use of 1.1-style prefix unbinding in 1.0 document -->
3
+ <a:foo xmlns:a="http://example.org/namespace">
4
+ <a:foo xmlns:a=""/>
5
+ </a:foo>
6
+
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Simple legal case: prefix rebinding -->
3
+ <a:foo xmlns:a="http://example.org/namespace">
4
+ <a:foo xmlns:a="http://example.org/other-namespace"/>
5
+ </a:foo>
6
+
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Unbound element prefix -->
3
+ <a:foo/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Unbound attribute prefix -->
3
+ <foo a:attr="1"/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: using the xml prefix undeclared -->
3
+ <foo xml:lang="en"/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: declaring the xml prefix correctly -->
3
+ <foo xmlns:xml="http://www.w3.org/XML/1998/namespace"/>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: declaring the xml prefix incorrectly -->
3
+ <foo xmlns:xml="http://example.org/namespace"/>
4
+
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: binding another prefix
3
+ to the xml namespace -->
4
+ <foo xmlns:yml="http://www.w3.org/XML/1998/namespace"/>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: declaring the xmlns prefix
3
+ with its correct URI (illegal) -->
4
+ <foo xmlns:xmlns="http://www.w3.org/2000/xmlns/"/>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: declaring the xmlns prefix
3
+ with an incorrect URI -->
4
+ <foo xmlns:xmlns="http://example.org/namespace"/>
5
+
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: binding another prefix
3
+ to the xmlns namespace -->
4
+ <foo xmlns:ymlns="http://www.w3.org/2000/xmlns/"/>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Reserved prefixes and namespaces: binding a reserved prefix -->
3
+ <foo xmlns:xml2="http://example.org/namespace"/>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: repeated identical attribute -->
3
+ <foo xmlns:a="http://example.org/~wilbur"
4
+ xmlns:b="http://example.org/~wilbur">
5
+
6
+ <bar a:attr="1" a:attr="2"/>
7
+
8
+ </foo>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: repeated attribute with different prefixes -->
3
+ <foo xmlns:a="http://example.org/~wilbur"
4
+ xmlns:b="http://example.org/~wilbur">
5
+
6
+ <bar a:attr="1" b:attr="2"/>
7
+
8
+ </foo>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: different attributes with same local name -->
3
+ <foo xmlns:a="http://example.org/~wilbur"
4
+ xmlns:b="http://example.org/~kipper">
5
+
6
+ <bar a:attr="1" b:attr="2"/>
7
+
8
+ </foo>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: prefixed and unprefixed attributes with same
3
+ local name -->
4
+ <foo xmlns:a="http://example.org/~wilbur">
5
+
6
+ <bar a:attr="1" attr="2"/>
7
+
8
+ </foo>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: prefixed and unprefixed attributes with same
3
+ local name, with default namespace -->
4
+ <foo xmlns:a="http://example.org/~wilbur"
5
+ xmlns:b="http://example.org/~kipper"
6
+ xmlns="http://example.org/~wilbur">
7
+
8
+ <b:bar a:attr="1" attr="2"/>
9
+
10
+ </foo>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: prefixed and unprefixed attributes with same
3
+ local name, with default namespace and element in default namespace -->
4
+ <foo xmlns:a="http://example.org/~wilbur"
5
+ xmlns="http://example.org/~wilbur">
6
+
7
+ <bar a:attr="1" attr="2"/>
8
+
9
+ </foo>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Attribute uniqueness: prefixed and unprefixed attributes with same
3
+ local name, element in same namespace as prefixed attribute -->
4
+ <foo xmlns:a="http://example.org/~wilbur">
5
+
6
+ <a:bar a:attr="1" attr="2"/>
7
+
8
+ </foo>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Colon in PI name -->
3
+ <?a:b bogus?>
4
+ <foo/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Colon in entity name -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ENTITY a:b "bogus">
6
+ ]>
7
+ <foo/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Colon in entity name -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!NOTATION a:b SYSTEM "notation">
6
+ ]>
7
+ <foo/>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Colon in ID attribute name -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo id ID #REQUIRED>
6
+ ]>
7
+ <foo id="a:b"/>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Colon in ID attribute name -->
3
+ <!DOCTYPE foo [
4
+ <!ELEMENT foo ANY>
5
+ <!ATTLIST foo id ID #IMPLIED
6
+ ref IDREF #IMPLIED>
7
+ ]>
8
+ <foo ref="a:b">
9
+ <foo id="a:b"/>
10
+ </foo>
@@ -0,0 +1,4 @@
1
+ <!DOCTYPE xml:foo [
2
+ <!ELEMENT xml:foo EMPTY>
3
+ ]>
4
+ <xml:foo/>
@@ -0,0 +1,5 @@
1
+ <!DOCTYPE x [
2
+ <!ELEMENT x EMPTY>
3
+ <!ATTLIST x xml:foo CDATA #IMPLIED>
4
+ ]>
5
+ <x xml:foo=""/>
@@ -0,0 +1,32 @@
1
+ Copyright (c) World Wide Web Consortium, (Massachusetts Institute of
2
+ Technology, European Research Consortium for Informatics and Mathematics,
3
+ Keio University, Beihang). All Rights Reserved.
4
+
5
+ This work is distributed under the
6
+ [W3C Test Suite License](https://www.w3.org/Consortium/Legal/2008/04-testsuite-license).
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are met:
10
+
11
+ - Redistributions of works must retain the original copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+ - Redistributions in binary form must reproduce the original copyright
14
+ notice, this list of conditions and the following disclaimer in the
15
+ documentation and/or other materials provided with the distribution.
16
+ - Neither the name of the W3C nor the names of its contributors may be
17
+ used to endorse or promote products derived from this work without
18
+ specific prior written permission.
19
+
20
+ The tests themselves SHALL NOT be changed in any way.
21
+
22
+ THIS SOFTWARE OR DOCUMENT IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
24
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,42 @@
1
+ = W3C XML Namespaces 1.0 Test Suite
2
+
3
+ == Source
4
+
5
+ These test fixtures are extracted from the W3C XML Test Suite
6
+ (https://www.w3.org/XML/Test/), specifically from the `xmlts20130923` archive:
7
+
8
+ * Path in archive: `xmlconf/eduni/namespaces/1.0/`
9
+ * Test catalog: `rmt-ns10.xml` (Richard Tobin's XML Namespaces 1.0 test suite,
10
+ 14 Feb 2003)
11
+
12
+ The test suite validates XML namespace processing conformance as defined in
13
+ https://www.w3.org/TR/xml-names/[Namespaces in XML 1.0].
14
+
15
+ == Test types
16
+
17
+ The W3C test suite classifies tests into the following categories:
18
+
19
+ valid:: Documents that must be accepted without errors.
20
+
21
+ error:: Namespace constraint violations that processors MAY report. These are
22
+ advisory -- a conforming processor is not required to reject them.
23
+
24
+ not-wf:: Namespace well-formedness violations that must be rejected by a
25
+ conforming processor.
26
+
27
+ invalid:: Validity errors. Non-validating parsers (which Moxml wraps) should
28
+ accept these documents.
29
+
30
+ == License
31
+
32
+ The W3C XML Test Suite is provided under the
33
+ https://www.w3.org/Consortium/Legal/2008/04-testsuite-license[W3C Test Suite License].
34
+ See link:LICENSE.md[] for the full license text.
35
+
36
+ The test files in this directory SHALL NOT be modified.
37
+
38
+ == See also
39
+
40
+ * https://www.w3.org/XML/Test/[W3C XML Test Suite]
41
+ * https://www.w3.org/TR/xml-names/[Namespaces in XML 1.0 (W3C Recommendation)]
42
+ * https://www.rfc-editor.org/rfc/rfc3986[RFC 3986 -- Uniform Resource Identifier (URI): Generic Syntax]