2
* =========================================
3
* LibXML : a free Java layouting library
4
* =========================================
6
* Project Info: http://reporting.pentaho.org/libxml/
8
* (C) Copyright 2006-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
10
* This library is free software; you can redistribute it and/or modify it under the terms
11
* of the GNU Lesser General Public License as published by the Free Software Foundation;
12
* either version 2.1 of the License, or (at your option) any later version.
14
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
* See the GNU Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public License along with this
19
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20
* Boston, MA 02111-1307, USA.
22
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
23
* in the United States and other countries.]
27
* $Id: StringReadHandler.java 3518 2007-10-16 10:26:53Z tmorgner $
29
* (C) Copyright 2006-2007, by Pentaho Corporation.
31
package org.jfree.xmlns.parser;
33
import org.xml.sax.Attributes;
34
import org.xml.sax.SAXException;
37
* A XmlReadHandler that reads character-data for the given element.
39
* @author Thomas Morgner
41
public class StringReadHandler extends AbstractXmlReadHandler
45
* A buffer containing the characters read so far.
47
private StringBuffer buffer;
50
* The string under construction.
52
private String result;
55
* Creates a new handler.
57
public StringReadHandler ()
65
* @param attrs the attributes.
66
* @throws SAXException if there is a parsing error.
68
protected void startParsing (final Attributes attrs)
71
this.buffer = new StringBuffer();
75
* This method is called to process the character data between element tags.
77
* @param ch the character buffer.
78
* @param start the start index.
79
* @param length the length.
80
* @throws SAXException if there is a parsing error.
82
public void characters (final char[] ch, final int start, final int length)
85
this.buffer.append(ch, start, length);
91
* @throws SAXException if there is a parsing error.
93
protected void doneParsing ()
96
this.result = this.buffer.toString();
101
* Returns the result as string.
103
* @return the parse-result as string.
105
public String getResult ()
111
* Returns the object for this element.
113
* @return the object.
115
public Object getObject ()