String elementName = parser.getLocalName();
if (lastNode == null) {
node = constructNode(null, elementName, true);
setSOAPEnvelope(node);
} else if (lastNode.isComplete()) {
OMContainer parent = lastNode.getParent();
if (parent == document) {
// If we get here, this means that we found the SOAP envelope, but that it was
// preceded by a comment node. Since constructNode will create a new document
// based on the SOAP version of the envelope, we simply discard the last node
// and do as if we just encountered the first node in the document.