0

I am trying to get the Names of The Quests added to a ListBox by parsing through an XML document

Example:

<EasyQuests>
  <EasyQuest>
    <Name>Example Quest1</Name>

So what I would want out of that is "Example Quest1". I then want to add "Example Quest1" to the ListBox.

I also need to get the Action value and the NameClass value from

<EasyQuestProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <QuestsSorted>
        <QuestsSorted Action="PickUp" NameClass="ExampleQuest1" />
        <QuestsSorted Action="Pulse" NameClass="ExampleQuest1" />

So I would need to get PickUp and ExampleQuest1 and Pulse and ExampleQuest1 I would then need to add those values to a SEPARATE list but they need to stay in the same row as in Pulse ExampleQuest1

This is what I have tried so far and I can't get working.

private void btnLoadProfile_Click(object sender, EventArgs e)
{
    OpenFileDialog ofd = new OpenFileDialog();
    ofd.Filter = "XML| * .xml";
    if (ofd.ShowDialog() == DialogResult.OK)
    {
        path = ofd.FileName;
        xDoc = new XDocument();
        //xDoc.Load(path);
        xDoc = XDocument.Load(path);
        var listBoxItems = xDoc.Elements("EasyQuest");
        lstQuestBox.DataSource = listBoxItems.ToList();
        lstQuestBox.DisplayMember = "Value";
        lstQuestBox.ValueMember = "Value";

        var questsSorted = xDoc.Elements("QuestsSorted");
        lstQuestsSorted.DataSource = questsSorted.ToList();
        lstQuestsSorted.DisplayMember = "Value";
        lstQuestsSorted.ValueMember = "Value";



    }
}

Here is the XML I am trying to parse through

