EDN Admin
Well-known member
Using XmlReader with .Net 2.0 I find that it correctly normalizes rn to n but it seems to ignore the xml:space="preserve" attribute which I put in the root node with the result that the reader does not preserve any linefeeds. I stepped throught the code
and Whitespace node is never executed:
if (reader.NodeType == XmlNodeType.Whitespace)<br/>
{<br/>
whiteSpace += reader.Value;<br/>
continue;<br/>
}
<br/>
The file has a rn on each line and the start of xml file looks like this in Notepad
<br/>
<bookstore xmlns=" http://www.contoso.com/books http://www.contoso.com/books " xml:space="preserve <br/>
<book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0 <br/>
<title>The Autobiography of Benjamin Franklin</title><br/>
<author><br/>
<first-name>Benjamin</first-name><br/>
<last-name>Franklin</last-name><br/>
</author><br/>
<price>8.99</price><br/>
</book>
View the full article
and Whitespace node is never executed:
if (reader.NodeType == XmlNodeType.Whitespace)<br/>
{<br/>
whiteSpace += reader.Value;<br/>
continue;<br/>
}
<br/>
The file has a rn on each line and the start of xml file looks like this in Notepad
<br/>
<bookstore xmlns=" http://www.contoso.com/books http://www.contoso.com/books " xml:space="preserve <br/>
<book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0 <br/>
<title>The Autobiography of Benjamin Franklin</title><br/>
<author><br/>
<first-name>Benjamin</first-name><br/>
<last-name>Franklin</last-name><br/>
</author><br/>
<price>8.99</price><br/>
</book>
View the full article