doc.getElementsByTagName("method") returns a NodeList.
You want the first one of these, so you should use doc.getElementsByTagName("method").item(0) - which returns a Node.
From this, you probably want the value; doc.getElementsByTagName("method").item(0).getTextContent() should get you that.