Search in sources :

Example 81 with DOMException

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);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) Element(org.w3c.dom.Element) Text(org.w3c.dom.Text) Document(org.w3c.dom.Document)

Example 82 with DOMException

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));
    }
}
Also used : Method(java.lang.reflect.Method) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 83 with DOMException

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));
    }
}
Also used : Method(java.lang.reflect.Method) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 84 with DOMException

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);
    }
}
Also used : Method(java.lang.reflect.Method) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 85 with DOMException

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));
    }
}
Also used : Method(java.lang.reflect.Method) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) DOMException(org.w3c.dom.DOMException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Aggregations

DOMException (org.w3c.dom.DOMException)323 Document (org.w3c.dom.Document)165 Element (org.w3c.dom.Element)131 Node (org.w3c.dom.Node)73 NodeList (org.w3c.dom.NodeList)57 DocumentBuilder (javax.xml.parsers.DocumentBuilder)42 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)42 Attr (org.w3c.dom.Attr)40 DOMImplementation (org.w3c.dom.DOMImplementation)37 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)28 FrameworkException (org.structr.common.error.FrameworkException)27 IOException (java.io.IOException)26 NamedNodeMap (org.w3c.dom.NamedNodeMap)25 DocumentType (org.w3c.dom.DocumentType)19 ArrayList (java.util.ArrayList)17 Text (org.w3c.dom.Text)17 DOMNode (org.structr.web.entity.dom.DOMNode)16 XPathExpressionException (javax.xml.xpath.XPathExpressionException)15 SAXException (org.xml.sax.SAXException)13 TransformerException (javax.xml.transform.TransformerException)12