The $domLead already is the documentElement, not the document. You're loading the XML into a SimpleXMLElement object, this will always represent an element, never a document. So you're importing the document element into DOM.
$xmlLead = new SimpleXMLElement('<Operations username="test" password="test"/>');
$domLead = dom_import_simplexml($xmlLead);
var_dump(get_class($domLead));
Output:
string(10) "DOMElement"
If you would like to use DOM, create the DOMDocument directly and load your XML into it:
$dom = new DOMDocument();
$dom->loadXml('<Operations username="test" password="test"/>');
var_dump(get_class($dom), get_class($dom->documentElement));
Output:
string(11) "DOMDocument"
string(10) "DOMElement"
If you have your XML loaded into a DOM, you can create an DOMXpath object and fetch data:
$dom = new DOMDocument();
$dom->loadXml('<Operations username="test" password="test"/>');
$xpath = new DOMXpath($dom);
var_dump(
$xpath ->evaluate('string(/*/@username)'),
$xpath ->evaluate('string(/*/@password)')
);
Output:
string(4) "test"
string(4) "test"