c# - xml namespace appears xml -
i'm making application extracts youtube data, , i've run few problems.
i have code:
xdocument docauthor = xdocument.parse(xdocument.load("https://gdata.youtube.com/feeds/api/users/crashcourse/uploads?v=2&alt=atom&max-results=0").tostring()); xnamespace ns = "http://www.w3.org/2005/atom"; xelement entryauthor = docauthor.root.element(ns + "author"); txbxconsole.text = entryauthor.element(ns + "name").tostring(); this output: <name xmlns=\"http://www.w3.org/2005/atom\">crashcourse</name>
but want be: crashcourse
just cast element string
txbxconsole.text = (string)entryauthor.element(ns + "name"); or can use .value property. xelement.tostring returns entire element, not value.
Comments
Post a Comment