Ajay,

You're creating two Documents, the 2nd of which isn't PSVI aware. Get rid
of the 2nd one (i.e. the one you create with DocumentBuilder.newDocument())
and make the 1st one both the DOMSource and DOMResult:

document = dBuilder.parse(new FileInputStream(xmlFile));
...
DOMSource source = new DOMSource(document);
DOMResult result = new DOMResult(document);
...
validator.validate(source,result);
...

This will augment the DOM with PSVI and also perform better since it
doesn't require that nodes be copied to the result since the source and
result DOMs are the same instances. You could have also set the Schema
object on the DocumentBuilderFactory instead of doing this separate
validate step after parsing.

Thanks.

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

ajay bhadauria <abhadau...@yahoo.com> wrote on 09/13/2009 06:03:03 AM:

> Hi all,
>
> Can anyone point out in the attached file what I am missing because
> of which I am not getting PSVI info. after validation ?
>
> Thanks
> AB.
>
> --- On Sat, 9/12/09, ajay bhadauria <abhadau...@yahoo.com> wrote:
>
> > From: ajay bhadauria <abhadau...@yahoo.com>
> > Subject: Missing PSVI after Validation.
> > To: j-users@xerces.apache.org
> > Date: Saturday, September 12, 2009, 4:21 PM
> > Hi all,
> >
> > I am trying to get PSVI info after JAXP validation of xml
> > instance with schema but I am not getting PSVI info. It
> > looks like I am missing very basic thing.
> >
> > I provided DOMSource and DOMResult to the JAXP validator
> > (validate(DOMSource,DOMResult). Both these sources are
> > created from the DocumentBuilderFactory which has
> > attribute(org.apache.xerces.dom.PSVIDocumentImpl") .
> >
> > Please find the attached file if someone can pinpoint what
> > I am missing that will great help for me.
> >
> > Thanks
> > Ab
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> > For additional commands, e-mail: j-users-h...@xerces.apache.org
>
>
> ---------------------------------------------------------------------
> 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