[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Converting Document object (DOM) into inputsource for XS

Subject: RE: Converting Document object (DOM) into inputsource for XSL processing in XT
From: "Maxime Levesque" <maximel@xxxxxxxxxxxxxx>
Date: Thu, 26 Aug 1999 13:20:32 -0700
dom to inputsource

  You could write a "DOM to SAX tree walker", i.e. a class
that implements org.xml.sax.Parser and that traverses a DOM
tree in pre order, and for each Element node visited : 

 1) call the 'startElement' method on the DocumentHandler

 2) visit all children elements

 3) call the 'endElement' method on the DocumentHandler

 I've started to write such a class, but I didn't
need it so it is untested, if you want the source,
send me a mail...


> Hi folks,
> 
> Currently, I'm working with DOM (SUN project X implementation) as a
> represention of my Object. As I wish to submit the source tree through
> an XSL style sheet using XT (for performance reason), I do need to
> convert the DOM object into it equivalent inputsource as expressed in
> the above java code :
> 
> ByteArrayOutputStream docOutputStream = new ByteArrayOutputStream();
> ((XmlDocument)myDOMDocument).write(docOutputStream);
> ByteArrayInputStream docInputStream = new
> ByteArrayInputStream(docOutputStream.toByteArray());
> InputSource inputSource = new InputSource(docInputStream);
> myXslProcessor.parse(inputSource);
> 
> Is there a better way to handle these opreations, since they're time
> consuming in resource and memory. 
> 
> Beside this, I tried using DOM directly with XSL:P processor, but it
> wasn't faster than XT solution, so I'm deducting that it take longer
> to work with DOM that to parse again the XML document and then work
> with it internal and lightweight representation, is it true ?
> 
> Thank for any reply, I would really appreciate.
> 
> Sebastien Sahuc
> ssahuc@xxxxxxxxxxxxxx
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.