I'm hacking Xerces source code and got a few questions. If someone could
shed some light on it, I'd appreciate it very much.


The first question is regarding how a component should configure itself.

Apparently, there're two ways to do this. One is to query the manager
from the XMLComponent.reset method, and the other is to wait for the
XMLComponent.setProperty() invocation.

I'm having hard time figuring out which route I should use for any given
property/feature.

Take the error-reporter property as an example. Looking at the javadoc
of XMLErrorReporter, my guess was that there will be one instance of
this object per a parser configuration. If so, it seems like using the
reset to query this object would be the natural choice. On the other
hand, this object might be being recreated every time a different
ErrorHandler is set, in which case this object should be better queried
from the setProperty method.

I searched how other components are obtaining a reference to
tXMLErrorReporter, and found that some are indeed using the setProperty
methods (such as XMLEntityManager, CMNodeFactory), while others are 
using the reset method (such as XMLDTDValidator), and yet some others
are using both (such as XMLScanner.)

So it seems to me that it's not just my lack of competence.

I had to do this much research for just one property. If you think about
doing this for every property that I need, I have to say it's definitely
not fun.


Now my questions are:

- how are developers expected to find out how a property should be
  queried? How is it documented? Or is it not?


- To me, the difference between the reset method and the setProperty
  method doesn't really make sense. Why do I have two routes for
  configuration? Is there any problem in just asking manager to feed
  every property through the XMLComponent.setProperty method?


- There are bunch of properties defined in the Constants class, but it
  is almost always used as
  
    Constants.XERCES_PROPERTY_PREFIX + Constants.XXX_YYY_ZZZ_PROPERTY
  
  If so, why not define this as the constant? I find it tedious to
  define all the properties again and again.
  
  As a data-point, Constants.ENTITY_RESOLVER_PROPERTY is referenced
  14 times and 12 of them are used in this form, and the remaining two
  were more or less used in the same way.
  
  Is there any reason why constants are defined in the way they are
  today?



regards,
----------------------
Kohsuke Kawaguchi
E-Mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to