1 16 19 package com.sun.org.apache.xml.internal.utils; 20 21 import java.io.Serializable ; 22 23 import org.xml.sax.Attributes ; 24 import org.xml.sax.helpers.AttributesImpl ; 25 26 30 public class MutableAttrListImpl extends AttributesImpl 31 implements Serializable 32 { 33 34 37 38 public MutableAttrListImpl() 39 { 40 super(); 41 } 42 43 51 public MutableAttrListImpl(Attributes atts) 52 { 53 super(atts); 54 } 55 56 73 public void addAttribute(String uri, String localName, String qName, 74 String type, String value) 75 { 76 77 if (null == uri) 78 uri = ""; 79 80 int index = this.getIndex(qName); 83 85 87 if (index >= 0) 88 this.setAttribute(index, uri, localName, qName, type, value); 89 else 90 super.addAttribute(uri, localName, qName, type, value); 91 } 92 93 98 public void addAttributes(Attributes atts) 99 { 100 101 int nAtts = atts.getLength(); 102 103 for (int i = 0; i < nAtts; i++) 104 { 105 String uri = atts.getURI(i); 106 107 if (null == uri) 108 uri = ""; 109 110 String localName = atts.getLocalName(i); 111 String qname = atts.getQName(i); 112 int index = this.getIndex(uri, localName); 113 if (index >= 0) 115 this.setAttribute(index, uri, localName, qname, atts.getType(i), 116 atts.getValue(i)); 117 else 118 addAttribute(uri, localName, qname, atts.getType(i), 119 atts.getValue(i)); 120 } 121 } 122 123 130 public boolean contains(String name) 131 { 132 return getValue(name) != null; 133 } 134 } 135 136 | Popular Tags |