Subject: Re: fault tolerant saxon:parse()
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 17 Nov 2008 13:45:05 +0000
|
>> 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/
|