tags:

views:

108

answers:

1

Hi, I am working on an autocomplete plugin for xml documents. I want to know if there are any recommended algorithms to which I could refer to parse through the xsd??

The idea is to parse through xsd and construct a collection/hash of objects and then suggest the next level sub tags on < and attributes on space inside <>.

Edit: The language I am using does not have native xml support. However I can use perl libraries to generate the hashes.

A: 

This pretty much depends what framework you have to access XML data. For instance, when using .net, a complete parser for XSD is already included.

Since XSD is itself an XML document, you'll need an XML parser, and then you can read an XSD and build the data structures in memory you need for your editor syntax completion.

For XML parsing, I'd use a proper parser generated via some parser/compiler generator which relies on a (E)BNF language definition, such as GoldParser or yacc.

Lucero