On Fri, 2009-02-27 at 14:26 +0100, Andreas Hartmann wrote:
> StringXMLizable.toSAX() sets only the content handler of the SAX
> parser. 
> 
> Maybe it makes sense to set the lexical handler, if possible?
> 
>      public void toSAX(ContentHandler contentHandler) throws
> SAXException {
>          final SAXParser parser = getContext().parser;
>          parser.getXMLReader().setContentHandler(contentHandler);
> 
> +       if (contentHandler instanceof LexicalHandler) {
> +           parser.getXMLReader().setProperty(
> +             "http://xml.org/sax/properties/lexical-handler";,
> +             (LexicalHandler) contentHandler);
> +       }
> 
>          InputSource is = new InputSource(new StringReader(data));
>          try {
>              parser.getXMLReader().parse(is);
>          } catch (IOException e) {
>              throw new SAXException(e);
>          }
>      }

I agree that this change is the elegant solution for the problem. Can
you apply it, if nobody objects. 

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la InformaciĆ³n, S.A.U. (SADESI)




Reply via email to