XML suggestions

XML suggestions

am 12.07.2011 20:07:36 von Doug Bradbury

Does anyone have suggestions for an active and easy to use XML building =
& parsing module?

Doug Bradbury


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: XML suggestions

am 12.07.2011 23:08:41 von Rob Dixon

On 12/07/2011 19:07, Doug Bradbury wrote:
>
> Does anyone have suggestions for an active and easy to use XML
> building & parsing module?

Hi Doug

Any code to write XML ends up looking very similar to the resulting XML
itself, although XML::Writer will make sure your syntax is correct for
you and avoid a lot of obvious errors.

As for parsing, it largely depends on what you want to do once you have
parsed tha XML. But XML::LibXML is a good all-rounder (although with
awkward documentation). XML::Twig and XML::TreeBuilder are also worth a
look.

HTH,

Rob

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: XML suggestions

am 13.07.2011 03:27:30 von Feng He

2011/7/13 Doug Bradbury :
> Does anyone have suggestions for an active and easy to use XML building & parsing module?
>

For a simple XML parsing I have used the module XML::Simple which just run well.

Regards.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: XML suggestions

am 13.07.2011 10:10:47 von Rob Coops

--00163630ebe358210d04a7eef5f3
Content-Type: text/plain; charset=UTF-8

On Wed, Jul 13, 2011 at 3:27 AM, Feng He wrote:

> 2011/7/13 Doug Bradbury :
> > Does anyone have suggestions for an active and easy to use XML building &
> parsing module?
> >
>
> For a simple XML parsing I have used the module XML::Simple which just run
> well.
>
> Regards.
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>
Recently having done some work with various XML libraries in perl I have to
recommend: XML::LibXML the documentation is well how to put it not
fantastic... but once you get passed that you are looking at probably the
fastest and most powerful library for XML parsing available in perl.

It really depends on what you are looking to do though, if you are aiming
for just a simple thing with only a few messages then don't worry
about XML::LibXML
and go for XML::Simple which is more then enough in most simple cases ;-)
I found that both Twig and Treebuilder are great if you are looking at
modifying the XML (add extra nodes, alter existing nodes) but since they
build a full tree structure for the XML file you are working with depending
on the size and complexity of the file this could cause serious memory
bloat, and even out of memory errors.

Personally I think that if you can stomach it getting past the somewhat
difficult XML::LibXML documentation it will provide you the best and fastest
way of working with XML files, but I have to be honest it took me several
years before I found a project where I needed the speed and power of LibXML.
On the other hand once learned... if you have the time to do so have a go at
it you will enjoy working with it once you know how to.

Regards,

Rob

--00163630ebe358210d04a7eef5f3--

Re: XML suggestions

am 21.07.2011 01:15:33 von Jenda Krynicky

From: Rob Coops
> It really depends on what you are looking to do though, if you are aiming
> for just a simple thing with only a few messages then don't worry
> about XML::LibXML
> and go for XML::Simple which is more then enough in most simple cases ;-)

Except that it's not so simple to set it up to give you consistent
data structure with things like optional tag attributes and repeated
tags. See http://www.perlmonks.org/?node_id=697036

> I found that both Twig and Treebuilder are great if you are looking at
> modifying the XML (add extra nodes, alter existing nodes) but since they
> build a full tree structure for the XML file you are working with depending
> on the size and complexity of the file this could cause serious memory
> bloat, and even out of memory errors.

XML::Twig (as the name suggests) is not supposed to build a full tree
structure, but rather lets you work with parts of the document. The
"twigs".

I personally believe XML::LibXML is overcomplicated, but some people
seem to like it.

Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/