© Disruptive Innovations 2006 Etna a wysiwyg XML RELAXNG- and Gecko-based editor

Preview:

Citation preview

© Disruptive Innovations 2006

http://disruptive-innovations.com

Etna

a wysiwyg XML RELAXNG- and Gecko-based editor

© Disruptive Innovations 2006

http://disruptive-innovations.com

What is Etna?

• Editing Tool for Networked Authors• an XML editor• sponsored by the Connexions Project• Open-Source MPL/GPL/LGPL• cross-platform• based on Gecko

http://cnx.org

© Disruptive Innovations 2006

http://disruptive-innovations.com

Genesis

• Connexions needed a standalone editor– simple to use for people w/o xml knowledge– for the academic world– localizable, internationalizable– power without complexity– markup quality– independent

© Disruptive Innovations 2006

http://disruptive-innovations.com

Requirements

• Wysiwyg

• Open-source, MPL-style preferred

• RELAX NG

• validating editor

• independence

© Disruptive Innovations 2006

http://disruptive-innovations.com

Choices

• Gecko– cross-platform– MPL/GPL/LGPL– great I18n/l10n– great extensibility

• our own RELAX NG implementation

© Disruptive Innovations 2006

http://disruptive-innovations.com

Constraints 1: simplicity

– don’t show the markup!– don’t require XML knowledge at all– don’t show technical details but human friendly

texts– the schema’s author should be able to specify

default behaviours instead of forcing the user to make choices

– the rendering in the editor should be the one a modern browser like Firefox will show/print

© Disruptive Innovations 2006

http://disruptive-innovations.com

Constraints 2 : clean

– Impossible to create or save invalid markup– RELAX NG validator queried by the UI layer– Impossible to load invalid markup

© Disruptive Innovations 2006

http://disruptive-innovations.com

First (bad) idea

– Reuse Nvu, and do some magic to show and manipulate HTML while we internally edit XML

• Was probably our stupidest idea ever

• So we decided to implement a new XML editor in Gecko

© Disruptive Innovations 2006

http://disruptive-innovations.com

libeditor/xml

– XML editor– RELAX NG parser

• Generates a graph from a domdocument holding a relax ng schema

– RELAX NG validator• Validates a domdocument against a relax ng graph

– RELAX NG queries and actions API• Allows to query the graph of a relax ng schema

© Disruptive Innovations 2006

http://disruptive-innovations.com

parser: our extensions 1

– our own namespace• http://disruptive-innovations.com/ns/editor-rng-

extensions/1.0

– <di:blank>• defines a « blank » instance for a given rng pattern;

multiple blanks are allowed

– <di:defaultValue>• default value for attribute patterns

© Disruptive Innovations 2006

http://disruptive-innovations.com

parser: our extensions 2

– <di:externalDoctype>• doctype to be added to document instances based on

the schema

– <di:processingInstruction>• creates a PI in the pattern

– <di:label>, <di:description>• human-readable info for a pattern (Cf. Grif 1989 !!!)

– <di:localizationProperties>• more specifically to extend Etna

© Disruptive Innovations 2006

http://disruptive-innovations.com

parser: our extensions 3

– <di:editorStylesheets>• to specify stylesheets only using when editing a

document based on the current schema

– <di:collapsedSelection>, <di:startSelection>, <di:endSelection>

• to specify what should be the selection or the caret’s position inside a new « blank » pattern

© Disruptive Innovations 2006

http://disruptive-innovations.com

parser: our extensions 4

– <di:semantics>• work in progress…

• we need a way to specify an element « is » a list item, a table cell, …

• we’re not sure yet it should be in the schema

• but we don’t want yet another parser, selectors mechanism and path

© Disruptive Innovations 2006

http://disruptive-innovations.com

parser: our extensions 5

– <di:behaviours>• listen before screaming :-)

• we claim it should be the RNG author’s responsability to specify two CRs at the end of a list item end the list and create a paragraph

• so we need a solution describing behaviours and attaching them to pattens

© Disruptive Innovations 2006

http://disruptive-innovations.com

parser: our extensions 6

– we are open to dicussion– we are open to (deep) changes– we are open to standardization– we just want a viable, reliable, simple solution

for problems all SGML/XML folks have been fighting with for TWENTY YEARS.

© Disruptive Innovations 2006

http://disruptive-innovations.com

validator

– validates a domdocument against a RNG schema loaded by our schema manager

– hidden by the XML editor and the nsEditingSession

– from an implementor’s perspective, just like nsPlaintextEditor or nsHTMLEditor…

© Disruptive Innovations 2006

http://disruptive-innovations.com

queries: examples

– query the rng schema to know if the result of a given action is valid

– canDeleteNode(in DOMNode node)

– canSetAttribute(in DOMElement elt, in string name, in URI namespaceUri, in string value)

– canDeleteSelection()

– have access to label, description, … for a given node

– get the list of possible « blanks »

© Disruptive Innovations 2006

http://disruptive-innovations.com

actions: examples

– allow to perform actions on the document, in full conformance with the schema

• create « blanks », triggering UI prompts when needed

– doDeleteNode(in DOMNode node)

– doSetAttribute(in DOMElement elt, in string name, in URI namespaceUri, in string value)

– doDeleteSelection()

© Disruptive Innovations 2006

http://disruptive-innovations.com

Etna: what else ?

– extensible set of datatypes: RNG datatypes and a lot of XML Schema datatypes by default

– in theory, the validator is not RNG-specific and can be adapted to other schema languages

© Disruptive Innovations 2006

http://disruptive-innovations.com

The future of Etna

– help schema authors build UI extensions specific to their schemas

– MathML– tabeditor…– xulrunner– world domination

© Disruptive Innovations 2006

http://disruptive-innovations.com

Conclusion

– Etna is not only an XML editor• it’s also the proof a major project like a wysiwyg

XML editor based on Gecko is possible, feasible ; that’s a superb indicator of maturity for Mozilla

• it’s also the live proof that it’s possible to solve VERY OLD issues with markup-based authoring

• in the long run, we hope to provide schema authors and the masses with a tool completely hiding the complexity of markup languages

© Disruptive Innovations 2006

http://disruptive-innovations.com

Links

• http://cnx.org

• http://rhaptos.org/downloads/editing/etna/

Recommended