<?xml version="1.0" encoding="utf-8"?>
<EasyQuestProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <QuestsSorted>
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest1" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest1" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest1" />
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest2" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest2" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest2" />
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest3" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest3" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest3" />
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest4" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest4" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest4" />
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest5" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest5" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest5" />
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest6" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest6" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest6" />
    <QuestsSorted Action="PickUp" NameClass="ExampleQuest7" />
    <QuestsSorted Action="Pulse" NameClass="ExampleQuest7" />
    <QuestsSorted Action="TurnIn" NameClass="ExampleQuest7" />
  </QuestsSorted>
  <NpcQuest>
    <NPCQuest Id="2055" Name="Master Apothecary Faranell" GameObject="false">
      <PickUpQuests>
        <int>1</int>
        <int>12</int>
        <int>123</int>
        <int>1234</int>
        <int>12345</int>
        <int>123456</int>
        <int>1234567</int>
      </PickUpQuests>
      <TurnInQuests>
        <int>1</int>
        <int>12</int>
        <int>123</int>
        <int>1234</int>
        <int>12345</int>
        <int>123456</int>
        <int>1234567</int>
      </TurnInQuests>
      <Position X="1434.48" Y="404.854" Z="-85.1753" />
    </NPCQuest>
  </NpcQuest>
  <Npc />
  <Blackspots />
  <BlackGuids />
  <EasyQuests>
    <EasyQuest>
      <Name>Example Quest1</Name>
      <QuestId>
        <int>1</int>
      </QuestId>
      <QuestType>None</QuestType>
      <QuestClass />
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>false</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
    <EasyQuest>
      <Name>Example Quest2</Name>
      <QuestId>
        <int>12</int>
      </QuestId>
      <QuestType>KillAndLoot</QuestType>
      <QuestClass xsi:type="KillAndLootEasyQuestClass">
        <HotSpots>
          <Vector3 X="-10872.6" Y="-2170.1" Z="117.256" />
          <Vector3 X="-10811.9" Y="-2195.57" Z="117.256" />
          <Vector3 X="-10844.4" Y="-2121.71" Z="121.006" />
          <Vector3 X="-11145" Y="-2270.49" Z="121.577" />
          <Vector3 X="-11121.4" Y="-2298.59" Z="117.256" />
          <Vector3 X="-10914.9" Y="-2217.93" Z="117.756" />
          <Vector3 X="-10996.2" Y="-2302.69" Z="117.256" />
          <Vector3 X="-10947.9" Y="-2281.99" Z="117.256" />
          <Vector3 X="-10860.2" Y="-2279.32" Z="117.256" />
        </HotSpots>
        <EntryTarget>
          <int>7369</int>
        </EntryTarget>
        <IsGrinderNotQuest>false</IsGrinderNotQuest>
      </QuestClass>
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>true</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
    <EasyQuest>
      <Name>Example Quest3</Name>
      <QuestId>
        <int>123</int>
      </QuestId>
      <QuestType>UseItemOn</QuestType>
      <QuestClass xsi:type="UseItemOnEasyQuestClass">
        <HotSpots>
          <Vector3 X="-639.344" Y="-4230.19" Z="38.5605" />
        </HotSpots>
        <EntryIdTarget>
          <int>3153</int>
        </EntryIdTarget>
        <ItemId>12345</ItemId>
        <Range>4.5</Range>
      </QuestClass>
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>true</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
    <EasyQuest>
      <Name>Example Quest4</Name>
      <QuestId>
        <int>1234</int>
      </QuestId>
      <QuestType>UseSpellOn</QuestType>
      <QuestClass xsi:type="UseSpellOnEasyQuestClass">
        <HotSpots>
          <Vector3 X="-639.344" Y="-4230.19" Z="38.5605" />
        </HotSpots>
        <EntryIdTarget>
          <int>3153</int>
        </EntryIdTarget>
        <SpellId>1234</SpellId>
        <Range>4.5</Range>
      </QuestClass>
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>true</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
    <EasyQuest>
      <Name>Example Quest5</Name>
      <QuestId>
        <int>12345</int>
      </QuestId>
      <QuestType>InteractWithNpc</QuestType>
      <QuestClass xsi:type="InteractWithNpcEasyQuestClass">
        <HotSpots>
          <Vector3 X="-639.344" Y="-4230.19" Z="38.5605" />
        </HotSpots>
        <GossipOptionNpcInteractWith>1</GossipOptionNpcInteractWith>
        <Macro></Macro>
        <IgnoreIfDead>false</IgnoreIfDead>
        <EntryIdTarget>
          <int>3153</int>
        </EntryIdTarget>
        <Range>4.5</Range>
      </QuestClass>
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>true</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
    <EasyQuest>
      <Name>Example Quest6</Name>
      <QuestId>
        <int>123456</int>
      </QuestId>
      <QuestType>FollowNpc</QuestType>
      <QuestClass xsi:type="FollowNpcEasyQuestClass">
        <StartPosition X="-639.344" Y="-4230.19" Z="38.5605" />
        <NpcEntry>3153</NpcEntry>
        <Assist>true</Assist>
        <FollowDistance>5</FollowDistance>
      </QuestClass>
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>true</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
    <EasyQuest>
      <Name>Example Quest7</Name>
      <QuestId>
        <int>1234567</int>
      </QuestId>
      <QuestType>Gatherer</QuestType>
      <QuestClass xsi:type="GathererEasyQuestClass">
        <HotSpots>
          <Vector3 X="-489.093" Y="-4301.17" Z="42.8668" />
          <Vector3 X="-406.266" Y="-4279.2" Z="46.376" />
          <Vector3 X="-487.607" Y="-4277.06" Z="43.0128" />
          <Vector3 X="-326.03" Y="-4395.06" Z="58.3265" />
          <Vector3 X="-486.916" Y="-4291.01" Z="43.2161" />
          <Vector3 X="-404.261" Y="-4263.58" Z="49.3811" />
          <Vector3 X="-360.679" Y="-4337.94" Z="58.1938" />
          <Vector3 X="-556.425" Y="-4288.72" Z="37.4423" />
          <Vector3 X="-422.731" Y="-4377.85" Z="42.2301" />
          <Vector3 X="-551.576" Y="-4292.26" Z="37.0935" />
          <Vector3 X="-592.091" Y="-4074.48" Z="74.4737" />
          <Vector3 X="-444.979" Y="-4122.43" Z="51.091" />
          <Vector3 X="-244.933" Y="-4318.93" Z="61.35" />
          <Vector3 X="-295.805" Y="-4337.23" Z="56.8324" />
          <Vector3 X="-465.098" Y="-4381.39" Z="50.5997" />
          <Vector3 X="-406.41" Y="-4460.83" Z="51.9784" />
          <Vector3 X="-423.568" Y="-4175.42" Z="50.8418" />
          <Vector3 X="-516.889" Y="-4187.04" Z="77.1396" />
          <Vector3 X="-746.487" Y="-4276.66" Z="43.7713" />
          <Vector3 X="-422.691" Y="-4187.55" Z="51.6474" />
          <Vector3 X="-469.634" Y="-4378.43" Z="48.3773" />
          <Vector3 X="-413.091" Y="-4398.37" Z="43.5909" />
          <Vector3 X="-407.968" Y="-4061.42" Z="51.8647" />
          <Vector3 X="-317.47" Y="-4438.41" Z="57.4445" />
          <Vector3 X="-674.292" Y="-4300.25" Z="44.9458" />
          <Vector3 X="-427.711" Y="-4185.25" Z="50.4451" />
          <Vector3 X="-601.576" Y="-4075.62" Z="75.8641" />
          <Vector3 X="-322.206" Y="-4438.69" Z="56.7659" />
          <Vector3 X="-408.213" Y="-4395.52" Z="42.7661" />
          <Vector3 X="-317.603" Y="-4105.12" Z="54.3323" />
          <Vector3 X="-489.684" Y="-4089.52" Z="64.5607" />
          <Vector3 X="-182.636" Y="-4183.35" Z="81.1131" />
          <Vector3 X="-489.837" Y="-4464.14" Z="51.9806" />
          <Vector3 X="-330.869" Y="-4393.1" Z="58.5324" />
          <Vector3 X="-298.444" Y="-4332.24" Z="56.6012" />
          <Vector3 X="-482.637" Y="-4083.92" Z="65.4204" />
          <Vector3 X="-183.5" Y="-4181.8" Z="80.8193" />
          <Vector3 X="-261.121" Y="-4159.08" Z="54.927" />
          <Vector3 X="-255.695" Y="-4160.31" Z="55.8644" />
          <Vector3 X="-475.429" Y="-4323.95" Z="44.0192" />
          <Vector3 X="-260.522" Y="-4211.04" Z="58.7291" />
          <Vector3 X="-523.076" Y="-4182.39" Z="76.9361" />
          <Vector3 X="-413.362" Y="-4058.05" Z="52.3058" />
          <Vector3 X="-364.977" Y="-4333.73" Z="55.1878" />
          <Vector3 X="-696.942" Y="-4355.8" Z="54.1846" />
        </HotSpots>
        <EntryIdObjects>
          <int>171938</int>
        </EntryIdObjects>
      </QuestClass>
      <ObjectiveCount1>0</ObjectiveCount1>
      <ObjectiveCount2>0</ObjectiveCount2>
      <ObjectiveCount3>0</ObjectiveCount3>
      <ObjectiveCount4>0</ObjectiveCount4>
      <ObjectiveCount5>0</ObjectiveCount5>
      <ObjectiveCount6>0</ObjectiveCount6>
      <ObjectiveCount7>0</ObjectiveCount7>
      <ObjectiveCount8>0</ObjectiveCount8>
      <ObjectiveCount9>0</ObjectiveCount9>
      <ObjectiveCount10>0</ObjectiveCount10>
      <AutoDetectObjectiveCount1>true</AutoDetectObjectiveCount1>
      <AutoDetectObjectiveCount2>false</AutoDetectObjectiveCount2>
      <AutoDetectObjectiveCount3>false</AutoDetectObjectiveCount3>
      <AutoDetectObjectiveCount4>false</AutoDetectObjectiveCount4>
      <AutoDetectObjectiveCount5>false</AutoDetectObjectiveCount5>
      <AutoDetectObjectiveCount6>false</AutoDetectObjectiveCount6>
      <AutoDetectObjectiveCount7>false</AutoDetectObjectiveCount7>
      <AutoDetectObjectiveCount8>false</AutoDetectObjectiveCount8>
      <AutoDetectObjectiveCount9>false</AutoDetectObjectiveCount9>
      <AutoDetectObjectiveCount10>false</AutoDetectObjectiveCount10>
      <CanCondition></CanCondition>
      <IsCompleteCondition></IsCompleteCondition>
      <RepeatableQuest>false</RepeatableQuest>
      <NotRequiredInQuestLog>false</NotRequiredInQuestLog>
      <PickUpQuestOnItem>false</PickUpQuestOnItem>
      <PickUpQuestOnItemID>0</PickUpQuestOnItemID>
      <Comment></Comment>
      <GossipOptionRewardItem>1</GossipOptionRewardItem>
      <RequiredQuest>0</RequiredQuest>
      <MaxLevel>110</MaxLevel>
      <MinLevel>0</MinLevel>
      <WoWClass>Hunter</WoWClass>
    </EasyQuest>
  </EasyQuests>
