protected void writeProcessingInstruction(ProcessingInstruction pi) throws IOException { // indent(); writer.write("<?"); writer.write(pi.getName()); writer.write(" "); writer.write(pi.getText()); writer.write("?>"); writePrintln(); lastOutputNodeType = Node.PROCESSING_INSTRUCTION_NODE; }
public void assertNodesEqual( Node n1, Node n2 ) { int nodeType1 = n1.getNodeType(); int nodeType2 = n2.getNodeType(); assertTrue( "Nodes are of same type: ", nodeType1 == nodeType2 ); switch (nodeType1) { case Node.ELEMENT_NODE: assertNodesEqual((Element) n1, (Element) n2); break; case Node.DOCUMENT_NODE: assertNodesEqual((Document) n1, (Document) n2); break; case Node.ATTRIBUTE_NODE: assertNodesEqual((Attribute) n1, (Attribute) n2); break; case Node.TEXT_NODE: assertNodesEqual((Text) n1, (Text) n2); break; case Node.CDATA_SECTION_NODE: assertNodesEqual((CDATA) n1, (CDATA) n2); break; case Node.ENTITY_REFERENCE_NODE: assertNodesEqual((Entity) n1, (Entity) n2); break; case Node.PROCESSING_INSTRUCTION_NODE: assertNodesEqual((ProcessingInstruction) n1, (ProcessingInstruction) n2); break; case Node.COMMENT_NODE: assertNodesEqual((Comment) n1, (Comment) n2); break; case Node.DOCUMENT_TYPE_NODE: assertNodesEqual((DocumentType) n1, (DocumentType) n2); break; case Node.NAMESPACE_NODE: assertNodesEqual((Namespace) n1, (Namespace) n2); break; default: assertTrue( "Invalid node types. node1: " + n1 + " and node2: " + n2, false ); } }
public ProcessingInstruction processingInstruction(String name) { return element.processingInstruction( name ); }
public void add(ProcessingInstruction processingInstruction) { element.add( processingInstruction ); }
public boolean remove(ProcessingInstruction processingInstruction) { return element.remove( processingInstruction ); }
public void add(ProcessingInstruction pi) { getWrapped().add(pi); }
public ProcessingInstruction processingInstruction(String target) { return getWrapped().processingInstruction(target); }
public List<ProcessingInstruction> processingInstructions() { return getWrapped().processingInstructions(); }
public List<ProcessingInstruction> processingInstructions(String target) { return getWrapped().processingInstructions(target); }
public boolean remove(ProcessingInstruction pi) { return getWrapped().remove(pi); }
public void setProcessingInstructions(List<ProcessingInstruction> listOfPIs) { getWrapped().setProcessingInstructions(listOfPIs); }
public void assertNodesEqual( ProcessingInstruction n1, ProcessingInstruction n2 ) { assertEquals( "PI targets equal", n1.getTarget(), n2.getTarget() ); assertEquals( "PI text equal", n1.getText(), n2.getText() ); }
public ProcessingInstruction processingInstruction(String name) { return target().processingInstruction( name ); }
public void add(ProcessingInstruction processingInstruction) { target().add( processingInstruction ); }
public boolean remove(ProcessingInstruction processingInstruction) { return target().remove( processingInstruction ); }
public boolean isProcessingInstruction(Object obj) { return obj instanceof ProcessingInstruction; }
public String getProcessingInstructionTarget(Object obj) { ProcessingInstruction pi = (ProcessingInstruction) obj; return pi.getTarget(); }
public String getProcessingInstructionData(Object obj) { ProcessingInstruction pi = (ProcessingInstruction) obj; return pi.getText(); }
/** * Writes the given {@link ProcessingInstruction}. * * @param processingInstruction * <code>ProcessingInstruction</code> to output. * * @throws IOException * DOCUMENT ME! */ public void write(ProcessingInstruction processingInstruction) throws IOException { writeProcessingInstruction(processingInstruction); if (autoFlush) { flush(); } }
protected void writeNode(Node node) throws IOException { int nodeType = node.getNodeType(); switch (nodeType) { case Node.ELEMENT_NODE: writeElement((Element) node); break; case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeNodeText(node); // write((Text) node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: // Will be output with attributes // write((Namespace) node); break; default: throw new IOException("Invalid node type: " + node); } }