Example #1
0
Handle_t Document::clone(Handle_t source) const {
#ifdef DD4HEP_USE_TINYXML
  return _XE(source.clone(0));
#else
  return _XE(_D(m_doc)->importNode(_E(source.ptr()),true));
#endif
}
Example #2
0
/// Access the XmlElements parent
Element::Elt_t Element::parentElement()  const   {
  Handle_t p = m_element.parent();
  if ( p && _N(p.ptr())->getNodeType() == ELEMENT_NODE_TYPE )  {
    return Elt_t(p);
  }
  return Elt_t(0);
}
Example #3
0
/// Remove a single child node identified by it's handle from the tree of the element
Handle_t Handle_t::remove(Handle_t node) const {
#ifdef DD4HEP_USE_TINYXML
  bool e = (m_node && node.ptr() ? _N(m_node)->RemoveChild(_N(node.ptr())) : false);
#else
  Elt_t e = Elt_t(m_node && node.ptr() ? _N(m_node)->removeChild(_N(node.ptr())) : 0);
#endif
  if (e)
    return node.ptr();
  string msg = "Handle_t::remove: ";
  if (m_node && node.ptr())
    msg += "Element [" + tag() + "] has no child of type '" + node.tag() + "'";
  else if (node)
    msg += "Element [INVALID]. Cannot remove child of type: '" + node.tag() + "'";
  else if (!node)
    msg += "Element [INVALID]. Cannot remove [INVALID] child. Big Shit!!!!";

  throw runtime_error(msg);
}
Example #4
0
void dd4hep::json::dumpTree(Handle_t elt)   {
  dumpTree(elt.ptr());
}
Example #5
0
/// Append a DOM element to the current node
void Handle_t::append(Handle_t e) const {
  _N(m_node)->appendChild(_N(e.ptr()));
}
Example #6
0
 /// Dump DOM tree using XercesC handles
 void dump_tree(Handle_t elt, ostream& os) {
   dumpTree((DOMNode*)elt.ptr(),os);
 }