"Lars Gullik Bjønnes" wrote:

> Perhaps the xml writer should be written first? and then the xml
> parser could be created/implemented later?
> 
 A writer is already available and I test it against the reader to check
that I am not making too many mistakes. But as you suggest I started
with the writer.

> Anyway when the parser is written it should still be possible to read
> old lyx files so the old lyx parser should be retained.
> 
 Indeed, the first lines of LyX docs in new format are like this :
 <?xml version="1.0"?>
 <!--LyX 1.1 created this file. For more info see http://www.lyx.org/-->
 So it is easy to call one read method or the other.


> I must admit that I don't like any of the xml parser libs that I have
> seen, so far I am most comfortable with xerces¹.
> 
 I had the same impression. There does not seem to be any real XML-SIG
for C++ users. 
> Can libxml also validate the document?
 From www.w3c.org : The release 2.0 provides a C toolkit to parse,
validate (with XML-1.0 DTDs) and save XML files [...] and offers either
a C version the SAX interface or builds a DOM suitable tree. It also
supports HTML and provides a version of XPath and XPointer. 

And it is LGPL which is fine for LyX, and smaller than Xerces (if my
memory serves well).

You are right about validation : we need it. The reading code I wrote
would easily get screwed by documents that are not valid and it is
really painfull to harden it (I have tried a bit).

In fact, I think that we can get XML support into LyX quite soon (before
1.2 ?): I used a wrapper header file to include the needed library. So,
we could leave the application code without #ifdef (i.e. the XMLRead and
XMLWrite methods, they are present in all classes that have a Read and
Write method) and only add a stub to replace the XML library. Then we
would only leave XML export active in LyX and leave the read function as
a compile-time option (so that people who do not need it are not
bothered).

  Anyway, I already have my own branch on my computer (under prcs
1.2.15, so it does not conflict with CVS files).

        sincerely,

        P.O. Gaillard

Reply via email to