-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
area-System.XmluntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Description
I'm using the following code for formatting:
var xdoc = XDocument.Parse( content );
if ( xdoc.Root is not null ) {
// ... custom code
var sb = new StringBuilder();
var settings = new XmlWriterSettings {
Indent = true,
IndentChars = "\t",
OmitXmlDeclaration = true,
NewLineOnAttributes = false,
Encoding = Encoding.UTF8,
WriteEndDocumentOnClose = true,
NewLineChars = CS.CrLf,
NewLineHandling = NewLineHandling.Replace
};
using ( var writer = XmlWriter.Create( sb, settings ) ) {
xdoc.Save( writer );
}
content = sb.ToString();
}
content = StructureCheck.FixXmlToHtml( content );
The result, in 'content', is not formatted!
It contains strings like the following:
"
"
So it is not formatted at all.
Before using the shown code, I also used "xdoc.ToString()", with the same, bad results.
Kind regards
Carlo
Reproduction Steps
See above.
Expected behavior
There should be a formatted, indented output, like:
<table class="page_table">
<tbody>
<tr>
<td>
<br />
per E-Mail: {$Contact_Email}
</td>
</tr>
<tr><td> </td></tr>
<tr><td align="right">{$Date_Long} {$User_Code} </td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
</tbody>
</table>
Actual behavior
Flat output, like:
"
"
Regression?
No response
Known Workarounds
None
Configuration
Console Application
DotNET Framework 9.0, on Windows Server.
Microsoft Windows [Version 10.0.20348.4405]
Microsoft Visual Studio Community 2022 (64-bit)
Version 17.14.19
Other information
No response
Metadata
Metadata
Assignees
Labels
area-System.XmluntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner