Search in sources :

Example 51 with DOMImplementation

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

the class DOMImplementationHasFeature method testHasFeatureXml.

public void testHasFeatureXml() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    boolean state;
    doc = (Document) load("staff", builder);
    domImpl = doc.getImplementation();
    state = domImpl.hasFeature("xml", "2.0");
    assertTrue("domimplementationFeaturexmlVersion2Assert", state);
}
Also used : DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 52 with DOMImplementation

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

the class DOMImplementationHasFeature method testHasFeatureCore.

/**
     * Runs the test case.
     *
     * @throws Throwable
     *             Any uncaught exception causes test to fail
     */
public void testHasFeatureCore() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    boolean state;
    doc = (Document) load("staff", builder);
    domImpl = doc.getImplementation();
    state = domImpl.hasFeature("core", "2.0");
    assertTrue("domimplementationFeaturecoreAssert", state);
}
Also used : DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 53 with DOMImplementation

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

the class DocumentCreateAttributeNS method testCreateAttributeNS6.

public void testCreateAttributeNS6() throws Throwable {
    Document doc;
    Document newDoc;
    DocumentType docType = null;
    DOMImplementation domImpl;
    String namespaceURI = "http://www.w3.org/XML/1998 /namespace";
    String qualifiedName = "xml:root";
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "dom:doc", docType);
    {
        boolean success = false;
        try {
            newDoc.createAttributeNS(namespaceURI, qualifiedName);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.NAMESPACE_ERR);
        }
        assertTrue("documentcreateattributeNS06", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 54 with DOMImplementation

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

the class DocumentCreateAttributeNS method testCreateAttributeNS5.

public void testCreateAttributeNS5() throws Throwable {
    Document doc;
    Document newDoc;
    DocumentType docType = null;
    DOMImplementation domImpl;
    String namespaceURI = null;
    String qualifiedName = "abc:def";
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "dom:doc", docType);
    {
        boolean success = false;
        try {
            newDoc.createAttributeNS(namespaceURI, qualifiedName);
        } catch (DOMException ex) {
            success = (ex.code == DOMException.NAMESPACE_ERR);
        }
        assertTrue("documentcreateattributeNS05", success);
    }
}
Also used : DOMException(org.w3c.dom.DOMException) DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 55 with DOMImplementation

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

the class DocumentTypeInternalSubset method testGetInternalSubset.

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

Aggregations

DOMImplementation (org.w3c.dom.DOMImplementation)82 Document (org.w3c.dom.Document)67 DOMException (org.w3c.dom.DOMException)35 Element (org.w3c.dom.Element)34 DocumentType (org.w3c.dom.DocumentType)28 DocumentBuilder (javax.xml.parsers.DocumentBuilder)25 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)22 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)22 ArrayList (java.util.ArrayList)8 TransformerException (javax.xml.transform.TransformerException)6 DOMImplementationRegistry (org.w3c.dom.bootstrap.DOMImplementationRegistry)6 DOMImplementationLS (org.w3c.dom.ls.DOMImplementationLS)6 IOException (java.io.IOException)5 Transformer (javax.xml.transform.Transformer)5 DOMSource (javax.xml.transform.dom.DOMSource)5 StreamResult (javax.xml.transform.stream.StreamResult)5 Node (org.w3c.dom.Node)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 NodeList (org.w3c.dom.NodeList)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3