You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Matthew Peters (JIRA)" <tu...@ws.apache.org> on 2007/08/21 12:49:30 UTC

[jira] Created: (TUSCANY-1564) xsi:type not always set for complexTypes

xsi:type not always set for complexTypes
----------------------------------------

                 Key: TUSCANY-1564
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1564
             Project: Tuscany
          Issue Type: Bug
          Components: C++ SDO
    Affects Versions: Cpp-Next
         Environment: Win XP and Gentoo Linux
            Reporter: Matthew Peters


This has been reported by a user of the PHP SDO code. I have verified that he is right - the problem does exist. I will cut and paste in the PHP example from the defect http://pecl.php.net/bugs/bug.php?id=11774 but the php-ness of the example is irrelevant: under the covers we are just manipulating a C++ SDO and then calling XMLHelper->save()

In the defect text below he puts in both expected and actual output. He is right to raise the problem in the sense that I have tried reading in the actual and expected xml under XERCES with schema validation turned on, and the actual will *not* validate whereas the expected will. 

Incidentally there is some history w.r.t. xsi:types - in a different case they were coming out when we did not want them and they were suppressed for us. See for example JIRA 1297. I do not know the rules which should determine whether it should be present or not.

Here follows the original PHP defect.

Description:
------------
xsi:type is not always set for complexTypes.  Notice the absence of xsi:type="collectionInfo" in the actual output.

Reproduce code:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="request" type="requestType"/>
     <xsd:complexType name="requestType" abstract="true"/>
      <xsd:complexType name="collectionInfo">
         <xsd:complexContent>
           <xsd:extension base="requestType">
              <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                 <xsd:element name="collection"/>
              </xsd:sequence>
              <xsd:attribute name="kind" type="xsd:string" fixed="collectionInfo"/>
           </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>
   <xsd:element name="request-list">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="request" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
     </xsd:complexType>
    </xsd:element>
</xsd:schema>

<?php
try {
	$xmldas = SDO_DAS_XML::create("request.xsd");
	try {
		$doc = $xmldas->createDocument('', 'request-list');
		$rdo = $doc->getRootDataObject();
		$request = $xmldas->createDataObject('', 'collectionInfo');
		$request->collection->insert('Blah');
		$request->kind = 'collectionInfo';
		$rdo->request->insert($request);
		print($xmldas->saveString($doc));
	} catch (SDO_Exception $e) {
		print($e);
	}
} catch (SDO_Exception $e) {
	print("Problem creating an XML document: " . $e->getMessage());
}
?>

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<request-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <request kind="collectionInfo" xsi:type="collectionInfo">
        <collection>Blah</collection>
    </request>
</request-list>

Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<request-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <request kind="collectionInfo">
        <collection>Blah</collection>
    </request>
</request-list>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Closed: (TUSCANY-1564) xsi:type not always set for complexTypes

Posted by "Matthew Peters (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthew Peters closed TUSCANY-1564.
-----------------------------------

    Resolution: Fixed

I have tested the fix in the cpp-pre2.1 branch and it is indeed fixed. Thanks.

> xsi:type not always set for complexTypes
> ----------------------------------------
>
>                 Key: TUSCANY-1564
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1564
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: Cpp-Next
>         Environment: Win XP and Gentoo Linux
>            Reporter: Matthew Peters
>             Fix For: Cpp-Next
>
>
> This has been reported by a user of the PHP SDO code. I have verified that he is right - the problem does exist. I will cut and paste in the PHP example from the defect http://pecl.php.net/bugs/bug.php?id=11774 but the php-ness of the example is irrelevant: under the covers we are just manipulating a C++ SDO and then calling XMLHelper->save()
> In the defect text below he puts in both expected and actual output. He is right to raise the problem in the sense that I have tried reading in the actual and expected xml under XERCES with schema validation turned on, and the actual will *not* validate whereas the expected will. 
> Incidentally there is some history w.r.t. xsi:types - in a different case they were coming out when we did not want them and they were suppressed for us. See for example JIRA 1297. I do not know the rules which should determine whether it should be present or not.
> Here follows the original PHP defect.
> Description:
> ------------
> xsi:type is not always set for complexTypes.  Notice the absence of xsi:type="collectionInfo" in the actual output.
> Reproduce code:
> ---------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <xsd:element name="request" type="requestType"/>
>      <xsd:complexType name="requestType" abstract="true"/>
>       <xsd:complexType name="collectionInfo">
>          <xsd:complexContent>
>            <xsd:extension base="requestType">
>               <xsd:sequence minOccurs="0" maxOccurs="unbounded">
>                  <xsd:element name="collection"/>
>               </xsd:sequence>
>               <xsd:attribute name="kind" type="xsd:string" fixed="collectionInfo"/>
>            </xsd:extension>
>       </xsd:complexContent>
>    </xsd:complexType>
>    <xsd:element name="request-list">
>       <xsd:complexType>
>          <xsd:sequence>
>             <xsd:element ref="request" minOccurs="0" maxOccurs="unbounded"/>
>         </xsd:sequence>
>      </xsd:complexType>
>     </xsd:element>
> </xsd:schema>
> <?php
> try {
> 	$xmldas = SDO_DAS_XML::create("request.xsd");
> 	try {
> 		$doc = $xmldas->createDocument('', 'request-list');
> 		$rdo = $doc->getRootDataObject();
> 		$request = $xmldas->createDataObject('', 'collectionInfo');
> 		$request->collection->insert('Blah');
> 		$request->kind = 'collectionInfo';
> 		$rdo->request->insert($request);
> 		print($xmldas->saveString($doc));
> 	} catch (SDO_Exception $e) {
> 		print($e);
> 	}
> } catch (SDO_Exception $e) {
> 	print("Problem creating an XML document: " . $e->getMessage());
> }
> ?>
> Expected result:
> ----------------
> <?xml version="1.0" encoding="UTF-8"?>
> <request-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <request kind="collectionInfo" xsi:type="collectionInfo">
>         <collection>Blah</collection>
>     </request>
> </request-list>
> Actual result:
> --------------
> <?xml version="1.0" encoding="UTF-8"?>
> <request-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <request kind="collectionInfo">
>         <collection>Blah</collection>
>     </request>
> </request-list>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (TUSCANY-1564) xsi:type not always set for complexTypes

