Mark Howe > XML-GenericJSON-0.05 > XML::GenericJSON

Download:
XML-GenericJSON-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

XML::GenericJSON - for turning XML into JSON, preserving as much XMLness as possible.

SYNOPSIS ^

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);

DESCRIPTION ^

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.

AUTHOR ^

Mark Howe, <melonman@cpan.org>

EXPORT

None

BUGS ^

The best way to report bugs is via the Xcruciate bugzilla site (http://www.xcruciate.co.uk/bugzilla).

PREVIOUS VERSIONS ^

string2string(xml_string [,preserve_whitespace])

Returns a JSON representation of an XML string. The second argument should be false if you want to preserve non-semantic whitespace.

file2string(xml_filename [,preserve_whitespace])

Returns a JSON representation of an XML file. The second argument should be false if you want to preserve non-semantic whitespace.

string2file(xml_string, json_filename [,preserve_whitespace])

Writes a JSON file based on an XML string. The third argument should be false if you want to preserve non-semantic whitespace.

file2file(xml_filename, json_filename [,preserve_whitespace])

Writes a JSON file based on an XML file. The third argument should be false if you want to preserve non-semantic whitespace.

dom2perlish(node)

The function that does the work of turning XML into a perlish data structure suitable for treatment by JSON::XS.

hash_attributes(node)

Makes a hash of attributes.

list_namespaces($node)

Makes a list of namespaces.

list_children(node)

Makes a list of child nodes.

PREVIOUS VERSIONS ^

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 AND LICENSE ^

Copyright (C) 2009 by SARL Cyberporte/Menteith Consulting

This library is distributed under BSD licence (http://www.xcruciate.co.uk/licence-code).

syntax highlighting: