2 * BioJava development code
4 * This code may be freely distributed and modified under the
5 * terms of the GNU Lesser General Public Licence. This should
6 * be distributed with the code. If you do not have a copy,
9 * http://www.gnu.org/copyleft/lesser.html
11 * Copyright for this code is held jointly by the individual
12 * authors. These should be listed in @author doc comments.
14 * For more information on the BioJava project and its aims,
15 * or to join the biojava-l mailing list, visit the home page
18 * http://www.biojava.org/
20 * Created on 19.03.2004
21 * @author Andreas Prlic
24 package org.biojava.dasobert.das;
27 import org.xml.sax.helpers.DefaultHandler;
28 import org.xml.sax.Attributes ;
29 import java.util.logging.* ;
32 * a class that parses the XML response of a DAS - sequence command.
33 * @author Andreas Prlic
36 public class DAS_Sequence_Handler extends DefaultHandler {
44 public DAS_Sequence_Handler() {
46 // TODO Auto-generated constructor stub
52 public void startElement (String uri, String name, String qName, Attributes atts){
54 if ( qName.equals("SEQUENCE")){
55 //System.out.println("new element >" + name + "< >" + qName+"<");
57 String lenstr = atts.getValue("stop");
58 length = Integer.parseInt(lenstr);
64 public void characters (char ch[], int start, int length){
65 //System.out.print("Characters: \"");
67 for (int i = start; i < start + length; i++) {
70 //System.out.print("\\\\");
73 //System.out.print("\\\"");
76 //System.out.print("\\n");
79 //System.out.print("\\r");
82 //System.out.print("\\t");
87 sequence = sequence + ch[i];
88 //System.out.print(ch[i]);
92 //System.out.print("\"\n");
96 public String get_sequence() {
97 if ( length != sequence.length()) {
98 Logger logger = Logger.getLogger("org.biojava.spice");
99 logger.warning("Sequence does not match specified length!");