Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Problem with TransformerHandler and Lexical events

Reply
Thread Tools

Problem with TransformerHandler and Lexical events

 
 
Collin VanDyck
Guest
Posts: n/a
 
      11-30-2004
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);
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 04-15-2011 04:00 AM
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 01-06-2011 05:00 PM
Problem with Lexical Scope jslowery@gmail.com Python 18 12-17-2005 10:53 AM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
Help with lexical events and a TransformerHandler Collin VanDyck Java 0 11-30-2004 03:05 PM



Advertisments