[jboss-as7-dev] Metadata validation in StAX

Remy Maucherat rmaucher at redhat.com
Mon Dec 5 03:50:50 EST 2011


On Mon, 2011-12-05 at 09:33 +0100, Thomas Diesler wrote:
> Hi Frederic,
> 
> here is a sample how stax can be used to validate
> 
> https://github.com/tdiesler/metadata/tree/staxval
> 
> Please note, that woodstox delegates to jaxb to create the schema 
> object. At first sight it is not obvious how to plug in the entity 
> resolver into that processing step - so because of network access the 
> test is terribly slow. A little research might show how to optimize this.
> 
> Anyway, I think we decided to do the validation as an 
> optional/additional processing step (i.e. not during the StAX parsing 
> phase). In AS7 I get a DOM tree of the EE descriptor and validate that 
> against a JAXP validator - after StAX processing is done. Also note, 

Ok, sounds good.

> that the jaxp validator does not catch invalid element duplicates, which 
> may be caused by the schema not being in sync with the spec (i.e you 
> can't have multiple session-config elements in web.xml). This we handle 
> hard coded in WebCommonMetaDataParser.

Yes, it's always been like that in previous metadata versions for these
three elements, they need an additional (simple) check.

-- 
Remy Maucherat <rmaucher at redhat.com>
Red Hat Inc



More information about the jboss-as7-dev mailing list