Auto linefeed/indent when loading XML?

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Guy
Avatar
I don't know if this can be done, I have looked in the documentation but found nothing. Maybe it is me or maybe it is not there. Looking for something similar to the setting of the XML writer that includes formatting options.

I have XML files that are streams (no line feed, carriage returns, tabs, formatting, etc...). When loaded into SyntaxEditor all 500 pluss characters show up on line one.

I have a work around but was wondering if there is direct support.

XmlDocument doc = new XmlDocument();
doc.Load(@"D:\data\test.xml");

MemoryStream tempXML = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(tempXML,Encoding.UTF8);
writer.Formatting = Formatting.Indented;
doc.Save(writer);
tempXML.Seek(0,SeekOrigin.Begin);  // Need to return the position of the stream to beging otherwise
                                   // you get nothing! Should LoadFile do this as a safty net?
this.syntaxEditor1.Document.LoadFile(tempXML,Encoding.UTF8);
[Modified at 10/27/2005 02:26 PM]

Comments (1)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
No, not yet. We load directly whatever text you set. So if your XML text is squooshed together, you should indent it prior to displaying it in SyntaxEditor.

Once we add language-specific add-on features to SyntaxEditor, we'll probably include something like that in an XML language add-on.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.