Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'xml,': 0.05; 'roll': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'xml.': 0.09; 'bug)': 0.16; 'conforms': 0.16; 'mismatching': 0.16; 'roy': 0.16; 'subject:lxml': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'integrate': 0.18; 'header:In-Reply-To:1': 0.22; 'format,': 0.24; 'writes:': 0.25; 'code': 0.25; 'django': 0.26; "i'm": 0.26; 'server.': 0.28; 'pm,': 0.29; 'url:)': 0.29; 'environment': 0.30; 'generally': 0.30; 'xml': 0.31; 'headers': 0.32; "isn't": 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'probably': 0.34; 'test.': 0.34; 'test': 0.35; 'external': 0.35; 'post': 0.36; 'http': 0.37; 'but': 0.37; 'run': 0.37; 'think': 0.37; 'could': 0.37; 'using': 0.38; 'received:org': 0.38; 'allows': 0.38; 'some': 0.38; "i'd": 0.39; 'received:de': 0.39; 'url:org': 0.39; "it's": 0.40; 'to:addr:python.org': 0.40; 'huge': 0.61; 'custom': 0.61; 'your': 0.61; 'john': 0.62; 'validate': 0.67; 'site.': 0.67; 'yourself': 0.69; 'article': 0.74; '10:33': 0.84; 'subject:skip:v 10': 0.84; 'supposedly': 0.84; 'validator': 0.84; 'contents,': 0.91; 'html5': 0.91; 'clients,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Gelonida N Subject: Re: lxml precaching DTD for document verification. Date: Mon, 28 Nov 2011 01:32:33 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: unicorn.dungeon.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110921 Lightning/1.0b2 "" In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322440368 news.xs4all.nl 6852 [2001:888:2000:d::a6]:42576 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16303 On 11/27/2011 10:33 PM, John Gordon wrote: > In Roy Smith writes: > >> In article , >> Gelonida N wrote: >> >>> I'd like to verify some (x)html / / html5 / xml documents from a server. > >> I'm sure you could roll your own validator with lxml and some DTDs, but >> you would probably save yourself a huge amount of effort by just using >> the validator the W3C provides (http://validator.w3.org/). This validator requires that I post the code to some host. The contents that I'd like to verify is intranet contents, which I am not allowed to post to an external site. > > With regards to XML, he may mean that he wants to validate that the > document conforms to a specific format, not just that it is generally > valid XML. I don't think the w3 validator will do that. > Basically I want to integrate this into a django unit test. I noticed, that some of of the templates generate documents with mismatching DTD headers / contents. All of the HTML code is parsable as xml (if it isn't it's a bug) There are also some custom XML files, which have their specific DTDs So I thought about validating some of the generated html with lxml. the django test environment allows to run test clients, which are supposedly much faster than a real http client.