1.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/EchoContentHandler.java Sun Jun 08 11:24:03 2014 +0200
1.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/EchoContentHandler.java Sun Jun 08 15:00:19 2014 +0200
1.3 @@ -17,6 +17,7 @@
1.4 */
1.5 package cz.frantovo.alt2xml.cli;
1.6
1.7 +import java.util.logging.Logger;
1.8 import javax.xml.stream.XMLStreamException;
1.9 import javax.xml.stream.XMLStreamWriter;
1.10 import org.xml.sax.Attributes;
1.11 @@ -34,6 +35,7 @@
1.12 */
1.13 public class EchoContentHandler extends DefaultHandler {
1.14
1.15 + private static final Logger log = Logger.getLogger(EchoContentHandler.class.getName());
1.16 private XMLStreamWriter w;
1.17
1.18 /**
1.19 @@ -98,4 +100,49 @@
1.20 throw new SAXException(e);
1.21 }
1.22 }
1.23 +
1.24 + /**
1.25 + * LexicalHandler methods
1.26 + *
1.27 + * @Override
1.28 + * public void startDTD(String name, String publicId, String systemId) throws SAXException {
1.29 + * log.log(Level.WARNING, "Start of DTD: {0} | {1} | {2}", new Object[]{name, publicId,
1.30 + * systemId});
1.31 + * }
1.32 + *
1.33 + * @Override
1.34 + * public void endDTD() throws SAXException {
1.35 + * log.log(Level.WARNING, "End of DTD");
1.36 + * }
1.37 + *
1.38 + * @Override
1.39 + * public void startEntity(String name) throws SAXException {
1.40 + * log.log(Level.WARNING, "Start of Entity: {0}", name);
1.41 + * }
1.42 + *
1.43 + * @Override
1.44 + * public void endEntity(String name) throws SAXException {
1.45 + * log.log(Level.WARNING, "End of Entity: {0}", name);
1.46 + * }
1.47 + *
1.48 + * @Override
1.49 + * public void startCDATA() throws SAXException {
1.50 + * log.log(Level.WARNING, "Start of CDATA");
1.51 + * }
1.52 + *
1.53 + * @Override
1.54 + * public void endCDATA() throws SAXException {
1.55 + * log.log(Level.WARNING, "End of CDATA");
1.56 + * }
1.57 + *
1.58 + * @Override
1.59 + * public void comment(char[] ch, int start, int length) throws SAXException {
1.60 + * try {
1.61 + * w.writeComment(new String(ch, start, length));
1.62 + * w.flush();
1.63 + * } catch (XMLStreamException e) {
1.64 + * throw new SAXException(e);
1.65 + * }
1.66 + * }
1.67 + */
1.68 }