[daisy] Javascript API & htmlcleaner
Jano Kula
jano.kula at tiscali.cz
Mon Sep 17 04:32:54 CDT 2007
Greetings!
Is daisy-util.js API also meant for use in Javascript API with "daisy-js
<name-of-scriptfile>"?
I try to write a script to import data. After some struggle I'm able to
write byte array in document.setPart with
new java.lang.String("<html><body><p>" + text +
"</p></body></html>").getBytes());
but I have no luck in using htmlcleaner. daisy-util.js library works in
cocoon flow.js, but in a javascript script even the "var daisy =
getDaisy();" doesn't work and with a small java and javascript (both
mixed well togheter) experience I don't know whether I need to
"importPackage(somepackage)" or just use Dasiy API to get htmlceaner
working for Javascript scripting (and how). If you could modify
following function (simplified guestbook example) it would be a big step
in Daisy & Java & Javascript learning to me on how to use Dasiy API
methods in Javascript in general.
Thanks.
Jano
meant to run with <DAISY_HOME>/bin/daisy-js
// ??? importPackage(somepackage)
function buildContent(message) {
message = encodeToHTML(message);
var content =
"<html><body><p>" + message + "</p></body></html>";
var htmlcleaner = getDaisy().getHTMLCleaner();
return htmlcleaner.cleanToByteArray(content);
}
More information about the daisy
mailing list