php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57774 SDO_DAS_XML - xsi:type not always set for complexTypes
Submitted: 2007-08-06 14:10 UTC Modified: 2007-08-24 20:37 UTC
From: mattsch at gmail dot com Assigned: tuscany 1564
Status: Closed Package: SCA_SDO (PECL)
PHP Version: 5.2.3 OS: Gentoo Linux
Private report: No CVE-ID:
 [2007-08-06 14:10 UTC] mattsch at gmail dot com
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>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-06 14:11 UTC] mattsch at gmail dot com
Changing php version.
 [2007-08-20 06:18 UTC] mfp@php.net
Matthew, thanks for this. You are right of course. I just tried running the xml that we generate (the actual) through XERCES and it does not validate, whereas with the xsi:types (expected) it does. I have emailed Pete Robbins with the details to see if he wants it turned into a Tuscany JIRA.
 [2007-08-22 12:16 UTC] mattsch at gmail dot com
Since the Tuscany issue has been resolved, when can I expect the new Tuscany code to make it into the php extension?
 [2007-08-24 12:27 UTC] mfp@php.net
Matt, you will see that I created release 1.2.3 today and this fix will be in there.
 [2007-08-24 18:08 UTC] cem@php.net
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pecl.php.net/get/SCA_SDO


 [2007-08-24 20:37 UTC] mattsch at gmail dot com
Thanks for the quick fix and reply.  Great job!  :-)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 04:01:57 2014 UTC