>
> I have a question - you say that the nodes_from_leo_xml()function will be 
> used for various paste commands. This way, the xml bits have to be parsed 
> each time the nodes are processed.  I would have expected that xml not be 
> used for internal communications, but only for external interactions.  I 
> realize that mostly the xml parts are short and quick to parse, but still I 
> would lean to using plain text or even python objects.  Are you doing it 
> this way mostly because Leo copies nodes as xml in the first place?
>
>
Yes, that is the main reason for using xml. But even if in the future we 
find a new format, or even several new formats, it would be enough just to 
write a function for each input format that generates tuples and then send 
those tuples to build_tree. We can treat files with Leo sentinels (@file 
external files) as another format for describing the outline shape and 
content. Parsing sentinels and decoding the outline shape and content to 
the bunch of tuples is enough for build_tree function to create the 
outline. All those reading functions for any given format can be easily 
tested. We just need to compare generated tuples with the expected ones. If 
the generated sequence of tuples is correct, then the outline will be 
correct too. Many of the tree operations are very difficult to test because 
they change a lot of things inside Leo and creating a new commander for 
each test is slow. Testing sequences of tuples is fast and easy.

In the attached Leo file, I tried at first to test 1000 round trips 
xml->outline->xml, but it was too slow when using Leo's current xml writing 
code. The technique of reusing a single Leo commander instance whose 
internals are not disturbed by the tests, allows testing to be 222 times 
faster. 

Vitalije


-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ae36be53-f973-4c52-a9b1-12afa708c46f%40googlegroups.com.

Reply via email to