public void marshall(PrintWriter wrt, String prefix, Attribute attr) throws Exception { String prfx = prefix + "attribute."; wrt.print(prfx); if (attr != null) { wrt.print("name="); wrt.println(attr.getName()); String[] vals = attr.getValues(); for (int i = 0; (vals != null && i < vals.length); i++) { String value = vals[i]; wrt.print(prfx); wrt.print("value="); wrt.println(value); } } }
public void marshall(XMLStreamWriter wrt, Attribute attr) throws Exception { assert wrt != null && attr != null; wrt.writeStartElement("attribute"); if (attr != null) { wrt.writeAttribute("name", attr.getName()); String[] vals = attr.getValues(); for (int i = 0; (vals != null && i < vals.length); i++) { String val = vals[i]; wrt.writeStartElement("value"); wrt.writeCharacters(val); wrt.writeEndElement(); } } wrt.writeEndElement(); }