private boolean containsPrefixMapping(String prefix, String uri) { for( int i=0; i<prefixMap.size(); i+=2 ) { if(prefixMap.get(i).equals(prefix) && prefixMap.get(i+1).equals(uri)) return true; } return false; }
for (int i = 0; i < unprocessedNamespaces.size(); i += 2) { String prefix = unprocessedNamespaces.get(i); String uri = unprocessedNamespaces.get(i + 1);
return createContext(classes.toArray(new Class[classes.size()]),properties);
for (int i = 0; i < prefixMap.size(); i += 2) {
@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(); }
private boolean containsPrefixMapping(String prefix, String uri) { for( int i=0; i<prefixMap.size(); i+=2 ) { if(prefixMap.get(i).equals(prefix) && prefixMap.get(i+1).equals(uri)) return true; } return false; }
for (int i = 0; i < unprocessedNamespaces.size(); i += 2) { String prefix = unprocessedNamespaces.get(i); String uri = unprocessedNamespaces.get(i + 1);
return createContext(classes.toArray(new Class[classes.size()]),properties);
for (int i = 0; i < prefixMap.size(); i += 2) {
@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 int getAttributeCount() { if (_state == START_ELEMENT) return _currentAttributes.size(); throw new IllegalStateException("DOMStreamReader: getAttributeCount() called in illegal state"); }
public int getAttributeCount() { if (_state == START_ELEMENT) return _currentAttributes.size(); throw new IllegalStateException("DOMStreamReader: getAttributeCount() called in illegal state"); }
public String getAttribute(String nsUri, String localName) { if(attributes!=null) { 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; }
private boolean containsPrefixMapping(String prefix, String uri) { for( int i=0; i<prefixMap.size(); i+=2 ) { if(prefixMap.get(i).equals(prefix) && prefixMap.get(i+1).equals(uri)) return true; } return false; }
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; }
String getNamespaceURI(int index) { int sz = currentNamespaces.size(); if(index< sz) { return currentNamespaces.get(index).getValue(); } else { return additionalNamespaces.get((index-sz)*2+1); } }
String getNamespacePrefix(int index) { int sz = currentNamespaces.size(); if(index< sz) { Attr attr = currentNamespaces.get(index); String result = attr.getLocalName(); if (result == null) { result = QName.valueOf(attr.getNodeName()).getLocalPart(); } return result.equals("xmlns") ? null : result; } else { return additionalNamespaces.get((index-sz)*2); } }