modperl_xml

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: mod_perl advocacy project resurrection
From: barries <barries@slaysys.com>
Date: Tue, 5 Dec 2000 17:09:22 -0500

On Tue, Dec 05, 2000 at 04:10:01PM -0500, Drew Taylor wrote:
> I know this goes a little off topic, so I apologize in advance.
> 
> One big sticking point with Perl I'm just starting to run into is XML.
> Yes, Perl has great XML modules, and many more promising ones. But where
> is the _validating_ XML parser?

Will XML::Checker::Parser do?

> I'm doing some XML work where a
> validating parser would be very nice, speed hit or not. I can work
> around it easily (this is perl :-), but it would save me some work.

<plug>And, if you want to validate while writing, XML::ValidWriter
might help</plug>.

===

Subject: Perl vs Java (XML Modules)
From: Matt Sergeant <matt@sergeant.org>
Date: Tue, 5 Dec 2000 22:23:26 +0000 (GMT)

On Tue, 5 Dec 2000, Drew Taylor wrote:

> I know this goes a little off topic, so I apologize in advance.

I changed the topic for you :-)

> One big sticking point with Perl I'm just starting to run into is XML.
> Yes, Perl has great XML modules, and many more promising ones. But where
> is the _validating_ XML parser? I'm doing some XML work where a
> validating parser would be very nice, speed hit or not. I can work
> around it easily (this is perl :-), but it would save me some work.

XML::Checker.
Also see www.perl.com which links to Kip Hampton's XML.com article about
validating using XPath.

> The XML & Java combination has a LOT more corporate resources (read $$$)
> focused on it than Perl & XML. How many Java-based XML software
> announcements have you seen lately? Now compare that to Perl-based XML
> modules. The numbers don't compare very well. What can we do about this?

Very little, except produce our own XML modules that can do our work. And
you can help by praising those that do produce good XML modules and by
using the modules that work rather than those that don't (hint: XML::XPath
vs XML::DOM with XML::XQL). Apart from validation, what are you missing?

> I can't help write a validating parser, but I would be happy to help
> test it out. IMHO, more XML support would help sell perl into more
> corporate settings. Java is big into buzzwords, and XML is one of the
> biggest there is at the moment. And as we know PHBs like buzzwords, so
> that is one more point in Java's favor.

Actually XML is one area where mod_perl kicks Java's butt in some ways.
AxKit is *faster* than Cocoon. Please test and see for yourself if you
don't believe me. And building XML based web sites with AxKit is *really*
easy. I built modperl.sergeant.org in 10 days of spare time, including a
content management system for the news articles (note that half of the CMS
code is just a plain mod_perl handler). I'll stick an article online
shortly about how the site is constructed.

===

Subject: Re: mod_perl advocacy project resurrection
From: Drew Taylor <drew@openair.com>
Date: Tue, 05 Dec 2000 17:31:49 -0500

barries wrote:
> 
> On Tue, Dec 05, 2000 at 04:10:01PM -0500, Drew Taylor wrote:
> > I know this goes a little off topic, so I apologize in advance.
> >
> > One big sticking point with Perl I'm just starting to run into is XML.
> > Yes, Perl has great XML modules, and many more promising ones. But where
> > is the _validating_ XML parser?
> 
> Will XML::Checker::Parser do?

Hmmm, looks interesting. I'll check into it. Any experience (good or
bad) with it? I see that it relies on XML::Parser. How well does
XML::Parser handle the newly available external DTD feature?

> > I'm doing some XML work where a
> > validating parser would be very nice, speed hit or not. I can work
> > around it easily (this is perl :-), but it would save me some work.
> 
> <plug>And, if you want to validate while writing, XML::ValidWriter
> might help</plug>.

