Login | Packages | Support | Bugs 

Package home | Report new bug | New search Status: Open | Feedback | All

Bug #11774 SDO_DAS_XML - xsi:type not always set for complexTypes
Submitted: 2007-08-06 18:10 UTC Modified: 2007-08-25 00:37 UTC
From: mattsch at gmail dot com Assigned: tuscany 1564
Status: Closed Package: SCA_SDO
Version: 5.2.3 OS: Gentoo Linux
[2007-08-06 18: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></reque
st-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-l
ist>
[2007-08-06 18:11 UTC] mattsch at gmail dot com
Changing php version.
[2007-08-20 10:18 UTC] mfp at php dot 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-21 10:50 UTC] mfp at php dot net
Raised as http://issues.apache.org/jira/browse/TUSCANY-1564
[2007-08-22 16: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 16:27 UTC] mfp at php dot net
Matt, you will see that I created release 1.2.3 today and this fix will
be in there.
[2007-08-24 22:08 UTC] cem at php dot 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-25 00:37 UTC] mattsch at gmail dot com
Thanks for the quick fix and reply.  Great job!  :-)
PRIVACY POLICY | CREDITS
Copyright © 2001-2008 The PHP Group
All rights reserved.
Last updated: Fri Aug 07 10:22:05 2009 UTC
Bandwidth and hardware provided by: pair Networks