XML editor
Looking at EditControl for XML editing with following features:
- Automatic tag closing: As soon as a tag is typed, the closing tag is automatically inserted. Optionally, when a parameter is typed with a quotation mark, the closing quotation mark is automatically inserted.
- Pretty Print: The editor can convert any xml into properly formatted xml with cr/lf and indentation.
If an XML document outline tree can be created on the fly, it is even better.
Kindly advise
Best Regards
Abhishek
SIGN IN To post a reply.
3 Replies
DR
Durga Rajan
Syncfusion Team
June 27, 2018 12:55 PM UTC
Hi Abishek,
Thanks for contacting Syncfusion support.
Query 1: Underlining of invalid tags (closing not matching opening)
Currently, Syntax Editor doesn’t have direct support to underlining the error words but Syntax Editor has method to underline to the word in desired range. So we have prepared word-around sample to achieve your requirement. In this sample, we have identified the error word and set underline for that word using SetUnderline() and removed the underline using RemoveUnderline() if it is not an error word.
|
editControl1.SetUnderline(this.editControl1.Selection.Top, this.editControl1.Selection.Bottom, format);
editControl1.RemoveUnderline(this.editControl1.Selection.Top, this.editControl1.Selection.Bottom); |
Query 2: Automatic tag closing: As soon as a tag is typed, the closing tag is automatically inserted. Optionally, when a parameter is typed with a quotation mark, the closing quotation mark is automatically inserted.
We have checked your query “Automatic closing tag will be added to the line”. As per implementation of SyntaxEditor, it has support for AutoComplete and AutoCorrect and Tag AutoClosing support is not available. But we can achieve this in sample level with the help of KeyUp event. We have prepared sample for the same, in this sample, we have added end tag to the same line if we type “>” to the start tag. For example, if we type “<tag>” then end tag “</tag>” will be added in the same line. Based on your requirement you can modify the codes in KeyUp event.
Query 3 : The editor can convert any xml into properly formatted xml with cr/lf and indentation.
Currently, Syntax Editor doesn’t have support to modify the alignment of the XML document while loading. But we can align the XML document with below method before loading it to the EditControl. Please refer the code for the same,
|
private void ArrangeXMLDocument(string filePath)
{
var xml = File.ReadAllText(filePath);
XDocument doc = XDocument.Parse(xml);
File.WriteAllText(filePath, doc.ToString());
} |
We have prepared sample which tries to meet your requirement. Please download it from below location,
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/XMLEditor_Sample-591960658.zip
If we have misunderstood your query please get back to us with more details. This would help us to provide solution at earliest.
Query 4: If an XML document outline tree can be created on the fly, it is even better.
In EditControl, ShowOutliningCollapsers is not work for the XML file and we done it using the BeginBlock and EndBlock lexemes for the collapse/Expand region for it, but in the XML content, the tag will not be common as like #region and #end region. So, we could not do it using the predefined lexemes. So, we have considered your requirement as a feature request and added it to our feature request list. This feature will be included in any of our upcoming release.
Regards,
Durga S.
AS
Abhishek Singhal
November 16, 2020 06:07 AM UTC
Hi
Pl update status of features asked in this thread as on today.
Thanks
EM
Elakkiya Muthukumarasamy
Syncfusion Team
November 17, 2020 01:09 PM UTC
Hi Abishek,
Thanks for your update.
We have logged the feature request for your requirement. We will be including this feature in any of our release. We will intimate you once this feature is included. We appreciate your patience until then.
You can track the status of this feature using the following link:
Feedback link: https://www.syncfusion.com/feedback/3387/provide-notepad-like-code-outlining-for-xml-to-collapse-or-expand-regions-in
Please let us know if you have any concerns.
Regards,
Elakkiya
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
AS Abhishek Singhal
- Jun 22, 2018 06:27 PM UTC
- Nov 17, 2020 01:09 PM UTC