1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.bea.xml.stream.events;
17
18 import com.bea.xml.stream.util.EmptyIterator;
19
20 import java.util.ArrayList;
21 import java.util.List;
22 import java.util.Iterator;
23
24 import javax.xml.namespace.QName;
25 import javax.xml.stream.events.Attribute;
26 import javax.xml.stream.events.Namespace;
27 import javax.xml.stream.events.XMLEvent;
28 import javax.xml.stream.events.EndElement;
29
30 public class EndElementEvent
31 extends NamedEvent
32 implements EndElement
33 {
34 private List outOfScopeNamespaces;
35
36 public EndElementEvent() {
37 super();
38 init();
39 }
40 protected void init() {
41 setEventType(XMLEvent.END_ELEMENT);
42 }
43 public EndElementEvent(QName name) {
44 super(name);
45 init();
46 }
47 public Iterator getNamespaces() {
48 if (outOfScopeNamespaces==null)
49 return EmptyIterator.emptyIterator;
50 return outOfScopeNamespaces.iterator();
51 }
52 public void addNamespace(Namespace n) {
53 if (outOfScopeNamespaces == null)
54 outOfScopeNamespaces = new ArrayList();
55 outOfScopeNamespaces.add(n);
56 }
57 public void reset() {
58 if (outOfScopeNamespaces != null) outOfScopeNamespaces.clear();
59
60 }
61
62 public String toString() {
63 String value = "</"+nameAsString();
64 Iterator ni = getNamespaces();
65 while(ni.hasNext())
66 value = value +" "+ ni.next().toString();
67 value = value+">";
68 return value;
69 }
70 }
71