/[alph]/alph/org/nongnu/alph/xml/SpanReader.java
ViewVC logotype

Diff of /alph/org/nongnu/alph/xml/SpanReader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by tjl, Wed Mar 26 10:17:54 2003 UTC revision 1.3 by tjl, Sun Apr 6 06:56:08 2003 UTC
# Line 8  import java.util.List; Line 8  import java.util.List;
8    
9  /** A simple span serializer / deserializer.  /** A simple span serializer / deserializer.
10   * Just takes a sequence of spans and adds them to a list.   * Just takes a sequence of spans and adds them to a list.
11     * To clear the list between readings, call clear().
12   */   */
13    
14  public class SpanReader extends org.xml.sax.helpers.DefaultHandler  {  public class SpanReader extends org.xml.sax.helpers.DefaultHandler  {
# Line 22  public class SpanReader extends org.xml. Line 23  public class SpanReader extends org.xml.
23    
24      private ArrayList spans = new ArrayList();      private ArrayList spans = new ArrayList();
25    
26        /** Empty this SpanReader for another read operation.
27         */
28        public void clear() { spans.clear(); }
29    
30      public List getSpans() { return spans; }      public List getSpans() { return spans; }
31    
32      public  void startElement(String uri, String localName, String qName,      public  void startElement(String uri, String localName, String qName,
33                              org.xml.sax.Attributes attributes)  {                              org.xml.sax.Attributes attributes)  {
34          if(dbg) pa("Se: '"+uri+"' '"+localName+"' '"+qName+"'");          if(dbg) pa("Se: '"+uri+"' '"+localName+"' '"+qName+"'");
35            // Wrapper element
36            if(qName.equals("alph")) return;
37          if(qName.equals("ts")) {          if(qName.equals("ts")) {
38              String b = attributes.getValue("b");              String b = attributes.getValue("b");
39              int s = Integer.parseInt(attributes.getValue("s"));              int s = Integer.parseInt(attributes.getValue("s"));

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26