Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
authortravil
Thu, 03 Apr 2014 09:57:47 -0700
changeset 50 f3d96628e2b5
parent 49 bf16edd32039
child 51 562246d9b452
Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
Plumbed the new "require well-formed" flag through the algorithm, and embedded
the rules for throwing InvalidStateError into the algorithm.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25168
index.html
--- a/index.html	Thu Mar 27 17:37:49 2014 -0700
+++ b/index.html	Thu Apr 03 09:57:47 2014 -0700
@@ -98,12 +98,6 @@
         
         <p class=issue>Open issues that appear throughout the remainder of this 
         document will be highlighted like this.</p>
-        
-        <!-- I don't believe this is a point of contention anymore...
-        <p class="issue">This specification currently requires using the XML 
-        Parser for some APIs, when in an XML document. It is unclear whether 
-        consensus can be found for this approach.</p>
-        -->
     </section>
 
     <section id="conformance">
@@ -251,7 +245,7 @@
         <p>The following steps form the 
             <dfn title="concept-fragment-serializing-algorithm">fragment serializing algorithm</dfn>,
             whose arguments are a <a title="node" data-spec="DOM4" class="externalDFN">Node</a> 
-            <var>node</var> and a flag <dfn title="concept-strict-validation">strict validation</dfn>.
+            <var>node</var> and a flag <dfn title="concept-well-formed">require well-formed</dfn>.
 
         <ol>
             <li>Let <var>context document</var> be <var>node</var>'s
@@ -262,7 +256,7 @@
             <li>Otherwise, <var>context document</var> is an
                 <a title="xml-document" data-spec="DOM4" class="externalDFN">XML document</a>;
                 return an <a title="concept-serialize-xml">XML serialization</a> of <var>node</var>
-                passing the flag <var>strict validation</var>.
+                passing the flag <var>require well-formed</var>.
             <p class="note">The <a title="concept-serialize-xml">XML serialization</a> defined in this document
                 conforms to the requirements of the <a data-spec="HTML5" title="xml-fragment-serialization-algorithm" 
                 class="externalDFN">XML fragment serialization algorithm</a> defined in [[HTML5]].</p>
@@ -276,7 +270,7 @@
 
         <p>To produce an <dfn title="concept-serialize-xml">XML serialization</dfn> of a
             <a title="node" data-spec="DOM4" class="externalDFN">Node</a> <var>node</var> given a
-            flag <var>strict validation</var>, run the following steps:
+            flag <var>require well-formed</var>, run the following steps:
         <ol>
             <li>Let <dfn title="concept-context-namespace">context namespace</dfn> be <code>null</code>.
                 The <a title="concept-context-namespace">context namespace</a> is changed when a
@@ -304,7 +298,7 @@
                 algorithm</a> on <var>node</var> passing the <a title="concept-context-namespace">context 
                 namespace</a>, <a title="concept-namespace-prefix-map">namespace prefix map</a>, 
                 <a title="concept-generated-prefix">generated namespace prefix index</a> reference, and the
-                flag <var>strict validation</var>. If an <dfn title="concept-algorithm-exception">exception</dfn>
+                flag <var>require well-formed</var>. If an <dfn title="concept-algorithm-exception">exception</dfn>
                 occurs during the execution of the algorithm, then catch that exception and throw a 
                 <code><a data-spec="DOM4" title="domexception" class="externalDFN">DOMException</a></code> with 
                 name <code>InvalidStateError</code>.
@@ -332,18 +326,11 @@
             elements in the <a title="html-ns">HTML namespace</a> that contain no child nodes are serialized 
             with an explicit begin and end tag rather than using the self-closing tag syntax [[XML10]].
         
-        <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=25168">Bug: 25168</a>
-            Should an XML Serialization check for these potential issues and tweak element 
-            and attribute localNames that could cause problems? For example, replace "<code>:</code>" 
-            (U+003A COLON) with "<code>_</code>" (U+005F LOW LINE) in element localNames and drop/replace
-            "<code>xmlns</code>" and "<code>xmlns:</code>" prefixes in attribute localNames? Or should
-            the XML Serialization fail to serialize under these scenarios?
-        
         <p>To run the <dfn title="concept-xml-serialization-algorithm">XML serialization algorithm</dfn> on
             a <var>node</var> given a <a title="concept-context-namespace">context namespace</a> 
             <var>namespace</var>, a <a title="concept-namespace-prefix-map">namespace prefix map</a>
             <var>prefix map</var>, a <a title="concept-generated-prefix">generated namespace prefix index</a>
