You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Joe Marini <jo...@presidiosoftware.com> on 2002/04/11 23:12:06 UTC

setExpandEntityReferences() question

Hello,

I'm using Xerces to parse a document that has the following attribute 
construct in it:

<sometag attr="&gt; some text" ... />

Now, I *don't* want the &gt; to be replaced by a > character, so I call 
setExpandEntityReferences(false). However, it still gets expanded into 
an > and causes problems down the road.

Am I doing something wrong or missing something else?

Thanks,

Joe Marini





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: setExpandEntityReferences() question

Posted by Dean Roddey <dr...@charmedquark.com>.
setExpandEntities is a DOM thing, right? Basically, that just affects *top
level* entities. It can't do anything about entities in attributes, because
it doesn't know that they are happening. The way the DOM parser expands or
not is that the scanner tells it when entity expansions start and stop, so
the parser can just not store the interim content (though it always really
does get expaned.) I never implemented the logic to call back out from the
scanner for those kinds of attributes, because of the overhead it implied,
and I don't think it has ever been added. And I'm not sure it would be a
good idea. Generally, if you want to avoid expansion in those cases, just
escape the actual ampersand:

<sometag attr="&amp;gt; some text" ... />

--------------------------
Dean Roddey
The Charmed Quark Controller
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"If it don't have a control port, don't buy it!"


----- Original Message -----
From: "Joe Marini" <jo...@presidiosoftware.com>
To: <xe...@xml.apache.org>
Sent: Thursday, April 11, 2002 2:12 PM
Subject: setExpandEntityReferences() question


> Hello,
>
> I'm using Xerces to parse a document that has the following attribute
> construct in it:
>
> <sometag attr="&gt; some text" ... />
>
> Now, I *don't* want the &gt; to be replaced by a > character, so I call
> setExpandEntityReferences(false). However, it still gets expanded into
> an > and causes problems down the road.
>
> Am I doing something wrong or missing something else?
>
> Thanks,
>
> Joe Marini
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org