In this article, Uche Ogbuji writes about python and XML , the two popular and powerful technologies. Uche Ogbuji is a consultant and co-founder of Fourthought. Fourthought is a consulting firm specializing in XML solutions for enterprise knowledge management applications also develops 4Suite, the open source platform for XML middleware.
Phillip J. Eby is one of the core developers at the Open Source Applications Foundation, where the primary project is an enterprise grade groupware application written in Python (Chandler). The project includes a component architecture called Parcels, originally expressed in XML but Recently the decision was made to move from XML to Python code.
According to Uche Ogbuji, the Chandler’s grown XML schema definition language was a terrible hardship on developers, he proposed to replace it with a descriptor-based Python API.
While migrating to Python it’s easy to forget to reassess the value of XML. If you define configuration and scripting for an application in a python and use the same language to express the script, the instructions in the script files can be directly executed in the context of the host process, which provides a tremendous amount of flexibility. Although this does not mean that there is no need for a XML..
Using Python itself for scripting gives you the full power of Python, and the script author is not restricted to simple key-value style parameters Uche Ogbuji continues, if you don’t need to invent a new syntax that the Python developer needs to learn, you shouldn’t do so, becausedoing so is erecting an unnecessary hurdle. This should be simple common sense rather than an exhibit in the case against XML.
XML Vs Python
- XML is often not the best choice for configuration and scripting in Python applications.
- XML is no more a good code format than Python is a good document format.
- Compared to Python code, XML is a boat anchor, a ball and chain.
- In Python, XML is something you use for inter-operability andÂ not your core functionality, because you simply don’t need it.
- In Java, avoiding coding is an advantage because coding means recompiling. But in Python, more often than not, code is easier to write than XML.
- Python can process code much, much faster than your code can process XML.
- you have to write the XML processing code, whereas Python itself is already written for you.
One thing is sure, XML might not be so useful with thepython but certainly useful with other languages.
>> Should Python and XML Coexist?