5

So, I work with an in-house XML solution we use for defining content, with it's own XSD file that goes with it. I want to be able to do Context Tagging and reference auto-complete like I do with C# and other languages for certain cases, while still using the XSD file for syntax validation. Example:

<Object id="foo" />
<Object id="bar" />
<Object id="myobject" source="foo" />

When I type in 'source=' in the third object, I want it to offer me up 'foo', 'bar', and any other ids on Objects in the file (or project, either way). 'foo' and 'bar' are not pre-defined strings in the XSD file; we have thousands of them and add more every day. So, when I declare a new XML node of

<Object id='someid'> 

I want the next time I type 'source=' to prompt me with 'someid' in the list, just like how C#/C++ does with variables.

I'm willing to use any code editor/text editor/IDE, but if there is no way to do this, what editor would be easiest to add this to? From a programming point of view, this should really not be so hard.

Dreadicon
  • 243
  • 2
  • 7

1 Answers1

0

The XML Editor in Visual Studio has the features you seem to be after. This article https://msdn.microsoft.com/en-us/library/ms255811.aspx gives a nice overview.

Alternatively, while I've not used it personally this post Using XML Schema for code autocomplete in my XML editor suggests that similar features are available in Eclipse.

Or there is this project on github https://github.com/pleonex/atom-autocomplete-xml for Atom that looks like it might do what you want.

Gareth
  • 913
  • 6
  • 14
  • That's what I currently use and it's ok, but I wanted more. I suppose I wasn't quite clear enough in my question. 'foo' and 'bar' are not pre-defined strings in the XSD file; we have thousands of them and add more every day. So, when I declare a new XML node of I want the next time I type – Dreadicon May 25 '17 at 22:03
  • @Dreadicon Auto-completion is not going to suggest something which it cannot index, like your id field. What you can do in Netbeans is type `f` and press Ctrl+K and it will start suggesting the last word you typed beginning with `f`. You can expand this further by typing something like `Fooba` Ctrl+K and it will complete it to `Foobar` if that word was encountered before. Keep pressing Ctrl+K for words even older. – Siddhesh Rane Nov 14 '18 at 08:43