List of usage examples for org.xml.sax.helpers AttributesImpl getType
public String getType(String qName)
From source file:org.apache.axis.message.MessageElement.java
/** * remove a named attribute.//from w w w . ja v a 2 s .c om * @see org.w3c.dom.Element#removeAttribute(String) * @param attrName name of the attributes * @throws DOMException */ public void removeAttribute(String attrName) throws DOMException { AttributesImpl impl = (AttributesImpl) attributes; int index = impl.getIndex(attrName); if (index >= 0) { AttributesImpl newAttrs = new AttributesImpl(); // copy except the removed attribute for (int i = 0; i < impl.getLength(); i++) { // shift after removal if (i != index) { String uri = impl.getURI(i); String local = impl.getLocalName(i); String qname = impl.getQName(i); String type = impl.getType(i); String value = impl.getValue(i); newAttrs.addAttribute(uri, local, qname, type, value); } } // replace it attributes = newAttrs; } }
From source file:org.tizzit.util.xml.SAXHelper.java
/** * Sets an attribute of an SAX AttributesImpl to a specific value (namespace supported).<br/> * If it exists, the value will be overwritten. * * @param attr The AttributesImpl/*from w w w . ja va 2 s .c o m*/ * @param namespaceUri * @param attrName The name * @param attrValue The (new) value * @since tizzit-common 15.10.2009 */ public static void setSAXAttr(AttributesImpl attr, String namespaceUri, String attrName, String attrValue) { if (attrName != null) { int idx = attr.getIndex(attrName); String saveVal = (attrValue == null) ? "" : attrValue; if (idx >= 0) { String dd = attr.getType(attrName); attr.setAttribute(idx, namespaceUri, attrName, attrName, dd, saveVal); } else { attr.addAttribute(namespaceUri, attrName, attrName, "CDATA", saveVal); } } }