Hi Keith,
thank you for your answer, it's working fine.
My mapping file looks now like following:
<mapping xmlns:rep="http://com.siemens.cds9/report">
<!--include href="Aspect.xml"/-->
<include href="AspectName.xml"/>
<include href="SubAspect.xml"/>
<include href="SubAspectName.xml"/>
<include href="SubAspectType.xml"/>
<include href="Language.xml"/>
<class name="com.siemens.cds9.model.Report" auto-complete="true">
<map-to xml="report" ns-uri="http://com.siemens.cds9/report" ns-prefix="rep"/>
<field name="objList" type="java.lang.Object" collection="arraylist">
<bind-xml name="rep:queryResultSet" node="element" />
</field>
</class>
</mapping>
My objList actually contains objects of type Aspect. If i remove the comment out of
the include of Aspect.xml i get an StackOverflowError without stacktrace. If i don't
include the xml file the xml-binds for Aspect member variables don't function (as
expected).
So why do i get an StackOverflowError if i include the xml file ?
Is there any description or tutorial for the order of each include in a mapping file ?
thanx in advance,
Mark
-----Urspr�ngliche Nachricht-----
Von: Keith Visco [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 26. August 2003 20:04
An: [EMAIL PROTECTED]
Betreff: Re: [castor-dev] Marshalling Multiple Objects into one document
See inline below:
Mark Baier wrote:
>
> Hi all,
>
> i have read the question and answer according to the subject.
> I want to do it the "obvious" way, creating a container element where i add
> my data objects to spool it out for doing some reporting.
> Following snippet is my mapping file for the container element.
>
> <mapping>
> <!--include href="Aspect.xml"/-->
> <include href="AspectName.xml"/>
> <include href="SubAspect.xml"/>
> <include href="SubAspectName.xml"/>
> <include href="SubAspectType.xml"/>
> <include href="Language.xml"/>
>
> <class name="com.siemens.cds9.model.Report" auto-complete="true">
> <map-to xml="report" ns-uri="http://com.siemens.cds9/report"
> ns-prefix="rep"/>
> <field name="objList" type="com.siemens.cds9.model.Aspect"
> collection="arraylist">
> <bind-xml name="aspect" node="element" />
> </field>
> </class>
> </mapping>
>
> As you can see, i declare a namespace for the container element.
> The produced xml output stream looks like following:
>
> <rep:report xmlns:rep="http://com.siemens.cds9/report">
> <aspect>
> <rep:sub-aspect position="1" id="1000">
> <rep:subAspectType type="1" id="1"/>
> <rep:subAspectName
> name="Subaspekt 11 " id="1000">
> <rep:language shortName="de" id="1000"/>
> </rep:subAspectName>
> </rep:sub-aspect>
> <rep:sub-aspect position="2" id="1001">
> <rep:subAspectType type="1" id="1"/>
> <rep:subAspectName
> name="Subaspekt 12 " id="1001">
> <rep:language shortName="de" id="1000"/>
> </rep:subAspectName>
> </rep:sub-aspect>
> <rep:sub-aspect position="3" id="1002">
> <rep:subAspectType type="1" id="1"/>
> <rep:subAspectName
> name="Subaspekt 13 " id="1002">
> <rep:language shortName="de" id="1000"/>
> </rep:subAspectName>
> </rep:sub-aspect>
> <position>1</position>
> <aspect-id>1000</aspect-id>
> <rep:aspect-name name="Aspekt 1 " id="1000">
> <rep:language shortName="de" id="1000"/>
> </rep:aspect-name>
> </aspect>
> </rep:report>
>
> In each mapping file included in the container mapping file the same namespace is
> declared.
> As you can see aspect.xml was comment out due to an occurring StackOverflowError.
> My xml element aspect was spooled out without a namespaceprefix. Where is the prefix
> gone to ?
Try the following:
<mapping xmlns:rep="http://com.siemens.cds9/report">
<!--include href="Aspect.xml"/-->
<include href="AspectName.xml"/>
<include href="SubAspect.xml"/>
<include href="SubAspectName.xml"/>
<include href="SubAspectType.xml"/>
<include href="Language.xml"/>
<class name="com.siemens.cds9.model.Report" auto-complete="true">
<map-to xml="report" ns-uri="http://com.siemens.cds9/report"
ns-prefix="rep"/>
<field name="objList" type="com.siemens.cds9.model.Aspect"
collection="arraylist">
<bind-xml name="rep:aspect" node="element" />
</field>
</class>
</mapping>
Notice the changes on the <mapping> and <bind-xml> elements.
> Also do i need to include every mapping file i want to use in my object ???
More than likely, unless you want Castor to try and automatically
introspect your objects.
> In future use i want to make my objList in my container type independent, so that i
> can
> add each entity object i need in creating a report.
Just change type to "java.lang.Object" and it should work.
--Keith
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev