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

Re: How to: Returning HTML Elements From a Saxon Exten

Subject: Re: How to: Returning HTML Elements From a Saxon ExtensionFunction (6.5.x)
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Thu, 17 Apr 2003 16:28:14 -0500
Re:  How to: Returning HTML Elements From a Saxon Exten
W. Eliot Kimber wrote:


1. Is my analysis correct or have I missed some easy way to return this markup?


2. If my analysis is correct, does anyone have an example of doing this sort of off-the-cuff SAX processing I could crib from? I didn't find any examples in the Saxon-supplied samples.

My analysis is correct--turns out one of my collegues had already figured this out and I didn't know it. What I had missed was the the "Parse()" method on the Saxon DocumentBuilderImpl class, which allows you to pass in a string to be parsed more or less directly. Here's the basic pattern:


public NodeInfo generateResultTree(String markup) {
  java.io.ByteArrayInputStream bais = new
                      ByteArrayInputStream(markup.getBytes());
  org.xml.sax.InputSource isource = null;
  try {
     isource = new InputSource(bais);
  } catch (org.xml.sax.SAXException e) {
     e.printStackTrace();
  }
  org.w3c.dom.Document root = new
            com.icl.saxon.om.DocumentBuilderImpl().parse(isource);
  return (NodeInfo)(root.getDocumentElement());
}

Cheers,

--
W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139


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.