Thanks so much for replying (I have been fighting this stuff for over a
week).

Do you happen to know if the "external subset" returned from here is
applied before the actual, physically-present internal subset?

In other words, if I have:
<!DOCTYPE ... [
<!ENTITY verison "VERSION">
<!ENTITY today "TODAY">
]>

Will the net result of injecting these value "again" be:
<!DOCTYPE ... [
<!ENTITY verison "1.1">
<!ENTITY today "June 18, 2009">
<!ENTITY verison "VERSION">
<!ENTITY today "TODAY">
]>

or vice-versa?

I found that xerces uses the first declaration, is why I ask...

On Thu, 2009-06-18 at 09:39 -0400, Michael Glavassevich wrote:
> Hi Steve,
> 
> Entities must always be declared somewhere in the DTD. Your
> EntityResolver only gets an opportunity to resolve the external ones
> (e.g. <!ENTITY foo SYSTEM "http://abc.def.ghi";>). It is possible to
> inject an external subset programmatically (see
> EntityResolver2.getExternalSubset [1]) with a similar effect to what
> you're currently doing directly with the stream. That's probably the
> best you can do.
> 
> Thanks.
> 
> [1]
> http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ext/EntityResolver2.html#getExternalSubset(java.lang.String,%20java.lang.String)
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrgla...@ca.ibm.com
> E-mail: mrgla...@apache.org
> 
> Steve Ebersole <steven.ebers...@gmail.com> wrote on 06/18/2009
> 09:11:48 AM:
> 
> > Does xerces provide a *pluggable* mechanism to tell the parser the
> > replacement text to use when it encounters an entity reference?
> > 
> > The specific use case is attempting to control values used in
> docbook
> > sources.  So say you have:
> > <book>
> >   <bookinfo>
> >     ...
> >     <releaseinfo>&version;</releaseinfo>
> >     <pubdate>&today;</pubdate>
> >   </bookinfo>
> > </book>
> > 
> > I would like to "inject" the replacement values for the '&version;'
> and
> > '&today;' entity references.  Currently I do this by injecting
> doctype
> > "internal subset" <!ENTITY ...> defs in the stream used by the
> parser.
> > What I'd much rather be able to do is to register something akin to
> an
> > EntityResolver that resolves the replacement text.
> > 
> > -- 
> > Steve Ebersole <st...@hibernate.org>
> > Hibernate.org
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> > For additional commands, e-mail: j-users-h...@xerces.apache.org
> 
> 
-- 
Steve Ebersole <st...@hibernate.org>
Hibernate.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to