1 |
|
|
2 |
|
|
3 |
|
package net.jaekl.qd.xml; |
4 |
|
|
5 |
|
import java.util.ArrayList; |
6 |
|
|
7 |
|
public class MissingInfoException extends XmlParseException |
8 |
|
{ |
9 |
|
private static final long serialVersionUID = 1L; |
10 |
|
|
11 |
|
String m_tagName; |
12 |
|
ArrayList<String> m_missingAttributes; |
13 |
|
ArrayList<String> m_missingChildTags; |
14 |
|
|
15 |
|
public MissingInfoException(String tagName) { |
16 |
Block: 1/1 |
super(); |
17 |
|
m_tagName = tagName; |
18 |
|
m_missingAttributes = new ArrayList<String>(); |
19 |
|
m_missingChildTags = new ArrayList<String>(); |
20 |
|
} |
21 |
|
|
22 |
|
public void addMissingAttribute(String name) { |
23 |
Block: 1/1 |
m_missingAttributes.add(name); |
24 |
|
} |
25 |
|
|
26 |
|
public void addMissingChild(String name) { |
27 |
Block: 1/1 |
m_missingChildTags.add(name); |
28 |
|
} |
29 |
|
|
30 |
Block: 1/1 |
public String getTagName() { return m_tagName; } |
31 |
|
|
32 |
|
@Override |
33 |
|
public String getMessage() { |
34 |
Block: 1/1 |
StringBuilder sb = new StringBuilder(); |
35 |
|
|
36 |
|
sb.append("Tag: \"" + getTagName() + "\""); |
37 |
|
|
38 |
|
for (String attr : m_missingAttributes) { |
39 |
Block: 1/1 Branch: 1/1 |
sb.append("\n Attribute: \"" + attr + "\""); |
40 |
|
} |
41 |
|
|
42 |
Block: 1/1 Branch: 1/1 |
for (String child : m_missingChildTags) { |
43 |
Block: 1/1 Branch: 1/1 |
sb.append("\n Child tag: \"" + child + "\""); |
44 |
|
} |
45 |
Block: 1/1 Branch: 1/1 |
return sb.toString(); |
46 |
|
} |
47 |
|
} |