.net - CLR C++ syntax question about GetElementsByTagName -
i'm newbie in c++. have xml file , code:
xmldocument^ xml = gcnew xmldocument(); xml -> load( "url.xml" ); box -> text = xml -> documentelement -> getelementsbytagname("item") -> item(0) -> getelementsbytagname("title") -> item(0) -> innerxml; // code doesnt work.
and xml file:
<item> <pubdate>date</pubdate> <title>title</title> <author>author</author> <description>description</description </item> <item> ...
i want title tag first item. , dont know how. please.
upd. tried code, not work :(
xml -> documentelement -> getelementsbytagname("item") -> item(0) -> childnodes -> getelementsbytagname("title") -> item(0) -> innerxml;
if call xml.loadxml()
using string copies have file, error </description
doesn't have end >
. if fix that, xmlexception
because have multiple root elements. if remove second <item>
, can give me title (converted on fly c# code):
xmlelement^ item = (xmlelement)(xml->getelementsbytagname("item")->item(0)); string^ title = item->getelementsbytagname("title")->item(0)->innerxml;
Comments
Post a Comment