XMLNodeList

Hello all, Trying to convert my app to windows store apps and parse my xml and keep getting the following errors.

The type or namespace name ‘XmlDocument’ could not be found (are you missing a using directive or an assembly reference?)

The type or namespace name ‘XmlNodeList’ could not be found (are you missing a using directive or an assembly reference?)

something has changed just can’t seem to find the answer in google.

So I was reading that we could use

Now before what I did was just add the .dll file in a separate folder and it worked perfectly but now I keep getting this error, any ideas?

You have to use XDocument and friends, not XmlDocument.

I just found that out, thanks Tomas.

Here is a question I hope someone could really answer. When ever I add the system.xml.linq to my references shut down my game and restart it disappears, why is that?

Disappears from where?

From my references like I never added it to the reference list and I have to add it everytime I start a project.

Which project is that?

  • the one generated by Editor when you build Windows Store Apps
  • Assembly-CSharp

For the windows store app and windows phone 8 and yes Assembly-CSharp.

As far as I know System.Xml.Linq is included automatically, because those solutions use Microsoft compiler under the hood. So you don’t need to explicilty add reference to System.Xml.Linq

As for Assembly-CSharp, yes, you’re right, it does disappear, because Unity is regenerating the project from scratch, and any modifications done to that project will be lost, System.Xml.Linq will be added by default to Assembly-CSharp in 4.3

Thanks for the information. You have solved alot of problems. I still have to add it because the compiler doesn’t see it otherwise unless I am doing something wrong.

Same path new issue. So I am using xdocument to load my www url and now I am getting the

Here is the code that I am getting it from:

   xmlDoc = XDocument.Load(highURL.text);
           // xmlDoc =  XDocument.Parse(highURL.text);
          List<HigscoreInfo> data =( from item in xmlDoc.Descendants("player")
                       select new HigscoreInfo
                       {
                          Username  = item.Element("username").Value,
                       }).ToList<HigscoreInfo>();

Any suggestions.

highURL.text is invalid according to the exception

Wow, never thought of that but this is how unity reads www correct, have to find another route I guess, thanks for the insight.

Just went and fixed everything and kept it all the same going to post the answer though using XDocument and XElement.
I am using Scoreoid’s api which is a beast and here is the snippet to make everything work.

 void OnGUI()
 {
     //convert our xelements to usable xml parsed data
       IEnumerable<XElement> players = data.Elements();
       IEnumerable<XElement> score = data.Elements();
      
     GUILayout.BeginArea(new Rect(150, 70, 1000, 800));
   

     foreach (var player in players.Elements())
     {
         GUILayout.TextArea(players.Elements("player").Attributes("username").ElementAt(0).Value, style, GUILayout.Width(600));
        
     }
   
     GUILayout.EndArea();
    
     GUILayout.BeginArea(new Rect(650, 70, 1000, 800));

    
     foreach (var scores in score.Elements())
     {
        GUILayout.TextArea(scores.Elements("score").Attributes("score").ElementAt(0).Value.ToString(), style, GUILayout.Width(600));
}

That should be all you would need in ONGUI to get it to look nice and pretty.