Search in sources :

Example 11 with DOMImplementation

use of org.w3c.dom.DOMImplementation 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 12 with DOMImplementation

use of org.w3c.dom.DOMImplementation 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 13 with DOMImplementation

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

the class DocumentTypePublicId method testGetPublicId.

/**
    * Runs the test case.
    * @throws Throwable Any uncaught exception causes test to fail
    */
public void testGetPublicId() throws Throwable {
    Document doc;
    DocumentType docType;
    DOMImplementation domImpl;
    String publicId;
    String nullNS = null;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    docType = domImpl.createDocumentType("l2:root", "PUB", nullNS);
    publicId = docType.getPublicId();
    assertEquals("documenttypepublicid01", "PUB", publicId);
}
Also used : DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 14 with DOMImplementation

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

the class DocumentTypeSystemId method testGetSystemId.

/**
    * Runs the test case.
    * @throws Throwable Any uncaught exception causes test to fail
    */
public void testGetSystemId() throws Throwable {
    Document doc;
    DocumentType docType;
    DOMImplementation domImpl;
    String publicId;
    String systemId;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    docType = domImpl.createDocumentType("l2:root", "PUB", "SYS");
    publicId = docType.getPublicId();
    systemId = docType.getSystemId();
    assertEquals("documenttypepublicid01", "PUB", publicId);
    assertEquals("documenttypesystemid01", "SYS", systemId);
}
Also used : DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 15 with DOMImplementation

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

the class XPathExpressionImpl method getDummyDocument.

private static Document getDummyDocument() {
    try {
        if (dbf == null) {
            dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            dbf.setValidating(false);
        }
        db = dbf.newDocumentBuilder();
        DOMImplementation dim = db.getDOMImplementation();
        d = dim.createDocument("http://java.sun.com/jaxp/xpath", "dummyroot", null);
        return d;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : DOMImplementation(org.w3c.dom.DOMImplementation) XPathExpressionException(javax.xml.xpath.XPathExpressionException) TransformerException(javax.xml.transform.TransformerException)

Aggregations

DOMImplementation (org.w3c.dom.DOMImplementation)73 Document (org.w3c.dom.Document)61 DOMException (org.w3c.dom.DOMException)35 Element (org.w3c.dom.Element)32 DocumentType (org.w3c.dom.DocumentType)28 DocumentBuilder (javax.xml.parsers.DocumentBuilder)23 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)22 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)20 ArrayList (java.util.ArrayList)7 TransformerException (javax.xml.transform.TransformerException)6 Transformer (javax.xml.transform.Transformer)4 DOMSource (javax.xml.transform.dom.DOMSource)4 StreamResult (javax.xml.transform.stream.StreamResult)4 NodeList (org.w3c.dom.NodeList)4 DOMImplementationRegistry (org.w3c.dom.bootstrap.DOMImplementationRegistry)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 IOException (java.io.IOException)3 Node (org.w3c.dom.Node)3 DOMImplementationLS (org.w3c.dom.ls.DOMImplementationLS)3 BufferedImage (java.awt.image.BufferedImage)2