Search in sources :

Example 41 with DOMException

use of org.w3c.dom.DOMException in project robovm by robovm.

the class CreateElementNS method testCreateElementNS3.

public void testCreateElementNS3() throws Throwable {
    String namespaceURI = "http://www.wedding.com/";
    String qualifiedName;
    Document doc;
    List<String> illegalQNames = new ArrayList<String>();
    illegalQNames.add("person:{");
    illegalQNames.add("person:}");
    illegalQNames.add("person:~");
    illegalQNames.add("person:'");
    illegalQNames.add("person:!");
    illegalQNames.add("person:@");
    illegalQNames.add("person:#");
    illegalQNames.add("person:$");
    illegalQNames.add("person:%");
    illegalQNames.add("person:^");
    illegalQNames.add("person:&");
    illegalQNames.add("person:*");
    illegalQNames.add("person:(");
    illegalQNames.add("person:)");
    illegalQNames.add("person:+");
    illegalQNames.add("person:=");
    illegalQNames.add("person:[");
    illegalQNames.add("person:]");
    illegalQNames.add("person:\\");
    illegalQNames.add("person:/");
    illegalQNames.add("person:;");
    illegalQNames.add("person:`");
    illegalQNames.add("person:<");
    illegalQNames.add("person:>");
    illegalQNames.add("person:,");
    illegalQNames.add("person:a ");
    illegalQNames.add("person:\"");
    doc = (Document) load("staffNS", builder);
    for (int indexN10098 = 0; indexN10098 < illegalQNames.size(); indexN10098++) {
        qualifiedName = (String) illegalQNames.get(indexN10098);
        {
            boolean success = false;
            try {
                doc.createElementNS(namespaceURI, qualifiedName);
            } catch (DOMException ex) {
                success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
            }
            assertTrue("throw_INVALID_CHARACTER_ERR", success);
        }
    }
}
Also used : DOMException(org.w3c.dom.DOMException) ArrayList(java.util.ArrayList) Document(org.w3c.dom.Document)

Example 42 with DOMException

use of org.w3c.dom.DOMException in project robovm by robovm.

the class CreateElementNS method testCreateElementNS2.

public void testCreateElementNS2() throws Throwable {
    String namespaceURI = null;
    String qualifiedName = "prefix:local";
    Document doc;
    doc = (Document) load("staffNS", builder);
    {
        boolean success = false;
        try {
            doc.createElementNS(namespaceURI, qualifiedName);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.NAMESPACE_ERR);
        }
        assertTrue("throw_NAMESPACE_ERR", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) Document(org.w3c.dom.Document)

Example 43 with DOMException

use of org.w3c.dom.DOMException in project robovm by robovm.

the class DOMImplementationCreateDocument method testCreateDocument7.

public void testCreateDocument7() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    String namespaceURI = "http://www.w3.org/DOMTest/level2";
    DocumentType docType = null;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    {
        boolean success = false;
        try {
            domImpl.createDocument(namespaceURI, ":", docType);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.NAMESPACE_ERR);
        }
        assertTrue("domimplementationcreatedocument07", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 44 with DOMException

use of org.w3c.dom.DOMException in project robovm by robovm.

the class DOMImplementationCreateDocument method testCreateDocument4.

public void testCreateDocument4() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    String namespaceURI = null;
    String qualifiedName = "dom:root";
    DocumentType docType = null;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    {
        boolean success = false;
        try {
            domImpl.createDocument(namespaceURI, qualifiedName, docType);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.NAMESPACE_ERR);
        }
        assertTrue("domimplementationcreatedocument04", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 45 with DOMException

use of org.w3c.dom.DOMException in project robovm by robovm.

the class ElementSetAttributeNodeNS method testSetAttributeNodeNS5.

public void testSetAttributeNodeNS5() throws Throwable {
    Document doc;
    Document docAlt;
    Element element;
    Attr attribute;
    doc = (Document) load("staffNS", builder);
    docAlt = (Document) load("staffNS", builder);
    element = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
    attribute = docAlt.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
    {
        boolean success = false;
        try {
            element.setAttributeNodeNS(attribute);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
        }
        assertTrue("throw_WRONG_DOCUMENT_ERR", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

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