数据库的XElement的显示:
1.<asp:Xml ID="Xml1" runat="server"></asp:Xml>控件与RepeatedCompany.xslt显示
XmlReader reader = xe.CreateReader();
reader.MoveToContent();
XmlDocument doc = new XmlDocument();
XmlNode cd = doc.ReadNode(reader);
doc.AppendChild(cd);
//Response.Expires = -1;
//Response.Clear();
//Response.Write("<?xml version='1.0' encoding='utf-8'?>");
//Response.Write(doc.OuterXml);
//Response.End();
//XslTransform trans = new XslTransform();
//trans.Load(Server.MapPath("RepeatedCompany.xslt"));
//Xml1.Document = doc;
//Xml1.Transform = trans;
//Xml1.DocumentContent = doc.OuterXml;
2.用单独页面显示XML
RepeatedCompany company = bllrc.FindEntity(companyId);
XmlReader reader = company.RelatedRecords.CreateReader();
reader.MoveToContent();
XmlDocument doc = new XmlDocument();
XmlNode cd = doc.ReadNode(reader);
doc.AppendChild(cd);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "text/xml";
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.Write(doc.OuterXml);
HttpContext.Current.Response.End();
1.<asp:Xml ID="Xml1" runat="server"></asp:Xml>控件与RepeatedCompany.xslt显示
XmlReader reader = xe.CreateReader();
reader.MoveToContent();
XmlDocument doc = new XmlDocument();
XmlNode cd = doc.ReadNode(reader);
doc.AppendChild(cd);
//Response.Expires = -1;
//Response.Clear();
//Response.Write("<?xml version='1.0' encoding='utf-8'?>");
//Response.Write(doc.OuterXml);
//Response.End();
//XslTransform trans = new XslTransform();
//trans.Load(Server.MapPath("RepeatedCompany.xslt"));
//Xml1.Document = doc;
//Xml1.Transform = trans;
//Xml1.DocumentContent = doc.OuterXml;
2.用单独页面显示XML
RepeatedCompany company = bllrc.FindEntity(companyId);
XmlReader reader = company.RelatedRecords.CreateReader();
reader.MoveToContent();
XmlDocument doc = new XmlDocument();
XmlNode cd = doc.ReadNode(reader);
doc.AppendChild(cd);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "text/xml";
HttpContext.Current.Response.Charset = "UTF-8";
HttpContext.Current.Response.Write(doc.OuterXml);
HttpContext.Current.Response.End();