[castor-dev] Unmarshalling with different namespaces

AJO <[email protected]> Tue, 15 May 2012 09:20:47 -0700 (PDT)
Newsgroups gmane.comp.java.castor.devel
Message-ID <[email protected]>
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"/>

    <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>
-- 
View this message in context: http://old.nabble.com/Unmarshalling-with-different-namespaces-tp33848928p33848928.html
Sent from the Castor - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email