It seems I found something mismatch between the various XML implementations inside .NET 3.5, and I'm struggling to figure out what is nominally correct.
The problem is actually quite easy to reproduce:
Create a simple XML document with a text element containing the characters '\ t' and assign it an attribute containing the characters '\ t':
var xmlDoc = new XmlDocument { PreserveWhitespace = false, };
xmlDoc.LoadXml("<test><text attrib=\"Tab'\t'space' '\">Tab'\t'space' '</text></test>");
xmlDoc.Save(@"d:\TabTest.xml");
NB: This means that the XmlDocument itself is quite happy with the characters '\ t' in the attribute value.
Download the document using the new XmlTextReader:
var rawFile = XmlReader.Create(@"D:\TabTest.xml");
var rawDoc = new XmlDocument();
rawDoc.Load(rawFile);
Download the document using XmlReader.Create:
var rawFile2 = new XmlTextReader(@"D:\TabTest.xml");
var rawDoc2 = new XmlDocument();
rawDoc2.Load(rawFile2);
Compare documents in the debugger:
(rawDoc).InnerXml "<test><text attrib=\"Tab' 'space' '\">Tab'\t'space' '</text></test>" string
(rawDoc2).InnerXml "<test><text attrib=\"Tab'\t'space' '\">Tab'\t'space' '</text></test>" string
XmlTextReader , , "\ t" , .
, , XmlReader.Create, , "\ t" ' '.
....!!: -)
After a bit of a Google search found that could encode a '\t' as '	' - if used this instead of '\t' in the example XML both readers work as expected.
Altova XmlSpy XML, -, '\ t' , - ?
XML "\ t", , XmlReader.Create, XML , "\ t" XmlReader.Create ?
, / ?