Hi,
I was looking at this demo of XML autocomplete in the CodeMirror web site:
https://codemirror.net/demo/xmlcomplete.html
… and well, of course, wanted to see what it could do for SLD, since there is still a lot of people
hand editing it. The system requires a JSON structure representing the schema, and there is a
windows only tool that can take a XSD in and generate such structure in output:
http://q42jaap.github.io/xsd2codemirror/
So I gave it a kick and came out with the following branch:
https://github.com/aaime/geoserver/tree/sld10-hint
Things I’ve discovered while playing with it:
- The tooling is completely namespace unaware, so the completion I managed to put toghether works under the assumpion that sld elements are not prefixed, the filter ones are prefixed by “ogc”, and the gml ones by “gml”
- The XSD to JSON tool is limited, has a not so useful notion of namespaces and no idea about substitution groups, so the JSON must be hand-tweaked after generation (5-10 minutes of search and replace like a madman put the JSON structure in some usable state)
- The CSSParameter name attribute values are not really listed in the schema, so no completion for those (but we could add them manually, lumping toghether all possible values for all symbolizers)
- GeoServer style handling has no distinction between SLD 1.0 and SLD 1.1/SE 1.1, so an eventual completion should try to support both at the same time (maybe, in a simple way, e.g. inspect the first element and see what namespaces are in use, and then decide which set of tags to use
Here is a screenshot showing the completion in action:
And a video too (a clumsy video for a clumsy implementation):
https://drive.google.com/open?id=18qgvEhhh8ijcdTjPkDOoVNICeu14S_F1
So a few questions for you:
- Given the current limitations of the current approach, would you suggest to merge it anyways, would you find it useful?
- Is there any javascript wiz interested in improving what I’ve got so far, to make it more useful?
Cheers
Andrea
···
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.