The book is useful but does not provide much new info for me. It spells a few things out clearly that are otherwise hard to figure out, with line-by-line code walkthrough.
Here are a few of the gaps:
I liked the section on XML Schemas, since I didn't know anything about them. I can't say that the book helped with today's particular problem of interest.
Trying SAX Modules
Installed Pod::SAX with cpan. This has many dependencies,
including XML::SAX::Writer. Installed okay. Pod documentation
for the functions is missing.
This style of code doesn't look like the kind of code
that I like write.
Installed XML::Generator::DBI with cpan. It failed tests looking for DBD/Pg.pm, there is some manual configuration that needs to be done. I didn't pursue this further because I have no database on this machine. The code is interesting to read though, both as an example of using XML::Handler::YAWriter and a nifty flexible DBI query.
Other activity
I installed psh and fooled around with it.
It looks like fun, but possibly dangerous
since I don't know what I'm doing.
My shell needs to be very reliable, eg rm commands.
I installed File::List, and wrote and example program using File::Flat with it. I posted this snippet as an answer to a question at perlmonks.
On SAX (Score:2)
That's pretty much just how SAX works I'm afraid. It has a tendency to contain a large case statement with things that say: "If tag is this do this. If tag is that do that."
I'd welcome alternate ways of designing SAX handlers though. Unfortunately that tends to be the way data driven code works.
Trying SAX Modules
Re:On SAX (Score:1)
I'm not really knowledgable enough about SAX to understand this design problem to make a good suggestion, but I won't let that stop me.
I have been using XML::Twig and XML::Writer with some success, and have enjoyed the XPath features in XML::Twig.
Instead of writing a large case statement, I usually use a dispatch table. Typically I use a hash of anonymous subs, where the key to
It should work perfectly the first time! - toma
Re:On SAX (Score:2)
Re:On SAX (Score:1)
I posted a question about this at XML::Filter::Dispatcher string rules problem [perlmonks.org].
It should work perfectly the first time! - toma
Huge case statements (Score:1)
sub start_element {
my $self = shift;
my $e = ElementFactory->make_from_struct(shift);
$e->start_with_parser($self);
}
And have
start_with_parserdo the double dispatch trick:sub MyElement::docbook::para::start_with_parser {
my $self = shift;