I'm trying to write an application that sends questions to a server
that speaks XML, and understands the replies that come back.
Everything is specified in XML, including the format of the commands I
can issue to the remote server.
On this web page: [login to view URL] are several
XML documents, including:-
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
[login to view URL]
Together - they form the basis of specifications for my project.
I require a perl script which parses the above documents, and makes
available to me a single perl function - &generateXML() - which I can
call to generate XML output, as per the above specs.
For example, in [login to view URL], we find this definition of the things we
can do - including issue a simple , or send a :-
Here is an example of my calling perl script:-
#!perl
use XML::Your_Module;
print &generateXML('epp::hello');
Here is what the output of my program must look like:-
[See below (deliverables) for additional information]
## Deliverables
[...continued from "Description" above]
Again - from [login to view URL] - we find the following definition:-
If I issue this from my script:-
print &generateXML('epp::command::login', 'clID' => 'chrisdrake',
'pw' => 'foobar',
'options' => \%options,
'svcs' => \%svcs);
Here is the output I expect to see:-
chrisdrake
foobar
1.0
en-AU
urn:ietf:params:xml:ns:xriAU
urn:ietf:params:xml:ns:xriINU
urn:ietf:params:xml:ns:xriINA
urn:ietf:params:xml:ns:xriISV
urn:ietf:params:xml:ns:xri
idcommons
... and so on.
Because the sub &generateXML() is XML-driven, it must also therefore
be able to return verbose and useful errors to me if - for example - I
tried to do this:-
print &generateXML('epp::command::login','version'=>'test');
...because the XML specification for the command knows there
is no such element 'version', and further, that the required elements
'clID, pw, options, and svcs are missing. I'd expect to see an error
like
"error calling epp::command::login. element 'version' was specified by
does not exist. element 'clID' is missing. element 'pw' is missing.
element 'options' is missing. element 'svcs' is missing.
(yes - I realize that it looks like there's a element inside
the one - but that's not a variable - it's a fixed numeric
constant of '1.0' in the specs. There is no paramater
supplyable to )
Ideally - I would also like to be able to read responses to my XML
commands too - so it would be nice to have a perl function &readXML()
to do this. For example - again from [login to view URL] - we find this:-
So my perl script:-
my %data=&readXML($xmltext);
print $data{'greeting'}{'svDate'};
should output the following text:-
2006-04-12T13:14:22.0Z
(assuming $xmltext contained a valid XML reply from the
server)
Deliverables:-
1) perl script or module, with working examples
2) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
3) Deliverables must be in ready-to-run condition
4) All deliverables will be considered "work made for hire" under U.S. Copyright law.
## Platform
Linux, Perl
I do not know XML very well, but the CPAN module "XML::LibXML" looks like it might be handy for this?
Update: No: I LibXML doesn't look like it works or is complete.
My example scripts above are just a guide - if you prefer to use
object-oriented notation, that is also acceptable (providing you
supply sufficient example test cases for me to grasp how to use your
code).