Search in sources :

Example 61 with DocumentType

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

the class CreateDocument method testCreateDocument2.

public void testCreateDocument2() throws Throwable {
    String namespaceURI = null;
    String qualifiedName = "k:local";
    Document doc;
    DocumentType docType = null;
    DOMImplementation domImpl;
    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("throw_NAMESPACE_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 62 with DocumentType

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

the class CreateDocument method testCreateDocument6.

public void testCreateDocument6() throws Throwable {
    String namespaceURI = "http://ecommerce.org/schema";
    String qualifiedName = "xml:local";
    Document doc;
    DocumentType docType = null;
    DOMImplementation domImpl;
    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("throw_NAMESPACE_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 63 with DocumentType

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

the class CreateDocument method testCreateDocument8.

public void testCreateDocument8() throws Throwable {
    String namespaceURI = "http://www.example.org/schema";
    DocumentType docType = null;
    DOMImplementation domImpl;
    domImpl = builder.getDOMImplementation();
    //     Our exception priorities differ from the spec
    try {
        domImpl.createDocument(namespaceURI, "", docType);
        fail();
    } catch (DOMException ex) {
    }
// END android-changed
}
Also used : DOMException(org.w3c.dom.DOMException) DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation)

Example 64 with DocumentType

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

the class CreateDocumentType method testCreateDocumentType3.

public void testCreateDocumentType3() throws Throwable {
    String qualifiedName = "prefix:myDoc";
    String publicId = "http://www.localhost.com";
    String systemId = "myDoc.dtd";
    Document doc;
    DOMImplementation domImpl;
    DocumentType newType = null;
    String nodeName;
    String nodeValue;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    newType = domImpl.createDocumentType(qualifiedName, publicId, systemId);
    nodeName = newType.getNodeName();
    assertEquals("nodeName", "prefix:myDoc", nodeName);
    nodeValue = newType.getNodeValue();
    assertNull("nodeValue", nodeValue);
}
Also used : DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 65 with DocumentType

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

the class DOMImplementationCreateDocument method testCreateDocument3.

/**
     * Runs the test case.
     *
     * @throws Throwable
     *             Any uncaught exception causes test to fail
     */
public void testCreateDocument3() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    Document newDoc;
    DocumentType docType = null;
    String namespaceURI = "http://www.w3.org/DOMTest/L2";
    String qualifiedName;
    List<String> qualifiedNames = new ArrayList<String>();
    qualifiedNames.add("_:_");
    qualifiedNames.add("_:h0");
    qualifiedNames.add("_:test");
    qualifiedNames.add("l_:_");
    qualifiedNames.add("ns:_0");
    qualifiedNames.add("ns:a0");
    qualifiedNames.add("ns0:test");
    qualifiedNames.add("a.b:c");
    qualifiedNames.add("a-b:c");
    qualifiedNames.add("a-b:c");
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    for (int indexN1006B = 0; indexN1006B < qualifiedNames.size(); indexN1006B++) {
        qualifiedName = (String) qualifiedNames.get(indexN1006B);
        newDoc = domImpl.createDocument(namespaceURI, qualifiedName, docType);
        assertNotNull("domimplementationcreatedocument03", newDoc);
    }
}
Also used : ArrayList(java.util.ArrayList) DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Aggregations

DocumentType (org.w3c.dom.DocumentType)75 Document (org.w3c.dom.Document)57 DOMImplementation (org.w3c.dom.DOMImplementation)28 DOMException (org.w3c.dom.DOMException)18 NamedNodeMap (org.w3c.dom.NamedNodeMap)12 Node (org.w3c.dom.Node)12 Element (org.w3c.dom.Element)11 NodeList (org.w3c.dom.NodeList)8 ArrayList (java.util.ArrayList)7 Entity (org.w3c.dom.Entity)7 IOException (java.io.IOException)5 Attr (org.w3c.dom.Attr)4 Text (org.w3c.dom.Text)4 SAXParseException (org.xml.sax.SAXParseException)4 URL (java.net.URL)3 URLConnection (java.net.URLConnection)3 DocumentBuilder (javax.xml.parsers.DocumentBuilder)3 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)3 DocumentImpl (org.apache.harmony.xml.dom.DocumentImpl)3 XMLString (org.apache.xml.utils.XMLString)3