Search in sources :

Example 6 with DocumentType

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

the class NodeGetOwnerDocument method testGetOwnerDocument2.

public void testGetOwnerDocument2() throws Throwable {
    Document doc;
    Document newDoc;
    Element newElem;
    Document ownerDocDoc;
    Document ownerDocElem;
    DOMImplementation domImpl;
    DocumentType docType;
    String nullNS = null;
    doc = (Document) load("staff", builder);
    domImpl = doc.getImplementation();
    docType = domImpl.createDocumentType("mydoc", nullNS, nullNS);
    newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "mydoc", docType);
    ownerDocDoc = newDoc.getOwnerDocument();
    assertNull("nodegetownerdocument02_1", ownerDocDoc);
    newElem = newDoc.createElementNS("http://www.w3.org/DOM/Test", "myelem");
    ownerDocElem = newElem.getOwnerDocument();
    assertNotNull("nodegetownerdocument02_2", ownerDocElem);
}
Also used : Element(org.w3c.dom.Element) DOMImplementation(org.w3c.dom.DOMImplementation) DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 7 with DocumentType

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

the class NodeHasAttributes method testHasAttributes4.

public void testHasAttributes4() throws Throwable {
    Document doc;
    Document newDoc;
    DocumentType docType = null;
    DOMImplementation domImpl;
    Element element;
    Element elementTest;
    Element elementDoc;
    Attr attribute;
    NodeList elementList;
    boolean hasAttributes;
    doc = (Document) load("staffNS", builder);
    domImpl = doc.getImplementation();
    newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "test", docType);
    element = newDoc.createElementNS("http://www.w3.org/DOM/Test", "dom:elem");
    attribute = newDoc.createAttribute("attr");
    element.setAttributeNode(attribute);
    elementDoc = newDoc.getDocumentElement();
    elementDoc.appendChild(element);
    elementList = newDoc.getElementsByTagNameNS("http://www.w3.org/DOM/Test", "elem");
    elementTest = (Element) elementList.item(0);
    hasAttributes = elementTest.hasAttributes();
    assertTrue("nodehasattributes04", hasAttributes);
}
Also used : Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) DocumentType(org.w3c.dom.DocumentType) DOMImplementation(org.w3c.dom.DOMImplementation) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Example 8 with DocumentType

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

the class SystemId method testGetSystemId.

/**
     * Runs the test case.
     *
     * @throws Throwable
     *             Any uncaught exception causes test to fail
     */
public void testGetSystemId() throws Throwable {
    Document doc;
    DocumentType docType;
    String systemId;
    doc = (Document) load("staffNS", builder);
    docType = doc.getDoctype();
    systemId = docType.getSystemId();
    assertURIEquals("systemId", null, null, null, "staffNS.dtd", null, null, null, null, systemId);
}
Also used : DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 9 with DocumentType

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

the class OwnerDocument method testGetOwnerDocument.

/**
    * Runs the test case.
    * @throws Throwable Any uncaught exception causes test to fail
    */
public void testGetOwnerDocument() throws Throwable {
    Document doc;
    DocumentType ownerDocument;
    doc = (Document) load("staff", builder);
    ownerDocument = (DocumentType) doc.getOwnerDocument();
    assertNull("throw_Null", ownerDocument);
}
Also used : DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 10 with DocumentType

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

the class PublicId method testGetPublicId.

/**
    * Runs the test case.
    * @throws Throwable Any uncaught exception causes test to fail
    */
public void testGetPublicId() throws Throwable {
    Document doc;
    DocumentType docType;
    String publicId;
    doc = (Document) load("staffNS", builder);
    docType = doc.getDoctype();
    publicId = docType.getPublicId();
    assertEquals("throw_Equals", "STAFF", publicId);
}
Also used : DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Aggregations

DocumentType (org.w3c.dom.DocumentType)107 Document (org.w3c.dom.Document)68 DOMImplementation (org.w3c.dom.DOMImplementation)34 Node (org.w3c.dom.Node)21 DOMException (org.w3c.dom.DOMException)19 Element (org.w3c.dom.Element)16 NamedNodeMap (org.w3c.dom.NamedNodeMap)14 NodeList (org.w3c.dom.NodeList)12 ArrayList (java.util.ArrayList)10 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)8 Entity (org.w3c.dom.Entity)8 IOException (java.io.IOException)7 CMDocument (org.eclipse.wst.xml.core.internal.contentmodel.CMDocument)6 DocumentBuilder (javax.xml.parsers.DocumentBuilder)5 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)4 Transformer (javax.xml.transform.Transformer)4 TransformerFactory (javax.xml.transform.TransformerFactory)4 DOMSource (javax.xml.transform.dom.DOMSource)4 StreamResult (javax.xml.transform.stream.StreamResult)4 Attr (org.w3c.dom.Attr)4