Does operational transformation work on structured documents such as HTML if simply treated as plain text?

前端 未结 3 1080
温柔的废话
温柔的废话 2021-02-04 03:18

The FAQ of Google Wave Protocol says that [HTML] \"does not have desirable properties\" and that \"HTML makes OT (Operational Transforms) difficult if not impossible\" [1]. Why

3条回答
  •  心在旅途
    2021-02-04 03:55

    There are approaches in OT that support SGML (superset of XML), but there are no implementations. Therefore, it is not impossible! Though, I agree, OT is not the best approach to enable XML. This is because OT was designed for linear data structures. But HTML/XML is much more complex: it has attributes, and it is built like a tree. The fact that it is a tree is solvable, but the attributes - which is realized as an ordered associative array - are not supported by OT. Simply because associative arrays are not supported by OT (at the moment). The approach above actually recommends to treat the attributes as a string: E.g. "id='myid' value='mystuff'" But you can easily break the whole syntax of your 'attributes-string', when one user deletes all attributes, and another one inserts a " character directly after "mystuff". This could resolve in some div tag that looks like this

    , which is not valid syntax.

    Maybe this interests you:

    CEFX is a project that aimed to support XML - it's dead to my knowledge. But it uses an OT approach. For some reason it is not possible to edit string - only xml elements.

    Google's Drive SDK supports graph-like data structures. It is, however, proprietary and nobody knows how it works.

    I am developing a framework that supports arbitrary data structures. Currently, Text, Json, XML, and HTML are supported. It has a different approach: check it out: Yatta!

    BTW: What the Wave protocol, and Eric Drechsel described is known as Annotations in OT. It is commonly leveraged to support rich text.

提交回复
热议问题