Without a  separate validator you can just use:

                DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();

                dbf.setNamespaceAware(true);
                dbf.setValidating(true);
                
dbf.setAttribute("http://apache.org/xml/features/validation/schema";,
                                Boolean.TRUE);

                dbf.setAttribute(
                                
"http://apache.org/xml/properties/dom/document-class-name";,
                                "org.apache.xerces.dom.PSVIDocumentImpl");

                DocumentBuilder docBuilder = dbf.newDocumentBuilder();
                Document doc = docBuilder.parse("data/personal.xml");
                Element documentElement = doc.getDocumentElement();
                if (documentElement.isSupported("psvi", "1.0"))
                {
                        ElementPSVI psviElem = (ElementPSVI) 
doc.getDocumentElement();
                        XSModel model = psviElem.getSchemaInformation();
                        XSElementDeclaration decl = 
psviElem.getElementDeclaration();
                        System.out.println(decl.getName());
                }

Without a separate JAXP validator I am not sure, but I think you have to use a validitionHandler,


Regards
Dick Deneer

Op 13-sep-2009, om 12:03 heeft ajay bhadauria het volgende geschreven:

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