<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20645</bug_id>
          
          <creation_ts>2013-01-11 15:38:00 +0000</creation_ts>
          <short_desc>[QT3TS] parse-xml-010</short_desc>
          <delta_ts>2013-01-11 18:04:22 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 3 &amp; XPath 3 Test Suite</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Mills">tim</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>mike</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>81240</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-01-11 15:38:00 +0000</bug_when>
    <thetext>I think the test should be

        &lt;test&gt;&lt;![CDATA[parse-xml(&quot;&lt;!DOCTYPE a [&lt;!ELEMENT a (#PCDATA)&gt;&lt;!ENTITY foo SYSTEM &apos;parse-xml/foo.entity&apos;&gt;]&gt;&lt;a&gt;&amp;foo;&lt;/a&gt;&quot;)]]&gt;&lt;/test&gt;

in

    &lt;test-case name=&quot;parse-xml-010&quot;&gt;
        &lt;description&gt;parse-xml test - with external entity&lt;/description&gt;
        &lt;created by=&quot;Michael Kay&quot; on=&quot;2013-01-07&quot;/&gt;        
        &lt;environment name=&quot;empty&quot;/&gt;
        &lt;test&gt;&lt;![CDATA[parse-xml(&quot;&lt;!DOCTYPE a [&lt;!ELEMENT a (#PCDATA)&gt;&lt;!ENTITY foo SYSTEM &apos;parse-xml/foo.entity&apos;&gt;]&gt;&lt;a&gt;&amp;amp;foo;&lt;/a&gt;&quot;)]]&gt;&lt;/test&gt;
        &lt;result&gt;
            &lt;assert-xml&gt;&lt;![CDATA[&lt;a&gt;&lt;bar&gt;baz&lt;/bar&gt;&lt;/a&gt;]]&gt;&lt;/assert-xml&gt;
        &lt;/result&gt;
    &lt;/test-case&gt;

to match the intent of the test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81245</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-01-11 16:06:16 +0000</bug_when>
    <thetext>I think it depends on whether you run it using an XPath processor or an XQuery processor.

The expression is this:

parse-xml(&quot;&lt;!DOCTYPE a [&lt;!ELEMENT a (#PCDATA)&gt;&lt;!ENTITY foo SYSTEM &apos;parse-xml/foo.entity&apos;&gt;]&gt;&lt;a&gt;&amp;amp;foo;&lt;/a&gt;&quot;)

In XQuery, the query processor interprets &quot;&amp;amp;&quot; in the string literal as &amp;, so it passes &amp;foo; to the XML parser.

In XPath, the xpath processor does nothing to the string, so it passes &quot;&amp;amp;foo;&quot; to the XML parser.

Do you agree with that analysis? If so, it looks like we need to split it into different tests for XPath and XQuery. Alternatively, we can construct the XML string using string concatenation and codepoints-to-string().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81250</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-01-11 16:44:49 +0000</bug_when>
    <thetext>
&gt; Do you agree with that analysis? 

Yes.  I hadn&apos;t spotted that it was only failing for XP30 runs, and not XQ30.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81262</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-01-11 18:04:22 +0000</bug_when>
    <thetext>Fixed by using codepoint-to-string() for the ampersand.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>