peterdungan
asked on
xmlwriter not recognised
Hi
I'm looking at an example use of the xmlwriter in .net 2.0.
When I compile the code shown, I get errors like
The type or namespace name 'XmlWriterSettings' could not be found (are you missing a using directive or an assembly reference?)
Why is this happening please? Do I need to add a reference to the project?
Thanks
I'm looking at an example use of the xmlwriter in .net 2.0.
When I compile the code shown, I get errors like
The type or namespace name 'XmlWriterSettings' could not be found (are you missing a using directive or an assembly reference?)
Why is this happening please? Do I need to add a reference to the project?
Thanks
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
context.Response.ContentType = "text/xml";
using (XmlWriter writer = XmlWriter.Create(context.Response.OutputStream, settings))
{
writer.WriteStartElement("slides");
writer.WriteStartElement("slide");
writer.WriteAttributeString("imageUrl", "foo.jpg");
writer.WriteAttributeString("thumbnailUrl", "foo_thumb.jpg");
writer.WriteAttributeString("caption", "this is a test");
writer.WriteEndElement();
writer.WriteEndElement();
}
}
public bool IsReusable {
get {
return false;
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
to be more specific, go to Menu -> Project -> Add Reference... -> .net tab
Check if System.Xml.dll reference is checked.
Check if System.Xml.dll reference is checked.
ASKER
Yes thanks I realised that and posted the reply above.
sorry, not noticed, that you was the question's author.
using System.Xml;
at the beginning of your source code file, and also check the project References, as peter stated.