> Sorry, meant to post this to the list...
>
> Thanks for the reply!

> I've got it now, however I'm not using the XalanTransformer as a factory
> because this "eats" error messages; in particular it converts a
> SAXParseException into a string, losing the file/line/column information
in
> the process.  What I've done to get around this is to copy the code for
> createCompiledStylesheet and parseSource into functions of my own, that
have
> the same code minus the try/catch(...) blocks.  Then I catch the
exceptions
> myself; processing the SAXParseException in a "nice" way that means that
the
> user gets a dump of the file that caused the error along with the line
that
> caused the error highlighted.  Does this seem like a reasonable thing to
do;
> i.e. is it supported to create XalanDefaultParsedSource and
> XalanCompiledStylesheetDefault objects from your own code?

Yes, it is.

> I also keep my own (mutex protected) map of stylesheet path->compiled
> stylesheets; the stylesheet is effectively compiled & stored on the first
> usage.  Thread safety of STL containers is a bit of a pain, for maximum
> efficiency you need a multiple readers/single writer locking mechanism (I
> have a generic one of these).  Presumably the transform() mechanism is
> thread safe?

No, XalanTransformer instance are _not_ shareable amongst threads.
However, compiled stylesheets and parsed source documents are thread-safe.
You can either have a cache of XalanTransformer instances, which you
control through a mutex, or you can just create a new one on the stack for
every thread.

> Also, do you know of any STL class that encapsulates a non-copying
istream?
> That is, I have the data in a read-only string buffer, creating an
> istringstream will copy that data to an encapsulated STL string
(typically),
> which means that I get two copies of the buffer.  I'd like to avoid this
if
> possible.

If you look at the StreamTransform sample, you'll see we use istrstream,
which does not copy data.

> Finally, do you know of anyway of setting the entity resolver used when
> parsing stylesheets?  My stylesheets tend to reference one another via
HTTP
> requests, my problem is that I would like to pass some HTTP headers along
> with the request, but I couldn't see an easy way to do this.

I'm not sure there's a way to do this with the XalanTransformer classes.
Perhaps we should consider this as a new feature.

Dave


Reply via email to