のにXMLNode item
追加する必要がXMLNode targetNode
ありますXMLDocument docRss
XmlNode targetNode = docRss.SelectSingleNode("channel");
targetNode .AppendChild(docRss.ImportNode(item, true));
例外: オブジェクト参照がオブジェクトのインスタンスに設定されていません。
編集targetNode が nullであることがわかりましたが、なぜですか? docRss.innerXml のように
このステートメントの前の値は次のとおりです。
docRss.innerXml = <?xml version=\"1.0\"?><rss version=\"2.0\"><channel><title>The federal Savings Bank News Feeds</title><link>https://www.thefederalsavingsbank.com</link><description>The federal Savings Bank News Feeds</description><language>en-us</language></channel></rss>
item.innerXml = <title>Housing market improvement helps economy</title><link>https://www.thefederalsavingsbank.com/Advice</link><description>&lt;p&gt;According to The Associated Press, a strong housing report helped improve the stock market, showing that the housing market affects more than just one industry.&lt;/p&gt;\r\n&lt;p&gt;The Dow increased by 5.22 points to close at 13,557, which marked the fourth straight day of gains, which is thought to be a result of the improving housing market.&lt;/p&gt;\r\n&lt;p&gt;Time Magazine recently reported that a recovery for the housing market is also great news for large banks. The Department of Commerce announced that new residential construction projects increased by 15 percent in September in comparison to the prior month, and they also increased by 34.8 percent compared to last year.&lt;/p&gt;\r\n&lt;p&gt;Housing starts are still down from the numbers that were seen before the recession, but the market is steadily improving every month.&lt;/p&gt;\r\n&lt;p&gt;First-time home buyers who are interested in purchasing a home might look at now as the perfect time considering the low cost of mortgages and affordable rates that are offered. Those considering buying their first home should look into FHA loans considering they offer lower interest rates.&lt;/p&gt;</description>