Hi Priya,

How come you are *not* using the ns-uri attribute on the <map-to> elements to identify the namespace URI you want to assign to a given Java class ?


<mapping>
    <class name="org.abc.xyv.model.ClinicalDocument">
        <map-to xml="ClinicalDocument" ns-uri="urn:hl7-org:v3" />
        <field name="typeId"
               type="org.telligen.patientsafety.model.TypeId">
            <bind-xml name="typeId"/>
        </field>
     </class>
</mapping>

Having done this, using Marshaller.setNamespace() should globally assign prefixes to namespace URIs.

Kind Regards
Werner

On 13.04.2012 15:20, Priya B wrote:
I think that was a typo. In the code I do the following.
m = new Marshaller(),
 > > m.setNameSpace..("voc", "urn:hl7-org:v3/voc");
 > > setNameSpace..("","urn:hl7-org:v3");

Mapping file is as below but the declaration for "xmlns" shows as an
empty tag.
Sorry for the confusion.
Priya


 > Date: Fri, 13 Apr 2012 13:12:35 +0200
 > From: [email protected]
 > To: [email protected]
 > Subject: Re: [castor-user] issues with setting the default name space
 >
 > Hi,
 >
 > Why are you trying to map one namespace uri (hl7-org:v3/voc) more than
 > once, i.e. to an explicit namespace prefix *and* the default namespace ?
 >
 > Kind regards
 > Werner
 >
 > On 08.04.2012 22:02, Priya B wrote:
 > > Below are the first few lines of the xml I get and the mapping. I
do not
 > > understand why I am getting the empty tag for xmlns, however the other
 > > namespaces come fine.
 > >
 > > *_XML File :_*
 > >
 > > <ClinicalDocument xmlns:voc="urn:hl7-org:v3/voc"
 > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 > > xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd"*xmlns=""*>
 > > <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040" />
 > > ---------------------------------
 > > -------------------------
 > > </ClinicalDocument>
 > >
 > > *_Mapping File:_*
 > > *
 > > *
 > > <mapping>
 > > <class name="org.abc.xyv.model.ClinicalDocument">
 > > <map-to xml="ClinicalDocument"
 > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 > > xsi:schemaLocation="urn:hl7-org:v3 infrastructure/cda/CDA.xsd"
 > > xmlns="urn:hl7-org:v3"
 > > xmlns:voc="urn:hl7-org:v3/voc"/>
 > > <field name="typeId" type="org.telligen.patientsafety.model.TypeId">
 > > <bind-xml name="typeId"/>
 > > </field>
 > > -----
 > > -----------------
 > > </mapping>
 > >
 > > In my code to marshal I do Marshaller m = new Marshaller(),
 > > m.setNameSpace..("voc", "urn:hl7-org:v3/voc");
 > > setNameSpace..("","urn:hl7-org:v3/voc");
 > > I am expecting the output xml to have the namespace
 > > xmlns="urn:hl7-org:v3/voc" but I get xmlns="" but get rest of the
 > > declaration. Not sure what am I doing wrong?
 > > Thanks,
 > > Priya
 >
 > ---------------------------------------------------------------------
 > 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


Reply via email to