[prev in list] [next in list] [prev in thread] [next in thread]
List: quanta-devel
Subject: Re: [quanta-devel] Re: Using KDOM in Quanta[typing parsing]
From: Frans Englich <frans.englich () telia ! com>
Date: 2005-06-07 12:25:46
Message-ID: 200506071225.46437.frans.englich () telia ! com
[Download RAW message or body]
On Tuesday 07 June 2005 11:55, Frans Englich wrote:
> On Tuesday 07 June 2005 01:56, Jens Herden wrote:
I define typing parsing as:
When the user edits the document, either by typing on the keyboard or
(replace-)pasting, Quanta does dynamic house-keeping in order to keep
internal structures up-to-date to correspond to the text stream(which the
user percepts as the document). For example, this could be to edit the KDOM \
tree to correspond to the text stream.
I don't know what status quo is, or what exactly is the hard & crucial \
parts, but I propose ideas from the problems I see.
I think typing-parsing can be divided into two categories:
-- Keyboard input. Characters are delivered on a key-event,
character-by-character basis. This can perhaps be handled by simply doing
whatever smart editing is needed(e.g, do the small changes to the tree,
usually append a character to a node, and do character reference \
replacements etc).
-- Copy & Paste. One type is the insertion of a string in a certain \
position in the text -- pasting. Another type is to replace-paste; \
existing text is replaced by new text. And the difficulty lies in(AFAICT) \
to keep the KDOM tree and text stream in sync.
In the case of replace-paste; it can be seen as a removal followed by an
addition. So first the nodes that correspond to the removed text are \
removed.
Then the tree needs to be updated for the new addition. AFAICT, the new \
text must be fed into an XML parser, which should produce an XML fragment, \
which can be inserted into the tree. DOM Load and Save have a nice entry \
point for that:
http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#LS-LSParser-parseWithContext
It does exactly what one wants, except that I raises an error on invalid \
XML. So, one would have to sub-class and feed it into KHTML's tokenizer, \
combined with a "setQuirkMode(true)" on the sub-class LSParserImpl. And \
when the XML fragment is built, it's inserted into the KDOM tree.
Right. World piece next?
Cheers,
Frans
_______________________________________________
quanta-devel mailing list
quanta-devel@kde.org
https://mail.kde.org/mailman/listinfo/quanta-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic