Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to for the XML using XDocument class from the below classes
    primarykey
    data
    text
    <p>I have two classes as</p> <pre><code>class WarningClass { public string SqlEyeWarning { get; set; } public string FileName { get; set; } } class RemarkClass { public string SqlEyeRamark { get; set; } public string FileName { get; set; } } </code></pre> <p>They are populated as under</p> <pre><code>List&lt;WarningClass&gt; lstWarningClass = new List&lt;WarningClass&gt;(); lstWarningClass.Add(new WarningClass { FileName = "a.sql", SqlEyeWarning = "SD001: Set QuotedIdentifier ON statement is missing" }); lstWarningClass.Add(new WarningClass { FileName = "b.sql", SqlEyeWarning = "SD001: Set QuotedIdentifier ON statement is missing" }); lstWarningClass.Add(new WarningClass { FileName = "c.sql", SqlEyeWarning = "SD009: Missing or order mismatch of Grant statement" }); lstWarningClass.Add(new WarningClass { FileName = "a.sql", SqlEyeWarning = "SD009: Missing or order mismatch of Grant statement" }); lstWarningClass.Add(new WarningClass { FileName = "d.sql", SqlEyeWarning = "SD004: Check for existence object then Drop statement before create statement" }); List&lt;RemarkClass&gt; lstRemarkClass = new List&lt;RemarkClass&gt;(); lstRemarkClass.Add(new RemarkClass { FileName = "a.sql", SqlEyeRamark = "SD010: Set AnsiiNullsOn ON statement is missing" }); lstRemarkClass.Add(new RemarkClass { FileName = "b.sql", SqlEyeRamark = "SD002: Order mismatch or it should be ON." }); lstRemarkClass.Add(new RemarkClass { FileName = "c.sql", SqlEyeRamark = "SD002: Order mismatch or it should be ON." }); </code></pre> <p>The desired output will be</p> <pre><code>&lt;ScriptFileNames&gt; &lt;SqlEye&gt; &lt;SqlEyeWarnings Name="Set QuotedIdentifier ON statement is missing"&gt; &lt;File Name="a.sql" /&gt; &lt;File Name="b.sql" /&gt; &lt;/SqlEyeWarnings&gt; &lt;SqlEyeWarnings Name="SD009: Missing or order mismatch of Grant statement"&gt; &lt;File Name="a.sql" /&gt; &lt;File Name="c.sql" /&gt; &lt;/SqlEyeWarnings&gt; &lt;SqlEyeWarnings Name="SD004: Check for existence object then Drop statement before create statement"&gt; &lt;File Name="d.sql" /&gt; &lt;/SqlEyeWarnings&gt; &lt;SqlEyeRemarks Name="SD010: Set AnsiiNullsOn ON statement is missing"&gt; &lt;File Name="a.sql" /&gt; &lt;/SqlEyeRemarks&gt; &lt;SqlEyeRemarks Name="SD002: Order mismatch or it should be ON."&gt; &lt;File Name="b.sql" /&gt; &lt;File Name="c.sql" /&gt; &lt;/SqlEyeRemarks&gt; &lt;/SqlEye&gt; &lt;/ScriptFileNames&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload