Hi counterkin,
Please refer updated code.
If you are using g then, the Namespace prefixes must be declared. You have to add on or above the element that uses the namespace prefix.
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string xmlDoc = "<?xml version='1.0' encoding='utf-8'?>";
xmlDoc += "<channel>";
xmlDoc += "<title>Super X Job Site</title>";
xmlDoc += "<link>http://www.superxjobsite.com</link>";
xmlDoc += "<description>http://www.superxjobsite.com</description>";
xmlDoc += "<item>";
xmlDoc += "<g:id xmlns:g='http://www.w3.org/2001/XInclude'>ABCDE</g:id>";
xmlDoc += "</item>";
xmlDoc += "</channel>";
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();
xdoc.LoadXml(xmlDoc);
xdoc.Save(Server.MapPath("~/feed.xml"));
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim xmlDoc As String = "<?xml version='1.0' encoding='utf-8'?>"
xmlDoc += "<channel>"
xmlDoc += "<title>Super X Job Site</title>"
xmlDoc += "<link>http://www.superxjobsite.com</link>"
xmlDoc += "<description>http://www.superxjobsite.com</description>"
xmlDoc += "<item>"
xmlDoc += "<g:id xmlns:g='http://www.w3.org/2001/XInclude'>ABCDE</g:id>"
xmlDoc += "</item>"
xmlDoc += "</channel>"
Dim xdoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
xdoc.LoadXml(xmlDoc)
xdoc.Save(Server.MapPath("~/feed.xml"))
End Sub
Generated XML
<?xml version="1.0" encoding="utf-8"?>
<channel>
<title>Super X Job Site</title>
<link>http://www.superxjobsite.com</link>
<description>http://www.superxjobsite.com</description>
<item>
<g:id xmlns:g="http://www.w3.org/2001/XInclude">ABCDE</g:id>
</item>
</channel>