@Override public void endStartTag() throws IOException { if(otherAttributes.isEmpty()) { if(len!=0) { // sort is expensive even for size 0 array, // so it's worth checking len==0 if(!namedAttributesAreOrdered) Arrays.sort(staticAttributes,0,len); // this is the common case for( int i=0; i<len; i++ ) staticAttributes[i].write(); len = 0; } } else { // this is the exceptional case // sort all the attributes, not just the other attributes for( int i=0; i<len; i++ ) otherAttributes.add(staticAttributes[i].toDynamicAttribute()); len = 0; Collections.sort(otherAttributes); // write them all int size = otherAttributes.size(); for( int i=0; i<size; i++ ) { DynamicAttribute a = otherAttributes.get(i); super.attribute(a.prefix,a.localName,a.value); } otherAttributes.clear(); } super.endStartTag(); }
@Override public void endStartTag() throws IOException { if(otherAttributes.isEmpty()) { if(len!=0) { // sort is expensive even for size 0 array, // so it's worth checking len==0 if(!namedAttributesAreOrdered) Arrays.sort(staticAttributes,0,len); // this is the common case for( int i=0; i<len; i++ ) staticAttributes[i].write(); len = 0; } } else { // this is the exceptional case // sort all the attributes, not just the other attributes for( int i=0; i<len; i++ ) otherAttributes.add(staticAttributes[i].toDynamicAttribute()); len = 0; Collections.sort(otherAttributes); // write them all int size = otherAttributes.size(); for( int i=0; i<size; i++ ) { DynamicAttribute a = otherAttributes.get(i); super.attribute(a.prefix,a.localName,a.value); } otherAttributes.clear(); } super.endStartTag(); }
public String getAttributeValue(int index) { if (_state == START_ELEMENT) { return _currentAttributes.get(index).getNodeValue(); } throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state"); }
public String getAttributeValue(int index) { if (_state == START_ELEMENT) { return _currentAttributes.get(index).getNodeValue(); } throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state"); }
/** * Return an attribute's local name. Handle the case of DOM level 1 nodes. */ public String getAttributeLocalName(int index) { if (_state == START_ELEMENT) { String localName = _currentAttributes.get(index).getLocalName(); return (localName != null) ? localName : QName.valueOf(_currentAttributes.get(index).getNodeName()).getLocalPart(); } throw new IllegalStateException("DOMStreamReader: getAttributeLocalName() called in illegal state"); }
public String getAttributeNamespace(int index) { if (_state == START_ELEMENT) { String uri = _currentAttributes.get(index).getNamespaceURI(); return fixNull(uri); } throw new IllegalStateException("DOMStreamReader: getAttributeNamespace() called in illegal state"); }
public String getAttributePrefix(int index) { if (_state == START_ELEMENT) { String prefix = _currentAttributes.get(index).getPrefix(); return fixNull(prefix); } throw new IllegalStateException("DOMStreamReader: getAttributePrefix() called in illegal state"); }
public String getAttributeNamespace(int index) { if (_state == START_ELEMENT) { String uri = _currentAttributes.get(index).getNamespaceURI(); return fixNull(uri); } throw new IllegalStateException("DOMStreamReader: getAttributeNamespace() called in illegal state"); }
public String getAttribute(String nsUri, String localName) { if(attributes==null) parseAttributes(); for(int i=attributes.size()-1; i>=0; i-- ) { Attribute a = attributes.get(i); if(a.localName.equals(localName) && a.nsUri.equals(nsUri)) return a.value; } return null; }
@Override public String getAttribute(String nsUri, String localName) { if(attributes==null) { parseAttributes(); } for(int i=attributes.size()-1; i>=0; i-- ) { Attribute a = attributes.get(i); if (a.localName.equals(localName) && a.nsUri.equals(nsUri)) { return a.value; } } return null; }
public String getAttribute(String nsUri, String localName) { if(attributes==null) parseAttributes(); for(int i=attributes.size()-1; i>=0; i-- ) { Attribute a = attributes.get(i); if(a.localName.equals(localName) && a.nsUri.equals(nsUri)) return a.value; } return null; }
public String getAttribute(String nsUri, String localName) { if(attributes==null) parseAttributes(); for(int i=attributes.size()-1; i>=0; i-- ) { Attribute a = attributes.get(i); if(a.localName.equals(localName) && a.nsUri.equals(nsUri)) return a.value; } return null; }