<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Warnings + Edit button disabled with Beanshell + OpenJdk11"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=127015#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Warnings + Edit button disabled with Beanshell + OpenJdk11"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=127015">bug 127015</a>
              from <span class="vcard"><a class="email" href="mailto:oliver.brinzing@gmx.de" title="Oliver Brinzing <oliver.brinzing@gmx.de>"> <span class="fn">Oliver Brinzing</span></a>
</span></b>
        <pre>(In reply to Julien Nabet from <a href="show_bug.cgi?id=127015#c6">comment #6</a>)
<span class="quote">> 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.</span >

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());

        }
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>