You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Bluestream - Jim Tivy <Ji...@bluestream.com> on 2000/01/27 00:15:50 UTC

Re: ampersant in Xerses

Hi Pierpaolo

I am still having this problem with DOMParser.   I set the feature as shown:
p.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes",false);
"Love &amp; Sweetness" is converted to "Love Sweetness".  When I traverse the DOM there
is only one child node with the text "Love Sweetness".  On the other hand & in the file
seems to work now.  Any ideas would be appreciated

cheers
Jim

Pierpaolo Fumagalli wrote:

> Bluestream - Boris Garbuzov wrote:
> >
> > Hello, guys. Can you please tell us how to join your Xerses news group
> > or mailing list or refer us to right people? Particularly we have
> > question how to handle ampersant "&" with your parser. If the text "Love
> > & Sweetness" is a fragment of xml file, then it gives an error. If to
> > change & to &amp;, it just swallows it unlike other parsers who convert
> > it to regular ampersant.
>
> I believe you're using a DOMParser, and you don't find a text node for
> your &amp; character. This is because an entity reference node is
> inserted and this one has a child text node with the value of the &...;
> thing.
> Try to disable setting up the parser in this way:
>
> > DOMParser p=new DOMParser();
> > p.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes",false);
> > p.parse(in);
> > Document document=p.getDocument();
>
> It should work... Otherwise send mail to the appropriate mailing list
> wich is xerces-dev@xml.apache.org.
>
>         Pier

--
----------------------------------------------------------
Jim Tivy - Bluestream Database Software Corp.
1168 Hamilton Street, Suite 200, Vancouver BC V6B 2S2
Tel: (604) 669-4469 ext 116 Fax: (604) 669-4469
E-Mail: mailto:jimt@bluestream.com  http://www.bluestream.com
----------------------------------------------------------