1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.joran.event;
15
16 import ch.qos.logback.core.joran.spi.ElementPath;
17 import org.xml.sax.Attributes;
18 import org.xml.sax.Locator;
19 import org.xml.sax.helpers.AttributesImpl;
20
21 public class StartEvent extends SaxEvent {
22
23 final public Attributes attributes;
24 final public ElementPath elementPath;
25
26 StartEvent(ElementPath elementPath, String namespaceURI, String localName, String qName, Attributes attributes,
27 Locator locator) {
28 super(namespaceURI, localName, qName, locator);
29
30 this.attributes = new AttributesImpl(attributes);
31 this.elementPath = elementPath;
32 }
33
34 public Attributes getAttributes() {
35 return attributes;
36 }
37
38 @Override
39 public String toString() {
40 StringBuilder b = new StringBuilder("StartEvent(");
41 b.append(getQName());
42 if (attributes != null) {
43 for (int i = 0; i < attributes.getLength(); i++) {
44 b.append(' ');
45 b.append(attributes.getLocalName(i)).append("=\"").append(attributes.getValue(i)).append("\"");
46 }
47 }
48 b.append(") [");
49 b.append(locator.getLineNumber());
50 b.append(",");
51 b.append(locator.getColumnNumber());
52 b.append("]");
53 return b.toString();
54 }
55
56 }