Hi,
as already mentioned, please make sure that all your classes are mapped
to a valid namespace. It's actually the namespace (and its URI) that is
more important in a Castor mapping than the prefices.
So
<class name="entity.output.CalculatorBw">
<map-to xml="field1" ns-prefix=""/>
should read
<class name="entity.output.CalculatorBw">
<map-to xml="field1"
ns-uri="http://www.example.org/example" />
...
</class>
and only then Castor will know that
field1{http://www.example.org/example}
is mapped against the Java class CalculatorBw.
Kind Regards
Werner
On 16.05.2012 10:06, AJO wrote:
This doesn't solve my issue.
I don't have a problem with the clc-prefixed elements, they are unmarshalled
correctly, only with the default namespace elements (ID, year, quarter,
amount).
Werner Guttmann-6 wrote:
Hi,
switching this conversation to the user list, as that's where it should
take place.
For answers to your questions, please see inline.
Kind Regards
Werner
On 15.05.2012 18:20, AJO wrote:
Hi,
I can't get unmarshalling to work with a combination of default namespace
and specific namespace.
The passed xml is the following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<clc:CalculationOutput
xmlns:clc="http://aaa.bbb.cc/ns/Calc/CalculInOut/CalcElement"
xmlns="http://www.example.org/example"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<clc:RuntimeConfiguration id="ID:a6db6635" name="runtime1"
version="0.3"/>
<clc:Calculation>
<field1 ref="S442">
<Features>
<ID>28</ID>
<year>2011</year>
<quarter>1</quarter>
<amount>216187.23</amount>
</Features>
</field1>
</clc:Calculation>
</clc:CalculationOutput>
I can only get the above xml to get unmarshalled by adding xmlns="" to
the
ID, year, quarter and amount fields, so it seems the default schema is
never
taken into account.
How can I get the above mapped in castor, taking into account the default
schema?
This is the mapping file working when I add xmlns="" to the detail
fields:
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.org/mapping.dtd">
<!--mapping xmlns:clc="http://aaa.bbb.cc/ns/Calc/CalculInOut/CalcElement"
xmlns="http://www.example.org/field1"
xsi:schemaLocation="C:/resources/schema/schemalocation.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"-->
<mapping>
<class name="entity.CalculationOutput">
<map-to xml="CalculationOutput" ns-prefix="clc"/>
You still need to define the namespace URI to which you want this (and
all other classes, of course) class to be bound:
<class name="entity.CalculationOutput">
<map-to xml="CalculationOutput"
ns-uri="http://aaa.bbb.cc/ns/Calc/CalculInOut/CalcElement"
ns-prefix="clc"/>
Can you please add those bindings accordingly, and everything should be
set.
<field name="versie" type="entity.output.CalculatorVersie">
<bind-xml name="RuntimeConfiguration"/>
</field>
<field name="field1" type="entity.output.CalculatorBw">
<bind-xml name="field1" location="Calculation"/>
</field>
</class>
<class name="entity.output.CalculatorBw">
<map-to xml="field1" ns-prefix=""/>
<field name="id" type="string">
<bind-xml name="ref" node="attribute"/>
</field>
<field name="number" type="string">
<bind-xml name="ID" node="element" location="Features"/>
</field>
<field name="year" type="string">
<bind-xml name="year" node="element" location="Features"/>
</field>
<field name="quarter" type="string">
<bind-xml name="quarter" node="element" location="Features"/>
</field>
<field name="amount" type="string">
<bind-xml name="amount" node="element" location="Features"/>
</field>
</class>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email