1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.axis.message.addressing;
19
20 import javax.xml.soap.SOAPElement;
21
22 import org.apache.axis.types.URI;
23
24 import org.w3c.dom.Element;
25
26 import org.apache.axis.message.addressing.util.TextExtractor;
27
28 /***
29 * Class Address
30 *
31 * @author Davanum Srinivas (dims@yahoo.com)
32 */
33 public class Address extends AttributedURI {
34
35 /***
36 * Constructor Address
37 *
38 * @param uri
39 */
40 public Address(URI uri) {
41 super(uri);
42 }
43
44 /***
45 * Constructor Address
46 *
47 * @param uri
48 * @throws MalformedURIException
49 */
50 public Address(String uri) throws MalformedURIException {
51 this(new URI(uri));
52 }
53
54 /***
55 * append DOM node to parent
56 *
57 * @param parent
58 */
59 public void append(Element parent) {
60 Element child = parent.getOwnerDocument().createElementNS(Constants.NS_URI_ADDRESSING_DEFAULT,
61 Constants.ADDRESS);
62 child.appendChild(parent.getOwnerDocument().createTextNode(toString()));
63 parent.appendChild(child);
64 }
65
66 public static Address fromSOAPElement(SOAPElement element)
67 throws Exception {
68 String value = TextExtractor.getText(element);
69 return new Address(value);
70 }
71
72 public static Address fromElement(Element element)
73 throws Exception {
74 String value = TextExtractor.getText(element);
75 return new Address(value);
76 }
77 }
78
79