SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

AvalonEdit & XmlEditor?

Last post 10-06-2010 8:50 PM by MattWard. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-30-2010 3:08 PM

    AvalonEdit & XmlEditor?

    Hi

    I just downloaded the new 4.0 beta 3, and am successfully using a basic AvalonEdit text editor in my Windows Forms application (via ElementHost)

    I want to edit XML documents.

    I infer from looking at the XmlEditor tests that XmlEditor is to be used in conjuction with AvalonEdit, but I can't work out how.  (The forum post on XmlEditorControl from April seems to be out of date - there is no XmlEditorControl in 4.0.0.6721. )

    At the most basic level, AvalonEdit provides the source view, and XmlEditor provides the XML Tree view, right?

    Basic instructions on how to set them up together would be much appreciated.

    thanks .. Jason

  • 10-01-2010 12:58 PM In reply to

    Re: AvalonEdit & XmlEditor?

     OK, pls disregard this.

    Once I get it all working, I'll summarise here..

  • 10-02-2010 12:06 PM In reply to

    Re: AvalonEdit & XmlEditor?

    In SharpDevelop 4.0 the custom text editor control that was used as the XML Editor was removed. Instead the XML Editor extends the existing text editor by adding code completion. It also adds a XML Tree View secondary display binding. It also provides some extra menu items. The extension points are defined in the .addin file.

    If you are doing this yourself in a separate application you have more work to do that using the .addin file depending on what features you want. What features do you want?

  • 10-06-2010 3:53 AM In reply to

    Re: AvalonEdit & XmlEditor?

    Hi Matt

    Thanks for your reply.

    I'm well on the way to making this work: I set things up more or less as per SharpDevelopMain.cs, and then create an AvalonEditViewContent, and an XmlTreeView.

    I can edit my XML document in each of these views.

    The main feature I am looking for is intellisense for xml elements and attributes.

    In SharpDevelop itself, this works in source view for an xml document using my XSD  (ie it gives a pop-up of element names from the xsd, although some of these are not valid at this location in the xml document).  It doesn't work in the tree view though: the AddXmlNodeDialog doesn't show any names; it only shows the "Custom" part of the form.

    In my application, I made the AddXmlNodeDialog show correct names by patching XmlTreeEditor.FindSchema.  I added the line:

        if(schema!=null) return schema;

    The name suggestions here are superior to the ones in the source view, since they are context sensitive, so it would be nice if AvalonEdit could be made to use XmlEditor's intellisense.

    cheers .. Jason

     

     

     

    Filed under:
  • 10-06-2010 8:50 PM In reply to

    Re: AvalonEdit & XmlEditor?

    If you look at the CodeEditor class in SharpDevelop you will see how to integrate code completion bindings. In your case you will only need the XmlCodeCompletionBinding. The TextArea.TextEntering is used to capture when the user types something into the text editor. Then each character is passed to the XmlCodeCompletionBinding's HandleKeyPress method. This method will show the code completion window.

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.