View Javadoc

1   /*
2    * Copyright 2005-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.soap;
18  
19  import java.util.Iterator;
20  import javax.xml.namespace.QName;
21  import javax.xml.transform.Source;
22  
23  /**
24   * The base interface for all elements that are contained in a SOAP message.
25   *
26   * @author Arjen Poutsma
27   * @see SoapMessage
28   * @since 1.0.0
29   */
30  public interface SoapElement {
31  
32      /**
33       * Returns the qualified name of this element.
34       *
35       * @return the qualified name of this element
36       */
37      QName getName();
38  
39      /**
40       * Returns the <code>Source</code> of this element. This includes the element itself, i.e.
41       * <code>SoapEnvelope.getSource()</code> will include the <code>Envelope</code> tag.
42       *
43       * @return the <code>Source</code> of this element
44       */
45      Source getSource();
46  
47      /**
48       * Adds an attribute with the specified qualified name and value to this element.
49       *
50       * @param name  the qualified name of the attribute
51       * @param value the value of the attribute
52       */
53      void addAttribute(QName name, String value);
54  
55      /**
56       * Removes the attribute with the specified name.
57       *
58       * @param name the qualified name of the attribute to remove
59       */
60      void removeAttribute(QName name);
61  
62      /**
63       * Returns the value of the attribute with the specified qualified name.
64       *
65       * @param name the qualified name
66       * @return the value, or <code>null</code> if there is no such attribute
67       */
68      String getAttributeValue(QName name);
69  
70      /**
71       * Returns an <code>Iterator</code> over all of the attributes in element as [email protected] QName qualified names}.
72       *
73       * @return an iterator over all the attribute names
74       */
75      Iterator<QName> getAllAttributes();
76  
77      /**
78       * Adds a namespace declaration with the specified prefix and URI to this element.
79       *
80       * @param prefix       the namespace prefix. Can be empty or null to declare the default namespace
81       * @param namespaceUri the namespace uri
82       * @throws SoapElementException in case of errors
83       */
84      void addNamespaceDeclaration(String prefix, String namespaceUri);
85  
86  }