You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Dvir Ofek <dv...@ScreenPeaks.com> on 2002/10/03 19:59:54 UTC

RE: SAX events as input source for XalanTransformer

Of course I can do something like this:

SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
theXalanTransformer = new XalanTransformer;
theBuilder = theXalanTransformer->createDocumentBuilder();
parser->setContentHandler(theBuilder->getContentHandler());
parser->parse("myXml.xml");
int result = theXalanTransformer->transform(*theBuilder,
"myStylesheet.xslt", "out.xml");

Which is similar to the DocumentBuilder sample, but this will not do the
transformation incrementally, hence there's no point in connecting several
documents and style sheets together, as I said - I need both the input and
the output to be SAX2 events (SAX1 might also be ok). (This is also true
regarding the ParsedSourceWrappers sample that was suggested - first it
loads and parse the XML document, and does the transformation).
The only option I can think of is to write an adapter between a
ContentHandler and some kind of XSLTInputSource (I have to choose between
istream and XalanNode), but I assume that won't work either since Xalan
wants the entire document to be available before calling the transform
function (am I wrong?). I will also need the opposite adapter for the output
of the transformation.
Another thing - can someone explain to me please what does the
XercesParserLiaison class do?
Maybe I'm talking rubbish 'cause it's the end of day and I fill like a
zombie, but I really need to clarify that I'm asking all those questions not
because I'm lazy and can't find the solution by myself or sit down and write
filters and pipes, but because I don't have the time to investigate Xalan
(as I did with Xerces) since I have a very close deadline and I need
something that I can work with quickly.
I could use any help I can get, so thanks in advance.

Cheers
Dvir Ofek
Software Engineer
Screenpeaks Ltd.



-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]
Sent: Monday, September 30, 2002 5:48 PM
To: xalan-c-users@xml.apache.org
Subject: Re: SAX events as input source for XalanTransformer







See the class XalanDynamicDocument builder, and the DocumentBuilder sample
application.  Unfortunately, Xalan-C's output events are still based on our
SAX1-derived proprietary interface, so chaining multiple transformations
through documents is a bit tricky.  For that you'll need an instance of
FormatterToSourceTree and an instance of a XalanSourceTreeDocument.  You
can then wrap that for transformation.  See the ParsedSourceWrappers
sample.

This will be much simpler, once the old interface is replaced by SAX2, but
it may be a while before that happens.

Dave



 

                      Dvir Ofek

                      <dvir@ScreenPeak         To:
"'xalan-c-users@xml.apache.org'" <xa...@xml.apache.org>

                      s.com>                   cc:      (bcc: David N
Bertoni/Cambridge/IBM)                                           
                                               Subject: SAX events as input
source for XalanTransformer                                
                      09/30/2002 02:52

                      AM

 

 




Hi
I'm working with Xalan C++ and I really need an interface similar to
Xalan-J's TrAx for feeding SAX events as an input for transformations
instead of a stream or a file.
Actually, what I want to do is to be able to connect some filters and pipes
of mixed XML documents and XSLT, for instance:
xmlDoc1 --> xslt1 --> filter1 --> xslt2 --> filter2 --> output
I'm sure everybody here knows what I'm talking about.
Any suggestions will be very much appreciated.

Cheers
Dvir Ofek
Software Engineer
Screenpeaks Ltd.