Path: csiph.com!news.mixmin.net!news2.arglkargh.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'schema': 0.05; 'attributes': 0.07; '(aka': 0.09; 'bindings': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'attributes,': 0.16; 'binding)': 0.16; 'binding.': 0.16; 'generated,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:XML': 0.16; 'library': 0.20; 'object.': 0.22; 'parse': 0.22; 'defined': 0.23; 'dependent': 0.23; 'elements': 0.23; 'xml': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'document.': 0.27; 'interface': 0.29; 'expose': 0.29; 'thus,': 0.29; 'objects': 0.29; 'gives': 0.35; 'level': 0.35; 'child': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'there,': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'associated': 0.38; 'rather': 0.39; 'resources': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'documents': 0.61; 'different': 0.63; 'binding': 0.66; 'received:217': 0.66; 'advantages': 0.72; 'low': 0.83; 'complex.': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: XML Binding Date: Wed, 09 Sep 2015 10:20:48 +0200 References: <8e17ef7d-a08d-42bf-a56c-0a886d620130@googlegroups.com> <9b916796-623d-45d9-abe0-8bc7934ec42b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e09a3d.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:2mJiN3oOzpYuMGj9I8bOpHSties= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441786885 news.xs4all.nl 23782 [2001:888:2000:d::a6]:59717 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96171 Palpandi writes: > Is it better to use pyxb than lxml? > > What are the advantages of lxml and pyxb? "pyxb" has a different aim than "lxml". "lxml" is a general purpose library to process XML documents. It gives you an interface to the document's resources (elements, attributes, comments, processing instructions) on a low level independ from the document type. "pyxb" is different: there, you start with an XML schema description. You use "pyxb" to generate Python bindings for this schema. With such a binding generated, "pyxb" can parse XML documents following a known XML schema into the corresponding binding. The binding objects expose child (XML) elements and (XML) attributes as attributes of the binding object. Thus, the Python interface (as defined by the binding) is highly dependent on the type (aka XML schema) of the document. I use "lxml" for either simple XML processing or when the XML documents are not described by an XML schema. I use "pyxb" when the XML documents has an associated complex schema and the processing is rather complex.