Hi David, I'm not sure I understand what you're doing. The jaxp.TypeInfoWriter sample shows how to get type information from a JAXP validator. If you're using the JAXP Validation API the PSVIProvider is the ValidatorHandler not the SAX parser.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org David Cao <govel...@gmail.com> wrote on 06/21/2009 09:03:49 PM: > Hi there, > > I need to be able to parse (either via DOM or SAX) an XML with > namespace spread out in several schema; this means the final type > could reside in an embedded schema a couple level deeper. I need to > tell if an element is defined as a simple type or as an array type. > > I took the sample jaxp.TypeInfoWriter (because I also need access > to org.w3c.dom.TypeInfo); then to add a org.apache.xerces.xs. > PSVIProvider to the handler, > > private PSVIProvider fPSVIProvider; > > and set it this way, > > org.apache.xerces.parsers.SAXParser saxParser = new org.apache. > xerces.parsers.SAXParser(); > fPSVIProvider = (PSVIProvider)saxParser; > > However, in the startElement( ... ) method, I did this, > > ElementPSVI elemPSVI = fPSVIProvider.getElementPSVI(); > > unfortunately, elemPSVI is always null no matter how I configure the > schema validation options. > > So, is my approach workable? if yes, what I did wrong. Or is there > better approach? > > ------------------------------ > > Also, I tried out-of-box simpletype.DatatypeInterfaceUsage sample on > the provided personal.xsd and personal-schema.xml; I found the same > result. But I found the underlying parsers are different between the > two samples. One uses, > org.apache.xerces.jaxp.SAXParserImpl, which inherits javax.xml. > parsers.SAXParser > the other uses, > org.apache.xerces.parsers.SAXParser > > I found although they have the same simple name, they don't overlap > at all. So how to choose which to use one or the other? > > Much appreciated, > David