Hi Thomas,

"Mathiesen, Thomas \(EXT\)" <[EMAIL PROTECTED]> wrote on 
09/22/2006 09:29:50 AM:

> Hello,
> 
> I am using the DOMErrorHandler API to locate the erroneous nodes (see
> code below). Unfortunately, getRelatedNode() always returns the element,
> but not the attruibute node. So, if an attribute has an error, I cannot
> locate it. What can I do to get that information?

It's a design limitation. The schema validator has no way to communicate 
which attribute was in error to the error handler. I've thought of a 
couple ways to workaround this but haven't found the time to implement it.

> class SchemaDOMErrorHandler implements DOMErrorHandler
> {
>    private Pattern patternAttribute;
>    private Pattern patternType;
>      public SchemaDOMErrorHandler()
>      {
>         ...
>      }
>      public boolean handleError(DOMError domError)
>      {
>          String message = (String)domError.getMessage();
>          DOMLocator loc = (DOMLocator) domError.getLocation();
>          Node node = loc.getRelatedNode();
>          ...
>      }
>  } 
> 
> Thanks,
> Thomas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to