-            <var>prefix index</var>, and a flag <var>strict validation</var>, the user agent must run the 
+            <var>prefix index</var>, and a flag <var>require well-formed</var>, the user agent must run the 
             appropriate steps, depending on <var>node</var>'s interface:</p>
         
         <dl class=switch>
@@ -354,7 +341,13 @@
                     <!-- "namespace" was passed via the caller, it's the default namespace scope -->
                     <!-- "prefix map" was passed via the caller, it's the namespace->prefix map -->
                     <!-- "prefix index" was passed via the caller, it's a number for generating prefixes if necessary -->
-                    <!-- "strict validation" was passed via the caller, it's a flag (true/false) for whether certain validation steps should be taken during serialization. -->
+                    <!-- "require well-formed" was passed via the caller, it's a flag (true/false) for whether certain validation steps should be taken during serialization. -->
+                    <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                        <code>true</code>), and this <var>node</var>'s 
+                        <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
+                        attribute contains the character "<code>:</code>" (U+003A COLON) or does not match the
+                        XML <code>Name</code> production [[XML10]], then <a title="concept-algorithm-exception">throw an 
+                        exception</a>; the serialization of this <var>node</var> would not be a well-formed element.
                     <li>Let <var>markup</var> be the string "<code>&lt;</code>" (U+003C LESS-THAN SIGN).
                     <li>Let <var>qualified name</var> be an empty string.
                     <li>Let a <var>skip end tag</var> flag have the value <code>false</code>.
@@ -443,7 +436,8 @@
                                 <li>the value of <var>prefix</var>;
                                 <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
                                 <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a> 
-                                    given <var>ns</var> as input;
+                                    given <var>ns</var> and the <a title="concept-well-formed">require well-formed</a> flag 
+                                    as input;
                                 <li>"<code>"</code>" (U+0022 QUOTATION MARK);
                             </ol>
                         </ol>
@@ -466,7 +460,8 @@
                                 <li>the string "<code>xmlns</code>";
                                 <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
                                 <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a> 
-                                    given <var>ns</var> as input;
+                                    given <var>ns</var> and the <a title="concept-well-formed">require well-formed</a> flag
+                                    as input;
                                 <li>"<code>"</code>" (U+0022 QUOTATION MARK);
                             </ol>
                         </ol>
@@ -535,7 +530,7 @@
                         <var>map</var> for the <a title="concept-namespace-prefix-map">namespace prefix map</a>,
                         <var>prefix index</var> for the 
                         <a title="concept-generated-prefix">generated namespace prefix index</a>, and the value
-                        of the <var>strict validation</var> flag.
+                        of the <var>require well-formed</var> flag.
                     <li>Append the following to <var>markup</var>, in order:
                         <ol>
                             <li>"<code>&lt;/</code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS);
@@ -547,25 +542,46 @@
 
             <dt><code><a title="document" data-spec="DOM4" class="externalDFN">Document</a></code>
             <dd>
