Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

ANNOUNCE: XML::Smart 1.0

by gmpassos (Priest)
on May 21, 2003 at 18:07 UTC ( #259824=perlnews: print w/ replies, xml ) Need Help??

XML::Smart is out!

It's a smart, easy and powerful way to access/create XML data/files.

You access/create your XML data with a HASH tree style, but any point in the tree can be a HASH, ARRAY or SCALAR at the same time, so you don't need to care about the different types in the tree, you just us the tree and XML::Smart change it, or make it works like it, for you.

Download at:
http://search.cpan.org/author/GMPASSOS/XML-Smart-1.0/

Dependence:
http://search.cpan.org/author/GMPASSOS/Object-MultiType-0.01/

Here is an example of use:

use XML::Smart ; my $XML = XML::Smart->new('file.xml') ; ## Change the root: $XML = $XML->{hosts} ; ## Get the address [0] of server [0]: my $srv0_addr0 = $XML->{server}[0]{address}[0] ; ## Or just: my $srv0_addr0 = $XML->{server}{address} ; ## Get the server where the attibute 'type' eq 'suse': my $server = $XML->{server}('type','eq','suse') ; ## Add a new server node: my $newsrv = { os => 'Linux' , type => 'Mandrake' , version => 8.9 , address => [qw(192.168.3.201 192.168.3.202)] } ; push(@{$XML->{server}} , $newsrv) ; ## Get/rebuild the XML data: my $xmldata = $XML->data ; ## Save in some file: $XML->save('newfile.xml') ; ## Send through a socket: print $socket $XML->data(length => 1) ; ## show the 'length' in the XML header to the ## socket know the amount of data to read. __DATA__ <?xml version="1.0" encoding="iso-8859-1"?> <hosts> <server os="linux" type="redhat" version="8.0"> <address>192.168.0.1</address> <address>192.168.0.2</address> </server> <server os="linux" type="suse" version="7.0"> <address>192.168.1.10</address> <address>192.168.1.20</address> </server> <server address="192.168.2.100" os="linux" type="conectiva" version= +"9.0"/> </hosts>

Graciliano M. P.
"The creativity is the expression of the liberty".

Comment on ANNOUNCE: XML::Smart 1.0
Download Code
Re: ANNOUNCE: XML::Smart 1.0
by adrianh (Chancellor) on May 21, 2003 at 19:51 UTC

    I have to admit I would have found XML::MultiType a far better name than XML::Smart - since it has the same API as Object::MultiType.

    By naming it "Smart" you have all the problems of the ambiguity of "smart" as a word, and lose the people who have already figured out what Object::MultiType is.

    (sorry to be so boring :)

      And I wanted the name to reflect it as a riff on XPath. Ah well.

Re: ANNOUNCE: XML::Smart 1.0
by mirod (Canon) on May 22, 2003 at 15:45 UTC

    Your module looks very nice indeed, it is very compatible with XML::Simple, and very easy to use.

    I just have one comment: with warnings on, it keeps complaininig. That's a big problem, as it basically forces the user to turn them off.

    The 2 main kinds of warning:

    Scalar value @stat[3] better written as $stat[3] at /usr/lib/perl5/sit +e_perl/5.8.0/XML/Smart.pm line 346-425 Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/si +te_perl/5.8.0/XML/Smart/Tree.pm line 229.

    If you could get rid of those, that would be a great improvement.

      Thanks for the advice! Will fix in the next release...

      Graciliano M. P.
      "The creativity is the expression of the liberty".

Re: ANNOUNCE: XML::Smart 1.0
by tmharish (Friar) on Jan 18, 2013 at 08:20 UTC
    Hi

    XML::Smart has not been maintained in a while now ( 8 years to be exact ).

    Please let me know if you have the time to maintain it - If not I could take over.

    I am on CPAN HERE

      Check gmpassos's page: he/she has not been here for 7 years. Try to contact him/her in a different way.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        Check gmpassos's page: he/she has not been here for 7 years. Try to contact him/her in a different way.

        :) It is procedure to try the most/many ways you know, although I don't hold out hope for gmpassos, he is M.I.A.

Re: ANNOUNCE: XML::Smart 1.0
by tmharish (Friar) on Jan 30, 2013 at 11:24 UTC

    Just as a note to anyone in the future who might come looking for this module:

    This module is now maintained and, as of now, bug free.

    You can contribute on GitHub

    You can use it through CPAN

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlnews [id://259824]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2015-07-05 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls