On Sep 18, 8:28 am, Frank Millman <[EMAIL PROTECTED]> wrote: > Hi all > > This is not strictly a Python question, but as I am writing in Python, > and as I know there are some XML gurus on this list, I hope it is > appropriate here. > > XML-schemas are used to define the structure of an xml document, and > to validate that a particular document conforms to the schema. They > can also be used to transform the document, by filling in missing > attributes with default values. > [..] > > Or maybe the best practice is to *always* validate a document before > processing it. >
I have realised that my question was irrelevant. xml's raison d'etre is to facilitate the exchange of information between separate entities. If I want to use xml as a method of serialisation within my own system, I can do what I like, but there can be no question of 'best practice' in this situation. When xml is used as intended, and you want to process a document received from a third party, there is no doubt that you should always validate it first before processing it. Thank you, Lorenzo, for pointing out the obvious. It may take me a while to catch up, but at least I can see things a little more clearly now. As to why I am using xml at all, I know that there is a serious side to Skip's light-hearted comment, so I will try to explain. I want to introduce an element of workflow management (aka Business Process Management) into the business/accounting system I am developing. I used google to try to find out what the current state of the art is. After several months of very confusing research, this is the present situation, as best as I can figure it out. There is an OMG spec called BPMN, for Business Process Modeling Notation. It provides a graphical notation, intended to be readily understandable by all business users, from business analysts, to technical developers, to those responsible for actually managing and monitoring the processes. Powerful though it is, it does not provide a standard method of serialsing the diagram, so there is no standard way of exchanging a diagram between different vendors, or of using it as input to a workflow engine. There is an OASIS spec called WS-BPEL, for Web Services Business Process Execution Language. It defines a language for specifying business process behavior based on Web Services. This does have a formal xml-based specification. However, it only covers processes invoked via web services - it does not cover workflow-type processes within an organisation. To try to fill this gap, a few vendors got together and submitted a draft specification called BPEL4People. This proposes a series of extensions to the WS-BPEL spec. It is still at the evaluation stage. The BPMN spec includes a section which attempts to provide a mapping between BPMN and BPEL, but the authors state that there are areas of incompatibility, so it is not a perfect mapping. Eventually I would like to make sense of all this, but for now I want to focus on BPMN, and ignore BPEL. I can use wxPython to design a BPMN diagram, but I have to invent my own method of serialising it so that I can use it to drive the business process. For good or ill, I decided to use xml, as it seems to offer the best chance of keeping up with the various specifications as they evolve. I don't know if this is of any interest to anyone, but it was therapeutic for me to try to organise my thoughts and get them down on paper. I am not expecting any comments, but if anyone has any thoughts to toss in, I will read them with interest. Thanks Frank -- http://mail.python.org/mailman/listinfo/python-list