I have a problem report from an SDO for PHP user which I'd like to
discuss. You can read it at http://pecl.php.net/bugs/bug.php?id=9339,
but here's what happens. The schema is:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" <http://www.w3.org/2001/XMLSchema%22>
targetNamespace="http://AnnotationTest" <http://AnnotationTest%22>>
<xs:element name="testTriggerEvent">
<xs:complexType>
<xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
We create a DataFactory and do a define using the above schema. Then use
the DataFactory to create an XMLDocument of type testTriggerEvent. So
the XMLDocument looks like:
<?xml version="1.0" encoding="UTF-8"?>
<testTriggerEvent xmlns="http://AnnotationTest"
xmlns:tns="http://AnnotationTest"/>
At this time we can do a XMLDocument::getRootDataObject() which returns
a rather uninteresting SDO without any properties.
Now we serialize the model (by doing getTypes() on the DataFactory and
passing the result into XSDHelper::generate()), and the document. The
serialized model comes out as:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sdo="commonj.sdo"
xmlns:sdoxml="commonj.sdo/xml">
<xsd:element name="rootType" type="RootType"/>
<xsd:complexType name="RootType">
<xsd:sequence>
<xsd:element name="testTriggerEvent" type="testTriggerEvent"
minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="testTriggerEvent " type="testTriggerEvent"/>
<xsd:complexType name="testTriggerEvent"/>
</xsd:schema>
Then we propagate the serialized model and the document and attempt to
unserialize it, by creating a DataFactory and using XSDHelper::define(),
followed by XMLHelper::load() to reconstruct the XMLDocument. These
apparently work OK, but then XMLDocument::getRootDataObject() returns null.
This may seem like a pathological case, but there are sound reasons for
doing it. I'm just not sure where the problem lies - is it the
reconstruction of the XMLDocument, or is the serialized model wrong? Is
there an alternative way to code the "empty" element which would get the
desired outcome?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]