-                <p>Return the result of concatenating the following, in order:
+                <p>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and this <var>node</var> has no 
+                    <a title="dom-document-documentelement" data-spec="HTML5" class="externalDFN">documentElement</a>
+                    (the <a title="dom-document-documentelement" data-spec="HTML5" class="externalDFN">documentElement</a>
+                    attribute's value is <code>null</code>), then <a title="concept-algorithm-exception">throw an 
+                    exception</a>; the serialization of this <var>node</var> would not be a well-formed document.
+                <p>Otherwise, run the following steps:
                 <ol>
-                    <li>The string produced by running the steps to 
+                    <li>Let <var>serialized document</var> be an empty string.
+                    <li>Append to <var>serialized document</var> the string produced by running the steps to 
                         <a title="concept-serialize-doctype">produce a DocumentType serialization</a>
                         of <var>node</var>'s 
                         <a title="dom-document-doctype" data-spec="HTML5" class="externalDFN">doctype</a>
-                        attribute;
-                    <li>The string produced by running the <a title="concept-xml-serialization-algorithm">XML 
-                        serialization algorithm</a> on <var>node</var>'s 
-                        <a title="dom-document-documentelement" data-spec="HTML5" class="externalDFN">documentElement</a>
-                        attribute, given <code>null</code> as the <a title="concept-context-namespace">context 
-                        namespace</a>, 
-                        <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>prefix map</var>,
-                        a reference to the <a title="concept-generated-prefix">generated namespace 
-                        prefix index</a> <var>prefix index</var>, and flag <var>strict validation</var>. 
+                        attribute provided the <var>require well-formed</var> flag if <var>node</var>'s 
+                        <a title="dom-document-doctype" data-spec="HTML5" class="externalDFN">doctype</a>
+                        attribute is not <code>null</code>.
+                    <li>For each
+                        <a title="concept-tree-child" data-spec="DOM4" class="externalDFN">child</a> of 
+                        <var>node</var>, in order, run the 
+                        <a title="concept-xml-serialization-algorithm">XML serialization algorithm</a>
+                        on the <var>child</var> given a <a title="concept-context-namespace">context namespace</a>
+                        <var>namespace</var>, a <a title="concept-namespace-prefix-map">namespace prefix map</a>
+                        <var>prefix map</var>, a reference to a <a title="concept-generated-prefix">generated 
+                        namespace prefix index</a> <var>prefix index</var>, flag <var>require well-formed</var>, and
+                        append the result to <var>serialized document</var>.
+                    <li>Return the value of <var>serialized document</var>.
                 </ol>
 
             <dt><code><a title="comment" data-spec="DOM4" class="externalDFN">Comment</a></code>
             <dd>
+                <p>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and <var>node</var>'s
+                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
+                    contains characters that are not matched by the XML <code>Char</code> production [[XML10]] or
+                    contains "<code>--</code>" (two adjacent U+002D HYPHEN-MINUS characters) or that ends with 
+                    a "<code>-</code>" (U+002D HYPHEN-MINUS) character, then 
+                    <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this 
+                    <var>node</var>'s 
+                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
+                    would not be well-formed.
                 <p>Return the concatenation of "<code>&lt;!--</code>", <var>node</var>'s
                 <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>, and
                 "<code>--></code>".
@@ -586,9 +602,17 @@
             
             <dt><code><a title="text" data-spec="DOM4" class="externalDFN">Text</a></code>
             <dd><ol>
+                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and <var>node</var>'s
+                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
+                    contains characters that are not matched by the XML <code>Char</code> production [[XML10]], 
+                    then <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this 
+                    <var>node</var>'s 
+                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
+                    would not be well-formed.
                 <li>Let <var>markup</var> be <var>node</var>'s
                 <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>.
-
+                
                 <li>Replace any occurrences of "<code>&amp;</code>" in <var>markup</var> by
                 "<code>&amp;amp;</code>".
                 
@@ -611,21 +635,39 @@
                     a <a title="concept-context-namespace">context namespace</a> <var>namespace</var>, a
                     <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>prefix map</var>,
                     a reference to a <a title="concept-generated-prefix">generated namespace prefix index</a> 
-                    <var>prefix index</var>, and flag <var>strict validation</var>. Concatenate the result 
+                    <var>prefix index</var>, and flag <var>require well-formed</var>. Concatenate the result 
                     to <var>markup</var>.
                 <li>Return <var>markup</var>.
               </ol>
             <dt><code><a title="documenttype" data-spec="DOM4" class="externalDFN">DocumentType</a></code>
             <dd>Run the steps to <a title="concept-serialize-doctype">produce a DocumentType 
-                serialization</a> of <var>node</var>
-                and return the string this produced.           
+                serialization</a> of <var>node</var> given the <a title="concept-well-formed">require well-formed</a>
+                flag, and return the string this produced.
             
             <dt><code><a title="processinginstruction" data-spec="DOM4" class="externalDFN">ProcessingInstruction</a></code>
             <dd><ol>
+                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and <var>node</var>'s
+                    <code><a title="dom-processinginstruction-target" data-spec="DOM4" class="externalDFN">target</a></code>
+                    contains a "<code>:</code>" (U+003A COLON) character or is an 
+                    <a data-spec="DOM4" class="externalDFN" title="ascii-case-insensitive">ASCII case-insensitive</a>
+                    match for the string "<code>xml</code>", then <a title="concept-algorithm-exception">throw an 
+                    exception</a>; the serialization of this <var>node</var>'s 
+                    <code><a title="dom-processinginstruction-target" data-spec="DOM4" class="externalDFN">target</a></code>
+                    would not be well-formed.
+                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and <var>node</var>'s
+                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
+                    contains characters that are not matched by the XML <code>Char</code> production [[XML10]] or
+                    contains the string "<code>?></code>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN),
+                    then <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this 
+                    <var>node</var>'s 
+                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
+                    would not be well-formed.
                 <li>Let <var>markup</var> be the concatenation of the following, in order:
                 <ol>
                     <li>"<code>&lt;?</code>" (U+003C LESS-THAN SIGN, U+003F QUESTION MARK);
-                    <li>The value of <var>node</var>'s <code><a title="dom-characterdata-target" 
+                    <li>The value of <var>node</var>'s <code><a title="dom-processinginstruction-target" 
                         data-spec="DOM4" class="externalDFN">target</a></code>;
                     <li>"<code> </code>" (U+0020 SPACE);
                     <li>The value of <var>node</var>'s <code><a title="dom-characterdata-data" 
@@ -637,10 +679,24 @@
         </dl>
 
         <p>To <dfn title="concept-serialize-doctype">produce a DocumentType serialization</dfn> of a
-        <a title="node" data-spec="DOM4" class="externalDFN">Node</a> <var>node</var>, the user agent
-        must return the result of the following algorithm:</p>
+            <a title="node" data-spec="DOM4" class="externalDFN">Node</a> <var>node</var>, given a 
+            <a title="concept-well-formed">require well-formed</a> flag, the user agent must return 
+            the result of the following algorithm:</p>
                 
         <ol>
+            <li>If the <a title="concept-well-formed">require well-formed</a> flag is <code>true</code>
+                and the <var>node</var>'s 
+                <code><a title="dom-documenttype-publicid" data-spec="DOM4" class="externalDFN">publicId</a></code>
+                attribute contains characters that are not matched by the XML <code>PubidChar</code> production 
+                [[XML10]], then <a title="concept-algorithm-exception">throw an exception</a>; the serialization 
+                of this <var>node</var> would not be a well-formed document type declaration.
+            <li>If the <a title="concept-well-formed">require well-formed</a> flag is <code>true</code>
+                and the <var>node</var>'s 
+                <code><a title="dom-documenttype-systemid" data-spec="DOM4" class="externalDFN">systemId</a></code>
+                attribute contains characters that are not matched by the XML <code>Char</code> production 
+                [[XML10]] or that contains both a "<code>"</code>" (U+0022 QUOTATION MARK) and a "<code>'</code>" 
+                (U+0027 APOSTROPHE), then <a title="concept-algorithm-exception">throw an exception</a>; the 
+                serialization of this <var>node</var> would not be a well-formed document type declaration.
             <li>Let <var>markup</var> be an empty string.
             <li>Append the string "<code>&lt;!DOCTYPE</code>" to <var>markup</var>.
             <li>Append "<code> </code>" (U+0020 SPACE) to <var>markup</var>.
@@ -785,15 +841,35 @@
             of an <a title="concept-element" data-spec="DOM4" class="externalDFN">Element</a>
             <var>element</var> together with a <a title="concept-namespace-prefix-map">namespace prefix 
             map</a> <var>map</var>, a <a title="concept-generated-prefix">generated prefix index</a> 
-            <var>prefix index</var> reference, a flag <var>ignore namespace definition attribute</var> and a
-            <var>duplicate prefix definition</var> value, is the result of the following algorithm:
+            <var>prefix index</var> reference, a flag <var>ignore namespace definition attribute</var>, a
+            <var>duplicate prefix definition</var> value, and a flag <var>require well-formed</var>,
+            is the result of the following algorithm:
         <ol>
             <li>Let <var>result</var> be the empty string.
+            <li>Let <var>localname set</var> be a new empty 
+                <dfn title="concept-namespace-localname-set">namespace localname set</dfn>. This <var>localname
+                set</var> will contain tuples of unique attribute <code>namespaceURI</code> and <code>localName</code>
+                pairs, and is populated as each <var>attr</var> is processed.
+                <span class="note">This set is used to [optionally] enforce the well-formed constraint that an 
+                element cannot have two attributes with the same <code>namespaceURI</code> and <code>localName</code>. 
+                This can occur when two otherwise identical attributes on the same element differ only by their 
+                prefix values.</span>
             <li>For each <a title="concept-attribute" data-spec="DOM4" class="externalDFN">attribute</a>
                 <var>attr</var> in <var>element</var>'s
                 <a title="concept-element-attribute" data-spec="DOM4" class="externalDFN">attributes</a>,
                 in order:
             <ol>
+                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and the <var>localname set</var> contains a tuple whose values match those 
+                    of a new tuple consisting of <var>attr</var>'s 
+                    <code><a title="dom-attribute-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
+                    attribute and <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
+                    attribute, then <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this 
+                    <var>attr</var> would fail to produce a well-formed element serialization.
+                <li>Create a new tuple consisting of <var>attr</var>'s 
+                    <code><a title="dom-attribute-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
+                    attribute and <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
+                    attribute, and add it to the <var>localname set</var>.
                 <li>Let <var>attribute namespace</var> be the <var>attr</var>'s  
                     <a title="dom-attribute-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a>
                     value.
@@ -828,7 +904,8 @@
                             <li>The value of <var>candidate prefix</var>;
                             <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
                             <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a> 
-                        given <var>attribute namespace</var> as input;
+                                given <var>attribute namespace</var> and the 
+                                <a title="concept-well-formed">require well-formed</a> flag as input;
                             <li>"<code>"</code>" (U+0022 QUOTATION MARK).
                         </ol>
                     </ol>
@@ -837,6 +914,14 @@
                 <li>Append a "<code> </code>" (U+0020 SPACE) to <var>result</var>.
                 <li>If <var>candidate prefix</var> is not <code>null</code>, then append to <var>result</var>
                     the concatenation of <var>candidate prefix</var> with "<code>:</code>" (U+003A COLON).
+                <!-- Check for well-formed localName -->
+                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                    <code>true</code>), and this <var>attr</var>'s 
+                    <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
+                    attribute contains the character "<code>:</code>" (U+003A COLON) or does not match the XML 
+                    <code>Name</code> production [[XML10]] or equals "<code>xmlns</code>" and <var>attribute 
+                    namespace</var> is <code>null</code>, then <a title="concept-algorithm-exception">throw an 
+                    exception</a>; the serialization of this <var>attr</var> would not be a well-formed attribute.
                 <!-- Write out the standard attribute -->
                 <li>Append the following strings to <var>result</var>:
                 <ol>
