1 package net.jaekl.cfb.xml;
3 import java.io.PrintWriter;
4 import java.util.ArrayList;
6 import org.xml.sax.Attributes;
8 import net.jaekl.qd.xml.MissingAttributeException;
9 import net.jaekl.qd.xml.ParseResult;
10 import net.jaekl.qd.xml.XmlParseException;
12 public class BugClass extends ParseResult {
14 static final String TAG = "Class";
15 static final String[] INTERNAL = { };
16 static final Object[][] EXTERNAL = { { SourceLine.TAG, SourceLine.class} };
18 static final String CLASS_NAME = "classname";
21 ArrayList<SourceLine> m_lines;
24 super(TAG, INTERNAL, EXTERNAL);
26 m_lines = new ArrayList<SourceLine>();
29 public String getClassName() { return m_className; }
30 public SourceLine[] getSourceLines() { return m_lines.toArray(new SourceLine[m_lines.size()]); }
33 public void handleMainAttributes(Attributes attr) throws MissingAttributeException
35 m_className = getRequiredAttr(TAG, attr, CLASS_NAME);
39 public void endContents(String uri, String localName, String qName, String chars)
40 throws XmlParseException
45 public void endExternal(String uri, String localName, String qName)
46 throws XmlParseException
48 if (SourceLine.TAG.equals(localName)) {
49 ParseResult[] collected = collectParsedChildren(SourceLine.class);
50 for (ParseResult pr : collected) {
51 assert(pr instanceof SourceLine);
52 m_lines.add((SourceLine)pr);
58 public void dump(PrintWriter pw, int indent)
60 super.dump(pw, indent);
61 String tab = String.format("%" + (indent + 2) + "s", "");
63 pw.println(tab + CLASS_NAME + "=" + m_className);
64 if (null != m_lines) {
65 for (SourceLine sl : m_lines) {
66 sl.dump(pw, indent + 2);