Posted 17 years ago by Richard Beyer - KBS Leipzig
Avatar
Hi,

I've cut my problem to these 3 lines:

    XmlDocument xdoc = new XmlDocument();
    xdoc.LoadXml(_synEditor.Document.Text);
    _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...

f.e.:

<root>
<test />
</root>

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
Avatar
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
Avatar
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
Avatar
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
Avatar
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
Avatar
oh, thank you, this will be definitly helpful ^^
The latest build of this product (v24.1.0) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.