Posted 17 years ago by Richard Beyer - KBS Leipzig

I've cut my problem to these 3 lines:

    XmlDocument xdoc = new XmlDocument();
    _synEditor.Document.Text = xdoc.OuterXml;
the xml formatting in the XmlDocument is getting lost when loading it into the Editor with

_synEditor.Document.Text = xdoc.OuterXml;

it's all in one single line after executing the code...


<test />

becomes <root><test /></root>

How can I prevent this?

[Modified at 07/06/2007 08:01 AM]

Comments (5)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Are you positive that OuterXml is returning line terminator characters?

Actipro Software Support

Posted 17 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
To make sure it's an issue with SyntaxEditor, have you tried using the same code to load your document into a multi-line textbox? If it shows up the same where there, the issue lies with how the document is loaded and parsed, and not with SyntaxEditor.
Posted 17 years ago by Richard Beyer - KBS Leipzig
I'm sorry, you were right.

XmlDocument looses the formatting when loading a xml-document, i've fixed it with an own xmlindenter method.

Thank you!
Posted 17 years ago by gardea
There's a probably simpler way to do it, assuming the doc is already indented the way you like: for your XmlDocument instance set the PreserveWhitespace property to true before loading the document/xml string. It'll then preserve the whitespace.
Posted 17 years ago by Richard Beyer - KBS Leipzig
oh, thank you, this will be definitly helpful ^^
The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.