use of org.w3c.dom.DOMException in project webservices-axiom by apache.
the class TestReplaceChildNotFound method runTest.
protected void runTest() throws Throwable {
Document document = dbf.newDocumentBuilder().newDocument();
Element root = document.createElementNS(null, "root");
root.appendChild(document.createElementNS(null, "child"));
Text node1 = document.createTextNode("test1");
Text node2 = document.createTextNode("test2");
try {
root.replaceChild(node2, node1);
fail("Expected DOMException");
} catch (DOMException ex) {
assertEquals(DOMException.NOT_FOUND_ERR, ex.code);
}
}
use of org.w3c.dom.DOMException in project Lucee by lucee.
the class XMLDocumentStruct method setXmlStandalone.
// used only with java 7, do not set @Override
public void setXmlStandalone(boolean arg0) throws DOMException {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = doc.getClass().getMethod("setXmlStandalone", new Class[] { boolean.class });
m.invoke(doc, new Object[] { Caster.toBoolean(arg0) });
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
use of org.w3c.dom.DOMException in project Lucee by lucee.
the class XMLDocumentStruct method setXmlVersion.
// used only with java 7, do not set @Override
public void setXmlVersion(String arg0) throws DOMException {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = doc.getClass().getMethod("setXmlVersion", new Class[] { arg0.getClass() });
m.invoke(doc, new Object[] { arg0 });
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
use of org.w3c.dom.DOMException in project Lucee by lucee.
the class XMLElementStruct method setIdAttributeNode.
// used only with java 7, do not set @Override
public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = element.getClass().getMethod("setIdAttributeNode", new Class[] { idAttr.getClass(), boolean.class });
m.invoke(element, new Object[] { idAttr, Caster.toBoolean(isId) });
} catch (Exception e) {
element.setAttributeNodeNS(idAttr);
}
}
use of org.w3c.dom.DOMException in project Lucee by lucee.
the class XMLElementStruct method setIdAttribute.
// used only with java 7, do not set @Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = element.getClass().getMethod("setIdAttribute", new Class[] { name.getClass(), boolean.class });
m.invoke(element, new Object[] { name, Caster.toBoolean(isId) });
} catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
}
Aggregations