My biggest problem with XML::Writer (and hence XML::ValidWriter) is that
I can't write to a string, unless there is some hackish workaround. I
remember someone talking about an IO::String sort of module, but it
sounds like using a sledhammer to drive a nail. ;-) I did actually check
out XML::Writer, and even went to far as to replace the IO handle stuff
with a plain old string. But then decided to use something else. While I
love the idea of validating as I write XML, it doesn't help on the other
end. :-(

====

Subject: XML::ValidWriter -> \$scaler [Was: mod_perl advocacy project resurrection]
From: barries <barries@slaysys.com>
Date: Tue, 5 Dec 2000 18:35:33 -0500

On Tue, Dec 05, 2000 at 05:31:49PM -0500, Drew Taylor wrote:
> 

I've used XML::Checker::Parser with no big issues.

> My biggest problem with XML::Writer (and hence XML::ValidWriter) is that
> I can't write to a string, unless there is some hackish workaround.

XML::ValidWriter writes to a string if you pass in a \$scalar as the
destination:

       new
              $writer = XML::ValidWriter->new( DTD => $dtd, OUTPUT => \*FH ) ;

           Creates an XML::ValidWriter.

           The value passed for OUTPUT may be:

           a SCALAR ref
               if you want to direct output to append to a
               scalar.  This scalar is truncated whenever the
               XML::ValidWriter object is reset() or DESTROY()ed

           a file handle glob ref or a reference to an IO object
               XML::ValidWriter does not load IO.  This is the
               only mode compatible with XML::Writer.

           a file name
               A simple scalar is taken to be a filename to be
               created or truncated and emitted to.  This file
               will be closed when the XML::ValidWriter object is
               reset or deatroyed.

===

Subject: RE: Perl vs Java (XML Modules)
From: "Herrington, Jack" <jack.herrington@Certive.com>
Date: Tue, 5 Dec 2000 15:54:13 -0800 

>True. As for praise, XML::Parser does the job for me. In this specific
>case, I'll be looking for something like <status>failure</status> in the
>response to an XML request I send. I'd like to pull out just the section
>that failed and be able to create another request from that XML chunk.
>It's a little down the road, but I'm trying to plan today.

If it's that simple, then try XML::Simple and use XMLin.  That package makes
basic XML stuff incredibly easy.

===

Subject: Re: XML::ValidWriter -> \$scaler [Was: mod_perl advocacy project 
From: Drew Taylor <drew@openair.com>
Date: Tue, 05 Dec 2000 19:03:58 -0500

barries wrote:
> 
> On Tue, Dec 05, 2000 at 05:31:49PM -0500, Drew Taylor wrote:
> >
> 
> I've used XML::Checker::Parser with no big issues.

Good to hear. Unfortunately, we are using an older version of
XML::Parser (2.22), while XML::Checker requires 2.23 (according to make
test). I'm not going to even try to get this upgraded on the production
site knowing how finicky XML::Parser can be. But I'll definately keep it
in mind should we upgrade in the future. I see our API becoming much
more important in the near future, and this might help get things
upgraded sooner.

> > My biggest problem with XML::Writer (and hence XML::ValidWriter) is that
> > I can't write to a string, unless there is some hackish workaround.
> 
> XML::ValidWriter writes to a string if you pass in a \$scalar as the
> destination:
> 
>        new
>               $writer = XML::ValidWriter->new( DTD => $dtd, OUTPUT => \*FH ) ;
> 
>            Creates an XML::ValidWriter.
> 
>            The value passed for OUTPUT may be:
> 
>            a SCALAR ref
>                if you want to direct output to append to a
>                scalar.  This scalar is truncated whenever the
>                XML::ValidWriter object is reset() or DESTROY()ed

I stand corrected. :-) I'll play around with XML::ValidWriter and see
what happens. Of course, I also happen to like the way we generate XML
now. It's just a big array of arrays of arrays... reference that is
walked to make the XML. Pretty neat, and the implementation is actually
very simple.

===

Subject: Re: XML::ValidWriter -> \$scaler [Was: mod_perl advocacy project resurrection]
From: barries <barries@slaysys.com>
Date: Tue, 5 Dec 2000 19:11:45 -0500

On Tue, Dec 05, 2000 at 07:03:58PM -0500, Drew Taylor wrote:
> barries wrote:
> 
> I stand corrected. :-) I'll play around with XML::ValidWriter and see
> what happens.

It also requires a more recent XML::Parser to slurp up DTDs, but DTDs
can be saved as Perl modules and you don't need to load XML::Parser to
use them.

===

Subject: Re: XML::ValidWriter -> \$scaler [Was: mod_perl advocacy project
From: patrick@paymybills.com
Date: Tue, 05 Dec 2000 17:45:34 -0800 (PST)

hello

for people using XML::Writer, you can write to a string by using
the IO::String module..


example:

my ($output, $io, $obj);
$io = IO::String->new($output);
tie *IO, 'IO::String';

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu