Troubleshooting SDO_DAS_XML_ParserException errors

7 views
Skip to first unread message

cdouglas

unread,
Apr 16, 2007, 3:16:16 PM4/16/07
to phpsoa
I have an XSD/XML combo I am trying to load but I am getting
SDO_DAS_XML_ParserException - unknown element errors when I try to
load the string. Doing a dump of the exception shows that a majority
of the XML document loads fine, but this one small section gets this
error. If I use any other program to validate the XSD/XML, it is
successful.

Since it seems to be a problem with the Tuscany parser, is there a way
for me to determine why this is erroring out without imposing on
anyone else?

Thanks
Chris

Simon Laws

unread,
Apr 17, 2007, 10:18:04 AM4/17/07
to php...@googlegroups.com
I'm just looking at how the exceptions get thrown in the C++ code and the message should be transferred from the underlying SDOXMLParserException into the PECL extensions SDO_DAS_XML_ParserException. Clearly there is not enough info in the exception to help you work out what's going on in your case otherwise you wouldn't have posted this. There is debugging logging you can turn on for the C++ SDO implementation (you need to set and environment variable TUSCANY_SDOCPP_LOGGING) but I'm just going to try this and see if it helps at all. I'll let you know.

If you are getting unknown element errors then it would seem to be the case that SDO has found an element that it doesn't believe is adequately defined by the schema. Is this a particualy complex type definition in the schema? If we can track this down maybe I can have a crack at improving the reporting to make this a bit easier in the future.

Regards

Simon

cdouglas

unread,
Apr 23, 2007, 11:11:39 AM4/23/07
to phpsoa
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.


simon...@googlemail.com

unread,
Apr 27, 2007, 1:52:03 PM4/27/07
to phpsoa

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

Reply all
Reply to author
Forward
0 new messages