~ubuntu-branches/ubuntu/quantal/libxml-java/quantal

« back to all changes in this revision

Viewing changes to source/org/jfree/xmlns/parser/StringReadHandler.java

  • Committer: Package Import Robot
  • Author(s): tony mancill, Miguel Landaeta, tony mancill
  • Date: 2011-12-23 09:07:02 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20111223090702-wvpt3s2m696owb5d
Tags: 1.1.6.dfsg-3
[Miguel Landaeta]
* Team upload.
* Add Build-Depends on ant-optional. (Closes: #652753).
* Bump Standards-Version to 3.9.2. No changes were required.
* Switch to source format 3.0 (quilt).
* Remove deprecated simple-patchsys management patch system.

[tony mancill]
* Add Vcs-Git and Vcs-Browser to d/control. (Closes: #653038)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * =========================================
3
 
 * LibXML : a free Java layouting library
4
 
 * =========================================
5
 
 *
6
 
 * Project Info:  http://reporting.pentaho.org/libxml/
7
 
 *
8
 
 * (C) Copyright 2006-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
9
 
 *
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.
13
 
 *
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.
17
 
 *
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.
21
 
 *
22
 
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
23
 
 * in the United States and other countries.]
24
 
 *
25
 
 *
26
 
 * ------------
27
 
 * $Id: StringReadHandler.java 3518 2007-10-16 10:26:53Z tmorgner $
28
 
 * ------------
29
 
 * (C) Copyright 2006-2007, by Pentaho Corporation.
30
 
 */
31
 
package org.jfree.xmlns.parser;
32
 
 
33
 
import org.xml.sax.Attributes;
34
 
import org.xml.sax.SAXException;
35
 
 
36
 
/**
37
 
 * A XmlReadHandler that reads character-data for the given element.
38
 
 *
39
 
 * @author Thomas Morgner
40
 
 */
41
 
public class StringReadHandler extends AbstractXmlReadHandler
42
 
{
43
 
 
44
 
  /**
45
 
   * A buffer containing the characters read so far.
46
 
   */
47
 
  private StringBuffer buffer;
48
 
 
49
 
  /**
50
 
   * The string under construction.
51
 
   */
52
 
  private String result;
53
 
 
54
 
  /**
55
 
   * Creates a new handler.
56
 
   */
57
 
  public StringReadHandler ()
58
 
  {
59
 
    super();
60
 
  }
61
 
 
62
 
  /**
63
 
   * Starts parsing.
64
 
   *
65
 
   * @param attrs the attributes.
66
 
   * @throws SAXException if there is a parsing error.
67
 
   */
68
 
  protected void startParsing (final Attributes attrs)
69
 
          throws SAXException
70
 
  {
71
 
    this.buffer = new StringBuffer();
72
 
  }
73
 
 
74
 
  /**
75
 
   * This method is called to process the character data between element tags.
76
 
   *
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.
81
 
   */
82
 
  public void characters (final char[] ch, final int start, final int length)
83
 
          throws SAXException
84
 
  {
85
 
    this.buffer.append(ch, start, length);
86
 
  }
87
 
 
88
 
  /**
89
 
   * Done parsing.
90
 
   *
91
 
   * @throws SAXException       if there is a parsing error.
92
 
   */
93
 
  protected void doneParsing ()
94
 
          throws SAXException
95
 
  {
96
 
    this.result = this.buffer.toString();
97
 
    this.buffer = null;
98
 
  }
99
 
 
100
 
  /**
101
 
   * Returns the result as string.
102
 
   *
103
 
   * @return the parse-result as string.
104
 
   */
105
 
  public String getResult ()
106
 
  {
107
 
    return result;
108
 
  }
109
 
 
110
 
  /**
111
 
   * Returns the object for this element.
112
 
   *
113
 
   * @return the object.
114
 
   */
115
 
  public Object getObject ()
116
 
  {
117
 
    return this.result;
118
 
  }
119
 
}