public String getNodeName() { return "@pi$" + ((ProcessingInstruction) node).getTarget(); }
/** * Get the target of a processing instruction node. * * @param obj the processing instruction * @return the target of the processing instruction * @throws ClassCastException if obj is not a processing instruction * */ public String getProcessingInstructionTarget(Object obj) { if (isProcessingInstruction(obj)) { ProcessingInstruction pi = (ProcessingInstruction) obj; return pi.getTarget(); } throw new ClassCastException(obj + " is not a processing instruction"); }
private void visit( Node n ) throws SAXException { setCurrentLocation( n ); // if a case statement gets too big, it should be made into a separate method. switch(n.getNodeType()) { case Node.CDATA_SECTION_NODE: case Node.TEXT_NODE: String value = n.getNodeValue(); receiver.characters( value.toCharArray(), 0, value.length() ); break; case Node.ELEMENT_NODE: visit( (Element)n ); break; case Node.ENTITY_REFERENCE_NODE: receiver.skippedEntity(n.getNodeName()); break; case Node.PROCESSING_INSTRUCTION_NODE: ProcessingInstruction pi = (ProcessingInstruction)n; receiver.processingInstruction(pi.getTarget(),pi.getData()); break; } }
} else if (n.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { ProcessingInstruction pi = (ProcessingInstruction) n; nextIndex = xmlString.indexOf("<?" + pi.getTarget(), nextIndex); } else if (n.getNodeType() == Node.TEXT_NODE) { String te = unexpandEntities(n, n.getNodeValue(), true); } else if (n.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { ProcessingInstruction pi = (ProcessingInstruction) n; nextIndex += "<?".length() + pi.getTarget().length() + "?>".length() + pi.getData().length();
/** * Loads the given processing instruction in the current sequence. * * @param pi The W3C DOM PI node to load. * * @throws LoadingException If thrown while parsing. */ private void load(ProcessingInstruction pi) throws LoadingException { this.sequence.addEvent(new ProcessingInstructionEvent(pi.getTarget(), pi.getData())); this.currentWeight++; }
ProcessingInstruction pi = (ProcessingInstruction) node; if ("target".equals(localName)) { result.add(createAttribute(pi, "target", pi.getTarget())); } else if ("data".equals(localName)) { result.add(createAttribute(pi, "data", pi.getData()));
final String target = currentPI.getTarget(); int length = target.length();
protected void printPI(ProcessingInstruction instruction, boolean endWithComma) { printIndent(); print("mkp.pi(" + qt); print(instruction.getTarget()); print(qt + ", " + qt); print(instruction.getData()); printEnd(qt + ");", endWithComma); }
Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "ProcessingInstruction", node.getTarget()});
Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "ProcessingInstruction", node.getTarget()});
return createProcessingInstruction(pi.getTarget(), pi.getData());
private void writeProcessingInstruction(final PrintWriter pOut, final ProcessingInstruction pNode) { pOut.print("\n<?"); pOut.print(pNode.getTarget()); String value = pNode.getData(); if (value != null) { pOut.print(" "); pOut.print(value); } pOut.println("?>"); }
/** * This will build a JDOM ProcessingInstruction from an existing DOM ProcessingInstruction * * @param pi <code> org.w3c.dom.ProcessingInstruction</code> object * @return <code>ProcessingInstruction</code> - JDOM ProcessingInstruction object * @since JDOM2 */ public org.jdom2.ProcessingInstruction build(org.w3c.dom.ProcessingInstruction pi) { return factory.processingInstruction(pi.getTarget(), pi.getData()); }
private void visit( Node n ) throws SAXException { setCurrentLocation( n ); // if a case statement gets too big, it should be made into a separate method. switch(n.getNodeType()) { case Node.CDATA_SECTION_NODE: case Node.TEXT_NODE: String value = n.getNodeValue(); receiver.characters( value.toCharArray(), 0, value.length() ); break; case Node.ELEMENT_NODE: visit( (Element)n ); break; case Node.ENTITY_REFERENCE_NODE: receiver.skippedEntity(n.getNodeName()); break; case Node.PROCESSING_INSTRUCTION_NODE: ProcessingInstruction pi = (ProcessingInstruction)n; receiver.processingInstruction(pi.getTarget(),pi.getData()); break; } }
/** * @param xmlNode XML node * @param xmlStreamWriter XML stream writer * @throws XMLStreamException the XML stream exception */ public static void writeNode(Node xmlNode, XMLStreamWriter xmlStreamWriter) throws XMLStreamException { if (xmlNode instanceof Element) { addElement((Element) xmlNode, xmlStreamWriter); } else if (xmlNode instanceof Text) { xmlStreamWriter.writeCharacters(xmlNode.getNodeValue()); } else if (xmlNode instanceof CDATASection) { xmlStreamWriter.writeCData(((CDATASection) xmlNode).getData()); } else if (xmlNode instanceof Comment) { xmlStreamWriter.writeComment(((Comment) xmlNode).getData()); } else if (xmlNode instanceof EntityReference) { xmlStreamWriter.writeEntityRef(xmlNode.getNodeValue()); } else if (xmlNode instanceof ProcessingInstruction) { ProcessingInstruction procInst = (ProcessingInstruction) xmlNode; xmlStreamWriter.writeProcessingInstruction(procInst.getTarget(), procInst.getData()); } else if (xmlNode instanceof Document) { writeToDocument((Document) xmlNode, xmlStreamWriter); } }
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); }
public String getPITarget() { if (event == PROCESSING_INSTRUCTION) { return ((ProcessingInstruction)node).getTarget(); } else { throw new IllegalStateException(); } }
/** * Constructor for creating a processing instruction from a DOM node. * Originally provided by Erdal Karaca. * @param pi DOM node */ public FPI(final ProcessingInstruction pi) { this(pi.getTarget(), pi.getData()); }
private static void _writeProcessingInstruction (@Nonnull final XMLEmitter aXMLWriter, @Nonnull final ProcessingInstruction aPI) { aXMLWriter.onProcessingInstruction (aPI.getTarget (), aPI.getData ()); }
protected void printPI(ProcessingInstruction instruction, boolean endWithComma) { printIndent(); print("mkp.pi(" + qt); print(instruction.getTarget()); print(qt + ", " + qt); print(instruction.getData()); printEnd(qt + ");", endWithComma); }