[AstroPy] accessing raw astropy.io.votable.tree.Resource content

Laurent Michel laurent.michel at astro.unistra.fr
Tue Aug 31 04:12:54 EDT 2021


Hello,

In the frame the VO data modeling efforts, I'm exercising the annotation of VOTable resources with data model meta-data.
These annotations are XML pieces matching their own schema.
For doing this without touching the VOTable schema, the annotations are enclosed in a Resource of type "meta".
The VOTable structure looks like this:

   <VOTable>
     <RESOURCE type=result>
       <RESOURCE type=meta>
         <==== My DM stuff ====>
       <RESOURCE type=result>
         <TABLE>

This approach has been validated by using standard XML parsers and validators and I'm now investigating a possible connection 
with Astropy.
For this, I need to be able to get the content of such a resource by using the  astropy.io.votable API.
My problem is that I do not know how to get that stuff as an XML DOM or even as a string either.

I would like to do something like:

         votable = parse(votable_path)
         for resource in votable.resources:
             if resource.type == "results":
                 for sub_resource in resource.resources:
                     if sub_resource.type == "meta":
                         print("here is my DM stuff")
                     >>> annotation_content = sub_resource.content()

Does anyone know a way to get the raw content of a resource?

Laurent
-- 
jesuischarlie/Tunis/Paris/Bruxelles/Berlin

Laurent Michel
SSC XMM-Newton
Tél : +33 (0)3 68 85 24 37
Fax : +33 (0)3 )3 68 85 24 32
Université de Strasbourg <http://www.unistra.fr>
Observatoire Astronomique
11 Rue de l'Université
F - 67200 Strasbourg


More information about the AstroPy mailing list