View Javadoc

1   /*
2    * Created on Feb 8, 2005
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package net.sf.gumshoe.indexer;
8   
9   import java.io.Reader;
10  import java.io.StringReader;
11  
12  import org.xml.sax.Attributes;
13  import org.xml.sax.ContentHandler;
14  import org.xml.sax.Locator;
15  import org.xml.sax.SAXException;
16  
17  
18  /***
19   * @author Gabor
20   *
21   * TODO To change the template for this generated type comment go to
22   * Window - Preferences - Java - Code Style - Code Templates
23   */
24  public class XMLSAXHandler implements ContentHandler {
25  	  /*** A buffer for all XML cdata */
26  	  private StringBuffer content = new StringBuffer();
27  
28  	  public Reader getContent() {
29  	    return new StringReader(content.toString());
30  	  }
31  
32  	/* (non-Javadoc)
33  	 * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
34  	 */
35  	public void setDocumentLocator(Locator locator) {
36  		// TODO Auto-generated method stub		
37  	}
38  
39  	/* (non-Javadoc)
40  	 * @see org.xml.sax.ContentHandler#startDocument()
41  	 */
42  	public void startDocument() throws SAXException {
43  		// TODO Auto-generated method stub
44  		content=new StringBuffer();
45  	}
46  
47  	/* (non-Javadoc)
48  	 * @see org.xml.sax.ContentHandler#endDocument()
49  	 */
50  	public void endDocument() throws SAXException {
51  		// TODO Auto-generated method stub		
52  	}
53  
54  	/* (non-Javadoc)
55  	 * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String)
56  	 */
57  	public void startPrefixMapping(String prefix, String uri) throws SAXException {
58  		// TODO Auto-generated method stub
59  		
60  	}
61  
62  	/* (non-Javadoc)
63  	 * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
64  	 */
65  	public void endPrefixMapping(String prefix) throws SAXException {
66  		// TODO Auto-generated method stub
67  		
68  	}
69  
70  	/* (non-Javadoc)
71  	 * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
72  	 */
73  	public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
74  		// TODO Auto-generated method stub
75  		
76  	}
77  
78  	/* (non-Javadoc)
79  	 * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
80  	 */
81  	public void endElement(String uri, String localName, String qName) throws SAXException {
82  		// TODO Auto-generated method stub
83  		content.append(" ");
84  	}
85  
86  	/* (non-Javadoc)
87  	 * @see org.xml.sax.ContentHandler#characters(char[], int, int)
88  	 */
89  	public void characters(char[] ch, int start, int length) throws SAXException {
90  		// TODO Auto-generated method stub
91  		content.append(ch, start, length);
92  	}
93  
94  	/* (non-Javadoc)
95  	 * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
96  	 */
97  	public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
98  		// TODO Auto-generated method stub
99  		
100 	}
101 
102 	/* (non-Javadoc)
103 	 * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String)
104 	 */
105 	public void processingInstruction(String target, String data) throws SAXException {
106 		// TODO Auto-generated method stub
107 		
108 	}
109 
110 	/* (non-Javadoc)
111 	 * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
112 	 */
113 	public void skippedEntity(String name) throws SAXException {
114 		// TODO Auto-generated method stub
115 		
116 	}
117 }