Brian,
I assume that the Xalan-J part of this runs quickly enough, but that now
you are reaching an issue with large strings and JNI. I also assume that
the bulk of that 50 seconds is in you JNI calls, not in Xalan-J at all.
If that is the case, there isn't much I can do, since this doesn't seem to
be a Xalan-J issue, but one with your desire to use JNI.
If Xalan-C knocks this down to less than 1 second, why aren't you going
down that path?
- Brian
- - - - - - - - - - - - - - - - - - - -
Brian Minchau
XSLT Development, IBM Toronto
e-mail: [EMAIL PROTECTED]
"Brian Frutchey"
<[EMAIL PROTECTED]
.com> To
Brian Minchau/Toronto/[EMAIL PROTECTED]
10/06/2005 04:46 cc
PM
Subject
RE: Difficulty converting
Stylesheet Class to XML String
Well, I thought the performance would be great, but it turns out not to be
so. The 12MB file seems to reach some kind of JNI memory limit on being
passed as a string, and smaller files (like 1MB) still take about 50
seconds to transform. I have tried many things, but don't seem to be able
to get it to go any faster. Any thoughts?
Brian
-----Original Message-----
From: Brian Minchau [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 05, 2005 3:27 PM
To: Brian Frutchey
Cc: [email protected]
Subject: RE: Difficulty converting Stylesheet Class to XML String
Brian,
I'm glad it works, seems to even be "great".
One question for you, you had mentioned a performance issue:
>> (even
>> with XSLTC a 12MB file takes 3 minutes and 85MB RAM to transform in
>> Xalan-J, Xalan-C++ knocks it out in less than a second). I am looking
to
>> pass the xml source, xslt, and result across the JNI interface as
strings.
How is the performance?
- Brian
- - - - - - - - - - - - - - - - - - - -
Brian Minchau
XSLT Development, IBM Toronto
e-mail: [EMAIL PROTECTED]
"Brian Frutchey"
<[EMAIL PROTECTED]
.com> To
Brian Minchau/Toronto/[EMAIL PROTECTED]
10/05/2005 02:39 cc
PM
Subject
RE: Difficulty converting
Stylesheet Class to XML String
Works great, thanks!
Brian
-----Original Message-----
From: Brian Minchau [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 04, 2005 7:21 PM
To: Brian Frutchey
Cc: [email protected]
Subject: Re: Difficulty converting Stylesheet Class to XML String
Brian,
rather than build you own ContentHandler, have a look at:
http://xml.apache.org/xalan-j/public_apis.html
On that page are 3 links to the serializer's public APIs.
The last one, Serializer, ( see
http://xml.apache.org/xalan-j/apidocs/org/apache/xml/serializer/Serializer.html
)
has an example of using the OutputPropertiesFactory and SerializerFactory
to obtain a Serializer
You can set your java.io.Writer or java.io.OutputStream on that Serializer,
then
send it SAX events to be written out as a stream of bytes (often an XML
File).
I'm not sure what format you stylesheet is in, but as a DOM you might
create a Serializer (as above),
then call the asDOMSerializer() method on it, to get a object through which
you can serializer the DOM,
see
http://xml.apache.org/xalan-j/apidocs/org/apache/xml/serializer/DOMSerializer.html
As of Xalan-J 2.7 the serializer is in its own jar, serializer.jar,
independent of the rest of Xalan-J.
A while ago performance work was put into this serializer. It also tends
to keep only as much information
as it needs to, serializing elements as soon as it can, and dropping them
from memory after that.
This serializer is also namespace sensitive, so the SAX
startPrefixMapping() calls will work.
I'm not sure what you are trying to do with the you Stylesheet object.
- Brian
- - - - - - - - - - - - - - - - - - - -
Brian Minchau
XSLT Development, IBM Toronto
e-mail: [EMAIL PROTECTED]
"Brian Frutchey"
<[EMAIL PROTECTED]
.com> To
<[email protected]>
10/04/2005 06:27 cc
PM
Subject
Difficulty converting Stylesheet
Class to XML String
I am attempting to build a quick JNI bridge between Xalan-J and Xalan-C++
such that a single-threaded windows application won't take so long to
transform large mime messages with embedded base-64 encoded content (even
with XSLTC a 12MB file takes 3 minutes and 85MB RAM to transform in
Xalan-J, Xalan-C++ knocks it out in less than a second). I am looking to
pass the xml source, xslt, and result across the JNI interface as strings.
However, I can't understand how to get the
org.apache.xalan.templates.Stylesheet class used by the
TransformerFactoryImpl to build an XML string from its contents. I built
my own ContentHandler instead of using the
org.apache.xalan.processor.StylesheetHandler, and I can simply build the
XML String from the SAX events (which then works with my JNI interface),
however I have difficulty supporting namespaces and am fairly certain I
will never implement the w3c requirements in full, so it is not very good
for general-use. Hence I am wanting to override the existing xalan
classes. The only problem I seem to have is getting the Stylesheet out of
the class as a string. I tried treating the stylesheet as a node tree and
walking it, but can't seem to find the root node (getParent() is always
null). Any ideas? Thanks.
This email message and any attachments are confidential to Endeca. If you
are not the intended recipient, please notify Endeca immediately -- by
replying to this message or by sending an email to: [EMAIL PROTECTED] -- and
destroy all copies of this message and any attachments. Thank you.