1 package net.jaekl.cfb.xml;
3 import java.io.PrintWriter;
5 import net.jaekl.qd.xml.MissingAttributeException;
6 import net.jaekl.qd.xml.ParseResult;
7 import net.jaekl.qd.xml.XmlParseException;
9 import org.xml.sax.Attributes;
11 public class SourceLine extends ParseResult {
13 static final String TAG = "SourceLine";
14 static final String[] INTERNAL = { };
15 static final Object[][] EXTERNAL = { };
17 static final String ATTR_CLASS_NAME = "classname";
18 static final String ATTR_START = "start";
19 static final String ATTR_END = "end";
26 super(TAG, INTERNAL, EXTERNAL);
28 m_start = m_end = (-1);
31 public String getClassName() { return m_className; }
32 public int getStart() { return m_start; }
33 public int getEnd() { return m_end; }
36 public void handleMainAttributes(Attributes attr) throws MissingAttributeException {
39 m_className = getRequiredAttr(TAG, attr, ATTR_CLASS_NAME);
41 scratch = getOptionalAttr(attr, ATTR_START, "-1");
42 m_start = Integer.parseInt(scratch);
44 scratch = getOptionalAttr(attr, ATTR_END, "-1");
45 m_end = Integer.parseInt(scratch);
49 public void endContents(String uri, String localName, String qName, String chars)
50 throws XmlParseException
56 public void endExternal(String uri, String localName, String qName)
57 throws XmlParseException
63 public void dump(PrintWriter pw, int indent)
65 super.dump(pw, indent);
66 String tab = String.format("%" + (indent + 2) + "s", "");
68 pw.println(tab + m_className + " (" + m_start + " .. " + m_end + ")");