Samuel, Thanks for your report.
Sincerely, Steven J. Hathaway > Greetings, > > 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: > > - *org.apache.xalan.stax.StAX2SAXAdapter > *Represents the adapter. > - *org.apache.xalan.sax.SAXHandler > *It's the SAX handler. It logs all incoming events into a stack. > - *org.apache.xalan.stax.test.StAX2SAXAdapterTest > *It tests the adapter by calling both SAXHandler > and StAX2SAXAdapter with a common XML file and verifying that their > event > stacks are equal. > - *org.apache.xalan.stax.resource > *This package contains some XML files used in the tests: xalam.xml, > birds.xml and xmark.xml. This last one is not included into the > attached > .zip file because its size is 35,7 MB. I have generated it using XMark > ( > http://www.xml-benchmark.org/downloads.html). > > > 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. > > Thanks, > Samuel Queiroz > > > 2013/6/25 Michael Glavassevich <[email protected]> > >> 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. >> >> Thanks. >> >> [1] http://woodstox.codehaus.org/ >> >> Michael Glavassevich >> XML Technologies and WAS Development >> IBM Toronto Lab >> E-mail: [email protected] >> E-mail: [email protected] >> >> Samuel Medeiros <[email protected]> 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] http://tutorials.jenkov.com/java-xml/index.html >> >> > 2013/6/25 Samuel Medeiros <[email protected]> >> > Hi Michael, >> > >> > Thanks for this information. >> > I am gonna study exactly how to apply this approach into the source >> code. >> > >> > If I have questions, I will let you know. >> > >> > Sincerely, >> > Samuel >> > >> >> > 2013/6/24 Michael Glavassevich <[email protected]> >> > Hi Samuel, >> > >> > One approach you could take for StAXSource would be to write a StAX to >> SAX >> > converter. This would take an XMLStreamReader / XMLEventReader as >> input >> > and generate SAX events on to a ContentHandler. You could wire that to >> the >> > 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: [email protected] >> > E-mail: [email protected] >> > >> > Samuel Medeiros <[email protected]> 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 javax.xml.stream, javax.xml.stream.events and >> > > javax.xml.stream.util 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] http://docs.oracle.com/javase/6/docs/technotes/guides/xml/jaxp/ >> > > ReleaseNotes_160.html >> > >> >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [email protected] >> > For additional commands, e-mail: [email protected] >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
