Hi Ajay
   Did you think about, Michael's reply? I think, he already answered
your question.

It seems, that you are using the JAXP class "Validator" to validate
the XML document, and probably have set an error handler in the
validation process.

I think, you can retrieve the error message only through, the
getMessage() method available on SAXException, and there seems to be
no way you can get which attribute caused the error. One way, as you
pointed, could be that you can parse (or perhaps tokenize) the error
message, to get the attribute name/value which caused the problem. But
this may become difficult, and I would say this is not a completely
reliable technique to get the item (like, an attribute) which caused
the error (as, format of error messages are generally, product
specific).

As Michael suggested, you can try using a PSVI DOM, instead of a
standard DOM, if you need this information. Pls have a look at the FAQ
entry, which Michael pointed.

On Sat, Aug 22, 2009 at 6:06 AM, ajay bhadauria<abhadau...@yahoo.com> wrote:
> Hi,
>
> When Schema Validator validates xml document and if it encounters for example 
> attribute validation error and validation error message displays that indeed 
> attribute 'xyz' has error which means that Validator knows that error is in 
> attribute node.
>
> How can I get this node (element Node, text node, attribute Node etc.) which 
> is in error other than error message. I am using DOM document.
>
> If anybody knows please reply asap whether it is possible or not ?
>
> AB



-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to