To add an attribute by code in Infopath:
IXMLDOMNode expressionBox= _document.DOM.selectSingleNode("//someNode");
IXMLDOMNode disableEditing;
node2 = _document.DOM.createAttribute("disableEditing");
node2.text = "yes";
addressNode.attributes.setNamedItem(node2);