Posted by "Pete Robbins (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12521605 ] 

Pete Robbins commented on TUSCANY-1564:
---------------------------------------

I have applied a patch to the branch only which I believe works. I think that we should always write xsi:type information for properties that are of an abstract type. In this case the property 'request' is of abstract type 'requestType' so we must specify what the real type of the property is.

I have tested this and it appears not to break anything else so please can you try this out in php and let me know.

> xsi:type not always set for complexTypes
> ----------------------------------------
>
>                 Key: TUSCANY-1564
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1564
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: Cpp-Next
>         Environment: Win XP and Gentoo Linux
>            Reporter: Matthew Peters
>
> This has been reported by a user of the PHP SDO code. I have verified that he is right - the problem does exist. I will cut and paste in the PHP example from the defect http://pecl.php.net/bugs/bug.php?id=11774 but the php-ness of the example is irrelevant: under the covers we are just manipulating a C++ SDO and then calling XMLHelper->save()
> In the defect text below he puts in both expected and actual output. He is right to raise the problem in the sense that I have tried reading in the actual and expected xml under XERCES with schema validation turned on, and the actual will *not* validate whereas the expected will. 
> Incidentally there is some history w.r.t. xsi:types - in a different case they were coming out when we did not want them and they were suppressed for us. See for example JIRA 1297. I do not know the rules which should determine whether it should be present or not.
> Here follows the original PHP defect.
> Description:
> ------------
> xsi:type is not always set for complexTypes.  Notice the absence of xsi:type="collectionInfo" in the actual output.
> Reproduce code:
> ---------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <xsd:element name="request" type="requestType"/>
>      <xsd:complexType name="requestType" abstract="true"/>
>       <xsd:complexType name="collectionInfo">
>          <xsd:complexContent>
>            <xsd:extension base="requestType">
>               <xsd:sequence minOccurs="0" maxOccurs="unbounded">
>                  <xsd:element name="collection"/>
>               </xsd:sequence>
>               <xsd:attribute name="kind" type="xsd:string" fixed="collectionInfo"/>
>            </xsd:extension>
>       </xsd:complexContent>
>    </xsd:complexType>
>    <xsd:element name="request-list">
>       <xsd:complexType>
>          <xsd:sequence>
>             <xsd:element ref="request" minOccurs="0" maxOccurs="unbounded"/>
>         </xsd:sequence>
>      </xsd:complexType>
>     </xsd:element>
> </xsd:schema>
> <?php
> try {
> 	$xmldas = SDO_DAS_XML::create("request.xsd");
> 	try {
> 		$doc = $xmldas->createDocument('', 'request-list');
> 		$rdo = $doc->getRootDataObject();
> 		$request = $xmldas->createDataObject('', 'collectionInfo');
> 		$request->collection->insert('Blah');
> 		$request->kind = 'collectionInfo';
> 		$rdo->request->insert($request);
> 		print($xmldas->saveString($doc));
> 	} catch (SDO_Exception $e) {
> 		print($e);
> 	}
> } catch (SDO_Exception $e) {
> 	print("Problem creating an XML document: " . $e->getMessage());
> }
> ?>
> Expected result:
> ----------------
> <?xml version="1.0" encoding="UTF-8"?>
> <request-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <request kind="collectionInfo" xsi:type="collectionInfo">
>         <collection>Blah</collection>
>     </request>
> </request-list>
> Actual result:
> --------------
> <?xml version="1.0" encoding="UTF-8"?>
> <request-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <request kind="collectionInfo">
>         <collection>Blah</collection>
>     </request>
> </request-list>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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