完整的execption堆栈:
href
我的代码
Exception in thread "main" org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: Si è tentato di inserire un nodo in un punto in cui non è consentito.
at com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(Unknown Source)
at awtcalc2pg.parserHTML.add_component(parserHTML.java:348)
at awtcalc2pg.pDialog.create(pDialog.java:107)
at awtcalc2pg.parserHTML.parse(parserHTML.java:171)
at awtcalc2pg.parserHTML.parse(parserHTML.java:164)
at Test.main(Test.java:67)
我在创建标签对话框时遇到问题。因为对话框中有任何组件。
测试HTML。
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer;
try {
transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "html");
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(fl);
transformer.transform(source, result);
} catch (TransformerException exception) {
exception.printStackTrace();
}