KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > axis > message > SOAPNodeList


1 /*
2  * Copyright 2001-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 package org.jboss.axis.message;
18
19 import org.w3c.dom.NodeList JavaDoc;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.List JavaDoc;
23
24 /**
25  * A simple implementation for Nodelist that holds soap nodes
26  *
27  * @author Thomas Diesler (thomas.diesler@jboss.org)
28  */

29 class SOAPNodeList implements NodeList JavaDoc
30 {
31
32    private List JavaDoc nodeList = new ArrayList JavaDoc();
33
34    /**
35     * Constructor and Setter is intensionally made package protected only
36     */

37    SOAPNodeList()
38    {
39    }
40
41    SOAPNodeList(List JavaDoc nodes)
42    {
43       nodeList = new ArrayList JavaDoc(nodes);
44    }
45
46    void addNode(javax.xml.soap.Node JavaDoc node)
47    {
48       nodeList.add(node);
49    }
50
51    // org.w3c.dom.NodeList ********************************************************************************************
52

53    public org.w3c.dom.Node JavaDoc item(int index)
54    {
55
56       if (-1 < index && index < nodeList.size())
57          return (javax.xml.soap.Node JavaDoc)nodeList.get(index);
58       else
59          return null;
60    }
61
62    public int getLength()
63    {
64       return nodeList.size();
65    }
66 }
67
Popular Tags