1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 /* 19 * $Id: $ 20 */ 21 package org.apache.xml.serializer.dom3; 22 23 import java.util.Vector; 24 25 //import org.apache.xerces.dom3.DOMStringList; 26 import org.w3c.dom.DOMStringList; 27 28 /** 29 * This class implemets the DOM Level 3 Core interface DOMStringList. 30 * 31 * @xsl.usage internal 32 */ 33 final class DOMStringListImpl implements DOMStringList { 34 35 //A collection of DOMString values 36 private Vector fStrings; 37 38 /** 39 * Construct an empty list of DOMStringListImpl 40 */ 41 DOMStringListImpl() { 42 fStrings = new Vector(); 43 } 44 45 /** 46 * Construct an empty list of DOMStringListImpl 47 */ 48 DOMStringListImpl(Vector params) { 49 fStrings = params; 50 } 51 52 /** 53 * Construct an empty list of DOMStringListImpl 54 */ 55 DOMStringListImpl(String[] params ) { 56 fStrings = new Vector(); 57 if (params != null) { 58 for (int i=0; i < params.length; i++) { 59 fStrings.add(params[i]); 60 } 61 } 62 } 63 64 /** 65 * @see org.apache.xerces.dom3.DOMStringList#item(int) 66 */ 67 public String item(int index) { 68 try { 69 return (String) fStrings.elementAt(index); 70 } catch (ArrayIndexOutOfBoundsException e) { 71 return null; 72 } 73 } 74 75 /** 76 * @see org.apache.xerces.dom3.DOMStringList#getLength() 77 */ 78 public int getLength() { 79 return fStrings.size(); 80 } 81 82 /** 83 * @see org.apache.xerces.dom3.DOMStringList#contains(String) 84 */ 85 public boolean contains(String param) { 86 return fStrings.contains(param) ; 87 } 88 89 /** 90 * DOM Internal: 91 * Add a <code>DOMString</code> to the list. 92 * 93 * @param domString A string to add to the list 94 */ 95 public void add(String param) { 96 fStrings.add(param); 97 } 98 99 } 100