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/07 21:00:23 UTC

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

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, 2.0.0 M2, 2.0.0 M1, 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


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

Posted by "Oliver Waeldrich (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MUSE-159?page=all ]

Dan Jemiolo updated MUSE-159:
-----------------------------

    Fix Version/s: 2.2.0
                       (was: 2.1.0)

Okay, I see the difference now between the two issues. I will make the change for 2.2.

> 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, 2.0.0 M2, 2.0.0 M1, 2.1.0
>            Reporter: Oliver Waeldrich
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> 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


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

Posted by "Oliver Waeldrich (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MUSE-159?page=comments#action_12457375 ] 
            
Oliver Waeldrich commented on MUSE-159:
---------------------------------------

I checked this issue against the latest version from the trunk, but it remains unresolved.

> 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
>             Fix For: 2.1.0
>
>
> 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


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

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MUSE-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Jemiolo closed MUSE-159.
----------------------------

    Resolution: Fixed

Fixed using the solution provided by Oliver.


> Schema validation fails for NonNilable ResourceProperties, when child elements of the resource properties are optional (minOccours="0")
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MUSE-159
>                 URL: https://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
>             Fix For: 2.2.0
>
>
> 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: https://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


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

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MUSE-159?page=all ]

Dan Jemiolo updated MUSE-159:
-----------------------------

    Fix Version/s: 2.1.0

I believe this was fixed in the current build - it came up when trying to debug a problem with WSSG MembershipContentRules. Can you check?

> 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
>             Fix For: 2.1.0
>
>
> 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