On Wednesday 23 July 2008 11:05, José Matos wrote:
> On Wednesday 23 July 2008 15:33:16 Steve Litt wrote:
> > The trouble is, XML tags can be anywhere -- spacing and linefeeds are
> > immaterial. That means you can no longer parse based on position, such
> > as:
> >
> > /^begin_layout/
> >
> > because technically the whole XML file could be in a single line. Or a
> > single tag could be split between lines.
>
> Since we control the format I am (almost) sure that we will choose a reader
> friendly output. There is no reason to do otherwise. In terms of size a
> blank or a newline are equivalent, so... :-)
>
> That is why it will be business as usual. :-)
> Not much will change in this regard.

Thanks José,

As a sed/awk/perl/ruby parser, I appreciate that very much.

The more I think about it, the more I think I should make the XML->YAML and 
YAML->XML converters. That way, if future generations of LyX project 
programmers forget why it's important to space their XML "just so", it won't 
matter. Also, I have a feeling that YAML will be much easier to parse than 
either 1.5.x or XML.

The way I envision it, these two converters will be simple standalone commands 
implemented as filters (convert stdin to stdout), very few dependencies. They 
will comply with the Unix Philosophy (little apps that do one thing and do it 
well). Trivial to install. They will be simple enough to be maintained by one 
person. 

They will be encapsulated. They won't need to know about LyX other than its 
XML format, and LyX won't need to know about them. They can be included in 
the LyX distribution, or not.

At first I'll do them in Ruby because Ruby has all that stuff built in and 
easy to do. Later, depending on performance and the percent of people who 
have Ruby installed, I can convert them to C. There's a C implementation of 
the same YAML parser/emitter that Ruby uses -- Syck. I'm pretty sure there 
are also C or C++ implementations of XML Parsers, although I don't know how 
well they do things like DTD/schema.

Thanks

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US

Reply via email to