You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sander Bos <sa...@x-hive.com> on 2003/05/01 10:04:30 UTC

RE: changing Xerces feature settings via a config file?

Dear Alex,

> I need to change the value of a Xerces feature setting (deferred-node
> expansion), but I do not have access to the code that 
> instantiates a parser
> and uses it to parse a document (I just get back a document). 
> So, I cannot
> use any of the JAXP or direct Xerces method calls for this.
> 
> Is there another way to instruct Xerces not to use 
> deferred-node expansion,
> perhaps via a configuration file? I know for sure that this 
> piece of code is
> not changing Xerces's default values for features and properties.

I have never used this myself, but to point you into some direction
(maybe even the right one, that is for you to decide...), maybe you
should look at the xerces.properties file. There is one provided with
the Xerces XNI samples, which has the comments copied below in it. I
guess it would allow you to define your own configuration class
extending StandardParserConfiguration in which you could override
default settings.

Kind regards,

--Sander.


##########################################
# When you create a Xerces parser, either directly using a native
# class like org.apache.xerces.parsers.DOMParser, or via a
# standard API like JAXP, Xerces provides a dynamic means of
# dynamically selecting a "configuration" for that parser.
# Configurations are the basic mechanism Xerces uses to decide
# exactly how it will treat an XML document (e.g., whether it
# needs to know about Schema validation, whether it needs to be
# cognizant of potential denial-of-service attacks launched via
# malicious XML documents, etc.)  The steps are threefold:
#
# * first, Xerces will examine the system property
# org.apache.xerces.xni.parser.XMLParserConfiguration;
# * next, it will try and find a file called xerces.properties in
# the lib subdirectory of your JRE installation;
# * next, it will examine all the jars on your classpath to try
# and find one with the appropriate entry in its
# META-INF/services directory.
# * if all else fails, it will use a hardcoded default.
#
# The third step can be quite time-consuming, especially if you
# have a lot of jars on your classpath and run applications which
# require the creation of lots of parsers.  If you know you're
# only using applications which require "standard" API's (that
# is, don't need some special Xerces property), or you want to
# try and force applications to use only certain Xerces
# configurations, then you may wish to copy this file into your
# JRE's lib directory.  We try and ensure that this file contains
# the currently-recommended default configuration; if you know
# which configuration you want, you may substitute that class
# name for what we've provided here.
org.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.pa
rsers.XML11Configuration


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