添加一个<;链接href=";模板.css“;rel=";样式表“;类型=";text/css“/&燃气轮机;使用c#System.xml将节点连接到xml文件
我正在使用System.xml创建一个xml文件…首先我得到了目前为止添加一个<;链接href=";模板.css“;rel=";样式表“;类型=";text/css“/&燃气轮机;使用c#System.xml将节点连接到xml文件,c#,asp.net,xml,C#,Asp.net,Xml,我正在使用System.xml创建一个xml文件…首先我得到了目前为止 XmlDocument xmldoc = new XmlDocument(); XmlNode docNode = xmldoc.CreateXmlDeclaration("1.0", "UTF-8", null); xmldoc.AppendChild(docNode); XmlNode Doc = xmldoc.CreateDocumentType("ht
XmlDocument xmldoc = new XmlDocument();
XmlNode docNode = xmldoc.CreateXmlDeclaration("1.0", "UTF-8", null);
xmldoc.AppendChild(docNode);
XmlNode Doc = xmldoc.CreateDocumentType("html", "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd", null);
xmldoc.AppendChild(Doc);
//XmlNode htmlNode = htmlNode.;
XmlNode xmlRoot, xmlNode;
xmlRoot = xmldoc.CreateElement("head");
xmldoc.AppendChild(xmlRoot);
xmlNode = xmldoc.CreateElement("Child");
xmlRoot.AppendChild(xmlNode);
xmlNode.InnerText = "This is the first Child";
xmlNode.InnerText = TextBox1.Text;
xmlNode = xmldoc.CreateElement("Child2");
xmlRoot.AppendChild(xmlNode);
xmlNode.InnerText = "This is the second Child";
xmlNode = xmldoc.CreateElement("Child3");
xmlRoot.AppendChild(xmlNode);
xmlNode.InnerText = "This is the third Child";
string filename = @"D:\Anusha\xmlFiles" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Minute + ".xml";
string filename = @"c:\NewXML" + ".xml" or @"c:\whatever" + ".xml"
xmldoc.Save(filename);
我需要添加.css文件
到我的xml文档。。。
我该怎么做呢?如果我没有错,试试这个
<?xml-stylesheet href="common.css" type="text/css"?>
<?xml-stylesheet href="modern.css" title="Modern" media="screen" type="text/css"?>
<?xml-stylesheet href="classic.css" alternate="yes" title="Classic" media="screen, print" type="text/css"?>
我想使用c#代码添加链接……比如XmlNode Doc=xmldoc.CreateDocumentType(“html”、“-//W3C//DTD XHTML1.1//EN”、”和null);xmldoc.AppendChild(Doc);。。。。。。。有没有一种方法可以像mayb…xmldoc.Createlinktype()那样创建链接节点?我想要c#代码2创建链接节点。。。比如xmldoc.CreateElement()。。。。xmlRoot=xmldoc.CreateElement(“head”);xmldoc.AppendChild(xmlRoot);。。。。这创造了一个。。。。我想在xml文件中创建代码或方法2…@Dorababu。。。我的解释行吗??