Java 8 ProcessingInstruction - 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 ProcessingInstruction class.

This code example shows how to use the following methods:getTarget
		return pi.getData();
	} 
	 
	@Kroll.getProperty @Kroll.method 
	public String getTarget() {
		return pi.getTarget();
	} 
	 
	@Kroll.setProperty @Kroll.method 
	public void setData(String data) throws DOMException {
		pi.setData(data);
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getParentNode
    } 
 
    private void setProcessingInstructionName(String localName) {
        org.w3c.dom.ProcessingInstruction pi = (ProcessingInstruction)this.dom;
        //    We cannot set the node name; Document.renameNode() only supports elements and attributes.  So we replace it 
        pi.getParentNode().replaceChild(
            pi,
            pi.getOwnerDocument().createProcessingInstruction(localName, pi.getData())
        ); 
    } 
 
    final void setLocalName(String localName) {
        if (dom instanceof ProcessingInstruction) {
            setProcessingInstructionName(localName);
        } else { 
            String prefix = dom.getPrefix();
            if (prefix == null) prefix = "";
            this.dom = dom.getOwnerDocument().renameNode(dom, dom.getNamespaceURI(), QName.qualify(prefix, localName));
        } 
    } 
6
CodeRank
This code example shows how to use the following methods:getOwnerDocument, getData, getTarget
 
        doc = (Document) load("staffNS", builder);
        aNewDoc = (Document) load("staffNS", builder);
        pi = aNewDoc.createProcessingInstruction("target1", "data1");
        aNode = (ProcessingInstruction) doc.importNode(pi, false);
        ownerDocument = aNode.getOwnerDocument();
        assertNotNull("ownerDocumentNotNull", ownerDocument);
        docType = ownerDocument.getDoctype();
        system = docType.getSystemId();
        assertURIEquals("systemId", null, null, null, "staffNS.dtd", null, 
                null, null, null, system);
        target = aNode.getTarget();
        assertEquals("piTarget", "target1", target);
        data = aNode.getData();
        assertEquals("piData", "data1", data);
    } 
    public void testImportNode15() throws Throwable {
        Document doc;
        Document aNewDoc;
        Text text;
5
CodeRank
This code example shows how to use the following methods:getData, getTarget
    } 
 
    protected void printPI(final ProcessingInstruction instruction, final boolean endWithComma) {
        printIndent(); 
        print("mkp.pi(" + qt);
        print(instruction.getTarget());
        print(qt + ", " + qt);
        print(instruction.getData());
        printEnd(qt + ");", endWithComma);
    } 
 
    protected void printComment(final Comment comment, final boolean endWithComma) {
        String text = comment.getData().trim();
        if (text.length() >0) {
            printIndent(); 
            print("/* "); 
            print(text);
            printEnd(" */", endWithComma);
        } 
    } 
5
CodeRank
This code example shows how to use the following methods:getData, getTarget
	// do nothing 
    } 
 
    public boolean enter(ProcessingInstruction pi) {
	buffer_.append("<?");
	buffer_.append(pi.getTarget());
	buffer_.append(" ");
	buffer_.append(pi.getData());
	buffer_.append("?>");
	return (true); 
    } 
 
    public void leave(ProcessingInstruction pi) {
	// do nothing 
    } 
 
    public boolean enter(Comment comment) {
	buffer_.append("<!--");
	buffer_.append(comment.getData());
	buffer_.append("-->");
5
CodeRank
This code example shows how to use the following methods:getData, getTarget
        String piTarget;
        doc = (Document) load("staffNS", builder);
 
        piToImport = doc.createProcessingInstruction("Target", "Data");
        piImport = (ProcessingInstruction) doc.importNode(piToImport, false);
        piTarget = piImport.getTarget();
        piData = piImport.getData();
        assertEquals("documentimportnode18_Target", "Target", piTarget);
        assertEquals("documentimportnode18_Data", "Data", piData);
    } 
 
// Assumes validation. 
//    public void testImportNode19() throws Throwable { 
//        Document doc; 
//        DocumentType docTypeNull = null; 
// 
//        Document docImp; 
//        DOMImplementation domImpl; 
//        DocumentType docType; 
//        NamedNodeMap nodeMap; 
5
CodeRank
This code example shows how to use the following methods:getData, getTarget
        return (false); 
    } 
 
    public boolean enter(ProcessingInstruction pi) {
        try { 
            content_.processingInstruction(pi.getTarget(), pi.getData());
        } catch (SAXException e) {
            _errorReport(e);
        } 
        return (false); 
    } 
 
    public boolean enter(Comment comment) {
        try { 
            String data = comment.getData();
            lexical_.comment(data.toCharArray(), 0, data.length());
        } catch (SAXException e) {
            _errorReport(e);
        } 
        return (false); 
5
CodeRank
This code example shows how to use the following methods:getData, getTarget
        } 
 
        public void testProcessingInstruction(ProcessingInstruction instr) {
            Assert.assertFalse("testProcessingInstruction called", piCalled);
            piCalled = true;
            Assert.assertEquals("target", instr.getTarget());
            Assert.assertEquals("processing-instruction", instr.getData());
        } 
 
        public void testText(Text text) {
            Assert.assertFalse("testText called", textCalled);
            textCalled = true;
            Assert.assertEquals("barhello", text.getNodeValue());
        } 
 
        public void noMoreNodes(NodeTest t) {
            Assert.assertFalse("noMoreNodes called", noMoreNodesCalled);
            noMoreNodesCalled = true;
        } 
 
4
CodeRank
This code example shows how to use the following methods:getData, getTarget
        return (false); 
    } 
 
    public boolean enter(ProcessingInstruction pi) {
        try { 
            content_.processingInstruction(pi.getTarget(), pi.getData());
        } catch (SAXException e) {
            _errorReport(e);
        } 
        return (false); 
    } 
 
    public boolean enter(Comment comment) {
        try { 
            String data = comment.getData();
            lexical_.comment(data.toCharArray(), 0, data.length());
        } catch (SAXException e) {
            _errorReport(e);
        } 
        return (false); 
5
CodeRank
This code example shows how to use the following methods:getData, getTarget
                w.comment(comment.getData());
                break; 
                 
            case Node.PROCESSING_INSTRUCTION_NODE:
                ProcessingInstruction pi = (ProcessingInstruction) node;
                w.processingInstruction(pi.getTarget(), pi.getData());
                break; 
        } 
    } 
} 
5
CodeRank
See Code Examples for Java 8 ProcessingInstruction Methods: