Re: yaml<=>xml

Ricardo SIGNES <rjbs-yaml-qhrM8SXbD5J4T/+Z0n4RR9i2O/[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <20070330144653.GA20274@knight>
* "J.D. Laub" <[email protected]> [2007-03-28T18:18:58]
> I did see Clark's yaml2xml.py posted 2003-11-27, but I'm a perl
> guy.  The hold grail, which is probably much more complicated than
> this end user realizes, would be to feed data from YAML's Load to
> XML::Simple's XMLout, and from XML::Simple's XMLin to YAML's Dump.

  sub yaml2xml {
    my ($yaml_string) = @_;
    XML::Simple::XMLout(YAML::Load($yaml_string);
  }

  sub xml2yaml {
    my ($xml_string) = @_;
    YAML::Dump(XML::Simple::XMLin($xml_string);
  }

This doesn't handle... well, a lot of things you might want, but it handles
everything you listed!

-- 
rjbs

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.