Metadata validation in StAX

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Metadata validation in StAX

Thomas Diesler
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

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Metadata validation in StAX

Rémy Maucherat
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 <[hidden email]>
Red Hat Inc

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Metadata validation in StAX

jean-frederic clere-2
In reply to this post by Thomas Diesler
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
>

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev