An STC "when" and "where" example
Matthew J. Graham
mjg at cacr.caltech.edu
Tue Mar 29 17:14:35 PST 2005
Hi,
>> Any parser that feels like it (or knows what they say) can skip the
>> included documents which are going to be part of a standard IVOA
>> library.
>
> Sorry, I have to take issue with this...
>
> Are you going to sit down and write factory and parser toolkits in
> Perl, Python, Ruby, C, C++, C#, Fortran, Java, PHP and the half dozen
> other languages currently in use inside various projects that will be
> involved in creating and parsing VOEvent messages?
OK, let's be realistic here: if you are serializing XML across the Web,
I believe with 95% confidence that you are using Java, C#, Perl or
Python (does anyone really write pure Fortran web services?) so we need
STC support libraries in these four languages. Now Java has binding
toolkits to handle XML <---> Java object and it needs to verified that
these will work with the STC schemata (previous versions have not). I
suspect that C# has a similar toolkit and Perl/Python?
Of course, the alternative way to access these verbose XML documents is
to apply an XPath statement against the XML document to retrieve the
elements/attributes you want:
if I had Java bindings for Arnold's example then I would call some
getValue2() method to access the RA,Dec pair but in the XPath example,
I would do: //crd:Position2D[crd:Name = "RA,Dec"]/crd:Value2. Now I
know that Java, Perl and Python all have XML libraries that let you do
this sort of thing on an XML document and the XPath statements will be
the same in all cases so we should certainly think about XPath
accessors as a way to do easy parsing.
The harder part is actually creating the documents. With standards like
XForms being increasingly supported, doing this through an interactive
form on a browser is straightforward - some of the registries already
do this based on the VOResource schemata which are just as complex.
This just leaves programmatically creating the document: binding is
good here where it is possible, otherwise a simple solution might be
stylesheets that would populate an XML STC document from a simpler
key-value pair document: default values could also be defined in the
stylesheets.
This type of approach will actually work with most of the languages you
mention with little additional work once it is implemented.
Cheers,
Matthew
More information about the voevent
mailing list