public final class XMLCopy extends org.xml.sax.helpers.DefaultHandler implements ContentHandler, LexicalHandler
This class also implements the LexicalHandler
interface, so that comments can be copied if the
XMLReader
reader supports the property.
Constructor and Description |
---|
XMLCopy(org.pageseeder.xmlwriter.XMLWriter xml)
Creates a new XMLExtractor wrapping the specified XML writer.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
comment(char[] ch,
int start,
int length)
Copy the comment to the output.
|
static boolean |
copyTo(File file,
org.pageseeder.xmlwriter.XMLWriter xml)
Copy the specified File to the given XML Writer.
|
static boolean |
copyTo(Reader reader,
org.pageseeder.xmlwriter.XMLWriter xml)
Copy the specified File to the given XML Writer.
|
void |
endCDATA()
Does nothing.
|
void |
endDTD()
Does nothing.
|
void |
endElement(String uri,
String localName,
String qName) |
void |
endEntity(String name)
Does nothing.
|
void |
processingInstruction(String target,
String data) |
void |
startCDATA()
Does nothing.
|
void |
startDTD(String name,
String publicId,
String systemId)
Does nothing.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes atts) |
void |
startEntity(String name)
Does nothing.
|
void |
startPrefixMapping(String prefix,
String uri) |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, resolveEntity, setDocumentLocator, skippedEntity, startDocument, unparsedEntityDecl, warning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
endDocument, endPrefixMapping, ignorableWhitespace, setDocumentLocator, skippedEntity, startDocument
public XMLCopy(org.pageseeder.xmlwriter.XMLWriter xml)
xml
- The XML writer to use.public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void comment(char[] ch, int start, int length) throws SAXException
comment
in interface LexicalHandler
SAXException
public void startCDATA() throws SAXException
startCDATA
in interface LexicalHandler
SAXException
public void endCDATA() throws SAXException
endCDATA
in interface LexicalHandler
SAXException
public void startDTD(String name, String publicId, String systemId) throws SAXException
startDTD
in interface LexicalHandler
SAXException
public void endDTD() throws SAXException
endDTD
in interface LexicalHandler
SAXException
public void startEntity(String name) throws SAXException
startEntity
in interface LexicalHandler
SAXException
public void endEntity(String name) throws SAXException
endEntity
in interface LexicalHandler
SAXException
public static boolean copyTo(File file, org.pageseeder.xmlwriter.XMLWriter xml) throws IOException
Any error is reported as XML on the XML writer.
This method does not perform any caching, caching is better handled externally by generators.
file
- The file.xml
- The XML writer.true
if the copy was done successfully;
false
otherwise.IOException
- should an error occur when writing the XML.public static boolean copyTo(Reader reader, org.pageseeder.xmlwriter.XMLWriter xml) throws IOException
Any error is reported as XML on the XML writer. This method does not perform any caching or validation.
reader
- The reader over the XML to read.xml
- The XML writer.true
if the copy was done successfully;
false
otherwise.IOException
- should an error occur when writing the XML.Copyright © 2016 Allette Systems. All rights reserved.