You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Andrew Welch <AW...@piper-group.com> on 2003/04/24 15:00:14 UTC

how to generate sax events from variables

Hi,

Ive got some variables that I want to turn into a stream of sax events.

For example:

String a = "root";
String b = "node";

Would become something like:

startElement(null, a, a, null);
  startElement(null, b ,b, null);
  endElement...
endElement...

...which will be the source of an xsl transform.

How can I go about generating SAX events without actually parsing a document?  This is hopefully trivial, but Im struggling with it at the moment.

cheers
andrew

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.470 / Virus Database: 268 - Release Date: 08/04/2003
 

Re: how to generate sax events from variables

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Have your code simply accept a pointer to a SAX handler and call its 
methods directly. (That's what the output stage of Xalan -- or of a parser 
-- does; we just have a lot of fancy code involved in deciding which 
methods to call with what values.)

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more. 
"may'ron DaroQbe'chugh vaj bIrIQbej"  ("Put down the squeezebox and nobody 
gets hurt.")