} elsif( $from eq '-' ) {
$file = \*STDIN;
} elsif( $from =~ /\.(xml|json)$/ ) {
$file = $from ;
$format = $1 unless $format;
}
}
i
push @objects, $object;
}
}
} elsif ( $format eq 'json' ) {
eval { $value = JSON->new->decode($from); };
croak $@ if $@;
if ( (keys %$value) ==
delete $value->{schema} if $root eq 'Response'; # ignore schema attribute
croak "JSON does not contain DAIA elements" unless $value;
push @objects, eval('DAIA::'.$root.'->new(
A::Document>
our $VERSION = '0.43'; #VERSION
use strict;
use base 'DAIA::Object';
use DAIA;
use JSON;
our %PROPERTIES = (
id => $DAIA::Object::COMMON_PROPERTIES{id},
href =>
a::Validate::URI qw(is_uri is_web_uri);
use IO::Scalar;
use Scalar::Util qw(refaddr reftype);
use JSON;
our $AUTOLOAD;
our @HIDDEN_PROPERTIES =
qw(to format xmlns cgi header xmlheader xslt pi ca
encoding=\"UTF-8\"?>\n$xml" if $param{header};
return $xml;
}
sub struct {
my ($self, $json) = @_;
my $struct = { };
foreach my $property (keys %$self) {
next unless $proper
if (ref $self->{$property} eq 'ARRAY') {
$struct->{$property} = [ map { $_->struct($json) } @{$self->{$property}} ];
} elsif ( UNIVERSAL::isa( $self->{$property}, "DAIA::Object"