On 23 Apr, 16:11, cdouglas <[EMAIL PROTECTED]> wrote:
> I don't think they are that complex, but they aren't exactly simple
> either. Is there a place I can post/email them for you to view and
> see if you get the same thing? They are really too large to do it in
> this post.
I got to the bottom of what's going on here. It seems that SDO doesn't
get the scoping right when there are two annonymous types with the
same name. We need to think up a new strategy for scoping annonymous
type in the Tuscany code based on the context in which they appear.
I've raised it on the Tuscany list.
I made a little sample to demonstrate what's going on. Here is the
XSD.
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=" http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/AnnonTypes"
xmlns:tns=" http://www.example.org/AnnonTypes"
elementFormDefault="qualified">
<element name="Top">
<complexType>
<sequence>
<element name="ElementA">
<complexType>
<sequence>
<element name="Overlapping">
<complexType>
<sequence>
<element name="ValueA" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="ElementB">
<complexType>
<sequence>
<element name="Overlapping">
<complexType>
<sequence>
<element name="ValueB" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
Here's the XML
<?xml version="1.0" encoding="UTF-8"?>
<tns:Top xmlns:tns="http://www.example.org/AnnonTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation="http://www.example.org/AnnonTypes
AnnonTypes.xsd ">
<tns:ElementA>
<tns:Overlapping>
<tns:ValueA>tns:ValueA</tns:ValueA>
</tns:Overlapping>
</tns:ElementA>
<tns:ElementB>
<tns:Overlapping>
<tns:ValueB>tns:ValueB</tns:ValueB>
</tns:Overlapping>
</tns:ElementB>
</tns:Top>
FYI here's the test I used to find the problem...
<?php
function printSdoType($sdo)
{
$reflection = new SDO_Model_ReflectionDataObject($sdo);
$sdo_type = $reflection->getType();
printType($sdo_type);
}
function printType($type)
{
echo $type->getNamespaceURI() .
":" .
$type->getName() .
"\n";
// iterate over the properties of this type
foreach ($type->getProperties() as $property) {
echo $type->getNamespaceURI() .
":" .
$type->getName() .
" " .
$property->getName() .
" isMany= " .
$property->isMany() .
" " .
$property->getType()->getNamespaceURI() .
":" .
$property->getType()->getName() .
" isOpen= " .
$property->getType()->isOpenType() .
" isDataType= " .
$property->getType()->isDataType() .
"\n";
// If this type is a complex type then recurse.
if (!$property->getType()->isDataType()) {
printType($property->getType());
}
}
}
try {
$xmldas = SDO_DAS_XML::create();
$xmldas->addTypes("AnnonTypes.xsd");
echo $xmldas->__toString();
$document = $xmldas->loadFile("AnnonTypes.xml ");
$root = $document->getRootDataObject();
print_r($root);
printSdoType($root);
} catch (Exception $ex) {
print_r($ex);
}
?>
Printing out the SDO type gives:
object(SDO_DAS_XML)#1 {
22 types have been defined. The types and their properties are::
1. commonj.sdo#BigDecimal
2. commonj.sdo#BigInteger
3. commonj.sdo#Boolean
4. commonj.sdo#Byte
5. commonj.sdo#Bytes
6. commonj.sdo#ChangeSummary
7. commonj.sdo#Character
8. commonj.sdo#DataObject
9. commonj.sdo#Date
10. commonj.sdo#Double
11. commonj.sdo#Float
12. commonj.sdo#Integer
13. commonj.sdo#Long
14. commonj.sdo#OpenDataObject
15. commonj.sdo#Short
16. commonj.sdo#String
17. commonj.sdo#URI
18. http://www.example.org/AnnonTypes#ElementA
- Overlapping ( http://www.example.org/AnnonTypes#Overlapping)
19. http://www.example.org/AnnonTypes#ElementB
- Overlapping ( http://www.example.org/AnnonTypes#Overlapping)
20. http://www.example.org/AnnonTypes#Overlapping
- ValueB (commonj.sdo#String)
21. http://www.example.org/AnnonTypes#RootType
- Top (http://www.example.org/AnnonTypes#Top )
22. http://www.example.org/AnnonTypes#Top
- ElementA (http://www.example.org/AnnonTypes#ElementA )
- ElementB (http://www.example.org/AnnonTypes#ElementB)
}Ready to output SDO array - hit any key
SDO_DAS_XML_ParserException Object
(
[message:protected] => SDO_DAS_XML::loadFile - Unable to parse the
supplied
xml file
1 parse error(s) occurred when parsing the file 'AnnonTypes.xml':
1. Parser found unknown element ValueA
And you note that there is only one type with the name "Overlapping"
registered. This has a property "ValueB" as the second one has
replaced the first one.
Regards
Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"phpsoa" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---