XML::GenericJSON - for turning XML into JSON, preserving as much XMLness as possible.
my $json_string = XML::GenericJSON::string2string($xml_string);
my $json_string = XML::GenericJSON::file2string($xml_filename);
XML::GenericJSON::string2file($xml_string,$json_filename);
XML::GenericJSON::file2file($xml_filename,$json_filename);
XML::GenericJSON provides functions for turning XML into JSON. It uses LibXML to parse the XML and JSON::XS to turn a perlish data structure into JSON. The perlish data structure preserves as much XML information as possible. (In other words, an application-specific JSON filter would almost certainly produce more compact JSON.)
The module was initially developed as part of the Xcruciate project (http://www.xcruciate.co.uk) to produce JSON output via the Xteriorize webserver. It turns the entire XML document into a DOM tree, which may not be what you want to do if your XML document is 3 buzillion lines long.
Mark Howe, <melonman@cpan.org>
None
The best way to report bugs is via the Xcruciate bugzilla site (http://www.xcruciate.co.uk/bugzilla).
Returns a JSON representation of an XML string. The second argument should be false if you want to preserve non-semantic whitespace.
Returns a JSON representation of an XML file. The second argument should be false if you want to preserve non-semantic whitespace.
Writes a JSON file based on an XML string. The third argument should be false if you want to preserve non-semantic whitespace.
Writes a JSON file based on an XML file. The third argument should be false if you want to preserve non-semantic whitespace.
The function that does the work of turning XML into a perlish data structure suitable for treatment by JSON::XS.
Makes a hash of attributes.
Makes a list of namespaces.
Makes a list of child nodes.
0.01: First upload
0.02: Get dependencies right
0.03: Get path to abstract right
0.04: ported to use Module::Build
0.05: fixed unit test
Copyright (C) 2009 by SARL Cyberporte/Menteith Consulting
This library is distributed under BSD licence (http://www.xcruciate.co.uk/licence-code).
To install XML::GenericJSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::GenericJSON
CPAN shell
perl -MCPAN -e shell install XML::GenericJSON
For more information on module installation, please visit the detailed CPAN module installation guide.