stefcl <stefatw...@gmail.com> wrote on 03/18/2010 04:08:38 AM: <snip/>
> When we were still using jaxb I could *cheat* the validator by using a Sax > filter like this one. > > @Override > public void startElement(String uri, String localName, String qName, > Attributes attributes) throws SAXException > { > > if( localName.equals( "items" )) > { > //inject namespace uri... > super.startElement( > "http://xml.prediggo.com/schema/ItemsSchema" , localName, qName, > attributes); > } > else > { > //do things normally... > super.startElement( uri , localName, qName, attributes); > } > > } > > But now, validation exceptions are thrown before my filter is even called. > > Any advice would be greatly appreciated.... You can do the same thing with the JAXP Validation API [1], feeding it your modified SAX events. Disable validation on the parser and attach a ValidatorHandler [2] after your filter. That should give you what you want. > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/package-summary.html, [2] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/ValidatorHandler.html Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org