Can one force XMLWriter to write elements in singl

2019-07-15 18:39发布

Here's my code:

var ptFirstName = tboxFirstName.Text;
writer.WriteAttributeString("first",ptFirstName);

note that ptFirstName will end up in double quotes even if I use

ptFirstName = ptFirstName.Replace("\"","'"); 

This does not work either since the writer will still force double quotes in my file as follows:

when in fact I need (don't ask me why - it's a long story...)

标签: c# xmlwriter
1条回答
爷的心禁止访问
2楼-- · 2019-07-15 19:03

Yes, you can set what character is used for quotes by setting the XmlTextWriter.QuoteChar property. See http://msdn.microsoft.com/en-ca/library/system.xml.xmltextwriter.quotechar.aspx for details.

But this means you have to create an XmlTextWriter object for this to work.

查看更多
登录 后发表回答