locked
LINQ to XML RRS feed

  • Question

  •  

    Hi,

     

    I was reading LINQ to XML related stuff. I have a doubt in this. Please let me know if i am wrong in my understanding..

     

    1) LINQ to XML is used in lines with XML DOM or XMLREADER and similar techinique and basicially a new way of in memory object to manipulate the XML.

     

    2) If i store my data as XML in database, i found SQL + XPATH + XQUERY little difficult since i just started to use them. My understanding is if i just take the whole XML data to my server memory and use LINQ to do all the querying and filtering.

     

    3) or I can use linq to XML to query and filter the data which is stored in database as an XML type data??

     

    am i confusing? well

     

    Thanks

    Chamy
    Thursday, September 18, 2008 8:59 PM

All replies

  • LINQ and LINQ to XML is part of the MS .NET framework, not of MS SQL Server.

    LINQ to XML is a replacemenf for the DOM implementation in the .NET framework (i.e. a replacement for System.Xml.XmlDocument/XmlNode/XmlElement). LINQ to XML makes use of and leverages the power of LINQ.

    So you will not use LINQ to XML within SQL Server with the xml data type, rather you will use LINQ to XML in your client code that reads data from your data base or writes data to your data base.

    Friday, September 19, 2008 12:23 PM
  •  Martin Honnen wrote:

    So you will not use LINQ to XML within SQL Server with the xml data type, rather you will use LINQ to XML in your client code that reads data from your data base or writes data to your data base.

     

    Yep, I am trying to find a replacement for SQLXML and easy way to query through XML documents stored in the sql Server.

     

    I found LINQ to XML provides a lot of methods,

     

    But my XML documents will be huge documents, when i use LINQ can i query one some nodes from the XML document ?

     

    I know if i bring the whole document to server i can use XMLREADER or DOM object to go through and find what i want, but the whole document has to be loaded on the memory its costly. so i wanted to find an alternative to load only the specific nodes that i am interested in.so that i dont need to fill up my memory with unwanted data. but if i choose my manager is interested in a consistent way, so if i use LINQ i should use IT for all. so i did my own research on SQL index and stuff.

     

    I am trying to learn more about sql + xml + xpath + xquery. i wanted to know whether my path is right or not. I have very short time to finish the project.

     

    Thanks

    Chamy

    Monday, September 22, 2008 2:47 PM
  • You can combine XmlReader and LINQ to XML to reduce the memory footprint, see http://msdn.microsoft.com/en-us/library/bb387008.aspx

    Monday, September 22, 2008 3:17 PM