/** * Copy an entire Attributes object. * * <p>It may be more efficient to reuse an existing object * rather than constantly allocating new ones.</p> * * @param atts The attributes to copy. */ public void setAttributes (Attributes atts) { clear(); length = atts.getLength(); if (length > 0) { data = new String[length*5]; for (int i = 0; i < length; i++) { data[i*5] = atts.getURI(i); data[i*5+1] = atts.getLocalName(i); data[i*5+2] = atts.getQName(i); data[i*5+3] = atts.getType(i); data[i*5+4] = atts.getValue(i); } } }
/** * 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; } } }
/** * Add the given attributes to the currently collected ones. These * attributes are always added, regardless of whether on not an element * is currently open. * @param atts List of attributes to add to this list */ public void addAttributes(Attributes atts) throws SAXException { int nAtts = atts.getLength(); for (int i = 0; i < nAtts; i++) { String uri = atts.getURI(i); if (null == uri) uri = ""; addAttributeAlways( uri, atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i), false); } }
/** * Copy an entire Attributes object. * * <p>It may be more efficient to reuse an existing object * rather than constantly allocating new ones.</p> * * @param atts The attributes to copy. */ public void setAttributes (Attributes atts) { clear(); length = atts.getLength(); if (length > 0) { data = new String[length*5]; for (int i = 0; i < length; i++) { data[i*5] = atts.getURI(i); data[i*5+1] = atts.getLocalName(i); data[i*5+2] = atts.getQName(i); data[i*5+3] = atts.getType(i); data[i*5+4] = atts.getValue(i); } } }
/** * Add the given attributes to the currently collected ones. These * attributes are always added, regardless of whether on not an element * is currently open. * @param atts List of attributes to add to this list */ public void addAttributes(Attributes atts) throws SAXException { int nAtts = atts.getLength(); for (int i = 0; i < nAtts; i++) { String uri = atts.getURI(i); if (null == uri) uri = ""; addAttributeAlways( uri, atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i), false); } }
@Override public boolean equals(Object obj) { Attributes other = ((PartialAttributes) obj).attributes; if (this.attributes.getLength() != other.getLength()) { return false; } for (int i = 0; i < other.getLength(); i++) { boolean found = false; for (int j = 0; j < attributes.getLength(); j++) { if (other.getURI(i).equals(attributes.getURI(j)) && other.getQName(i).equals(attributes.getQName(j)) && other.getType(i).equals(attributes.getType(j)) && other.getValue(i).equals(attributes.getValue(j))) { found = true; break; } } if (!found) { return false; } } return true; }
/** * Add the contents of the attribute list to this list. * * @param atts List of attributes to add to this list */ public void addAttributes(Attributes atts) { int nAtts = atts.getLength(); for (int i = 0; i < nAtts; i++) { String uri = atts.getURI(i); if (null == uri) uri = ""; String localName = atts.getLocalName(i); String qname = atts.getQName(i); int index = this.getIndex(uri, localName); // System.out.println("MutableAttrListImpl#addAttributes: "+uri+":"+localName+", "+index+", "+atts.getQName(i)+", "+this); if (index >= 0) this.setAttribute(index, uri, localName, qname, atts.getType(i), atts.getValue(i)); else addAttribute(uri, localName, qname, atts.getType(i), atts.getValue(i)); } }
int nAttrs = attributes.getLength(); String attrUri = attributes.getURI(i); && (attributes.getQName(i).startsWith("xmlns:") || attributes.getQName(i).equals("xmlns"))) String attrLocalName = attributes.getLocalName(i); XSLTAttributeDef attrDef = def.getAttributeDef(attrUri, attrLocalName); handler.error(XSLTErrorResources.ER_ATTR_NOT_ALLOWED, new Object[]{attributes.getQName(i), rawName}, null);//"\""+attributes.getQName(i)+"\"" attributes.getQName(i), attributes.getType(i), attributes.getValue(i)); attributes.getQName(i), attributes.getValue(i), target);
int nAtts=(atts==null) ? 0 : atts.getLength(); qName=atts.getQName(i); if(qName.startsWith("xmlns:") || "xmlns".equals(qName)) m_nsNames.stringToIndex(atts.getValue(i)), atts.getType(i).equalsIgnoreCase("ID")); qName=atts.getQName(i); if(!(qName.startsWith("xmlns:") || "xmlns".equals(qName))) m_char.append(atts.getValue(i)); // Single-string value int contentEnd=m_char.length(); appendAttribute(m_nsNames.stringToIndex(atts.getURI(i)), m_localNames.stringToIndex(localName), m_prefixNames.stringToIndex(prefix), atts.getType(i).equalsIgnoreCase("ID"), m_char_current_start, contentEnd-m_char_current_start); m_char_current_start=contentEnd;
int nAtts=(atts==null) ? 0 : atts.getLength(); qName=atts.getQName(i); if(qName.startsWith("xmlns:") || "xmlns".equals(qName)) m_nsNames.stringToIndex(atts.getValue(i)), atts.getType(i).equalsIgnoreCase("ID")); qName=atts.getQName(i); if(!(qName.startsWith("xmlns:") || "xmlns".equals(qName))) m_char.append(atts.getValue(i)); // Single-string value int contentEnd=m_char.length(); appendAttribute(m_nsNames.stringToIndex(atts.getURI(i)), m_localNames.stringToIndex(localName), m_prefixNames.stringToIndex(prefix), atts.getType(i).equalsIgnoreCase("ID"), m_char_current_start, contentEnd-m_char_current_start); m_char_current_start=contentEnd;
int nAttrs = attributes.getLength(); String attrUri = attributes.getURI(i); && (attributes.getQName(i).startsWith("xmlns:") || attributes.getQName(i).equals("xmlns"))) String attrLocalName = attributes.getLocalName(i); XSLTAttributeDef attrDef = def.getAttributeDef(attrUri, attrLocalName); handler.error(XSLTErrorResources.ER_ATTR_NOT_ALLOWED, new Object[]{attributes.getQName(i), rawName}, null);//"\""+attributes.getQName(i)+"\"" attributes.getQName(i), attributes.getType(i), attributes.getValue(i)); attributes.getQName(i), attributes.getValue(i), target);
int n = attributes.getLength(); String attrUri = attributes.getURI(i); String attrQName = attributes.getQName(i); String valString = attributes.getValue(i); String attrLocalName = attributes.getLocalName(i); if (m_buildIdIndex && attributes.getType(i).equalsIgnoreCase("ID")) setIDAttribute(valString, elemNode);
int n = attributes.getLength(); String attrUri = attributes.getURI(i); String attrQName = attributes.getQName(i); String valString = attributes.getValue(i); String attrLocalName = attributes.getLocalName(i); if (m_buildIdIndex && attributes.getType(i).equalsIgnoreCase("ID")) setIDAttribute(valString, elemNode);
if(DEBUG_ATTRS & attributes!=null) int n = attributes.getLength(); if(n==0) System.out.println("\tempty attribute list"); else for (int i = 0; i < n; i++) System.out.println("\t attr: uri: " + attributes.getURI(i) + ", localname: " + attributes.getLocalName(i) + ", qname: " + attributes.getQName(i) + ", type: " + attributes.getType(i) + ", value: " + attributes.getValue(i) ); int n = attributes.getLength(); String attrUri = attributes.getURI(i); String attrQName = attributes.getQName(i); String valString = attributes.getValue(i); String attrLocalName = attributes.getLocalName(i); if (attributes.getType(i).equalsIgnoreCase("ID")) setIDAttribute(valString, elemNode);
if(DEBUG_ATTRS & attributes!=null) int n = attributes.getLength(); if(n==0) System.out.println("\tempty attribute list"); else for (int i = 0; i < n; i++) System.out.println("\t attr: uri: " + attributes.getURI(i) + ", localname: " + attributes.getLocalName(i) + ", qname: " + attributes.getQName(i) + ", type: " + attributes.getType(i) + ", value: " + attributes.getValue(i) ); int n = attributes.getLength(); String attrUri = attributes.getURI(i); String attrQName = attributes.getQName(i); String valString = attributes.getValue(i); String attrLocalName = attributes.getLocalName(i); if (attributes.getType(i).equalsIgnoreCase("ID")) setIDAttribute(valString, elemNode);
public void startElement( String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (namespaceDecls != null) { for (int i = 0, ii = atts.getLength(); i < ii; i++) { namespaceDecls.addAttribute( null, null, atts.getQName(i), atts.getType(i), atts.getValue(i)); } atts = namespaceDecls; namespaceDecls = null; } if (namespaceURI == null) namespaceURI = ""; if (localName == null) localName = ""; original.startElement(namespaceURI, localName, qName, atts); }