Lists Home |
Date Index |
> I think the tricky part comes when the user jumps (mouse, keyboard action)
> to another part of the document - where/how do you pick up the context?
> where and how do you save the current context?
I wrote a small editor that I use every day-- but is maybe not the most
efficient. It uses a SAX parser (AElfred2/Delphi) and attempts to parse the
document as it is changed. When the document is parsed I save the locator
information-- when the SAX Parse hits an error (WF) then it stops. That is
the end of the locator info. This gives columns and line numbers as the user
navigates. Obviously in Bi-directional text or Right To Left reading SAX
stops being useful in terms of document location.
This could all be optimized to continue parsing at a certain point-- or
magically understand document changes at certain points. I could also add a
better hashing mechanism to position lookups-- it is pretty fast though--
looking up the position in the tree is quick as you can jump through the
XML Development and Developer Web Hosting