示例#1
0
 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;
 }
示例#2
0
 /**
  * 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);
   }
 }