The first line should have DOMNodeList, not IXMLDOMNode.
The foreach line should be something like:
foreach(IXMLDOMNode node in n)
and then you should replace "field1" with "node" in these lines:
if (field1.Length > 0)
InfoPathAttachmentEncoding.InfoPathAttachmentDecoder(field1);