i trying read value xml file, , cannot figure out code read value.
the xml file looks this:
<listbucketresult> <name>files</name> <prefix/> <marker/> <maxkeys>1000</maxkeys> <istruncated>false</istruncated> <contents> <key>tmp.png</key> <lastmodified>2013-04-30t09:25:54.000z</lastmodified> <etag>"49e6d7e2967d1a471341335c49f46c6c"</etag> <size>561</size> <storageclass>standard</storageclass> </contents> <contents> <key>2013.png</key> <lastmodified>2013-05-21t12:26:15.000z</lastmodified> <etag>"1eea6fda0ca03698efba7b045b5375f9"</etag> <size>3665</size> <storageclass>standard</storageclass></contents> </listbucketresult>
the code im trying use is:
dim xmlfile string = tmpdir & "tmp.xml" dim xmldoc new xmldocument xmldoc.load(xmlfile) 'opens xml file dim node xmlnode = xmldoc.selectsinglenode("/listbucketresult/contents/key") each inst xmlnode in node.childnodes each sproperty xmlnode in inst.childnodes if sproperty.name = "key" messagebox.show(sproperty.value) end if next next
the code not returning content of key. can tell me how text contents of key?
i think may wasting few processor cycles; should need:
dim nodelist xmlnodelist = xmldoc.selectnodes("//contents/key") each inst xmlnode in nodelist messagebox.show(inst.innertext) next
as you're @ correct xml node.
Comments
Post a Comment