1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.danube.webdav.xml.dav;
14
15 import org.abstracthorizon.danube.webdav.xml.XMLParserHandler;
16
17 import org.xml.sax.Attributes;
18 import org.xml.sax.SAXException;
19
20
21
22
23
24
25 public class DAVNamespace implements XMLParserHandler {
26
27
28 public static final String DAV_NAMESPACE_URL = "DAV:";
29
30
31 public static final String DAV_NAMESPACE_PREFERRED_PREFIX = "D";
32
33
34 protected DAVFactory davFactory = new DAVFactory();
35
36
37
38
39 public DAVNamespace() {
40 }
41
42
43
44
45
46 public DAVFactory getDAVFactory() {
47 return davFactory;
48 }
49
50
51
52
53
54 public void setDAVFactory(DAVFactory factory) {
55 this.davFactory = factory;
56 }
57
58
59
60
61
62 public String getURLString() {
63 return DAV_NAMESPACE_URL;
64 }
65
66
67
68
69
70 public String getPreferredPrefix() {
71 return DAV_NAMESPACE_PREFERRED_PREFIX;
72 }
73
74
75
76
77
78
79
80
81
82 public Object start(Object current, String tag, Attributes attributes) throws SAXException {
83
84 if (current instanceof XMLParserHandler) {
85 return ((XMLParserHandler)current).start(current, tag, attributes);
86 } else {
87 XMLParserHandler parent = this;
88 if (current instanceof XMLParserHandler) {
89 parent = (XMLParserHandler)current;
90 }
91 if ("propertyupdate".equals(tag)) {
92 return davFactory.newPropertyUpdate(parent);
93 } else if ("lockinfo".equals(tag)) {
94 return davFactory.newLockInfo(parent);
95 } else if ("propfind".equals(tag)) {
96 return davFactory.newPropFind(parent);
97 } else if ("propertybehavior".equals(tag)) {
98 return davFactory.newPropertyBehavior(parent);
99 } else if ("href".equals(tag)) {
100 return new HRef(parent);
101 }
102 return current;
103 }
104 }
105
106
107
108
109
110
111
112
113
114 public Object end(Object current, String tag, String value) throws SAXException {
115 if (current instanceof XMLParserHandler) {
116 return ((XMLParserHandler)current).end(current, tag, value);
117 } else {
118
119
120 return current;
121 }
122 }
123
124 }