EDN Admin
Well-known member
<p align=left><font face=Arial>Many thanks to Martin Honnen and especially to Vitek Karas (for thorough explanations on the ground level) for <a title="http://forums.microsoft.com/forums/showpost.aspx?postid=3819821&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=2 http://forums.microsoft.com/forums/showpost.aspx?postid=3819821&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=2 helping me to break into Linq to Xml stuff. </font>
<p align=left><font face=Arial></font>
<p align=left><font face=Arial>Now I am able to write fairly complex routines and see that the power of Linq is awesome. Still there are some problems. here is one:</font>
<p align=left><font size=3>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
<p align=left>
<p align=left><b><font color="#0000ff if</b></font> ( <b><font color="#0000ff this</font>.searchXmlDict.Count > 0 ) </b>
<p align=left>{
<p align=left>System.Xml.Linq.<b><font color="#2b91af XDocument</b></font> xdoc = <b><font color="#0000ff new</b></font> System.Xml.Linq.<b><font color="#2b91af XDocument</b></font> ( <b><font color="#0000ff this</font>.searchXmlDict );</b>
<p align=left>
<p align=left> </font>
<b></b>
<p align=left>
<p align=left>I get a runtime error quoted in the header. Both keys and values in the dictionary are ordinary string values that have been collected from another Xml file (this dictionary collection is simply a small subset of the original xml) that I built with XmlNotepad and have been able to process many times with Linq queries and other XDOM classes.
<p align=left>
<p align=left>Why is it? What is the concept of the constructor for XDocument then?
<p align=left>
<p align=left>Thanks.
<p align=left>
<p align=left>P.S. I should probably explain the intent. I have a large xml file, I do a search thru it and a certain number of items are come up as a result. Lets say I get 5 items out of 400. I needd to store them in a separate Xml file. The key is the node ID (an Attribute.Value) and the Value is the XElement.Value (InnerText).
<p align=left>
View the full article
<p align=left><font face=Arial></font>
<p align=left><font face=Arial>Now I am able to write fairly complex routines and see that the power of Linq is awesome. Still there are some problems. here is one:</font>
<p align=left><font size=3>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
<p align=left>
<p align=left><b><font color="#0000ff if</b></font> ( <b><font color="#0000ff this</font>.searchXmlDict.Count > 0 ) </b>
<p align=left>{
<p align=left>System.Xml.Linq.<b><font color="#2b91af XDocument</b></font> xdoc = <b><font color="#0000ff new</b></font> System.Xml.Linq.<b><font color="#2b91af XDocument</b></font> ( <b><font color="#0000ff this</font>.searchXmlDict );</b>
<p align=left>
<p align=left> </font>
<b></b>
<p align=left>
<p align=left>I get a runtime error quoted in the header. Both keys and values in the dictionary are ordinary string values that have been collected from another Xml file (this dictionary collection is simply a small subset of the original xml) that I built with XmlNotepad and have been able to process many times with Linq queries and other XDOM classes.
<p align=left>
<p align=left>Why is it? What is the concept of the constructor for XDocument then?
<p align=left>
<p align=left>Thanks.
<p align=left>
<p align=left>P.S. I should probably explain the intent. I have a large xml file, I do a search thru it and a certain number of items are come up as a result. Lets say I get 5 items out of 400. I needd to store them in a separate Xml file. The key is the node ID (an Attribute.Value) and the Value is the XElement.Value (InnerText).
<p align=left>
View the full article