473,503 Members | 12,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with TransformerHandler and Lexical events

Hello!

I have set up a pluggable SAX transformation pipeline which is made up
of individual nodes that transform the source XML, and for the most part
it works well. Each node in the pipeline is assigned a ContentHandler
and a LexicalHandler by the transformation framework.

Each node in the pipeline may either be:

* a class that implements ContentHandler and LexicalHandler
* a wrapper class that creates a TransformerHandler from an XSL
stylesheet and handles the SAX events.

The first case works perfectly. Both normal and lexical SAX events are
processed and then reported to the following nodes in the pipeline.

I'm having trouble with the second case; specifically lexical events
such as comments are not being passed to the next node.

Each node defines a setOutputHandlers() (below) that sets the handlers
for events generated by that node. For the xslt wrapper, I simply
create a SAXResult using both the ContentHandler and the LexicalHandler
and then proceed to create the TransformerHandler member that will
receive SAX events from the previous node.

Is there something I am doing wrong here that would prevent my xsl
stylesheet from passing the lexical events to the next node? I have
already verified that the transformation correctly passes through
comments in XMLSpy and that my framework is correctly invoking
transformerHandler.comment() when a comment event fires on a previous node.

Thanks for any help, thoughts, or suggestions.

Collin

p.s. I forgot to crosspost this from comp.lang.java.programmer -- Sorry
for the duplicates :(

--------------------------

public void setOutputHandlers(ContentHandler content, LexicalHandler
lexical) throws SAXException
{
super.setOutputHandlers(content, lexical);
this.result = new SAXResult();
this.result.setHandler(content);
this.result.setLexicalHandler(lexical);

try
{
final String xslt = fetchXSLTAsString();
final SAXSource xsltSource = new SAXSource(new
InputSource(new BufferedReader(new StringReader(xslt))));
final SAXTransformerFactory factory =
(SAXTransformerFactory) TransformerFactory.newInstance();
this.transformerHandler =
factory.newTransformerHandler(xsltSource);
this.transformerHandler.setResult(this.result);
}
catch (Exception e)
{
throw new SAXException(e);
}
}
Jul 20 '05 #1
0 1443

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3029
by: Konrad Den Ende | last post by:
Normally, one can put any bull as long as comments are on, as in: // import yava.biteme.yo_mamma; but when i tried to do //String s = "\u305\u3048"; the stupid computer tells me to shut...
3
2287
by: Matt Knepley | last post by:
I must be misunderstanding how Python 2.3 handles lexical scoping. Here is a sample piece of code: def run(): a = 1 def run2(b): print a run2(2) print a run()
4
4391
by: bariole | last post by:
Hi I am trying to make lexical analysis of some simplified html code with flex tool. However that kind of work is new to me and I don't know where to start. I have searched a web but I didn't...
13
1927
by: Lucas Zimmerman | last post by:
Is there any Lex code available that describes how to scan C programs? I'd like to read someting related to this. One of my doubs is how C deals with ambiguities, for example, `a = x/*p;' or `a =...
18
1770
by: jslowery | last post by:
I am not completely knowledgable about the status of lexical scoping in Python, but it was my understanding that this was added in a long time ago around python2.1-python2.2 I am using python2.4...
2
2312
by: Frank-René Schäfer | last post by:
penSource Project 'Quex': http://quex.sf.net Last weekend, the lexical analyser generator 'Quex' has been released on SourceForge. Quex provides advanced features for mode definitions and...
14
2151
by: Khookie | last post by:
Woah... is it just me or do C programmers don't bother talking about how cool C can be (compared to Lisp, Haskell, etc.) - functionally speaking? // Lexical scoping - via nested functions...
3
8768
by: globalrev | last post by:
i cant figure outif python has lexical or general scope. it seems functions have lexical scope but with some restrictions and some non-function scopes are dynamic?
3
2180
by: =?Utf-8?B?TWFya19C?= | last post by:
The following is working for me but I want to include numbers in scientific notation. public double Evaluate( string expr ) { const string Num = @"(\-?\d+\.?\d*|\-?\.\d+)" Regex reMulDiv = new...
0
7212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.