xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Glavassevich <mrgla...@ca.ibm.com>
Subject Re: Attribute validation Error
Date Mon, 24 Aug 2009 12:02:35 GMT

Hi Ajay,

PSVIProvider is intended for SAX applications.

Have you read the FAQ for PSVI DOM [1]? You access the PSVI by casting
element / attribute nodes to ElementPSVI / AttributePSVI. If you provide
the Validator a PSVI DOM as input it will annotate it with PSVI as the
document is validated.

Thanks.

[1] http://xerces.apache.org/xerces2-j/faq-dom.html#faq-8

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

ajay bhadauria <abhadauria@yahoo.com> wrote on 08/22/2009 10:26:25 PM:

> Mukul,
>
> Thanks for reply.
>
> I looked at the FAQ and found that org.apache.xerces.xs.PSVIProvider
> can be used with JAXP 1.3 Validator. I need some help. How should I
> use it? I never used it.
>
> I have xml DOMSource object feeding to the JAXP1.3 Validator object.
> So when I should register Validator object with PSVIProvider interface.
>
> Any code sample will help me a lot if you or anybody can provide.
>
> Regards
> AB
>
> --- On Sat, 8/22/09, Mukul Gandhi <gandhi.mukul@gmail.com> wrote:
>
> > From: Mukul Gandhi <gandhi.mukul@gmail.com>
> > Subject: Re: Attribute validation Error
> > To: j-users@xerces.apache.org
> > Date: Saturday, August 22, 2009, 7:49 AM
> > 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<abhadauria@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-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Mime
View raw message