alexo / wro4j

New project location is:https://github.com/wro4j/wro4j
442 stars 110 forks source link

Empty group cause build model failed because of wro.xsd #212

Closed M3lkior closed 10 years ago

M3lkior commented 10 years ago

Hi,

ignoreEmptyGroup property has no effect because of built model from XML failed if does not have at least one element (js, css or group-ref)

this is due to group xsd definition with minOccurs="1" :


 <xsd:complexType name="Groups">
                <xsd:choice minOccurs="1" maxOccurs="unbounded">
                        <xsd:element name="import" type="xsd:string"/>
                        <xsd:element name="group" type="Group" minOccurs="1"
                                maxOccurs="unbounded" />
                </xsd:choice>
        </xsd:complexType>

My wro4j code :


<group name="app-header-all"></group>

Stacktrace :

[FAIL] Model creation using XmlModelFactory failed. Trying another ...
[FAIL] Exception occured while building the model using: XmlModelFactory Cannot build model from XML: cvc-complex-type.2.4.b: The content of element 'group' is not complete. One of '{"http://www.isdc.ro/wro":css, "http://www.isdc.ro/wro":js, "http://www.isdc.ro/wro":group-ref}' is expected. Using LazyWroModelFactoryDecorator for model creation..
[FAIL] Model creation using LazyWroModelFactoryDecorator failed. Trying another ...
[FAIL] Exception occured while building the model using: LazyWroModelFactoryDecorator Invalid model found! Using LazyWroModelFactoryDecorator for model creation..
[FAIL] Model creation using LazyWroModelFactoryDecorator failed. Trying another ...
[FAIL] Exception occured while building the model using: LazyWroModelFactoryDecorator Invalid model found! (SmartWroModelFactory.java:207)
11:51:16.614 [http-bio-8080-exec-5] ERROR r.i.w.m.f.FallbackAwareWroModelFactory - Error while creating the model (FallbackAwareWroModelFactory.java:50)
ro.isdc.wro.WroRuntimeException: Cannot create model using any of provided factories
alexo commented 10 years ago

Thanks!

M3lkior commented 10 years ago

It's works with an empty <css> or <js> declaration but it's just a hack ;)

alexo commented 10 years ago

Fixed in 1.7.x