FileDocCategorySizeDatePackage
AttributesRenderer.javaAPI DocApache log4j 1.2.151670Sat Aug 25 00:09:38 BST 2007org.apache.log4j.or.sax

AttributesRenderer

public class AttributesRenderer extends Object implements ObjectRenderer
Render org.xml.sax.Attributes objects.
author
Ceki Gülcü
since
1.2

Fields Summary
Constructors Summary
public AttributesRenderer()

  
Methods Summary
public java.lang.StringdoRender(java.lang.Object o)
Render a {@link org.xml.sax.Attributes}.

    if(o instanceof Attributes) {
      StringBuffer sbuf = new StringBuffer();
      Attributes a = (Attributes) o;
      int len = a.getLength();
      boolean first = true;
      for(int i = 0; i < len; i++) {
	if(first) {
	  first = false;
	} else {
	  sbuf.append(", ");
	}
	sbuf.append(a.getQName(i));
	sbuf.append('=");
	sbuf.append(a.getValue(i));
      }
      return sbuf.toString();
    } else {
      return o.toString();
    }