01: /*
02: * $Id: TextHandler.java 265 2004-04-15 13:08:31Z hengels $
03: * (c) Copyright 2004 con:cern development team.
04: *
05: * This file is part of con:cern (http://concern.sf.net).
06: *
07: * con:cern is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2.1
10: * of the License, or (at your option) any later version.
11: *
12: * Please see COPYING for the complete licence.
13: */
14: package org.concern.model.cpd;
15:
16: import org.xml.sax.Attributes;
17: import org.xml.sax.SAXException;
18:
19: public class TextHandler extends ScopeHandler {
20: private StringBuffer text = new StringBuffer();
21:
22: public TextHandler() {
23: }
24:
25: public String getText() {
26: return text.toString();
27: }
28:
29: public void startElement(String uri, String localName,
30: String qName, Attributes attributes) throws SAXException {
31: text.setLength(0);
32: }
33:
34: public void characters(char ch[], int start, int length)
35: throws SAXException {
36: text.append(new String(ch, start, length));
37: }
38:
39: public void endElement(String uri, String localName, String qName)
40: throws SAXException {
41: }
42:
43: public ScopeHandler getHandler(String localName, String qName) {
44: throw new RuntimeException("unexpected tag " + localName + " "
45: + qName);
46: }
47:
48: public void fetchChild(ScopeHandler handler) {
49: }
50: }
|