I searched stack overflow for this, and found an old similar question here:
Ignore comment node in SimpleXML [duplicate]
Unfortunately neither this nor its dup