Hallo,
wieso wird die Datei
http://www.aspintranet.de/dotnet/createxml.aspx
nicht als XML-Dokument dargestellt, sondern
nur als HTML-Text? Der Dokumentquelltext sieht
so aus:
<?xml version="1.0" encoding="windows-1252"?>
<book genre="novel" publicationdate="1997" ISBN="1-861001-57-5">
<title>Pride And Prejudice</title>
<author>
<first-name>Jane</first-name>
<last-name>Austen</last-name>
</author>
<price>24.95</price>
<pages>290</pages>
</book>
Der Code, der das Dokument erzeugt, ist folgender:
<%@ Page Language="C#" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Xml" %>
<% Response.ContentType = "text/xml"; %>
<%
XmlDocument doc = new XmlDocument();
doc.LoadXml("<?xml version=\"1.0\" encoding=\"windows-1252\"?>" +
"<book genre=\"novel\" publicationdate=\"1997\" " +
" ISBN=\"1-861001-57-5\">" +
" <title>Pride And Prejudice</title>" +
" <author>" +
" <first-name>Jane</first-name>" +
" <last-name>Austen</last-name>" +
" </author>" +
" <price>24.95</price>" +
"</book>");
XmlNode newElem=doc.CreateNode(XmlNodeType.Element, "pages", "");
newElem.InnerText = "290";
//add the new node to the document
XmlElement root = doc.DocumentElement;
root.AppendChild(newElem);
StringWriter w = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(w);
writer.Formatting = Formatting.Indented;
doc.WriteTo( writer );
writer.Flush();
Response.Write(w);
%>
Gruss
Alex
www.aspintranet.de
------------------
Professionelles .NET Hosting auf leistungsf�higen Servern.
ASP.NET, VS.NET, XML, CDO, SQL 2000 und vieles mehr.
Informieren Sie sich jetzt unter http://www.aspnet.de
_______________________________________________
Asp.net mailing list
[EMAIL PROTECTED]
http://www.glengamoi.com/mailman/listinfo/asp.net