Search in sources :

Example 31 with DOMException

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

the class CreateAttributeNS method testCreateAttributeNS3.

public void testCreateAttributeNS3() 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 indexN10090 = 0; indexN10090 < illegalQNames.size(); indexN10090++) {
        qualifiedName = (String) illegalQNames.get(indexN10090);
        {
            boolean success = false;
            try {
                doc.createAttributeNS(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 32 with DOMException

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

the class CreateAttributeNS method testCreateAttributeNS6.

public void testCreateAttributeNS6() throws Throwable {
    String namespaceURI = "http://www.example.com/";
    Document doc;
    doc = (Document) load("hc_staff", builder);
    //     Our exception priorities differ from the spec
    try {
        doc.createAttributeNS(namespaceURI, "");
        fail();
    } catch (DOMException ex) {
    }
// END android-changed
}
Also used : DOMException(org.w3c.dom.DOMException) Document(org.w3c.dom.Document)

Example 33 with DOMException

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

the class DocumentCreateElementNS method testCreateElementNS5.

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

Example 34 with DOMException

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

the class DocumentImportNode method testImportNode8.

public void testImportNode8() throws Throwable {
    Document doc;
    DocumentType docType;
    DOMImplementation domImpl;
    String nullNS = null;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    docType = domImpl.createDocumentType("test:root", nullNS, nullNS);
    {
        boolean success = false;
        try {
            doc.importNode(docType, true);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
        }
        assertTrue("throw_NOT_SUPPORTED_ERR", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 35 with DOMException

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

the class DocumentCreateAttributeNS method testCreateAttributeNS3.

public void testCreateAttributeNS3() throws Throwable {
    Document doc;
    String namespaceURI = "http://www.w3.org/DOM/Test/Level2";
    String qualifiedName;
    List<String> qualifiedNames = new ArrayList<String>();
    qualifiedNames.add("/");
    qualifiedNames.add("//");
    qualifiedNames.add("\\");
    qualifiedNames.add(";");
    qualifiedNames.add("&");
    qualifiedNames.add("*");
    qualifiedNames.add("]]");
    qualifiedNames.add(">");
    qualifiedNames.add("<");
    doc = (Document) load("staffNS", builder);
    for (int indexN1005A = 0; indexN1005A < qualifiedNames.size(); indexN1005A++) {
        qualifiedName = (String) qualifiedNames.get(indexN1005A);
        {
            boolean success = false;
            try {
                doc.createAttributeNS(namespaceURI, qualifiedName);
            } catch (DOMException ex) {
                success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
            }
            assertTrue("documentcreateattributeNS03", success);
        }
    }
}
Also used : DOMException(org.w3c.dom.DOMException) ArrayList(java.util.ArrayList) Document(org.w3c.dom.Document)

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