Following the approach suggested by Michael, I have developed the first version of the 'StAX to SAX events' adapter.

To develop it, I have created a local project (attached) with the following structure:

As provided in the plan, this week I should study how to implement StAXResult support, but I can also start integrating this adapter into the Xalan code.

Michael, what do you advise me to do?

I am looking forward to having your feedback about this adapter.

Samuel Queiroz 

2013/6/25 Michael Glavassevich <>
Hi Samuel,

Xerces has partial support for StAX but doesn't yet have an implementation
of XMLStreamReader.

For testing purposes I'd suggest using Woodstox [1]. It's a popular open
source StAX implementation which many Apache projects already use.

There's also a complete implementation of StAX in all versions of Java 6+,
so you could use that for testing too.



Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab

Samuel Medeiros <> wrote on 06/25/2013 11:19:00 AM:

> Hi Michael,
> Please disconsider my first email in this thread.
> I was thinking about implement StAX. However, this project is
> nothing to do with this.
> I have read the tutorial [1] and the ideas got more clear for me:
> In fact, what is proposed is to accomplish the XLS Transformation by
> receiving a StAXSource and sending the result trough a StAXResult.
> The approach you have proposed in your last message is now clear for
> me: I have to iterate over the StAXSource by using an XMLEventReader
> / XMLStreamReader and translate these events to SAX ones.
> I just have to check how to apply this approach into the code.
> --
> I know the implementation is based on the interfaces defined by
> JAXP. However, for run the samples as well as the tests I will
> write, we are gonna need an implementation. By default, Xalan uses
> Xerces. The question is: does Xerces support StAX?
> Thanks,
> Samuel
> [1]

> 2013/6/25 Samuel Medeiros <>
> Hi Michael,
> Thanks for this information.
> I am gonna study exactly how to apply this approach into the source
> If I have questions, I will let you know.
> Sincerely,
> Samuel

> 2013/6/24 Michael Glavassevich <>
> Hi Samuel,
> One approach you could take for StAXSource would be to write a StAX to
> converter. This would take an XMLStreamReader / XMLEventReader as input
> and generate SAX events on to a ContentHandler. You could wire that to
> TemplatesHandler (org.apache.xalan.processor.StylesheetHandler) allowing
> you to reuse the existing components for building the Templates object.
> Thanks for the update.
> Michael Glavassevich
> XML Technologies and WAS Development
> IBM Toronto Lab
> E-mail:
> E-mail:
> Samuel Medeiros <> wrote on 06/23/2013 04:30:38 PM:
> > Hi Michael,
> >
> > I have read the documentation available at the Xalan's website and
> > also its pointers to XSL/XSLT, XPath and JAXP. I have also run some
> > samples and did some tracing by adding some prints into the code.
> >
> > It's quite clear for me how the things work, but I am not
> > familiarized enough with the code.
> >
> > According to [1], the javax.xml.transform.stax was added to support
> > StAX. This package consists of the interfaces: TemplatesHandler
> > and TransformerHandler; and classes: StAXResult and StAXSource.
> > Also, the packages, and
> > were added to support StAX. In addition, the
> > class Validator have also to accept StAXSource.
> >
> > For me, to add StAX support, it would be just implement the
> > interfaces provided by these packages and plug them into the
> > existent code. For example, in the
> > org.apache.xalan.processor.TransformerFactoryImpl's method
> > newTemplates(Source source), I would add a condition to test if the
> > source is a StAX one and then create the correct TemplatesHandler
> > instance, that will create the Templates object.
> >
> > I don't know exactly how prepared is Xalan to receive these changes.
> >
> > I need help to understand the project's structure. Then I will be
> > able to do the work of the 2 next weeks (as provided in the plan):
> > define precisely the changes I will do.
> >
> > Sincerely,
> > Samuel
> >
> > [1]
> > ReleaseNotes_160.html

> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail: