0
$\begingroup$

I have an xml file with the tag data from Stackexchange: https://archive.org/download/stackexchange/stackoverflow.com-Tags.7z

After I unzip it I would like to import it to Mathematica to some statistics. I get an XML Object like this:

XMLObject[ "Document"][{XMLObject["Declaration"]["Version" -> "1.0", "Encoding" -> "utf-8"]}, XMLElement[ "tags", {}, {XMLElement[ "row", {"Id" -> "1", "TagName" -> ".net", "Count" -> "265332", "ExcerptPostId" -> "3624959", "WikiPostId" -> "3607476"}, {}], XMLElement[ "row", {"Id" -> "2", "TagName" -> "html", "Count" -> "733157", "ExcerptPostId" -> "3673183", "WikiPostId" -> "3673182"}, {}] 

How do i convert it to a Mathematica dataset?

I'm aware that a similar question was asked regarding Import itunes xml data. (Import iTunes xml data and convert it into a dataset or table) but i could not figure out how to change this code that i can use it for my XML Object.

Some help would be highly appreciated!

$\endgroup$
2
  • 3
    $\begingroup$ For the snippet you showed Dataset@Cases[xml, XMLElement[_, attrs_, _]:>Association[attr], Infinity] should work $\endgroup$ Commented Mar 27, 2018 at 17:35
  • $\begingroup$ @b3m2a1 thank you very much!! It worked perfect. $\endgroup$ Commented Mar 28, 2018 at 11:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.