Hi,
On 29.05.2012 20:02, drowelbuod wrote:
Hello.
I want to marshal an object to an XML with Castor.
To do so, I used the castor XML conversor to generate the Java classes from
the XSD files.
When I marshal an object using the generated classes I get an XML.
But there is problem in the XML generated when the xsi:type is required to
reference a subclass, because I don't get the reference to the namespace
defined in the XSD of the subclass.
I am not sure, but I wouldn't think that this is how Castor populates
the xsi:type attribute. As I'd like to replay this problem, can you
please create a new Jira issue at http://jira.codehaus.org/browse/CASTOR
and attach a minimal set of files (XML schemas, Junit test case, ....).
Thanks in advance ....
So I get:
...
<bodyContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="getUser">
...
But I would like to obtain something like:
...
<bodyContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="bn:getUser">
...
Or something like:
...
<bodyContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="B:getUser">
...
Is this just a nice to have, or are you running into *'naming'
collisions in this context ?
Kind regards
Werner
With this definition of XSD files used:
File A.xsd
...
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:an="http://www.mydefinition.com/A"
targetNamespace="http://www.mydefinition.com/A"
elementFormDefault="qualified">
...
<xsd:complexType name="bodyContentType"/>
...
File B.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:an="http://www.mydefinition.com/A"
xmlns:bn="http://www.mydefinition.com/B"
targetNamespace="http://www.mydefinition.com/B"
elementFormDefault="qualified">
<xsd:import namespace="http://www.mydefinition.com/A"
schemaLocation="./A.xsd"/>
...
<xsd:complexType name="getUser">
<xsd:complexContent>
<xsd:extension base="an:bodyContentType">
<xsd:sequence>
<xsd:element name="webExId" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
...
The XML conversor of Castor doesn't add the namespace information to
generate it.
How can force to add this information in the generation?
May be I need change something in the XSD files?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email