[jboss-as7-dev] Metadata validation in StAX

Thomas Diesler thomas.diesler at jboss.com
Mon Dec 5 03:33:04 EST 2011


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, 
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.

cheers
-thomas

On 12/02/2011 12:38 PM, jean-frederic clere wrote:
> Hi.
>
> Is there a way to get stax making the validation before we process the 
> metadata? It is some work to add the validation in metadata (and it 
> would be hard coded).
>
> Please help.
>
> Cheers
>
> Jean-Frederic

-- 
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
JBoss OSGi Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx



More information about the jboss-as7-dev mailing list