Appending DOMNode from DOMXPath back to DOMDocument

DOMXPath is a very simple and good way of traversing HTML and search for a particular node. Playing around with its query function provide straight forward method in retrieving each node’s name and value.