{"id":105,"date":"2008-02-07T10:03:00","date_gmt":"2008-02-07T18:03:00","guid":{"rendered":"https:\/\/simpkins.social\/cliff\/?p=105"},"modified":"2025-03-11T15:21:52","modified_gmt":"2025-03-11T22:21:52","slug":"parsing-the-wow-armory","status":"publish","type":"post","link":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/","title":{"rendered":"Parsing the WoW Armory"},"content":{"rendered":"\n<p>One of my side projects is working on a\u00a0<a href=\"https:\/\/codeplexarchive.org\/codeplex\/project\/WowGuildRoster\">WoW Guild Roster<\/a>. I\u2019ve been doing a lot of work over the past couple months with\u00a0<a href=\"http:\/\/msdn2.microsoft.com\/en-gb\/vstudio\/default.aspx\">Visual Studio 2008<\/a>, although I\u2019ve been stuck with ASP.NET v2 since\u00a0<a href=\"http:\/\/www.dotnetnuke.com\/\">DNN<\/a>\u00a0won\u2019t be supporting v3.5 until DNN v5. One of the features that has me really excited within .NET v3.5 is\u00a0<a href=\"http:\/\/msdn2.microsoft.com\/en-us\/netframework\/aa904594.aspx\">LINQ<\/a>.<\/p>\n\n\n\n<p>So, while I was playing with LINQ, I decided \u2018what would the code look like if I were to query WoW character data from the&nbsp;<a href=\"http:\/\/www.wowarmory.com\/\">WoW Armory<\/a>? So\u2026I sat down and wrote a quick query of character information.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>XDocument _charSheet;\n  \n System.Net.WebClient _wc = new System.Net.WebClient(); \n _wc.QueryString.Add(\"r\", this.Realm); \n _wc.QueryString.Add(\"n\", this.CharName); \n _wc.Headers.Add(\"user-agent\", \"MSIE 7.0\"); \n System.Xml.XmlTextReader _reader = new System.Xml.XmlTextReader(_wc.OpenRead(ArmoryCharSheet));\n \n_charSheet = XDocument.Load(_reader); \nIEnumerable&lt;XElement&gt; _charInfoEl = _charSheet.Root.Descendants(\"characterInfo\"); \nif (_charInfoEl.Count() &lt; 1) {\n  MessageBox.Show(\"No descendants at &lt;characterInfo&gt;\"); \n} else if (_charInfoEl.Count() &gt; 1) { \n  MessageBox.Show(\"Multiple descendants at &lt;characterInfo&gt;\"); \n}\n \nvar _charInfo = from item in _charInfoEl.Descendants(\"character\") \n                 select new { \n                   Battlegroup = item.Attribute(\"battleGroup\").Value, \n                   CharURL = item.Attribute(\"charUrl\").Value, \n                   Class = item.Attribute(\"class\").Value, \n                   ClassID = item.Attribute(\"classId\").Value, \n                   Faction = item.Attribute(\"faction\").Value, \n                   FactionID = item.Attribute(\"factionId\").Value, \n                   Gender = item.Attribute(\"gender\").Value, \n                   GenderID = item.Attribute(\"genderId\").Value, \n                   GuildName = item.Attribute(\"guildName\").Value, \n                   GuildURL = item.Attribute(\"guildUrl\").Value, \n                   LastModifiedString = item.Attribute(\"lastModified\").Value, \n                   Level = item.Attribute(\"level\").Value, \n                   Name = item.Attribute(\"name\").Value, \n                   Prefix = item.Attribute(\"prefix\").Value, \n                   Race = item.Attribute(\"race\").Value, \n                   RaceID = item.Attribute(\"raceId\").Value, \n                   Realm = item.Attribute(\"realm\").Value, \n                   Suffix = item.Attribute(\"suffix\").Value \n                 }; \nIEnumerable&lt;XElement&gt; _profsEl = _charInfoEl.Descendants(\"professions\"); \nvar _profs = from item in _profsEl.Descendants(\"skill\") \n                select new { \n                  Key = item.Attribute(\"key\").Value, \n                  Name = item.Attribute(\"max\").Value, \n                  Max = item.Attribute(\"name\").Value, \n                  Value = item.Attribute(\"value\").Value \n                }; \nIEnumerable&lt;XElement&gt; _baseStatsEl = _charInfoEl.Descendants(\"baseStats\"); \nvar _baseStats = from item in _baseStatsEl.Descendants() \n             select new { \n               Stat = item.Name.ToString(), \n               Base = item.Attribute(\"base\").Value, \n               Effective = item.Attribute(\"effective\").Value, \n               Element = item \n             };<\/code><\/pre>\n\n\n\n<p>I was quite impressed by the brevity of the code needed to get this. I still want to go back and clean up the web request to use some of WCF\u2019s new capabilities, but I think the LINQ aspects of the code really speaks for itself. The code that it currently takes in .NET v2 to crawl\/navigate the XML files was much much larger.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of my side projects is working on a\u00a0WoW Guild Roster. I\u2019ve been doing a lot of work over the past couple months with\u00a0Visual Studio 2008, although I\u2019ve been stuck&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Parsing the WoW Armory - Cliff Simpkins<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Parsing the WoW Armory - Cliff Simpkins\" \/>\n<meta property=\"og:description\" content=\"One of my side projects is working on a\u00a0WoW Guild Roster. I\u2019ve been doing a lot of work over the past couple months with\u00a0Visual Studio 2008, although I\u2019ve been stuck&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/\" \/>\n<meta property=\"og:site_name\" content=\"Cliff Simpkins\" \/>\n<meta property=\"article:published_time\" content=\"2008-02-07T18:03:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-11T22:21:52+00:00\" \/>\n<meta name=\"author\" content=\"cliff.simpkins\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cliff.simpkins\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/\"},\"author\":{\"name\":\"cliff.simpkins\",\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/#\\\/schema\\\/person\\\/bba546ac4d77da1fb51bc4030238e864\"},\"headline\":\"Parsing the WoW Armory\",\"datePublished\":\"2008-02-07T18:03:00+00:00\",\"dateModified\":\"2025-03-11T22:21:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/\"},\"wordCount\":171,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/\",\"url\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/\",\"name\":\"Parsing the WoW Armory - Cliff Simpkins\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/#website\"},\"datePublished\":\"2008-02-07T18:03:00+00:00\",\"dateModified\":\"2025-03-11T22:21:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/#\\\/schema\\\/person\\\/bba546ac4d77da1fb51bc4030238e864\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/2008\\\/02\\\/07\\\/parsing-the-wow-armory\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Parsing the WoW Armory\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/#website\",\"url\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/\",\"name\":\"Cliff Simpkins\",\"description\":\"Personal site + blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/#\\\/schema\\\/person\\\/bba546ac4d77da1fb51bc4030238e864\",\"name\":\"cliff.simpkins\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/07b113647e819a448cfc8545b476db50a641b9d43808a2c399af84e724d078d2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/07b113647e819a448cfc8545b476db50a641b9d43808a2c399af84e724d078d2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/07b113647e819a448cfc8545b476db50a641b9d43808a2c399af84e724d078d2?s=96&d=mm&r=g\",\"caption\":\"cliff.simpkins\"},\"url\":\"https:\\\/\\\/simpkins.social\\\/cliff\\\/blog\\\/author\\\/cliff-simpkins\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Parsing the WoW Armory - Cliff Simpkins","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/","og_locale":"en_US","og_type":"article","og_title":"Parsing the WoW Armory - Cliff Simpkins","og_description":"One of my side projects is working on a\u00a0WoW Guild Roster. I\u2019ve been doing a lot of work over the past couple months with\u00a0Visual Studio 2008, although I\u2019ve been stuck&hellip;","og_url":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/","og_site_name":"Cliff Simpkins","article_published_time":"2008-02-07T18:03:00+00:00","article_modified_time":"2025-03-11T22:21:52+00:00","author":"cliff.simpkins","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cliff.simpkins","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/#article","isPartOf":{"@id":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/"},"author":{"name":"cliff.simpkins","@id":"https:\/\/simpkins.social\/cliff\/#\/schema\/person\/bba546ac4d77da1fb51bc4030238e864"},"headline":"Parsing the WoW Armory","datePublished":"2008-02-07T18:03:00+00:00","dateModified":"2025-03-11T22:21:52+00:00","mainEntityOfPage":{"@id":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/"},"wordCount":171,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/","url":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/","name":"Parsing the WoW Armory - Cliff Simpkins","isPartOf":{"@id":"https:\/\/simpkins.social\/cliff\/#website"},"datePublished":"2008-02-07T18:03:00+00:00","dateModified":"2025-03-11T22:21:52+00:00","author":{"@id":"https:\/\/simpkins.social\/cliff\/#\/schema\/person\/bba546ac4d77da1fb51bc4030238e864"},"breadcrumb":{"@id":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/simpkins.social\/cliff\/blog\/2008\/02\/07\/parsing-the-wow-armory\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/simpkins.social\/cliff\/"},{"@type":"ListItem","position":2,"name":"Parsing the WoW Armory"}]},{"@type":"WebSite","@id":"https:\/\/simpkins.social\/cliff\/#website","url":"https:\/\/simpkins.social\/cliff\/","name":"Cliff Simpkins","description":"Personal site + blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/simpkins.social\/cliff\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/simpkins.social\/cliff\/#\/schema\/person\/bba546ac4d77da1fb51bc4030238e864","name":"cliff.simpkins","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/07b113647e819a448cfc8545b476db50a641b9d43808a2c399af84e724d078d2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/07b113647e819a448cfc8545b476db50a641b9d43808a2c399af84e724d078d2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/07b113647e819a448cfc8545b476db50a641b9d43808a2c399af84e724d078d2?s=96&d=mm&r=g","caption":"cliff.simpkins"},"url":"https:\/\/simpkins.social\/cliff\/blog\/author\/cliff-simpkins\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":2,"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":185,"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/posts\/105\/revisions\/185"}],"wp:attachment":[{"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/simpkins.social\/cliff\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}