/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * This method sets the attributes, previous attributes are cleared, * it also keeps the hashtable up to date for quick lookup via * getIndex(qName). * @param atts the attributes to copy into these attributes. * @see org.xml.sax.helpers.AttributesImpl#setAttributes(Attributes) * @see #getIndex(String) */ public final void setAttributes(Attributes atts) { super.setAttributes(atts); // we've let the super class add the attributes, but // we need to keep the hash table up to date ourselves for the // potentially new qName/index pairs for quick lookup. int numAtts = atts.getLength(); if (MAX <= numAtts) switchOverToHash(numAtts); }
/** * This method sets the attributes, previous attributes are cleared, * it also keeps the hashtable up to date for quick lookup via * getIndex(qName). * @param atts the attributes to copy into these attributes. * @see org.xml.sax.helpers.AttributesImpl#setAttributes(Attributes) * @see #getIndex(String) */ public final void setAttributes(Attributes atts) { super.setAttributes(atts); // we've let the super class add the attributes, but // we need to keep the hash table up to date ourselves for the // potentially new qName/index pairs for quick lookup. int numAtts = atts.getLength(); if (MAX <= numAtts) switchOverToHash(numAtts); }
/** * Copy an entire Attributes object. The "specified" flags are * assigned as true, and "declared" flags as false (except when * an attribute's type is not CDATA), * unless the object is an Attributes2 object. * In that case those flag values are all copied. * * @param atts The attributes to copy. * * @see AttributesImpl#setAttributes */ public void setAttributes (Attributes atts) { int length = atts.getLength (); super.setAttributes (atts); declared = new boolean [length]; specified = new boolean [length]; if (atts instanceof Attributes2) { Attributes2 a2 = (Attributes2) atts; for (int i = 0; i < length; i++) { declared [i] = a2.isDeclared (i); specified [i] = a2.isSpecified (i); } } else { for (int i = 0; i < length; i++) { declared [i] = !"CDATA".equals (atts.getType (i)); specified [i] = true; } } }
protected Attributes createAttributes(Element element, Attributes namespaceAttributes) throws SAXException { attributes.clear(); if (namespaceAttributes != null) { attributes.setAttributes(namespaceAttributes); } for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) { Attribute attribute = iter.next(); attributes.addAttribute(attribute.getNamespaceURI(), attribute .getName(), attribute.getQualifiedName(), "CDATA", attribute.getValue()); } return attributes; }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Copy an existing Attributes object. * * <p>This constructor is especially useful inside a * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> * * @param atts The existing Attributes object. */ public AttributesImpl (Attributes atts) { setAttributes(atts); }
/** * Create a copy of the attributes. * <p/> * This needs to be done because some SAX parsers reuse the same {@link Attributes} instance * across SAX events. * * @param attributes The attributes to copy. * @return The new {@link Attributes} instance with a copy of the attributes. */ private AttributesImpl copyAttributes(Attributes attributes) { AttributesImpl attributesCopy = new AttributesImpl(); attributesCopy.setAttributes(attributes); return attributesCopy; }
@Override public void setAttributes(Attributes atts) { for (int i = 0; i < atts.getLength(); i++) { if (!qNames.add(atts.getQName(i))) { handleDuplicate(atts.getQName(i), atts.getValue(i)); } } super.setAttributes(atts); }
@Override public void setAttributes(Attributes atts) { for (int i = 0; i < atts.getLength(); i++) { if (!qNames.add(atts.getQName(i))) { handleDuplicate(atts.getQName(i), atts.getValue(i)); } } super.setAttributes(atts); }
@Override public void setAttributes(Attributes atts) { for (int i = 0; i < atts.getLength(); i++) { if (!qNames.add(atts.getQName(i))) { handleDuplicate(atts.getQName(i), atts.getValue(i)); } } super.setAttributes(atts); }
@Override public void setAttributes(Attributes atts) { for (int i = 0; i < atts.getLength(); i++) { if (!qNames.add(atts.getQName(i))) { handleDuplicate(atts.getQName(i), atts.getValue(i)); } } super.setAttributes(atts); }
@Override public void setAttributes(Attributes atts) { for (int i = 0; i < atts.getLength(); i++) { if (!qNames.add(atts.getQName(i))) { handleDuplicate(atts.getQName(i), atts.getValue(i)); } } super.setAttributes(atts); }
protected Attributes createAttributes(Element element, Attributes namespaceAttributes) throws SAXException { attributes.clear(); if (namespaceAttributes != null) { attributes.setAttributes(namespaceAttributes); } for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) { Attribute attribute = iter.next(); attributes.addAttribute(attribute.getNamespaceURI(), attribute .getName(), attribute.getQualifiedName(), "CDATA", attribute.getValue()); } return attributes; }
protected Attributes createAttributes(Element element, Attributes namespaceAttributes) throws SAXException { attributes.clear(); if (namespaceAttributes != null) { attributes.setAttributes(namespaceAttributes); } for (Iterator iter = element.attributeIterator(); iter.hasNext();) { Attribute attribute = (Attribute) iter.next(); attributes.addAttribute(attribute.getNamespaceURI(), attribute .getName(), attribute.getQualifiedName(), "CDATA", attribute.getValue()); } return attributes; }