View Javadoc
1   
2   package eu.simuline.util.sgml;
3   
4   import org.xml.sax.ContentHandler;
5   import org.xml.sax.Locator;
6   import org.xml.sax.SAXException;
7   import org.xml.sax.Attributes;
8   
9   /**
10   * A <code>ContentHandler</code> which reports certain events 
11   * to {@link System#out}. 
12   *
13   * @author <a href="mailto:ernst.reissner@simuline.eu">Ernst Reissner</a>
14   * @version 1.0
15   */
16  class ReportContentHandler implements ContentHandler {
17  
18      /** <!-- api-docs inherited from interface implemented.  -->*/ 
19      public void setDocumentLocator(Locator locator) {
20  	// is empty. 
21      }
22  
23      public void startDocument() throws SAXException {
24  	System.out.println("start of document");
25      }
26  
27      public void endDocument() throws SAXException {
28  	System.out.println("end of document");
29      }
30  
31      public void startPrefixMapping(String prefix,
32  				   String uri)
33  	throws SAXException {
34  	// is empty. 
35      }
36  
37      public void endPrefixMapping(String prefix)
38  	throws SAXException {
39  	// is empty. 
40      }
41  
42      public void startElement(String namespaceURI,
43  			     String localName,
44  			     String qName,
45  			     Attributes atts)
46  	throws SAXException {
47  	System.out.println("T<" + qName + ">");
48      }
49  
50      public void endElement(String namespaceURI,
51  			   String localName,
52  			   String qName)
53  	throws SAXException {
54  	System.out.println("T</" + qName + ">");
55      }
56  
57      public void characters(char[] chr,
58  			   int start,
59  			   int length)
60  	throws SAXException {
61  	// is empty. 
62      }
63  
64      public void ignorableWhitespace(char[] chr,
65  				    int start,
66  				    int length)
67  	throws SAXException {
68  	// is empty. 
69      }
70  
71      public void processingInstruction(String target,
72  				      String data)
73  	throws SAXException {
74  	System.out.println("P<" + target + ">");
75      }
76  
77      public void skippedEntity(String name)
78  	throws SAXException {
79  	// is empty. 
80      }
81  
82  } // class ReportContentHandler