Search in sources :

Example 46 with DOMImplementation

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

the class DocumentBuilderTest method testGetImplementation.

public void testGetImplementation() {
    DOMImplementation d;
    try {
        d = dbf.newDocumentBuilder().getDOMImplementation();
    } catch (Exception e) {
        throw new RuntimeException("Unexpected exception", e);
    }
    assertNotNull(d);
}
Also used : DOMImplementation(org.w3c.dom.DOMImplementation) IOException(java.io.IOException) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException)

Example 47 with DOMImplementation

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

the class DOMImplementationCreateDocumentType method testCreateDocumentType2.

public void testCreateDocumentType2() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    DocumentType newDocType;
    Document ownerDocument;
    String publicId = "http://www.w3.org/DOM/Test/dom2.dtd";
    String systemId = "dom2.dtd";
    String qualifiedName;
    List<String> qualifiedNames = new ArrayList<String>();
    qualifiedNames.add("_:_");
    qualifiedNames.add("_:h0");
    qualifiedNames.add("_:test");
    qualifiedNames.add("_:_.");
    qualifiedNames.add("_:a-");
    qualifiedNames.add("l_:_");
    qualifiedNames.add("ns:_0");
    qualifiedNames.add("ns:a0");
    qualifiedNames.add("ns0:test");
    qualifiedNames.add("ns:EEE.");
    qualifiedNames.add("ns:_-");
    qualifiedNames.add("a.b:c");
    qualifiedNames.add("a-b:c.j");
    qualifiedNames.add("a-b:c");
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    for (int indexN10077 = 0; indexN10077 < qualifiedNames.size(); indexN10077++) {
        qualifiedName = (String) qualifiedNames.get(indexN10077);
        newDocType = domImpl.createDocumentType(qualifiedName, publicId, systemId);
        assertNotNull("domimplementationcreatedocumenttype02_newDocType", newDocType);
        ownerDocument = newDocType.getOwnerDocument();
        assertNull("domimplementationcreatedocumenttype02_ownerDocument", ownerDocument);
    }
}
Also used : ArrayList(java.util.ArrayList) DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 48 with DOMImplementation

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

the class DOMImplementationCreateDocumentType method testCreateDocumentType4.

public void testCreateDocumentType4() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    DocumentType newDocType;
    Document ownerDocument;
    String publicId = "http://www.w3.org/DOM/Test/dom2.dtd";
    String systemId = "dom2.dtd";
    String qualifiedName;
    List<String> qualifiedNames = new ArrayList<String>();
    qualifiedNames.add("_:_");
    qualifiedNames.add("_:h0");
    qualifiedNames.add("_:test");
    qualifiedNames.add("_:_.");
    qualifiedNames.add("_:a-");
    qualifiedNames.add("l_:_");
    qualifiedNames.add("ns:_0");
    qualifiedNames.add("ns:a0");
    qualifiedNames.add("ns0:test");
    qualifiedNames.add("ns:EEE.");
    qualifiedNames.add("ns:_-");
    qualifiedNames.add("a.b:c");
    qualifiedNames.add("a-b:c.j");
    qualifiedNames.add("a-b:c");
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    for (int indexN10077 = 0; indexN10077 < qualifiedNames.size(); indexN10077++) {
        qualifiedName = (String) qualifiedNames.get(indexN10077);
        newDocType = domImpl.createDocumentType(qualifiedName, publicId, systemId);
        assertNotNull("domimplementationcreatedocumenttype02_newDocType", newDocType);
        ownerDocument = newDocType.getOwnerDocument();
        assertNull("domimplementationcreatedocumenttype02_ownerDocument", ownerDocument);
    }
}
Also used : ArrayList(java.util.ArrayList) DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 49 with DOMImplementation

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

the class DOMImplementationHasFeature method testHasFeature1.

public void testHasFeature1() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    String version = "";
    String version1 = "1.0";
    String version2 = "2.0";
    String featureCore;
    String featureXML;
    boolean success;
    List<String> featuresXML = new ArrayList<String>();
    featuresXML.add("XML");
    featuresXML.add("xmL");
    List<String> featuresCore = new ArrayList<String>();
    featuresCore.add("Core");
    featuresCore.add("CORE");
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    for (int indexN10063 = 0; indexN10063 < featuresXML.size(); indexN10063++) {
        featureXML = (String) featuresXML.get(indexN10063);
        success = domImpl.hasFeature(featureXML, version);
        assertTrue("domimplementationhasfeature01_XML_1", success);
        success = domImpl.hasFeature(featureXML, version1);
        assertTrue("domimplementationhasfeature01_XML_2", success);
    }
    for (int indexN1007C = 0; indexN1007C < featuresCore.size(); indexN1007C++) {
        featureCore = (String) featuresCore.get(indexN1007C);
        success = domImpl.hasFeature(featureCore, version);
        assertTrue("domimplementationhasfeature01_Core_1", success);
        success = domImpl.hasFeature(featureCore, version1);
        success = domImpl.hasFeature(featureCore, version2);
        assertTrue("domimplementationhasfeature01_Core_3", success);
    }
}
Also used : ArrayList(java.util.ArrayList) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document)

Example 50 with DOMImplementation

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

the class DOMImplementationHasFeature method testHasFeature2.

public void testHasFeature2() throws Throwable {
    Document doc;
    DOMImplementation domImpl;
    boolean success;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    success = domImpl.hasFeature("Blah Blah", "");
    assertFalse("domimplementationhasfeature02", success);
}
Also used : 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