I'm an extreme novice at the java thing, and I'm an intermediate perl user so please excuse the poorly phrased/understood question. I'm trying to retrieve an XML document using a java class, through perl, and I'm having a hard time converting the resulting returned java object/document into something useful in perl land. Here's the perl that I'm using: JavaXMLGrabber.pm package JavaXMLGrabber; use strict; use warnings; BEGIN { $ENV{CLASSPATH} .= ":/home/paulw/javaclassdir/"; } use Inline Java => 'STUDY', DEBUG => 1, STUDY => ['com.somecompany.xmltools.JavaXMLGrabber.DeviceEmulator']; sub new { my $class = shift; return JavaXMLGrabber::com::somecompany.xmltools.JavaXMLGrabber::DeviceEmulator->new(@_); } 1;
java_test.pl #! /usr/bin/perl use strict; use warnings; use JavaXMLGrabber; my $grabber = JavaXMLGrabber->new(); $grabber->getUpdate(); my $xml = $grabber->getLastUpdateDocument(); print $xml, "\n"; Here's a part of the java code that I'm calling upon: package com.somecompany.xmltools.JavaXMLGrabber; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import com.somecompany.xmltools.JavaXMLGrabber.error.FeedException; import org.jdom.Document; import org.jdom.Element; public class DeviceEmulator { /* ......... the rest of the java ...........*/ public Document getLastUpdateDocument() { return lastUpdateDocument; } I've used ethereal to ensure that when I run java_test.pl, I see the appropriate get requests go out to the web server where the XML resides, and I see the appropriate XML document returned to my server, however when trying to retrieve that document I run into issues... The result of the print in java_test.pl is this: Inline::Java::Object=HASH(0x8511500) Why do I not get the entire XML document in the print of $xml? Do I need to coerce the resulting document into a string? If it is a coercion issue where would I need to perform the coerce and how would I go about doing it? Or am I going about this the wrong way? Is this more of a java question than an inline::java one? Should I be passing the resulting java document into the jdom document constructor (or something of the like) so that I can use a getContent method? Should this be done in the java class instead of the perl script/program? Thanks, Paul W