Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to read Xml-Files with many difference Attribute? (CSharp)

$
0
0

Hello Guys,

I've just small questions, how I can just  read the "<sprite>sprites\spr_***</sprite>"?

<sprites name="Atmospheric"><sprite>sprites\spr_lighter</sprite></sprites><sprites name="Character"><sprite>sprites\spr_char_walk</sprite><sprite>sprites\spr_char_stand</sprite><sprite>sprites\spr_char_att1</sprite><sprite>sprites\spr_char_stand_storm</sprite><sprite>sprites\spr_char_att2</sprite><sprite>sprites\spr_char_att2_stand</sprite><sprite>sprites\spr_char_death</sprite><sprite>sprites\spr_char_shadow</sprite><sprite>sprites\sprite77</sprite><sprite>sprites\spr_walk_smoke</sprite></sprites><sprites name="SoulMana"><sprites name="SoulFaust"><sprite>sprites\spr_soulfire_attack</sprite><sprite>sprites\spr_soulfire_attack_2</sprite><sprite>sprites\spr_soulfire_attack_3</sprite><sprite>sprites\spr_soulfire_attack_4</sprite></sprites><sprites name="SoulHeal"><sprites name="Front"><sprite>sprites\spr_soulfire_heal_front</sprite><sprite>sprites\spr_soulfire_heal_begin_front</sprite><sprite>sprites\spr_soulfire_heal_end_front</sprite></sprites><sprites name="Back"><sprite>sprites\spr_soulfire_heal_back</sprite><sprite>sprites\spr_soulfire_heal_begin_back</sprite><sprite>sprites\spr_soulfire_heal_end_back</sprite></sprites></sprites><sprites name="SoulCircle"><sprite>sprites\spr_soulfire_half</sprite><sprite>sprites\spr_soulfire_circle</sprite></sprites></sprites><sprites name="Enemy"><sprites name="SoulStone"><sprite>sprites\spr_eny_soulstone</sprite><sprite>sprites\spr_eny_soulstone_att</sprite><sprite>sprites\spr_eny_soulstone_hit</sprite><sprite>sprites\spr_eny_soulstone_stone</sprite></sprites><sprites name="SoulKnight"><sprite>sprites\spr_eny_soulknight</sprite><sprite>sprites\spr_eny_soulknight_att</sprite><sprite>sprites\spr_eny_soulknight_hit</sprite><sprite>sprites\spr_eny_soulknight_death</sprite><sprite>sprites\spr_eny_soulknight_sword</sprite></sprites><sprites name="GolemSpeer"><sprite>sprites\spr_eny_golemspeer</sprite><sprite>sprites\spr_eny_golemspeer_att</sprite><sprite>sprites\spr_eny_golemspeer_hit</sprite><sprite>sprites\spr_eny_golemspeer_death</sprite><sprite>sprites\spr_eny_golemspeer_walking</sprite></sprites></sprites><sprite>sprites\spr_tree_1</sprite><sprite>sprites\spr_block</sprite>

(there is the full version of xml: http://pastebin.com/qaiBUkZV )

The other like "<sprites name="Golemspeer">" should be ignored, I don't want this.

I've tried this code, but this is not effectiv:

        public static void Start(){
            if (File.Exists(InfoFromProject.InfoFromProject.GetProjectPath()) == true)
            {

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(File.ReadAllText(InfoFromProject.InfoFromProject.GetProjectPath()));

                    string sprite_files = "";


                    foreach (XmlNode eventBackground in doc.SelectNodes("assets/sprites")) {
                        sprite_files = eventBackground.InnerText.ToString();
                        MessageBox.Show(sprite_files);
                    }

            }

        }

Any ideas? :-)

- China


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>