if (value == null) { value = ""; }
    protected Attributes getAttributes() {        AttributesImpl attrs = new AttributesImpl();        // Adding namespace declaration as attributes is necessary because        // the xalan implementation that ships with SUN JDK 1.4 is bugged        // and does not handle the startPrefixMapping method        for (int i = 0; i < streamReader.getNamespaceCount(); i++) {            String prefix = streamReader.getNamespacePrefix(i);            String uri = streamReader.getNamespaceURI(i);            // Default namespace            if (prefix == null || prefix.length() == 0) {                attrs.addAttribute(null,                                    null,                                    XMLConstants.XMLNS_ATTRIBUTE,                                    "CDATA",                                    uri);            } else {                attrs.addAttribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,                                    prefix,                                    XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix,                                    "CDATA",                                    uri);            }        }        for (int i = 0; i < streamReader.getAttributeCount(); i++) {            String uri = streamReader.getAttributeNamespace(i);            String localName = streamReader.getAttributeLocalName(i);            String prefix = streamReader.getAttributePrefix(i);            String qName;            if (prefix != null && prefix.length() > 0) {                qName = prefix + ':' + localName;            } else {                qName = localName;            }            String type = streamReader.getAttributeType(i);            String value = streamReader.getAttributeValue(i);            attrs.addAttribute(uri, localName, qName, type, value);        }        return attrs;    }