if (data instanceof AttributesContainer && ((AttributesContainer) data).getAttributes() != null) {
for (Entry<QName, String> attribute : ((AttributesContainer) data).getAttributes().entrySet()) {
writer.writeAttribute(attribute.getKey().getNamespace().toString(), attribute.getKey().getLocalName(), attribute.getValue());
if (data instanceof AttributesContainer && ((AttributesContainer) data).getAttributes() != null) {
for (Entry<QName, String> attribute : ((AttributesContainer) data).getAttributes().entrySet()) {
writer.writeAttribute(attribute.getKey().getNamespace().toString(), attribute.getKey().getLocalName(), attribute.getValue());