在插入XML的结点的时候。怎么在插入节点的上面加上换行?<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
</bookstore>
像这样。。
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
</bookstore>
像这样。。
解决方案 »
- 求助,急!关于在DataList中放置LinkButton的问题,运行时点击没反应。
- 大家都来看下怎么弄 急!!在线等
- rdl 报表 如何改变背景色
- 操作Web.cofig的问题
- 30分求统计在线人数的源码//及方法
- VS.NET2003 Web应用程序里树型目录无法正常显示
- 请教ASP.NET开发环境
- 关于点击把[i][/i]之类的UBB代码添加到文域中。
- </title><script language=javascript>alert("test");</script>
- 写插入数据的命令,表中的字段很多的话,要写那么多的参数.add!有什么办法没有?
- 怎样在HTML代码中控制<img...>的显示与否
- 初学求救
<%@ Import Namespace="System.Data.SqlClient" %><html>
<head>
<script language="C#" runat="server"> public DataView Source;
public DataSet ds;
public bool getSchema, getData; public void Submit_Click(Object sender, EventArgs evt) {
if (IsPostBack) {
SqlConnection myConnection = new SqlConnection(ConnectString.Value);
SqlDataAdapter myCommand = new SqlDataAdapter(myText.Value, myConnection); ds = new DataSet();
myCommand.Fill(ds, "表"); Source = new DataView(ds.Tables[0]); getSchema = GetSchema.Checked;
getData = GetData.Checked; MyDataGrid.DataSource=Source;
MyDataGrid.DataBind();
}
} </script></head>
<body bgcolor="ffffcc"> <h3><font face="宋体">SQL 到 XML 生成器</font></h3> <form runat="server"> <table border=0 cellpadding=5 style="font:10.5pt 宋体">
<tr>
<td colspan="2">
<b>连接字符串:</b><br>
<input id="ConnectString" type="text" value="server=(local);database=pubs;uid=sa;pwd=1234" size="85" runat="server">
</td>
</tr>
<tr>
<td colspan="2">
<b>查询:</b><br>
<input id="myText" type="text" value="SELECT * FROM Authors" size="85" runat="server">
</td>
</tr>
<tr>
<td>
<input type="radio" id="GetSchema" name="Mode" runat="server"/>获取 XML 架构<br>
<input type="radio" id="GetData" name="Mode" runat="server"/>获取 XML 数据<br>
<input type="radio" id="GetBoth" name="Mode" checked runat="server"/>两者都获取
</td>
<td valign="top">
<input type="submit" runat="server" OnServerClick="Submit_Click">
</td>
</tr>
<tr>
<td colspan="2"> <% if (Page.IsPostBack) { %>
<b>结果:</b><br>
<textarea cols=80 rows=25>
<%
if (getSchema)
ds.WriteXmlSchema(Response.Output);
else if (getData)
ds.WriteXml(Response.Output, XmlWriteMode.IgnoreSchema);
else
ds.WriteXml(Response.Output, XmlWriteMode.WriteSchema);
%>
</textarea>
<% } %> </td>
</tr>
<tr>
<td colspan="2"> <% if (Page.IsPostBack) { %>
<b>数据:</b><br>
<% } %> <ASP:DataGrid id="MyDataGrid"
BackColor="#EDBE7B"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="宋体"
Font-Size="8pt"
HeaderStyle-BackColor="#DC6035"
EnableViewState="false"
runat="server"
/> </td>
<tr>
</table> </form></body>
</html>
http://www.cnblogs.com/weekzero/articles/178140.html
我用的方法是:
先插入一个节点.然后用system.io把这个XMl以流的方式读入然后替换
</cmpid>(尾节点)为</cmpid>/n/n
这样就可以实现我的效果了,谢谢大家....结啦....