[XML-SIG] Repost - disabling entity expansion
Uche Ogbuji
uche.ogbuji@fourthought.com
Tue, 17 Dec 2002 08:22:53 -0700
>
> I have an element v_function referencing external
> entities &vf1; &vf2; and &vf3;
>
> <!ELEMENT v_function (#PCDATA)>
> <!ENTITY vf1 "Animal">
> <!ENTITY vf2 "Vegetable">
> <!ENTITY vf3 "Mineral">
>
> Sometimes I'd like to expand these entities
> as normal, but other times I'd like to select
> <v_function>&vf1;</v_function>
> and get &vf1; or vf3 returned or
> even <!ENTITY vf1 "Animal"> ???
>
>
> Is there a simple way to disable the entity expansion?
> I'm able to do this in libxml2-python but haven't found a way
> to do this in pyxml
I didn't respond to this because I don't know the answer. I don't think there
is a simple way to disable entity expansion from the internal subset, because
I don't know of any XML parsers that offer this option. Maybe Xerces does?
After all, DOM does keep entity ref stuff around and I think Xerces is the
strictest DOM implementation out there, which means the undrlying parser
probably reports all lexical entities, rather than just those that need
resolution.
I don't know that there is an easy solution for you, though.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html
XML class warfare - http://www.adtmag.com/article.asp?id=6965
MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi
nk14.html