1
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, Locator locator) {
27 super(namespaceURI, localName, qName, locator);
28
29 this.attributes = new AttributesImpl(attributes);
30 this.elementPath = elementPath;
31 }
32
33 public Attributes getAttributes() {
34 return attributes;
35 }
36
37 @Override
38 public String toString() {
39 StringBuilder b = new StringBuilder("StartEvent(");
40 b.append(getQName());
41 if(attributes != null) {
42 for(int i = 0; i < attributes.getLength(); i++) {
43 if(i > 0)
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 }
57