View Javadoc

1   /*
2    * Copyright  1999-2004 The Apache Software Foundation.
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  
18  package org.apache.axis.message.addressing;
19  
20  import org.apache.axis.utils.XMLUtils;
21  
22  import org.w3c.dom.Element;
23  import org.w3c.dom.Document;
24  
25  import javax.xml.namespace.QName;
26  
27  /***
28   * Java content class for AttributedQName complex type.
29   * <p>The following schema fragment specifies the expected content contained within this java content object. (defined at http://schemas.xmlsoap.org/ws/2004/08/addressing line 98)
30   * <p>
31   * <pre>
32   * &lt;complexType name="AttributedQName">
33   *   &lt;simpleContent>
34   *     &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>QName">
35   *     &lt;/extension>
36   *   &lt;/simpleContent>
37   * &lt;/complexType>
38   * </pre>
39   * 
40   * @author Davanum Srinivas (dims@yahoo.com)
41   */
42  public class AttributedQName extends QName {
43  
44      /***
45       * Constructor AttributedQName
46       * 
47       * @param qname 
48       */
49      public AttributedQName(QName qname) {
50          super(qname.getNamespaceURI(), 
51                qname.getLocalPart(), 
52                qname.getPrefix());
53      }
54  
55      /***
56       * Constructor AttributedQName
57       * 
58       * @param namespace
59       * @param localname
60       */
61      public AttributedQName(String namespace, 
62                             String localPart) {
63          super(namespace, localPart);
64      }
65      
66      /***
67       * append DOM node to parent
68       * 
69       * @param parent 
70       */
71      public void append(Element parent, String elementName) {
72          Document doc = parent.getOwnerDocument();
73          Element pt = doc.createElementNS(Constants.NS_URI_ADDRESSING_DEFAULT, elementName);
74          String value = XMLUtils.getStringForQName(this, pt);
75          pt.appendChild(doc.createTextNode(value));
76          parent.appendChild(pt);
77      }
78  }
79  
80