[Libreoffice-bugs] [Bug 127015] Warnings + Edit button disabled with Beanshell + OpenJdk11
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Aug 19 15:41:06 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=127015
--- Comment #8 from Oliver Brinzing <oliver.brinzing at gmx.de> ---
(In reply to Julien Nabet from comment #6)
> Now the problem is I don't know how to use this class since import don't
> work.
> I searched how to import to avoid all the introspection stuff (it's quite
> ugly and I suppose it doesn't help for speed) but failed.
maybe something like this can help:
import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.DOMStringList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSOutput;
import org.w3c.dom.ls.LSSerializer;
public class LSSerialize {
public static void main(String[] args) throws Exception {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
Node n = document.appendChild(document.createElement("Hello"));
n.appendChild(document.createElement("World"));
DOMImplementation impl = document.getImplementation();
DOMImplementationLS implLS = (DOMImplementationLS)
impl.getFeature("LS", "3.0");
LSSerializer dsi = implLS.createLSSerializer();
DOMConfiguration dc = dsi.getDomConfig();
DOMStringList params = dc.getParameterNames();
for (int i = 0; i < params.getLength(); i++) {
System.out.println(params.item(i));
}
dc.setParameter("well-formed", true);
dc.setParameter("format-pretty-print", true);
dc.setParameter("xml-declaration", true);
LSOutput lsOutput = implLS.createLSOutput();
lsOutput.setEncoding("UTF-8");
StringWriter stringWriter = new StringWriter();
lsOutput.setCharacterStream(stringWriter);
dsi.write(document, lsOutput);
System.out.println("\n" + stringWriter.toString());
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190819/7944a0db/attachment.html>
More information about the Libreoffice-bugs
mailing list