public Attribute copy() { XmlAttribute attr = new HibXmlAttribute(); attr.setQName(getQName().copy()); Element clone = value != null ? (Element) value.cloneNode(true) : null; attr.setValue(clone); return attr; }
/** * Convienence method for setting a Elementvalue on an XmlAttribute with a given QName stored on * the given item. * * @param item item to fetch Xmlttribute from * @param qname QName of attribute * @param value value to set on XmlAttribute */ public static void setValue(Item item, QName qname, Element value) { XmlAttribute attr = (XmlAttribute) item.getAttribute(qname); if (attr == null && value != null) { attr = new HibXmlAttribute(qname, value); item.addAttribute(attr); return; } if (value == null) { item.removeAttribute(qname); } else { attr.setValue(value); } }