@Override public void processingInstruction(String target, String data) { Node parent = getParent(); ProcessingInstruction pi = this.document.createProcessingInstruction(target, data); parent.appendChild(pi); }
public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { Node parent = nodeStack.peek(); Node n = document.createProcessingInstruction(target, data); parent.appendChild(n); }
@Override public void processingInstruction(String target, String data) { Node parent = getParent(); ProcessingInstruction pi = this.document.createProcessingInstruction(target, data); parent.appendChild(pi); }
/** * adds processing instruction node to DOM. */ public void processingInstruction(String target, String data) { final Node last = (Node)_nodeStk.peek(); ProcessingInstruction pi = _document.createProcessingInstruction( target, data); if (pi != null){ if (last == _root && _nextSibling != null) last.insertBefore(pi, _nextSibling); else last.appendChild(pi); _lastSibling = pi; } }
/** * Receive notification of a processing instruction. * * <p>The Parser will invoke this method once for each processing * instruction found: note that processing instructions may occur * before or after the main document element.</p> * * <p>A SAX parser should never report an XML declaration (XML 1.0, * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.</p> * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { append(m_doc.createProcessingInstruction(target, data)); }
/** * Adds a new * {@link org.w3c.dom.ProcessingInstruction ProcessingInstruction} to * the current node. * * @param target the processing instruction target * @param data the processing instruction data, or null if none was * supplied * @throws SAXException if the DOM implementation throws an exception */ @Override public void processingInstruction(String target, String data) throws SAXException { try { top.appendChild(doc.createProcessingInstruction(target, data)); } catch (DOMException e) { throw new SAXException(e.getMessage()); } }
/** * Receive notification of a processing instruction. * * <p>The Parser will invoke this method once for each processing * instruction found: note that processing instructions may occur * before or after the main document element.</p> * * <p>A SAX parser should never report an XML declaration (XML 1.0, * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.</p> * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. */ public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { append(m_doc.createProcessingInstruction(target, data)); }
/** * {@inheritDoc} * * @throws DOMException If thrown by method invoked on the underlying DOM document */ public void writePI(String target, String data) throws DOMException { deNude(); Node node = this.document.createProcessingInstruction(target, data); this.currentElement.appendChild(node); if (this.indent) { newLine(); } }
@Signature public Node createProcessingInstruction(String name, String value) { return getWrappedObject().createProcessingInstruction(name, value); }
DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document doc = docBuilder.newDocument(); doc.appendChild(doc.createProcessingInstruction( "xml-stylesheet", "type=\"text/xsl\" href=\"configuration.xsl\""));
DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document doc = docBuilder.newDocument(); doc.appendChild(doc.createProcessingInstruction( "xml-stylesheet", "type=\"text/xsl\" href=\"configuration.xsl\""));
/** * If available, when the disable-output-escaping attribute is used, * output raw text without escaping. A PI will be inserted in front * of the node with the name "lotusxsl-next-is-raw" and a value of * "formatter-to-dom". * * @param ch Array containing the characters * @param start Index to start of characters in the array * @param length Number of characters in the array */ public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { if(isOutsideDocElem() && org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createProcessingInstruction("xslt-next-is-raw", "formatter-to-dom")); append(m_doc.createTextNode(s)); }
/** * If available, when the disable-output-escaping attribute is used, * output raw text without escaping. A PI will be inserted in front * of the node with the name "lotusxsl-next-is-raw" and a value of * "formatter-to-dom". * * @param ch Array containing the characters * @param start Index to start of characters in the array * @param length Number of characters in the array */ public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { if(isOutsideDocElem() && org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createProcessingInstruction("xslt-next-is-raw", "formatter-to-dom")); append(m_doc.createTextNode(s)); }
/** * adds processing instruction node to DOM. */ public void processingInstruction(String target, String data) { final Node last = (Node) _nodeStk.peek(); ProcessingInstruction pi = _document.createProcessingInstruction( target, data); if (pi != null) last.appendChild(pi); }
public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { Node parent = nodeStack.peek(); Node n = document.createProcessingInstruction(target, data); parent.appendChild(n); }
Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Node n = d.createProcessingInstruction("test", null); System.out.println(domToString(n));
public void processingInstruction(String target, String data) throws SAXException { Node parent = getParent(); ProcessingInstruction pi = document.createProcessingInstruction(target, data); parent.appendChild(pi); }
protected void appendDOMTree(org.w3c.dom.Document domDoc, org.w3c.dom.Node domCurrent, ProcessingInstruction pi) { org.w3c.dom.ProcessingInstruction domPI = domDoc .createProcessingInstruction(pi.getTarget(), pi.getText()); domCurrent.appendChild(domPI); }
/** * This will handle printing of a {@link ProcessingInstruction}. * * @param fstack * the FormatStack * @param basedoc * The org.w3c.dom.Document for creating DOM Nodes * @param pi * <code>ProcessingInstruction</code> to write. * @return The input JDOM ProcessingInstruction converted to a DOM * ProcessingInstruction. */ protected org.w3c.dom.ProcessingInstruction printProcessingInstruction( final FormatStack fstack, final org.w3c.dom.Document basedoc, final ProcessingInstruction pi) { String target = pi.getTarget(); String rawData = pi.getData(); if (rawData == null || rawData.trim().length() == 0) { rawData = ""; } return basedoc.createProcessingInstruction(target, rawData); }
private void appendChild(Element e, XhtmlNode node) { if (node.getNodeType() == NodeType.Comment) e.appendChild(e.getOwnerDocument().createComment(node.getContent())); else if (node.getNodeType() == NodeType.DocType) throw new Error("not done yet"); else if (node.getNodeType() == NodeType.Instruction) e.appendChild(e.getOwnerDocument().createProcessingInstruction("", node.getContent())); else if (node.getNodeType() == NodeType.Text) e.appendChild(e.getOwnerDocument().createTextNode(node.getContent())); else if (node.getNodeType() == NodeType.Element) { Element child = e.getOwnerDocument().createElementNS(XHTML_NS, node.getName()); e.appendChild(child); for (XhtmlNode c : node.getChildNodes()) { appendChild(child, c); } } else throw new Error("Unknown node type: "+node.getNodeType().toString()); }