Hi Jeff,

The logic in the marshaller for xsi:type is basically summed up by the following statement: if the type can be determined based on the element name simply by looking at the field descriptor of the current class descriptor, then no xsi:type is output. Similarly if the type cannot reasonably be determined, then xsi:type is output for round-triping purposes.

So basically the marshaller analyzes the current state and tries to assess whether or not the unmarshaller will be able to determine which class to instantiate based on element name, or information found within the descriptor. Which is basically why you see the xsi:type appearing on complexTypes which extend other ones.

There are properties on the Marshaller which allow supressing the xsi:type all together if you don't want it output.

We currently don't have a way to specify that the xsi:type should be output for all complexType definitions, regardless of whether or not they are extended.

--Keith



Jeff Konnen wrote:
Hi!

I am new to Castor.
I've generated Java classes from a complex XML Schema.
I'm now doing some tests for marshalling.

Everything works very fine and exactly like I've been expecting.

There's only one thing I cannot understand.
I have not understood when The Marshaller writes the "xsi:type="..." definition into a tag.


An example:

- <#> <WorkspaceDefinition>
  <WorkspaceType>esriLocalDatabaseWorkspace</WorkspaceType>
  <Version />
  <Domains />
- <#> <DatasetDefinitions>
- <#> <DataElement xsi:type="*esri:DEFeatureDataset*">
  <CatalogPath>/FD=totoDS</CatalogPath>
  <Name>totoDS</Name>
- <#> <Children>
- <#> <DataElement xsi:type="*esri:DEFeatureClass*">
  <CatalogPath>/FD=totoDS/FC=toto</CatalogPath>
  <Name>toto</Name>
  <DatasetType>esriDTFeatureClass</DatasetType>
  <DSID>1</DSID>
  <Versioned>false</Versioned>
  <CanVersion>false</CanVersion>
  <HasOID>true</HasOID>
  <OIDFieldName>OBJECTID</OIDFieldName>
- <#> <Fields>
(...)

I do however need the xsi:types defined for every single complextype, and not only for the extended ones:

- <#> <WorkspaceDefinition xsi:type="*esri:WorkspaceDefinition*">
  <WorkspaceType>esriLocalDatabaseWorkspace</WorkspaceType>
  <Version />
  <Domains xsi:type="*esri:ArrayOfDomain*" />
- <#> <DatasetDefinitions xsi:type="*esri:ArrayOfDataElement*">
- <#> <DataElement xsi:type="*esri:DEFeatureDataset*">
  <CatalogPath>/FD=totoDS</CatalogPath>
  <Name>totoDS</Name>
- <#> <Children xsi:type="*esri:ArrayOfDataElement*">
- <#> <DataElement xsi:type="*esri:DEFeatureClass*">
  <CatalogPath>/FD=totoDS/FC=toto</CatalogPath>
  <Name>toto</Name>
  <DatasetType>esriDTFeatureClass</DatasetType>
  <DSID>1</DSID>
  <Versioned>false</Versioned>
  <CanVersion>false</CanVersion>
  <HasOID>true</HasOID>
  <OIDFieldName>OBJECTID</OIDFieldName>
- <#> <Fields xsi:type="*esri:Fields*">
- <#> (...)


Is there a possibility to define this? Do I have to write mapping files? Should I change something in the Descriptors? Or do I have to modify the sourcecode of the Marshaller?

Thanks in advance for your help!

Jeff



Reply via email to