Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using XML Schema for code autocomplete in my XML editor

Tags:

xml

xsd

I have XSD file (for example) http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd and I would like to use it for adding code autocomplete in my xml editor (I prefer Eclipse but any other free editor would be O.K.).

Is it possible? And if Yes, how can I do it?

like image 294
Maciek Sawicki Avatar asked Jun 02 '10 14:06

Maciek Sawicki


People also ask

How do I add an XML Schema in Visual Studio?

In Visual Studio, open the File menu and select New > File. Or, use the Ctrl+N keyboard shortcut. In the New File dialog box, select XML Schema and then select Open. A new file is created.

How XML schemas are used with examples?

The line above: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" tells the XML parser that this document should be validated against a schema. The line: xsi:noNamespaceSchemaLocation="shiporder. xsd" specifies WHERE the schema resides (here it is in the same folder as "shiporder. xml").


2 Answers

I had a similar problem but did not find a solution here so I posted a similar question. The answer led me to the Eclipse XML Editors and Tools plugin in Eclipse which supports autocomplete based on XML Schema.

Once the XML document is associated with the relevant XSD file, autocomplete should kick in automatically.

p.s. Considering the date of your question, you probably already found a suitable solution. However I thought I'd leave this answer anyway as a heads up to future visitors. HTH.

like image 71
Shawn Chin Avatar answered Sep 23 '22 23:09

Shawn Chin


Using XML Schema for code autocomplete is supported in Visual Studio more details here.

Alternative XML editor is: Microsoft XML Notepad 2007 (personally I found this editor to be very unfriendly, is very visual but editing files is not very productive)

like image 43
Paulius Zaliaduonis Avatar answered Sep 22 '22 23:09

Paulius Zaliaduonis