Java 8 DocumentType - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DocumentType class.

This code example shows how to use the following methods:getName, getPublicId, getSystemId
    } else { 
      assertNotNull(text, maker);
      DOMImplementation impl = DOMImplementationRegistry.newInstance()
          .getDOMImplementation("XML 1.0 Traversal"); 
      DocumentType doctype = maker.apply(impl);
      assertEquals(text, name, doctype.getName());
      assertEquals(text, systemId, doctype.getSystemId());
      assertEquals(text, pubid, doctype.getPublicId());
    } 
  } 
} 
6
CodeRank
This code example shows how to use the following methods:getPublicId, getSystemId
      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);
      } 
 
} 
 
5
CodeRank
This code example shows how to use the following methods:getInternalSubset, getName, getPublicId, getSystemId
		write(node.getDocumentElement());
	} 
 
	protected void write(DocumentType node) throws ShellException {
		printWriter.print("<!DOCTYPE "); //$NON-NLS-1$
		printWriter.print(node.getName());
		String publicId = node.getPublicId();
		String systemId = node.getSystemId();
		if (publicId != null) {
			printWriter.print(" PUBLIC \""); //$NON-NLS-1$
			printWriter.print(publicId);
			printWriter.print("\" \""); //$NON-NLS-1$
			printWriter.print(systemId);
			printWriter.print('\"');
		} else if (systemId != null) {
			printWriter.print(" SYSTEM \""); //$NON-NLS-1$
			printWriter.print(systemId);
			printWriter.print('"');
		} 
 

5
CodeRank
This code example shows how to use the following methods:getName, getPublicId, getSystemId
  { 
    if (newChild instanceof StandaloneDocumentType)
      { 
        DocumentType dt = (DocumentType) newChild;
        newChild = ((GnomeDocument) getOwnerDocument())
          .createDocumentType(dt.getName(), dt.getPublicId(),
                              dt.getSystemId());
      } 
    if (newChild == null)
      { 
        throw new GnomeDOMException(DOMException.NOT_FOUND_ERR, null);
      } 
    if (!(newChild instanceof GnomeNode))
      { 
        throw new GnomeDOMException(DOMException.WRONG_DOCUMENT_ERR, null);
      } 
    if (refChild == null || !(refChild instanceof GnomeNode))
      { 
        throw new GnomeDOMException(DOMException.NOT_FOUND_ERR, null);
      } 
5
CodeRank
This code example shows how to use the following methods:getName, getPublicId, getSystemId, getNamespaceURI
        DocumentType controlDocType = controlDocument.getDoctype();
 
        log(systemDocument);
        log(controlDocument);
 
        this.assertEquals(controlDocType.getName(), systemDocType.getName());
        this.assertEquals(controlDocType.getNamespaceURI(), systemDocType.getNamespaceURI());
        this.assertEquals(controlDocType.getPublicId(), systemDocType.getPublicId());
        this.assertEquals(controlDocType.getSystemId(), systemDocType.getSystemId());
 
        assertXMLIdentical(controlDocument, systemDocument);
 
    } 
 
    public void testCreateDocumentWithSystemIdentifierNullName() throws Exception {
        XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
        try { 
            Document systemDocument = xmlPlatform.createDocumentWithSystemIdentifier(null, "http://127.0.0.1/manual.dtd");
        } catch (XMLPlatformException platformException) {
            assertTrue("The wrong XMLPlatformException was thrown.", platformException.getErrorCode() == XMLPlatformException.XML_PLATFORM_COULD_NOT_CREATE_DOCUMENT);
5
CodeRank
This code example shows how to use the following methods:getNotations
 
        doc = (Document) load("hc_staff", builder);
        docType = doc.getDoctype();
 
        if (!(("text/html".equals(getContentType())))) {
            assertNotNull("docTypeNotNull", docType);
            notations = docType.getNotations();
            assertNotNull("notationsNotNull", notations);
 
            try { 
                notations.removeNamedItemNS("http://www.w3.org/1999/xhtml",
                        "alpha"); 
                fail("throw_NO_MOD_OR_NOT_FOUND_ERR"); 
 
            } catch (DOMException ex) {
                switch (ex.code) {
                case 7: 
                    break; 
                case 8: 
                    break; 
5
CodeRank
This code example shows how to use the following methods:getNotations
        Element elem;
        doc = (Document) load("hc_staff", builder);
        docType = doc.getDoctype();
 
        if (!(("text/html".equals(getContentType())))) {
            assertNotNull("docTypeNotNull", docType);
            notations = docType.getNotations();
            assertNotNull("notationsNotNull", notations);
            elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
 
            try { 
                notations.setNamedItemNS(elem);
                fail("throw_HIER_OR_NO_MOD_ERR"); 
 
            } catch (DOMException ex) {
                switch (ex.code) {
                case 3: 
                    break; 
                case 7: 
                    break; 
5
CodeRank
This code example shows how to use the following methods:getNodeName, getNodeValue
        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);
    } 
    public void testCreateDocumentType4() throws Throwable {
        String publicId = "http://www.example.com/";
        String systemId = "myDoc.dtd";
 
        DOMImplementation domImpl;
        domImpl = builder.getDOMImplementation();
 
        { 
            boolean success = false;
            try { 
5
CodeRank
This code example shows how to use the following methods:getPublicId, getSystemId
					transformer.setParameter("targetBaseURL", uri);
				} 
			} 
			DocumentType doctype = doc.getDoctype();
			if (doctype != null) {
				if (doctype.getPublicId() != null) {
					transformer.setParameter("publicType", doctype.getPublicId());
				} 
				if (doctype.getSystemId() != null) {
					transformer.setParameter("systemType", doctype.getSystemId());
				} 
			} 
 
			transformer.transform(source, result);
		} catch (Exception ex) {
			Logger.getLogger(OdfXMLHelper.class.getName()).log(Level.SEVERE, null, ex);
			ex.printStackTrace();
		} 
	} 
 
5
CodeRank
This code example shows how to use the following methods:getName, getPublicId, getSystemId
            return true; 
        } else if ((null == control) || (null == test)) {
            return false; 
        } 
 
        if (!isStringEqual(control.getName(), test.getName())) {
            return false; 
        } 
        if (!isStringEqual(control.getPublicId(), test.getPublicId())) {
            return false; 
        } 
        if (!isStringEqual(control.getSystemId(), test.getSystemId())) {
            return false; 
        } 
 
        return true; 
    } 
 
    private boolean isElementEqual(Element control, Element test) {
        if (!isStringEqual(control.getNamespaceURI(), test.getNamespaceURI())) {
5
CodeRank
See Code Examples for Java 8 DocumentType Methods: