[Po4a-devel] XML <? blabla ?> constructs

Martin Quinson mquinson@ens-lyon.fr
Fri, 16 Jul 2004 16:41:24 -0700


On Fri, Jul 16, 2004 at 11:15:35PM +0200, Jordi Vilalta wrote:
> Hi,
> 
> On Fri, 16 Jul 2004, Martin Quinson wrote:
> > On Fri, Jul 16, 2004 at 10:21:46AM +0200, Jordi Vilalta wrote:
> > > Hi,
> > > 
> > > On Fri, 16 Jul 2004, Martin Quinson wrote:
> > > > I am near the point where I decide that nsgml creates more problem than it 
> > > > solves. Making a ?ML parser in perl from the scratch shouldn't be that 
> > > > difficult after all.
> > > 
> > > My current implementation of the XML parser is quite generic and 
> > > customizable (I think). Maybe it could replace the current sgml one (when 
> > > it gets mature).
> > 
> > It's maybe time that:
> >  - you create a user on alioth, so that we can give you the cvs write access
> 
> Thanks for the offer :) I already have the "jvprat-guest" user.

done. You should have the commit rights. Try not to abuse it ;)

> >  - you show us the code of this xml module
> 
> I'll try to send something tomorrow. At this moment it's broken and does 
> nothing.

Why that? Just commit your working version in the CVS without changing the
Chooser documentation neither the MANIFEST. That way, it will be available
from the CVS, but not from distributed versions.

That's what cvs is made for ;)

[about file inclusion]
> > A solution may be to do something like that at the begining of each module:
> > 
> > map { if (/^.so (.*)/) $doc->includefile($1) } $doc->{TT}{doc_in};
> > 
> > It is a very crude proof of concept, though. The right solution may even be
> > completely different ;)
> 
> At the moment I prefer staying out of the core modules.
> 
> I'm still so new to perl, and I get stuck with sentences like the above 
> one.

hehe, if you want to know to truth, I kind of expected it, but map is such a
cool contruct that I wanted to bring your attention to it...

> I've been thinking about the concept, and I think that there are 3 
> interesting cases on file inclusion:
> 1) include the file at the beginning of the input stream 
> 2) include the file at the end of the input stream
> 3) get the file in a separate list, to be able to parse it alone
> 
> Cases 2 and 3 can be reduced to case 1 with a little work from the module 
> developer, saving the names of the files to include in a list, and 
> including them when he gets to the end of the main file.
> 
> This should be done as a single function call, for example:
>   $self->include_file("file");
> 
> And it would include this file at the beginning of the input (case 1)
> 
> Well, I only see it from the document modules point of view (the one I 
> know), but I think that case 1 should be easy to implement.

Yes, you are right. If I get ride of this nasty nsgml, I could implement
this include_file() the same way that unshiftline(). It would include the
file at the current begin of the document. 

The process would then to parse the document with calls to shiftline, and
when you find a file inclusion request, you do an include_file, and then
continue with your shiftline()s. That's clean. I like that. 

I just have to get ride of sgml.

But I can't do so without threating my professional occupations. I /really/
don't have the time. Even if I would prefer to do it ;)

> > For the encoding issues, it's even worse. I don't have even the begining of
> > an answer. We may have to wait until Denis comes back.
> 
> I have a vague idea about it. I'll think about it in the next days.

Please.

Bye, Mt.

-- 
C'est dégueulasse, y'a pas une meuf. C'est pas un temps à faire du surf !
    -- Les malpolis