[jdom-interest] Getting non-XML result from XML parsing

Kevin L. Cobb kevin.cobb at emergint.com
Mon Oct 10 12:24:34 PDT 2005


The JDOMResult object JavaDoc gives this example on how to get a List of
JDOM Nodes back. What if the result of my parse is not an XML document
at all, but is a Text String?
 
   public static List transform(Document doc, String stylesheet)
                                        throws JDOMException {
     try {
       Transformer transformer = TransformerFactory.newInstance()
                             .newTransformer(new
StreamSource(stylesheet));
       JDOMSource in = new JDOMSource(doc);
       JDOMResult out = new JDOMResult();
       transformer.transform(in, out);
       return out.getResult();
     }
     catch (TransformerException e) {
       throw new JDOMException("XSLT Transformation failed", e);
     }
   }
 
-Kevin

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20051010/45578b04/attachment.htm


More information about the jdom-interest mailing list