[BangPypers] Mapping python types to xml schema

Heshan Suriyaarachchi heshan.suri at gmail.com
Mon May 12 13:05:53 CEST 2008


Hi,
  I am using a mechanism to annotate a python script, and at the deployment
time I am reading the annotations and mapping the types defined in the
python script to xml schema types(This is done inside java).But the problem
I am facing is , since python is dynamically typed how should I map the date
, time types , complex types?(I have attached below some sample code to give
you an idea). The information in [1] gives a bit of an idea but it does not
give any detail description.I will be grateful if anyone can give me any
direction on mapping python types to xml schema.(either in python or in
java)

// my java imports
import org.apache.ws.commons.schema.constants.Constants;

// my java code
    HashMap simpleTypetoxsd = new HashMap();
    simpleTypetoxsd.put("int", Constants.XSD_INT);        // i.e. I am
mapping my "int" annotation to schema type XSD_INT
        simpleTypetoxsd.put("integer", Constants.XSD_INT);
        simpleTypetoxsd.put("Integer", Constants.XSD_INT);
        simpleTypetoxsd.put("double", Constants.XSD_DOUBLE);
        simpleTypetoxsd.put("Double", Constants.XSD_DOUBLE);

        simpleTypetoxsd.put("string", Constants.XSD_STRING);
        simpleTypetoxsd.put("String", Constants.XSD_STRING);


[1] -
http://jython.org/Project/userguide.html#calling-java-methods-and-functions


Thanx in advance


-- 
Regards,
Heshan Suriyaarachchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20080512/d3fc47c9/attachment.htm>


More information about the BangPypers mailing list