1

I am designing a reference implementation for EmotionML (W3C's language for machine representation of emotions) in Python and I would like some design suggestions on data types to XML binding (I guess you can say I am crowdsourcing some design ideas).

I would like suggestions and pointers to some design and code of people who might have already done similar. My tendency is to just use Java path I am familiar of creating objects that correspond to the structures of XML and have them translated into DOM.

OO gives me polymorphism but creates a more intricate object structure, where Python is very good about set representation and use of built in collections.

I am looking for possible more elegant approach. Could I define my own non-object structs and interrogate these and translate into DOM?

How would I represent optional, mandatory attributes, elements using lists and dictionaries?

These are all my design thoughts and dilemmas, not per say cries for help.

I could figure these things on my own, so I am truly soliciting mature, benevolent suggestions from experienced Python designers and developers.

Thanks in advance, Edmon

1
  • "This question is not a good fit to our Q&A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion." Commented Apr 24, 2012 at 3:36

2 Answers 2

3

OR you may use generateDS.py which serves the purpose of being an XML binder for Python. Given a scheme definition, it automatically generated the data classes in python and also produces the xml export/import method.

Sign up to request clarification or add additional context in comments.

Comments

2

Data binding is not very common in the Python world compared to Java or C#. I think this is because Python has so many much better XML APIs that are in use instead of the horrible monstrosity that is the DOM.

Investigate these APIs to see if they meet your needs:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.