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

Here is some appropriate text from the documentation[1].


  Components are managed by a component manager. The
  component manager keeps track of the parser state
  for features and properties. The component manager
  is responsible for notifying each component when
  the value of those features and properties change.

  Before parsing a document, a parser configuration
  must use the component manager to reset all of the
  parser components. Then, during parsing, each time
  a feature or property value is modified, all of the
  components must be informed of the change.

The reset() method is used to initialize a component.
The setFeature/Property() methods are used *during*
parsing for when a setting has changed.

You can't just rely on setFeature/Property because
you will not be notified of the values of settings
unless they explicitly change during the course of
parsing. If there are components in Xerces that
rely on this style, then they should be fixed.

However, that being said, if the component does not
care about changes to settings during parsing, then
it does not need to "listen" to changes sent to the
setFeature/Property methods. In other words, the
component may query the value of the settings before
parsing (in the reset method) and then ignore any
changes that may occur afterwards (as communicated
by the setFeature/Property methods). These would be
settings that are not allowed (by the component) to
change.

- 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?

I hope that my previous explanation clarifies this point.

- 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?

Yes.


By defining the prefix separate from the feature or
property identifier, you can write code such as:

if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
if (feature.equals(XXX_YYY_ZZZ_FEATURE)) {
// do something
}
}


If you don't like that style, then you don't have
to use it.

I hope this helps. Let me know if you have any more
questions or comments on how we can make the parser
configuration easier to understand.

[1] http://xml.apache.org/xerces2-j/xni-config.html

--
Andy Clark * [EMAIL PROTECTED]


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



Reply via email to