</EasyQuestProfile>
2
  • so what is the problem? what is not working? Commented Feb 3, 2017 at 1:54
  • The document loads but I am not getting anything imported into the GUI list. Commented Feb 3, 2017 at 1:57

1 Answer 1

2

Elements looks for direct children so it will not work like that. You need to tell it exactly whose children like this:

xDoc.Elements("EasyQuestProfile").Elements("EasyQuests").Elements("EasyQuest");

You can use Descendants if you want since it will look for children, grand children and so on. You can do it like this:

var listBoxItems = xDoc.Descendants("EasyQuest").Select(x => x.Element("Name").Value);
lstQuestBox.DataSource = listBoxItems.ToList();

var questsSorted = xDoc.Descendants("QuestsSorted").Descendants("QuestsSorted")
    .Select(x => x.Attribute("Action").Value + " : " + x.Attribute("NameClass").Value);
lstQuestsSorted.DataSource = questsSorted.ToList();

Elements is faster performance wise but you do not need to worry since you do not have a huge file and you are not doing many times.

Sign up to request clarification or add additional context in comments.

4 Comments

Hmm its still not appending to the list boxes, also when I debug nothing is filling up its null.
When you debug, is there anything in listBoxItems?
Hey so lets say I edit the content in the List boxes, will it change the xml in the background?
No it will not. But that's possible. If you need help with that just post another question please and I or someone else can help you with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.