W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2010

Re: Looking for help. Implementing a XML validation engine in JavaScript.

From: Cheney, Edward A SSG RES USAR USARC <austin.cheney@us.army.mil>
Date: Mon, 09 Aug 2010 20:53:42 -0500
To: Casey Jordan <casey.jordan@jorsek.com>
Cc: xmlschema-dev@w3.org,www-dom@w3.org
Message-ID: <f678e0591d6d4.4c606ad6@us.army.mil>

I have attempted to write a Lint engine for HTML to imply conformance to an XHTML type syntax with rigid structure requirements to throw errors for violations that conflict with either semantics or accessibility.  The problems I ran into are:

1)  JavaScript is too slow for any sort of validation engine where structure is stressed as well as syntax.  JavaScript is a high level interpreted language, and so it about as slow as it gets with regards to programming.  My experience writing such things with JavaScript has left me to believe that in order to return any level of acceptable processing time you can have syntax validation like that of JSLint or structure analysis like that of the markup beautifier used by Pretty Diff tool, but you cannot have both.  I even mean far too slow even on the latest and greatest interpreters.

2) Logically, the natural inclination of JavaScript towards Lambda closures in theory should be helpful enough to solve the prior problem, but that is not so in practice.  This is line of thought is further enforced by the mere fact that XML namespace inheritance appears to likewise follow a Lambda model.  Unfortunately, this is not a benefit enough to over come the processing inefficiencies described in the prior point.  Additionally, Lambda models exist because they are helpful, however that do appear to directly represent strong potential towards the covert channels better described in systems architectures.  The covert channels are not so much a concern here for security violations, but rather for logic collision with regard to reuse of logic components where closure is manifest in that reuse, but scoped above the parts being reused.

These are the problems I ran into when using JavaScript in a similar manner.  For me the task became too ambitious for my feeble understanding of JavaScript and general inexperience programming.  I sincerely hope you succeed where I did not hope my pitfalls are something that are not present in your current frustrations.

Received on Tuesday, 10 August 2010 01:54:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:57 UTC