You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Oliver Waeldrich (JIRA)" <ji...@apache.org> on 2006/12/08 12:47:24 UTC

[jira] Commented: (MUSE-159) Schema validation fails for NonNilable ResourceProperties, when child elements of the resource properties are optional (minOccours="0")

    [ http://issues.apache.org/jira/browse/MUSE-159?page=comments#action_12456789 ] 
            
Oliver Waeldrich commented on MUSE-159:
---------------------------------------

A workaround for this issue is ton include a white space in the element text. The resulting xml would look like

<MyType> <MyType>

and is validated successful in contrast to </MyType>.

However, this looks quite dirty to me. Therfore I would suggest to determine if an element is nil the presence of the xsi:nil attribute should be checked.

<MyType xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

I have not checked it, but for me it looks like the above sample would be validated as NOT nil since some attribute is present. Therefore I think it might be sensible to look at the nil attribute rather then checking the content. A patch could look like foolows:

                    String nil = instances[n].getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    boolean isNil  = (nil == null) ? false : Boolean.valueOf(nil).booleanValue();
                    if (isNil) throw new SchemaValidationFault(message);




> Schema validation fails for NonNilable ResourceProperties, when child elements of the resource properties are optional (minOccours="0")
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MUSE-159
>                 URL: http://issues.apache.org/jira/browse/MUSE-159
>             Project: Muse
>          Issue Type: Bug
>          Components: WSRF WSRP ResourcePropertyCollection and Capabilities
>    Affects Versions: 2.0.0 M1, 2.0.0 M2, 2.0.0, 2.1.0
>            Reporter: Oliver Waeldrich
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>
> I have the following declaration for ResourceProperties in my wsdl-file:
> 	<xs:complexType name="MyPropertiesType">
> 		<xs:sequence>
> 			<xs:element ref="tns:MyType" />
> 		</xs:sequence>
> 	</xs:complexType>
> 	<xs:element name="MyType" type="tns:MyType1" />
> 	<xs:complexType name="MyType1">
> 		<xs:sequence>
> 			<xs:element ref="tns:MyType2" minOccurs="0" />
> 		</xs:sequence>
> 	</xs:complexType>
> However, the schema validation (validateSchema() in SimpleResourcePropertyCollection) does not honor that the property may be empty (e.g. <MyType/>) and recognizes it as nil. Therefore the schema validation process breaks.
> // some sort of "can  be empty check" is missing here
>             if (!isNillable)
>             {
>                 for (int n = 0; n < instances.length; ++n)
>                 {
>                     //
>                     // check for child elements, attributes, and text, all of 
>                     // which qualify an element as "not null"
>                     //
>                     if (!instances[n].hasChildNodes() && 
>                         !instances[n].hasAttributes() && 
>                         XmlUtils.extractText(instances[n]) == null)
>                         throw new SchemaValidationFault(message);
>                 }
>             }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org