Okay. Can you please create a new Jira issue as explained below ?
Werner
Premal Shah wrote:
> Hello again,
> It seems that if I add
> setSuppressNamespaces(true)
> and then comment out the line
> MessageMarshaller.setNamespaceMapping("",http://test.com); The output
> looks like what I want.
> Somehow it is thinking that my "rec" tag is in a differetnt namespace. I
> hope I don't experience issues to unmarshall it.
>
> To answer your question , I changed the container attribute to true, and the
> mapping no longer loads, however when I remove the line completly, then it
> does marshall, but the output is not what I want.
>
> Thanks,
> P. Shah
>
>
>
> On 6/4/08, Werner Guttmann <[EMAIL PROTECTED]> wrote:
>> For the sake of completeness, can you please set the container attribute
>> to true, and check whether anything changes. If that's the case, I will
>> have to ask you to create a new Jira issue at
>>
>> http://jira.codehaus.org/browse/CASTOR
>>
>> and attach all relevant files.
>>
>> Werner
>>
>> Premal Shah wrote:
>>> Hello,
>>> Yes, the test.record class has the namespace specified. This is a wierd
>>> error, my xml looks great except for that one peculiar error. I wonder
>> what
>>> is causing the marshaller to think that the list of records is in a
>>> different namespace.
>>>
>>> Thanks for your help so far, i'll see what I can figure out, if something
>>> occurs to you please let me know.
>>>
>>>
>>> On 6/3/08, Werner Guttmann <[EMAIL PROTECTED]> wrote:
>>>> Hi again
>>>>
>>>> Premal Shah wrote:
>>>>> Thanks Warner,
>>>>> Placing all the classes in the same namespace worked in removing the
>>>>> xmlns="" tags.
>>>> Great.
>>>>
>>>>> I do seem to have something peculiar happening when I'm
>>>>> trying to marshall an arraylist. I have the following mapping:
>>>>>
>>>>> <class name="test.Message" auto-complete="false">
>>>>> <map-to xml="ICHData" ns-uri=http://test.namespace/>
>>>>>
>>>>> <field name="recordList" collection="arraylist"
>>>>> type="test.Record" container="false">
>>>>> <bind-xml name="Recs" />
>>>>> </field>
>>>>> </class>
>>>>> All the other fields map correctly, but this field still adds the
>>>> xmlns=""
>>>>> . Here is a snippet of the output..
>>>>> ICHData xmlns="http://test.namespace">
>>>>> <Recs xmlns="">
>>>>> ...everything else is properly marshalled.
>>>>> Do I have to somehow put the arraylist in my namespace?
>>>> Hmm, ahrd to say. Is the text.Record class assigned to a namespace (as
>>>> you are setting container to 'flase' ?
>>>>
>>>>> Thanks again,
>>>>> P. shah
>>>>>
>>>>>
>>>>> On 6/3/08, Premal Shah <[EMAIL PROTECTED]> wrote:
>>>>>> Hello,
>>>>>> That's a good point. I did that because I didn't want the namespace
>> to
>>>>>> print there on the other lines. Essentially, my client handed me the
>>>> format
>>>>>> that they required and I tried to use castor to emulate it.
>>>>>>
>>>>>>
>>>>>> On 6/3/08, Werner Guttmann <[EMAIL PROTECTED]> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> just looking at both the XML output and the mapping file (fragments),
>> I
>>>>>>> have got a question: how come it's only the test.Message class that
>> is
>>>>>>> being mapped to the 'http://test.com' namespace ? Is this on
>> intention
>>>> ?
>>>>>>> Shouldn't the other classes (at least test.Type) to assigned to the
>>>> same
>>>>>>> namespace (or any other, if you wish) ?
>>>>>>>
>>>>>>> Mapping one class to a namespace (by the means of a mapping file) and
>>>>>>> another class not does not really make sense.
>>>>>>>
>>>>>>> Regards
>>>>>>> Werner
>>>>>>>
>>>>>>> Premal Shah wrote:
>>>>>>>> Hello,
>>>>>>>> Thanks for your help. Here is the attached code fragments:
>>>>>>>>
>>>>>>>> <class name="test.Message" auto-complete="false">
>>>>>>>> <map-to xml="XMLMessage" ns-uri="http://test.com" />
>>>>>>>> <field name="header" type="test.Header">
>>>>>>>> <bind-xml name="Header" node="element" />
>>>>>>>> </field>
>>>>>>>> <field name="metadata" type="test.Metadata">
>>>>>>>> <bind-xml name="Metadata" node="element" />
>>>>>>>> </field>
>>>>>>>> <field name="payload" type="test.Payload">
>>>>>>>> <bind-xml name="Payload" node="element" />
>>>>>>>> </field>
>>>>>>>> </class>
>>>>>>>>
>>>>>>>> <class name="test.Type" auto-complete="false">
>>>>>>>> <map-to xml="Type" />
>>>>>>>> <field name="key" type="java.lang.String">
>>>>>>>> <bind-xml name="Key" node="element" />
>>>>>>>> </field>
>>>>>>>> <field name="value" type="java.lang.String">
>>>>>>>> <bind-xml name="Value" node="element" />
>>>>>>>> </field>
>>>>>>>> </class>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ...other classes are defined here
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> snipped of code:
>>>>>>>> Marshaller MessageMarshaller = new Marshaller(handler);
>>>>>>>>
>>>>>>>> //MessageMarshaller.setSuppressNamespaces(true);
>>>>>>>> //MessageMarshaller.setNamespaceMapping("",http://test.com);
>>>>>>>> MessageMarshaller.setMapping(mapping);
>>>>>>>> MessageMarshaller.marshal(message);
>>>>>>>> Unmarshaller MessageUnmarshaller =new
>>>>>>>> Unmarshaller(mapping);
>>>>>>>>
>>>>>>>> System.out.println(writer.toString());
>>>>>>>> StringReader reader=new
>>>>>>>> StringReader(writer.toString());
>>>>>>>> Message x
>>>>>>>> =(Message)MessageUnmarshaller.unmarshal(reader);
>>>>>>>>
>>>>>>>> System.out.println("Header:\n"+x.getHeader().print());
>>>>>>>>
>>>>>>>> System.out.println("Metadata:\n"+x.getMetadata().print());
>>>>>>>>
>>>>>>>> System.out.println("Payload:\n"+x.getPayload().print());
>>>>>>>>
>>>>>>>> snippet of xml produced:
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <XMLMessage xmlns="http://test.com">
>>>>>>>> <Header xmlns="">
>>>>>>>> <MessageID>test</MessageID>
>>>>>>>> <MessageType>test</MessageType>
>>>>>>>> <MessageCategory>test</MessageCategory>
>>>>>>>> <AckStatus></AckStatus>
>>>>>>>> <Checksum>fff</Checksum>
>>>>>>>> <EncodeType>hhhh</EncodeType>
>>>>>>>> <Sender>mm</Sender>
>>>>>>>> <Recipient>kk</Recipient>
>>>>>>>> <EncryptionType></EncryptionType>
>>>>>>>> </Header>
>>>>>>>> <Metadata xmlns="">
>>>>>>>> <Type>
>>>>>>>> <Key>DCC</Key>
>>>>>>>> <Value>MSD</Value>
>>>>>>>> </Type>
>>>>>>>> My client cannot handle the xmlns="", however when I uncomment the
>>>>>>> following
>>>>>>>> lines:
>>>>>>>>
>>>>>>>> //MessageMarshaller.setSuppressNamespaces(true);
>>>>>>>> //MessageMarshaller.setNamespaceMapping("",http://test.com);
>>>>>>>>
>>>>>>>> My xml looks like how my client requires it as follows but then my
>>>>>>>> unmarshalled message is full of null objects. I appreciate your
>>>> insight
>>>>>>>> into this.
>>>>>>>>
>>>>>>>> <XMLMessage xmlns="http://test.com">
>>>>>>>> <Header>
>>>>>>>> .......
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 6/1/08, Werner Guttmann <[EMAIL PROTECTED]> wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> can you please give us some more code fragments to show what you
>> are
>>>>>>>>> doing ? I.e. a mapping file (fragment), XML being produced, etc.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Werner
>>>>>>>>>
>>>>>>>>> Premal Shah wrote:
>>>>>>>>>> Hello,
>>>>>>>>>> I have generated a mapping file in which one class has a ns-uri
>>>>>>> element
>>>>>>>>> in
>>>>>>>>>> the <map-to xml> tag. The problem that I have is that after I
>>>>>>> marshall
>>>>>>>>>> this, the tags that are generated all have <xmlns=""> except for
>> the
>>>>>>> one
>>>>>>>>>> that i have specified the ns-uri for. However, I am able to
>>>> correctly
>>>>>>>>>> unmarshal the the xml back to the objects. My clients parser
>> cannot
>>>>>>>>> handle
>>>>>>>>>> the <xmlns=""> so I tried to use the
>>>>>>> setsuppressedNamespaces(true). This
>>>>>>>>>> creates an xml format that is satisfactory, but the objects are
>> null
>>>>>>> when
>>>>>>>>> I
>>>>>>>>>> unmarshal them.
>>>>>>>>>>
>>>>>>>>>> Any insites into this problem?
>>>>>>>>>>
>>>>>>>>>> Thanks in advance,
>>>>>>>>>> P. Shah
>>>>>>>>>>
>> ---------------------------------------------------------------------
>>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email