XmlTextWriter and quotes ???

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

I'm trying to specify single-quotes to be used in xmlAttributes as follows :

XmlTextWriter writer = new XmlTextWriter (filename, null);

//Use indenting for readability.
writer.Formatting = Formatting.Indented;
writer.QuoteChar = (char)39;

--> but he still generates double quotes ???

thnx for your help
Chris
 
Chris wrote:

I'm trying to specify single-quotes to be used in xmlAttributes as follows :

XmlTextWriter writer = new XmlTextWriter (filename, null);

//Use indenting for readability.
writer.Formatting = Formatting.Indented;
writer.QuoteChar = (char)39;

--> but he still generates double quotes ???

I have tried the following with .NET 1.1

XmlTextWriter xmlWriter = new XmlTextWriter(Console.Out);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.QuoteChar = '\'';

xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("god");
xmlWriter.WriteAttributeString("name", "Kibo");
xmlWriter.WriteEndElement();
xmlWriter.WriteEndDocument();

and it outputs single quotes:

<?xml version='1.0' encoding='ibm850'?>
<god name='Kibo' />
 
Back
Top