c# - Read and extract XML parser? -
i have folder contains around 15,103 xml files.
an example of xml file within folder following.
a snippet of xml part want focus in on.
<imgdir name="000010000.img"> <imgdir name="info"> <int name="version" value="10" /> <int name="cloud" value="0" /> <int name="town" value="0" /> <float name="mobrate" value="1.0" /> <string name="bgm" value="bgm34/mapleleaf" /> <int name="returnmap" value="10000" /> <string name="mapdesc" value="" /> <int name="hideminimap" value="0" /> <int name="forcedreturn" value="999999999" /> <int name="movelimit" value="0" /> <string name="mapmark" value="mushroomvillage" /> <int name="swim" value="0" /> <int name="fieldlimit" value="8260" /> <int name="vrtop" value="-892" /> <int name="vrleft" value="-1064" /> <int name="vrbottom" value="915" /> <int name="vrright" value="1334" /> <int name="fly" value="0" /> <int name="nomapcmd" value="0" /> <string name="onfirstuserenter" value="" /> <string name="onuserenter" value="go10000" /> <int name="standalone" value="0" /> <int name="partystandalone" value="0" /> <string name="fieldscript" value="" /> </imgdir> </imgdir> <imgdir name="portal"> <imgdir name="0"> <string name="pn" value="sp" /> <int name="pt" value="0" /> <int name="x" value="-389" /> <int name="y" value="183" /> <int name="tm" value="999999999" /> <string name="tn" value="" /> </imgdir> <imgdir name="1"> <string name="pn" value="sp" /> <int name="pt" value="0" /> <int name="x" value="-416" /> <int name="y" value="185" /> <int name="tm" value="999999999" /> <string name="tn" value="" /> </imgdir> <imgdir name="2"> <string name="pn" value="sp" /> <int name="pt" value="0" /> <int name="x" value="-450" /> <int name="y" value="183" /> <int name="tm" value="999999999" /> <string name="tn" value="" /> </imgdir> <imgdir name="3"> <string name="pn" value="out00" /> <int name="pt" value="2" /> <int name="x" value="1080" /> <int name="y" value="541" /> <int name="tm" value="20000" /> <string name="tn" value="in00" /> <string name="script" value="" /> <int name="hidetooltip" value="0" /> <int name="onlyonce" value="0" /> <int name="delay" value="0" /> </imgdir> </imgdir> i not know how code (never done xml parsing before) , think may possible in .bat.
i need automatically go each xml file, extract portal information & map id, , put 1 text file.
here example of how need output of text (uses snippet of xml above reference)
[10000] // <int name="returnmap" value="10000" /> total=4 // total amount of portals (4 below) sp 0 -389 183 999999999 // <imgdir name="0"> sp 0 -416 185 999999999 // <imgdir name="1"> sp 0 -450 183 999999999 // <imgdir name="2"> out00 2 1080 541 20000 // <imgdir name="3"> i need program go each xml, extract information above , put consistently single text file.
all xml files have same structure , pretty follow same style , imgdir name's, contain different amounts of portals.
you should improve searching ability, anyway did quick search , found this: http://msdn.microsoft.com/en-us/library/87274khy(v=vs.110).aspx parsing xml, , this: http://msdn.microsoft.com/en-us/library/2kzb96fk.aspx iterating on directories , files.
Comments
Post a Comment