Looks from the code that you have to specify the targetNamespace on the
XSDHelper::generate() call

On 17/11/06, Pete Robbins <[EMAIL PROTECTED]> wrote:

The generated schema is missing the targetNamespace so the types don't
have one! The document has the element testTriggerEvent belonging to
http://AnnotationTest <http://annotationtest/> so that doesn't match
anything in the model when you reloaded the generated schema..

Now to find out why the tns wasn't generated...

Cheers,


 On 17/11/06, Caroline Maynard <[EMAIL PROTECTED]> wrote:
>
> 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/> " <
> http://AnnotationTest%22 <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 <http://annotationtest/>"
> xmlns:tns=" http://AnnotationTest <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]
>
>


--
Pete




--
Pete

Reply via email to