/** * Function: getElementById * * Returns the element with the given ID from * <document>. The optional attr argument specifies * the name of the ID attribute. Default is "id". * The XPath expression used to find the element is * //*[@attr='arg'] where attr is the name of the * ID attribute and arg is the given id. * * Parameters: * * id - String that contains the ID. * attr - Optional string for the attributename. * Default is "id". */ function getElementById($id, $attr = "id") { $expr = "//*[@{$attr}='{$id}']"; return mxUtils::selectSingleNode($this->document, $expr); }