You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Scott Boag/CAM/Lotus <Sc...@lotus.com> on 2000/01/22 03:16:15 UTC

Re: Bug: External Entities that begin with newline

Interesting.  My first bet is that this is a Xerces issue.  You should try
the parse with just Xerces to see what happens.

-scott




                                                                                                                           
                    "Chris P. McCabe"                                                                                      
                    <chris_mccabe@choiceh        To:     xalan-dev@xml.apache.org                                          
                    otels.com>                   cc:     (bcc: Scott Boag/CAM/Lotus)                                       
                    Sent by:                     Subject:     Bug: External Entities that begin with newline               
                    cmccabe@choicehotels.                                                                                  
                    com                                                                                                    
                                                                                                                           
                                                                                                                           
                    01/21/00 05:37 PM                                                                                      
                    Please respond to                                                                                      
                    xalan-dev                                                                                              
                                                                                                                           
                                                                                                                           




I don't know if this is a Xerces or Xalan bug, but if an external entity
that contains XML begins with a newline character, the XML cannot be
referenced in the stylesheet in certain circumstances.  In the test case
below, if test2.xml begins with a newline, the xsl:value-of element in
the stylesheet will produce no value.  If the newline is removed, it
works as expected.  This is a contrived example to illustrate the
problem, and if a template is created for the "bar" element and
apply-templates is called, it works correctly in either case.


============ test.xml ==============
<?xml version="1.0"?>

<!DOCTYPE page [
   <!ENTITY values SYSTEM "test2.xml">
]>

<page>
   &values;
</page>
=====================================

============ test2.xml ==============

<foo>
   <bar>Some Text</bar>
</foo>
=====================================

============= test.xsl ==============
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns="http://www.w3.org/TR/REC-html40">

   <xsl:output method="html" indent="yes"/>

   <xsl:template match="page">
      <html><body>
      <xsl:value-of select="//bar"/>
      </body></html>
   </xsl:template>

</xsl:stylesheet>
=====================================


--
Chris P. McCabe  602-953-4416
Choice Hotels International  chris_mccabe@choicehotels.com








Re: Bug: External Entities that begin with newline

Posted by "Chris P. McCabe" <ch...@choicehotels.com>.
I tried parsing this with just Xerces, and it seems to handle it fine.  In both cases it reads and parses the
external entity properly.  I expected this to be the case since Xalan properly processes the XML in the
external entity when it is referenced in a different manner than in this test case.

Chris

Scott Boag/CAM/Lotus wrote:

> Interesting.  My first bet is that this is a Xerces issue.  You should try
> the parse with just Xerces to see what happens.
>
> -scott
>
>
>                     "Chris P. McCabe"
>                     <chris_mccabe@choiceh        To:     xalan-dev@xml.apache.org
>                     otels.com>                   cc:     (bcc: Scott Boag/CAM/Lotus)
>                     Sent by:                     Subject:     Bug: External Entities that begin with newline
>                     cmccabe@choicehotels.
>                     com
>
>
>                     01/21/00 05:37 PM
>                     Please respond to
>                     xalan-dev
>
>
>
> I don't know if this is a Xerces or Xalan bug, but if an external entity
> that contains XML begins with a newline character, the XML cannot be
> referenced in the stylesheet in certain circumstances.  In the test case
> below, if test2.xml begins with a newline, the xsl:value-of element in
> the stylesheet will produce no value.  If the newline is removed, it
> works as expected.  This is a contrived example to illustrate the
> problem, and if a template is created for the "bar" element and
> apply-templates is called, it works correctly in either case.
>
> ============ test.xml ==============
> <?xml version="1.0"?>
>
> <!DOCTYPE page [
>    <!ENTITY values SYSTEM "test2.xml">
> ]>
>
> <page>
>    &values;
> </page>
> =====================================
>
> ============ test2.xml ==============
>
> <foo>
>    <bar>Some Text</bar>
> </foo>
> =====================================
>
> ============= test.xsl ==============
> <xsl:stylesheet
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    xmlns="http://www.w3.org/TR/REC-html40">
>
>    <xsl:output method="html" indent="yes"/>
>
>    <xsl:template match="page">
>       <html><body>
>       <xsl:value-of select="//bar"/>
>       </body></html>
>    </xsl:template>
>
> </xsl:stylesheet>
> =====================================
>

--
Chris P. McCabe  602-953-4416
Choice Hotels International  chris_mccabe@choicehotels.com




Re: Bug: External Entities that begin with newline

Posted by "Chris P. McCabe" <ch...@choicehotels.com>.
I tried parsing this with just Xerces, and it seems to handle it fine.  In both cases it reads and parses the
external entity properly.  I expected this to be the case since Xalan properly processes the XML in the
external entity when it is referenced in a different manner than in this test case.

Chris

Scott Boag/CAM/Lotus wrote:

> Interesting.  My first bet is that this is a Xerces issue.  You should try
> the parse with just Xerces to see what happens.
>
> -scott
>
>
>                     "Chris P. McCabe"
>                     <chris_mccabe@choiceh        To:     xalan-dev@xml.apache.org
>                     otels.com>                   cc:     (bcc: Scott Boag/CAM/Lotus)
>                     Sent by:                     Subject:     Bug: External Entities that begin with newline
>                     cmccabe@choicehotels.
>                     com
>
>
>                     01/21/00 05:37 PM
>                     Please respond to
>                     xalan-dev
>
>
>
> I don't know if this is a Xerces or Xalan bug, but if an external entity
> that contains XML begins with a newline character, the XML cannot be
> referenced in the stylesheet in certain circumstances.  In the test case
> below, if test2.xml begins with a newline, the xsl:value-of element in
> the stylesheet will produce no value.  If the newline is removed, it
> works as expected.  This is a contrived example to illustrate the
> problem, and if a template is created for the "bar" element and
> apply-templates is called, it works correctly in either case.
>
> ============ test.xml ==============
> <?xml version="1.0"?>
>
> <!DOCTYPE page [
>    <!ENTITY values SYSTEM "test2.xml">
> ]>
>
> <page>
>    &values;
> </page>
> =====================================
>
> ============ test2.xml ==============
>
> <foo>
>    <bar>Some Text</bar>
> </foo>
> =====================================
>
> ============= test.xsl ==============
> <xsl:stylesheet
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    xmlns="http://www.w3.org/TR/REC-html40">
>
>    <xsl:output method="html" indent="yes"/>
>
>    <xsl:template match="page">
>       <html><body>
>       <xsl:value-of select="//bar"/>
>       </body></html>
>    </xsl:template>
>
> </xsl:stylesheet>
> =====================================
>

--
Chris P. McCabe  602-953-4416
Choice Hotels International  chris_mccabe@choicehotels.com