locked
WoWArmory XML Parsing using LINQ to XML? RRS feed

  • Question

  •  

    In case you didn't know, Blizzard publishes XML data for World of Warcraft characters. It comes as a fairly large XML doc.

     

    Right now I'm using XPath to parse the document and push data into a class. My question is, would LINQ to XML be a good choice to use in place of XPath for an XML document like this? Are there performance gains compared to XPath?

     

    Here's a part of the XML doc:

     

        <characterTab>
          <talentSpec treeOne="2" treeThree="11" treeTwo="48"/>
          <buffs>
            <spell effect="Causes 75 Fire damage to attackers.  Chance to receive a critical hit reduced by 5%.  Chance to critically strike with spells increased by 3%." icon="ability_mage_moltenarmor" name="Molten Armor"/>
          </buffs>
          <debuffs/>
          <pvp>
            <lifetimehonorablekills value="23541"/>
            <arenacurrency value="904"/>
          </pvp>
          <professions>
            <skill key="enchanting" max="375" name="Enchanting" value="385"/>
            <skill key="tailoring" max="375" name="Tailoring" value="375"/>
          </professions>

    </characterTab>

    Thursday, May 22, 2008 5:27 AM

Answers

  • Hi Zuuljin,

    As far as I know, LINQ to XML is not a replacement for any of the current DOM’s or XML class libraries; LINQ to XML in many cases overlaps their functionality and aims to provide a superior developer experience, but existing code will continue to work. One aspect of LINQ to XML is that it supports writing Query Expressions and can be combined with any of the other LINQ technologies to create or use XML data as a source or destination format.

    For more information, please check the LINKs below.

    http://msdn.microsoft.com/en-us/library/bb308960.aspx

    LINQ to XML - 5 Minute Overview

    Regards,

    Xun

     

    Monday, May 26, 2008 7:27 AM

All replies

  • Hi Zuuljin,

    As far as I know, LINQ to XML is not a replacement for any of the current DOM’s or XML class libraries; LINQ to XML in many cases overlaps their functionality and aims to provide a superior developer experience, but existing code will continue to work. One aspect of LINQ to XML is that it supports writing Query Expressions and can be combined with any of the other LINQ technologies to create or use XML data as a source or destination format.

    For more information, please check the LINKs below.

    http://msdn.microsoft.com/en-us/library/bb308960.aspx

    LINQ to XML - 5 Minute Overview

    Regards,

    Xun

     

    Monday, May 26, 2008 7:27 AM
  •  

    I know this post is a few months old, but I wanted to add a link for those who may find this in the future (I came across this post while searching for previous experiments using the WCF Test Client with the Armory).

     

    I had done some playing around with Armory XML data back in February, and wrote a post with LINQ-to-XML code for parsing the Armory - and posted the code on my blog.

     

    I'm going to try and layer on WCF and RESTful URI's to do the pull, and post up a .NET 3.5 Armory parser to CodePlex in a couple weeks.

     

    All of that being said - please share your progress with LINQ and the Armory. Smile

    Tuesday, August 5, 2008 5:37 PM