You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Voytenko, Dimitry" <DV...@SECTORBASE.COM> on 2000/09/28 05:12:12 UTC

RE: What to do with the &

Use "&amp;" instead of '&'. 
But on your place I would use SAX interfaces for this task (DocumentHandler,
LexicalHandler, ...). Everything you will need is:

DocumentHandler fxml = new .....
fxml.startElement ("Description", attrs);
    fxml.characters ("Description");
fxml.endElement ("Description");

And you can use many classes implementing DocumentHandler. For instance in
Xalan 1.X library you can use:
- XSLTProcessor (which extends DocumentHandler) to specify input for XSLT
processor
- FormatterToXML to save you XML to OutputStream/Writer

That's all.

-----Original Message-----
From: Eric Advincula [mailto:eric07@earthlink.net]
Sent: Wednesday, September 27, 2000 20:17
To: xalan-dev@xml.apache.org
Subject: What to do with the &


I have a set of text that I'm combining in an xml file

_strXML is a string

        _strXML += "<Description>";
        _strXML += _result.getString( "Description" );
        _strXML += "</Description>";

The problem is that the result from the database returns a string with the
following:

Ex "This is a & text"

and with the '&' I get the following error:

XSL Error: Could not parse input XML document
XSL  Error: SAX Exception
org.apache.xalan.xslt.XSLProcessorException: The entity name must be
immidiately follow the '&' in the entity reference.

Any way of going around this?

Thanks