@@ -845,7 +930,8 @@
                     <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
                     <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a> 
                         given <var>attr</var>'s
-                        <a title="concept-attribute-value" data-spec="DOM4" class="externalDFN">value</a> as input;
+                        <code><a title="concept-attribute-value" data-spec="DOM4" class="externalDFN">value</a></code>
+                        attribute and the <a title="concept-well-formed">require well-formed</a> flag as input;
                     <li>"<code>"</code>" (U+0022 QUOTATION MARK).
                 </ol>
             </ol>
@@ -853,8 +939,14 @@
         </ol>
         
         <p>To <dfn title="concept-serialize-attr-value">serialize an attribute value</dfn> given an 
-            <var>attribute value</var>, the user agent must run the following steps:
+            <var>attribute value</var> and <a title="concept-well-formed">require well-formed</a> flag,
+            the user agent must run the following steps:
         <ol>
+            <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is 
+                <code>true</code>), and <var>attribute value</var> contains characters that are not matched 
+                by the XML <code>Char</code> production [[XML10]], then 
+                <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this 
+                <var>attribute value</var> would fail to produce a well-formed element serialization.
             <li>If <var>attribute value</var> is <code>null</code>, then return the empty string.
             <li>Otherwise, <var>attribute value</var> is a string. Return <var>attribute value</var>,
                 first replacing any occurrences of the following:
