[Expat-discuss] numeric entities

Lee Brown lee at puddledock.net
Mon Nov 22 02:32:28 CET 2004


Okay, I used xmlwf from 1.95.8 this way:

xmlwf -c -m -d tmp < test.xsl

test.xsl looks like this:

<?xml version="1.0"?>
<outer>
<text>BEFORE&#64;&amp;AFTER</text>
</outer>

The output file looks like this:

<document>
<starttag name="outer" byte="22" nbytes="7" line="2" col="0"/>
<chars str="&#10;" byte="29" nbytes="1" line="2" col="7"/>
<starttag name="text" byte="30" nbytes="6" line="3" col="0"/>
<chars str="BEFORE" byte="36" nbytes="6" line="3" col="6"/>
<chars str="" byte="42" nbytes="5" line="3" col="12"/>
<chars str="&amp;" byte="47" nbytes="5" line="3" col="17"/>
<chars str="AFTER" byte="52" nbytes="5" line="3" col="22"/>
<endtag name="text" byte="57" nbytes="7" line="3" col="27"/>
<chars str="&#10;" byte="64" nbytes="1" line="3" col="34"/>
<endtag name="outer" byte="65" nbytes="8" line="4" col="0"/>
</document>

Notice the strings "BEFORE" and "AFTER" in the input file, which are
separated by a numeric entity (the value of the at-sign) and a standard
entity.  The standard entity is repeated as a character value in the xmlwf
output, but the numeric entity is discarded.

But, if I do not use the -m option, I do see an exact copy of my input file.

This is the behavior I might expect for external entities, but it is my
understanding that numeric entities should work like the "standard"
pre-defined entities.

It is important to repeat that this appears to be a change in the behavior
from an earlier release.  Is this a bug that everyone sees, or is it a bug
in my port (in which case are there any suggestions about where to look), or
is my XML file incorrect (in which case, what would be correct)?

P.S., the xmlwf man page asks why anyone would want to use the -c, -m,
and -d options.  I found them quite useful to see if expat would indeed make
an exact copy of the input.

Thanks,
Lee


----- Original Message ----- 
From: "Karl Waclawek" <karl at waclawek.net>
To: <expat-discuss at libexpat.org>
Sent: Sunday, November 21, 2004 6:04 PM
Subject: Re: [Expat-discuss] numeric entities


> I suggest you test this with Expat directly.
>
> Karl
>
> ----- Original Message ----- 
> From: "Lee Brown" <lee at puddledock.net>
> To: <expat-discuss at libexpat.org>
> Sent: Sunday, November 21, 2004 5:27 PM
> Subject: [Expat-discuss] numeric entities
>
>
> The handling of numeric entities changed between releases 1.95.5 and
1.95.8, such that in 1.95.8
> numeric entities seem to be ignored during output.
>
> Example XSL file:
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
> <xsl:output method="text"/>
> <xsl:template match="/test">
>         <xsl:for-each select="line">
>                 <xsl:value-of select="."/>
>                 <xsl:text>&#64;</xsl:text>
>                 <xsl:text>&amp;</xsl:text>
>         </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> Example XML input file:
>
> <?xml version="1.0"?>
> <test>
> <line>line one</line>
> <line>line two</line>
> <line>line three</line>
> </test>
>
> I'm using Sablotron's sabcmd.  When linked with expat 1.95.5 each output
line is followed by an
> at-sign (#64) and an ampersand.  When linked with expat 1.95.8 each line
is followed only by an
> ampersand.
>
> Is this intentional?  Or am I the only one experiencing this (I have my
own port of expat built from
> source)?  Anyone know how to write out the value of a numeric entity?
>
> Thanks,
> Lee
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>



More information about the Expat-discuss mailing list