Hi,
Wonder if anyone can help me on this, In DotNet2.0 I've been quite happily
using the WriteAttributeString method of XmlWriter object, but have run into
a problem when trying to output a space character as the value of an
attribute.
Prototype of the method I am using is XmlWriter.WriteAttributeString
(String, String) in the following fashion:
xmlTextWriter.WriteStartElement("Rule");
xmlTextWriter.WriteAttributeString("Separator", " ");
xmlTextWriter.WriteEndElement();
Which results in the following XML:
<Rule Separator="" />
I've looked into xmlTextWriter.WriteWhiteSpace(string) but this outputs
directly into the text writer object, which doesn't help when trying to
write a value for an attribute of an element. I've also checked the other
properties to see if there is a "preserve white space" setting, which I
can't see.
Can anyone throw any light on a possible solution? Can I encode the space
differently to make sure it is kept in the output XML when using
WriteAttributeString or do I have to use a different method (which one?) or
a completely different object for outputting the XML?
Regards,
- Paul.