locked
Linq to XML

    Question

  • Will I be able to query XML documents using Linq in the WinRT environment?
    Sunday, October 7, 2012 1:08 AM

Answers

All replies

  • Linq is part of .Net and is available for Windows Store apps written in .Net (i.e. C# or VB).

    --Rob

    Sunday, October 7, 2012 4:00 PM
    Owner
  • What are my options for XML querying for Windows Store apps written in C++? I'm converting a C# WP7 application to Windows Store and I was using XML and Linq for application data. I'm researching what my options are for C++. I want to stay with my XML storage.

    Sunday, October 7, 2012 5:48 PM
  • You can use XmlDocument and the Windows.Data.Xml.Dom classes to read your XML data files.

    --Rob

    Monday, October 8, 2012 2:29 AM
    Owner
  • Hi,

    I am able to read from xml file using the following code in Windows 8. However, I am not able to figure out how to write to an xml file from my form fields.

     XDocument risks = XDocument.Load(@"risks.xml");
    
                var xml = from x in risks.Descendants("risk")
                          where x.Attribute("status").Value == "Planning"
                          select x;
    
                foreach (var x in xml)
                {
    
                    StatusField.SelectedItem = x.Attribute("status").Value;
                    RiskTitleField.Text = x.Attribute("title").Value;
                    RiskStatementField.Text = x.Attribute("statement").Value;
                }
    Any Help will be greatly appreciated!


    Carmelo Milian

    Saturday, November 17, 2012 7:33 AM
  • Compose an XML elements from your control contents, insert them into an XmlDocument and call the document's SaveToFileAsync method to put it into permanent storage.

    Sunday, November 18, 2012 12:50 AM