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: [email protected]
E-mail: [email protected]

ajay bhadauria <[email protected]> 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 <[email protected]> wrote:
>
> > From: ajay bhadauria <[email protected]>
> > Subject: Missing PSVI after Validation.
> > To: [email protected]
> > 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: [email protected]
> > For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

Reply via email to