@@ -996,7 +1088,7 @@
 
         <dd>The <code>serializeToString(<var>root</var>)</code>
         method must <a title="concept-serialize-xml">produce an XML serialization</a> of <var>root</var> passing 
-        a value of <code>false</code> for the <a title="concept-strict-validation">strict validation</a> parameter, and return the result.</dd>
+        a value of <code>false</code> for the <a title="concept-well-formed">require well-formed</a> parameter, and return the result.</dd>
     </dl>
 </section>
 
@@ -1050,7 +1142,7 @@
             <p>On getting, return the result of invoking the 
                 <a title="concept-fragment-serializing-algorithm">fragment serializing algorithm</a> on the 
                 <a title="context object">context object</a> providing <code>true</code> for the 
-                <a title="concept-strict-validation">strict validation</a> flag (this might throw an exception 
+                <a title="concept-well-formed">require well-formed</a> flag (this might throw an exception 
                 instead of returning a string).
 
             <p>On setting, these steps must be run:
@@ -1098,7 +1190,7 @@
                 <a title="concept-fragment-serializing-algorithm">fragment serializing algorithm</a> on a 
                 fictional node whose only child is the <a title="context object">context object</a>
                 <a title="context object">context object</a> providing <code>true</code> for the 
-                <a title="concept-strict-validation">strict validation</a> flag (this might throw an exception 
+                <a title="concept-well-formed">require well-formed</a> flag (this might throw an exception 
                 instead of returning a string).
 
             <p>On setting, the following steps must be run: