On 03/18/2011 02:58 PM, Philippe Nobili wrote:
> On 03/18/2011 01:19 PM, Hussein Shafie wrote:
>> Philippe Nobili wrote:
>>> The ValidateHook mechanism is really easy to develop&  deploy. Ours is
>>> rather simple, just fixing bad IDs, excerpt:
>>>
>>> *if( element.hasAttribute(ID) ) {
>>>
>>>             String idstring = element.getAttribute(ID) ;
>>>
>>>             if( idstring == null || !XMLText.isNCName(idstring) ) {
>>>
>>>               element.putAttribute(ID,generateID());
>>>             }
>>> }
>> This is just the obvious part, but there is another part which
>> integrates the above snippet to XXE.
> Indeed... This was to illustrate what changes we want to make to the 
> document... Integration with XXE works OK, and the code of the 
> validation hook itself looks OK to me.
>> Such validators are automatically invoked when you use Tools|Validate or
>> File|Open and/or File|Save.
> Yes, that's exactly what we want.
>>> their ID is fixed.
>>> If we create several new elements, then the ValidateHook fails to fix
>>> them all the first time it is ran, and fixes them all (as expected) the
>>> second time it is ran.
>> I don't see how this could be possible. Once attached to the document
>> tree, there is no difference between newly created elements and other
>> elements.
> Actually, there is a subtlety here... the validate hook runs after the 
> standard validation code I guess...
> 
> So we fixed some of the issues in our validation hook (e.g. bad IDs), 
> but only after the standard validation code has ran. Therefore, the 
> valdiation diagnostics (e.g, 'Invalid IDs') and the document itself are 
> not in sync. since the second validation pass (i.e. our "hook") has 
> fixed the problems...
> 
> That's why we got the impression that we had to run it twice... We had 
> to run it twice, but just to get the right messages, the document itself 
> was OK after the first pass.
> 
> I don't know if this is clear ?

I'm sorry but we have done our maximum to help you and we cannot do
more. Therefore this thread is closed.

[1] We are 100% sure that we have no bug related to validationHooks.

[2] The support we provide to our customers does not consist in fixing
their mistakes.

[3] We cannot force your Java developers to read the documentation
before coding. (No, blindly copying the example found "XMLmind XML
Editor - Developer's Guide" is not a good idea.)

I thought that we were pretty clear in our Developer's Guide:

Excerpts from "Writing a validateHook, Implementing the ValidateHook
interface",
http://www.xmlmind.com/xmleditor/_distrib/doc/dev/validatehook.html#d0e5583:

---
Method: checkingDocument        

Description: Invoked *before* a document conforming to a schema is
validated.

Method: documentChecked 

Description: Invoked *after* a document conforming to a schema has been
validated.
---

Obviously, validationHooks reporting semantic errors implement method
documentChecked and validationHooks fixing problems in the document
implement method checkingDocument.



 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to