/** * Escapes and outputs the given characters. */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { characters(ch, start, length); }
/** * Escapes and outputs the given characters. */ public void characters(char[] ch, int start, int length) throws SAXException { closeStartTagIfOpen(); write(ch, start, length, false); }
/** * Starts the XML serialization by outputting the <?xml?> header. */ public void startDocument() throws SAXException { processingInstruction("xml", declaration); }
@Override public void exportDocumentView(String absPath, OutputStream out, boolean binaryAsLink, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(out); exportDocumentView(absPath, handler, binaryAsLink, noRecurse); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException("Error serializing document view XML", e); } } }
/** * Serializes a processing instruction. */ public void processingInstruction(String target, String data) throws SAXException { closeStartTagIfOpen(); try { writer.write("<?"); writer.write(target); if (data != null) { writer.write(" "); writer.write(data); } writer.write("?>"); } catch (IOException e) { throw new SAXException( "Failed to output XML processing instruction: " + target, e); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (rootStarted) { super.startElement(uri, localName, qName, attributes); } else if (usedNamespaceURISet == null) { super.startElement(uri, localName, qName, attributes); rootStarted = true; } else { Set<String> ignoringQNameSet = new HashSet<String>(); for (int i = 0; i < attributes.getLength(); i++) { String attrQName = attributes.getQName(i); if (attrQName.startsWith("xmlns:") && !"xmlns:sv".equals(attrQName)) { String namespaceURI = attributes.getValue(i); if (!usedNamespaceURISet.contains(namespaceURI)) { ignoringQNameSet.add(attributes.getQName(i)); } } } FilteredOutDelegatingAttributes filteredOutAttributes = new FilteredOutDelegatingAttributes(attributes, ignoringQNameSet); super.startElement(uri, localName, qName, filteredOutAttributes); rootStarted = true; } } };
@Override public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new DocumentViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing document view XML", e); } } }
/** * Serializes a processing instruction. */ public void processingInstruction(String target, String data) throws SAXException { closeStartTagIfOpen(); try { writer.write("<?"); writer.write(target); if (data != null) { writer.write(" "); writer.write(data); } writer.write("?>"); } catch (IOException e) { throw new SAXException( "Failed to output XML processing instruction: " + target, e); } }
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new SystemViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing system view XML", e); } } }
/** * Escapes and outputs the given characters. */ public void characters(char[] ch, int start, int length) throws SAXException { closeStartTagIfOpen(); write(ch, start, length, false); }
/** * Escapes and outputs the given characters. */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { characters(ch, start, length); }
/** * Starts the XML serialization by outputting the <?xml?> header. */ public void startDocument() throws SAXException { processingInstruction("xml", declaration); }
/** * Serializes a processing instruction. */ public void processingInstruction(String target, String data) throws SAXException { closeStartTagIfOpen(); try { writer.write("<?"); writer.write(target); if (data != null) { writer.write(" "); writer.write(data); } writer.write("?>"); } catch (IOException e) { throw new SAXException( "Failed to output XML processing instruction: " + target, e); } }
@Override public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new DocumentViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing document view XML", e); } } }
/** * Escapes and outputs the given characters. */ public void characters(char[] ch, int start, int length) throws SAXException { closeStartTagIfOpen(); write(ch, start, length, false); }
/** * Escapes and outputs the given characters. */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { characters(ch, start, length); }
/** * Starts the XML serialization by outputting the <?xml?> header. */ public void startDocument() throws SAXException { processingInstruction("xml", declaration); }
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new SystemViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing system view XML", e); } } }
/** * Outputs the specified start tag with the given attributes. */ public void startElement( String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { closeStartTagIfOpen(); try { writer.write("<"); writer.write(qName); for (int i = 0; i < atts.getLength(); i++) { writer.write(" "); writer.write(atts.getQName(i)); writer.write("=\""); char[] ch = atts.getValue(i).toCharArray(); write(ch, 0, ch.length, true); writer.write("\""); } startTagIsOpen = true; } catch (IOException e) { throw new SAXException( "Failed to output XML end tag: " + qName, e); } }
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new SystemViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing system view XML", e); } } }