- From: Casey Jordan <casey.jordan@jorsek.com>
- Date: Thu, 22 Jul 2010 12:36:28 -0400
- To: xmlschema-dev@w3.org, www-dom@w3.org
- Message-ID: <AANLkTikPSJGjIw6qkPFLQOvZXTFYbK5GSRsh1yrmMYqg@mail.gmail.com>
Hi group, I have implemented the DOM3 Validation spec in JavaScript, but am running into some efficiency issues. Mainly with methods like: allowedNextSiblings(), allowedPreviousSiblings(), allowedFirstChildren() All of these methods are created to let the user determine what elements that can be inserted at a given point. For instance a simplified example would work as follows. <instance> <c1/> </instance> <sequence> <element name="c1"/> <element name="c2"/> <element name="c3"/> </sequence> Thus if I was to ask "What elements can be inserted after <c1/>, I would get <c2/>. IE <c1>.allowedNextSiblings() == NameList(<c2/>) So here is my problem, the only way I have been able to reliably get the correct results is by inserting and validating for each element. The steps look something like this: 1.) Determine all the elements that can be child nodes of the parent node. IE DOM3 Validtion allowedChildren() 2.) Insert an empty element for each one at every possible insertion point and validate. 3.) When insertion produces a valid structure, that element is flagged as insert-able at given point. This is extremely accurate, and will work with very complex patterns, but also *extremely inefficient*, especially in JavaScript. I would be really appreciative if anyone could help me better understand how this can be done more efficiently. Thanks, Casey -- -- Casey Jordan Jorsek Software LLC. "CaseyDJordan" on LinkedIn, Twitter & Facebook Cell (585) 348 7399 Office (585) 239 6060 Jorsek.com This message is intended only for the use of the Addressee(s) and may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, please be advised that any disclosure copying, distribution, or use of the information contained herein is prohibited. If you have received this communication in error, please destroy all copies of the message, whether in electronic or hard copy format, as well as attachments, and immediately contact the sender by replying to this e-mail or by phone. Thank you.
Received on Thursday, 22 July 2010 16:36:56 UTC