/** * SAX ContentHandler API. * * <p>Detect and use the oasis-xml-catalog PI if it occurs. */ public void processingInstruction(String target, String pidata) throws SAXException { if (target.equals("oasis-xml-catalog")) { URL catalog = null; String data = pidata; int pos = data.indexOf("catalog="); if (pos >= 0) { data = data.substring(pos + 8); if (data.length() > 1) { String quote = data.substring(0, 1); data = data.substring(1); pos = data.indexOf(quote); if (pos >= 0) { data = data.substring(0, pos); try { if (baseURL != null) { catalog = new URL(baseURL, data); } else { catalog = new URL(data); } } catch (MalformedURLException mue) { // nevermind } } } } if (allowXMLCatalogPI) { if (catalogManager.getAllowOasisXMLCatalogPI()) { catalogManager.debug.message(4, "oasis-xml-catalog PI", pidata); if (catalog != null) { try { catalogManager.debug.message(4, "oasis-xml-catalog", catalog.toString()); oasisXMLCatalogPI = true; if (piCatalogResolver == null) { piCatalogResolver = new CatalogResolver(true); } piCatalogResolver.getCatalog().parseCatalog(catalog.toString()); } catch (Exception e) { catalogManager.debug.message( 3, "Exception parsing oasis-xml-catalog: " + catalog.toString()); } } else { catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata); } } else { catalogManager.debug.message(4, "PI oasis-xml-catalog ignored: " + pidata); } } else { catalogManager.debug.message( 3, "PI oasis-xml-catalog occurred in an invalid place: " + pidata); } } else { super.processingInstruction(target, pidata); } }
public void processingInstruction(String target, String data) throws SAXException { StackContext stackEntry = stack.peek(); SaxEventBufferBuilder bufferBuilder = stackEntry.bufferBuilder; if (bufferBuilder != null) { bufferBuilder.processingInstruction(target, data); } super.processingInstruction(target, data); }
public void processingInstruction(String target, String data) throws SAXException { try { indent(); writer.write("<?"); writer.write(target); writer.write(" "); writer.write(data); writer.write("?>"); writePrintln(); lastOutputNodeType = Node.PROCESSING_INSTRUCTION_NODE; super.processingInstruction(target, data); } catch (IOException e) { handleException(e); } }
/** * Write a processing instruction. * * <p>Pass the event on down the filter chain for further processing. * * @param target The PI target. * @param data The PI data. * @exception org.xml.sax.SAXException If there is an error writing the PI, or if a handler * further down the filter chain raises an exception. * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) */ public void processingInstruction(String target, String data) throws SAXException { try { if (!startTagIsClosed) { write('>'); startTagIsClosed = true; } write("<?"); write(target); write(' '); write(data); write("?>"); if (elementLevel < 1) { write('\n'); } super.processingInstruction(target, data); } catch (IOException e) { throw new SAXException(e); } }
/** * <i>[SAX ContentHandler interface support]</i> Receives notification of a processing * instruction. */ public void processingInstruction(String target, String data) throws SAXException { this.ensureInitialization(); super.processingInstruction(target, data); }