Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * Convienence method for returning a Element value on an XmlAttribute with a given QName stored
  * on the given item.
  *
  * @param item item to fetch XmlAttribute from
  * @param qname QName of attribute
  * @return Long value of XmlAttribute
  */
 public static Element getValue(Item item, QName qname) {
   XmlAttribute xa = (XmlAttribute) item.getAttribute(qname);
   if (xa == null) {
     return null;
   } else {
     return xa.getValue();
   }
 }
Exemplo n.º 3
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);
   }
 }