xsl-list
[Top] [All Lists]

Re: [xsl] fault tolerant saxon:parse()

2008-11-17 08:45:38
Not too sure at the moment how to incorporate tagsoup as it expects
the concrete DefaultHandler as opposed to the interface

 as it expects the concrete DefaultHandler as opposed to the interface
 ContentHandler...

bah humbug java witterings,

:) I've got that bit sorted now...

TransformerFactory tFactory = new net.sf.saxon.TransformerFactoryImpl();
Transformer transformer = tFactory.newTransformer(new StreamSource(new
File(xslPath)));

Map tagSoupMap = new HashMap();
SAXParserImpl saxParser =
org.ccil.cowan.tagsoup.jaxp.SAXParserImpl.newInstance(tagSoupMap);

SAXSource ss = new SAXSource(saxParser.getXMLReader(), new
InputSource(new File(xmlPath).toURI().toString()));

StringWriter sw = new StringWriter();
Result result = new StreamResult(sw);

transformer.transform(ss, result);


Still not quite right though - the post-tagsoup markup is quite a bit
different from the input... I probably just need to tweak some
settings



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--