On 12/3/06, Simon Laws <[EMAIL PROTECTED]> wrote:
On 12/1/06, Pete Robbins <[EMAIL PROTECTED]> wrote: > > Fix now checked in for TUSCANY-963. > > On 01/12/06, Pete Robbins <[EMAIL PROTECTED]> wrote: > > > > > > > > On 01/12/06, Caroline Maynard < [EMAIL PROTECTED]> wrote: > > > > > > I created http://issues.apache.org/jira/browse/TUSCANY-963 for the > > > "attributes as elements" problem. > > > > > > I'm working on this. I see the problem and should be able to get a fix > > soon. > > > > Cheers, > > > > -- > > Pete > > > > > > -- > Pete > > Hi Pete I've been working on a fix for 950 which I managed to complete so that you could successfully copy a DO tree containing both mixed and open types. I then applied your fix for 963 and the resulting SDO fails. It happily does the copy still but won't print out elements in sequences or open typed elements from the new DO that results from the copy. Looking at the svn commit for 963 the main change seems to be to the SDOXMLWriter. // Do not write attributes as members of the sequence XSDPropertyInfo* pi = getPropertyInfo(seqPropType, seqProp); PropertyDefinitionImpl propdef; if (!pi || (pi->getPropertyDefinition().isElement)) { continue; } I'm not au fait with how property info works but taking a tour round the code it seems to be where the DAS keeps extra info derived from the schema that is only used when writing back out to XML. The change finds, from the property info, those elements that are really attributes and hence only writes them as attributes. 1/ The first thing that looks a little fishy is "if (!pi || (pi->getPropertyDefinition().isElement))" which looks like it breaks out of the loop if the property represents an element rather than when it's not an element. Is this right? Regardless of the correctness of this my copy doesn't work because "!pi" is always true after I have copied the sequence. Can you explain to me how property information is intended to work. I need to know if I should copy anything more than just the instance information. I had thought everything else was in the model and hence I don't need to copy it. With the schema: <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/test " targetNamespace="http://www.example.org/test"> <complexType name="CloneType" mixed="true"> <sequence> <element name="test" type="string"/> <any namespace="##any"/> </sequence> </complexType> <element name="Clone" type="tns:CloneType"/> </schema> And the XML document: <Clone xmlns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance " xsi:schemaLocation="http://www.example.org/test clone.xsd "> abc <test>test</test> def <tests>test</tests> ghi </Clone> CloneType does have property info associated with it. But neither commonj.sdo.String (the type of test) or commonj.sdo.OpenDataObject (the type of tests) have property info associated with them once the schema has been read. Hence it is not present in the model after the copy and the new writer doesn't write out "test" or "tests". Regards Simon
My changes (so far) are attached to http://issues.apache.org/jira/browse/TUSCANY-950 so you can see them but also as a backup. Simon
