[jboss-as7-dev] Metadata validation in StAX
jean-frederic clere
jclere at redhat.com
Mon Dec 5 03:59:23 EST 2011
On 12/05/2011 09:33 AM, 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.
In a quick test I have noted that web.xml without version cause an error
I need to have a closer look to it.
>
> 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.
There are already some test hard coded there, we could add more.
Cheers
Jean-Frederic
>
> 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
>
More information about the jboss-as7-dev
mailing list