fb198688068f58353ed80c3dd93bdbb65d4db1a1
[cfb.git] / prod / net / jaekl / cfb / xml / LocalVariable.java
1 package net.jaekl.cfb.xml;
2
3 import java.io.PrintWriter;
4
5 import org.xml.sax.Attributes;
6
7 import net.jaekl.qd.xml.MissingAttributeException;
8 import net.jaekl.qd.xml.ParseResult;
9 import net.jaekl.qd.xml.XmlParseException;
10
11 public class LocalVariable extends ParseResult {
12
13         static final String TAG = "LocalVariable";
14         static final String[] INTERNAL = { };
15         static final Object[][] EXTERNAL = { };
16
17         static final String NAME = "name";
18         static final String ROLE = "role";
19         
20         String m_name;
21         String m_role;
22         
23         public LocalVariable() {
24                 super(TAG, INTERNAL, EXTERNAL);
25                 
26                 m_name = m_role = null;
27         }
28         
29         @Override
30         public void handleMainAttributes(Attributes attr)
31                 throws MissingAttributeException
32         {
33                 m_name = getRequiredAttr(TAG, attr, NAME);
34                 m_role = getRequiredAttr(TAG, attr, ROLE);
35         }
36         
37         @Override
38         public void endContents(String uri, String localName, String qName, String chars) 
39                 throws XmlParseException 
40         {
41         }
42
43         @Override
44         public void endExternal(String uri, String localName, String qName)
45                 throws XmlParseException 
46         {
47                 // no-op
48         }
49         
50         @Override
51         public void dump(PrintWriter pw, int indent) 
52         {
53                 super.dump(pw, indent);
54                 String tab = String.format("%" + (indent + 2) + "s", "");
55                 
56                 pw.println(tab + NAME + "=" + m_name);
57                 pw.println(tab + ROLE + "=" + m_role);
58         }
59 }