Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating Simple Xml In C#
    primarykey
    data
    text
    <p>I need help some help printing out some xml. Here is my code (which isnt working its not even formatting the full url right, it doesnt understand "//" in the url string) It also doesnt understand "&lt;". There must be a better way to do this??</p> <pre><code> foreach (string url in theUrls) { fullurl=@"http://www.cambit.com/restaurants" +url; xml = xml + @"&lt;url&gt;" + Environment.NewLine + @"&lt;loc&gt;" + fullurl + @"&lt;/loc&gt;" + Environment.NewLine + @"&lt;changefreq&gt;weekly&lt;/changefreq&gt;" + Environment.NewLine + @"&lt;priority&gt;0.80&lt;/priority&gt;" + Environment.NewLine + @"&lt;/url&gt;" + Environment.NewLine; } </code></pre> <p>It returns 400 of these appended right next to each other. Environment.NewLine isn't working either....</p> <blockquote> <p><a href="http://www.cambit.com/restaurantsBerwyn" rel="nofollow">http://www.cambit.com/restaurantsBerwyn</a> weekly 0.80</p> </blockquote> <p>I tried this and it says the loc object is not set to an instance of an object</p> <pre><code> XmlDocument aNewNode = new XmlDocument(); XmlElement urlRoot = aNewNode.CreateElement("url"); //aNewNode.DocumentElement.AppendChild(urlRoot); XmlElement loc = aNewNode.CreateElement("loc"); XmlText locText = aNewNode.CreateTextNode(fullurl); aNewNode.DocumentElement.AppendChild(loc); aNewNode.DocumentElement.LastChild.AppendChild(locText); XmlElement chgFreq = aNewNode.CreateElement("changefreq"); XmlText chgFreqText = aNewNode.CreateTextNode("weekly"); aNewNode.DocumentElement.AppendChild(chgFreq); aNewNode.DocumentElement.LastChild.AppendChild(chgFreqText); XmlElement priority = aNewNode.CreateElement("priority"); XmlText priorityText = aNewNode.CreateTextNode("0.80"); aNewNode.DocumentElement.AppendChild(priority); aNewNode.DocumentElement.LastChild.AppendChild(priorityText); </code></pre> <p>What am doing wrong??</p>
    singulars
    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