prohibit inherritance of namespaces on child elements

View: New views
3 Messages — Rating Filter:   Alert me  

prohibit inherritance of namespaces on child elements

by kennywest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear list,

The following mapping:
    <class name="SomeClass">
        <map-to xml="A" ns-prefix="bean" ns-uri="http://beans.be/" />

        <field name="B" type="java.lang.String" collection="set">
            <bind-xml name="C" location="C" />
        </field>

        <field name="D" type="SomeClass2" get-method="getClass2">
        </field>
    </class>
Generates the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<bean:SomeClass xmlns:bean="http://beans.be/">
    <bean:B>
        <bean:C>83021805793</bean:C>
    </bean:B>
    <bean:D>
        <E>83021805793</E>
        <E>RC</E>
    </bean:D>
</bean:SomeClass>

The children of SomeClass should not inherit the namespace from SomeClass. So the XML should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<bean:SomeClass xmlns:bean="http://beans.be/">
    <B>
        <C>83021805793</C>
    </B>
    <D>
        <E>83021805793</E>
        <E>RC</E>
    </D>
</bean:SomeClass>

I know it is possible to have a different namespaces on the child elements (using QName), but for some reason I cannot configure an empty namespace on the child elements.
Is this possible or is this a known limitation of Castor?

Many thanks in advance.



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

    http://xircles.codehaus.org/manage_email



Re: prohibit inherritance of namespaces on child elements

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kenneth,

if you were to use the XML code generator to geenrate your Java classes
from an XML schema (or a set thereof), this would be given to you
automatically. But in the context of a manually mapped set of java
classes, I am not sure this can be achieved at all.

Regards
Werner

kenneth.westelinck@... wrote:

> Dear list,
>
> The following mapping:
>     <class name="SomeClass">
>         <map-to xml="A" ns-prefix="bean" ns-uri="http://beans.be/" />
>
>         <field name="B" type="java.lang.String" collection="set">
>             <bind-xml name="C" location="C" />
>         </field>
>
>         <field name="D" type="SomeClass2" get-method="getClass2">
>         </field>
>     </class>
> Generates the following XML:
> <?xml version="1.0" encoding="UTF-8"?>
> <bean:SomeClass xmlns:bean="http://beans.be/">
>     <bean:B>
>         <bean:C>83021805793</bean:C>
>     </bean:B>
>     <bean:D>
>         <E>83021805793</E>
>         <E>RC</E>
>     </bean:D>
> </bean:SomeClass>
>
> The children of SomeClass should not inherit the namespace from SomeClass. So the XML should look like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <bean:SomeClass xmlns:bean="http://beans.be/">
>     <B>
>         <C>83021805793</C>
>     </B>
>     <D>
>         <E>83021805793</E>
>         <E>RC</E>
>     </D>
> </bean:SomeClass>
>
> I know it is possible to have a different namespaces on the child elements (using QName), but for some reason I cannot configure an empty namespace on the child elements.
> Is this possible or is this a known limitation of Castor?
>
> Many thanks in advance.
>
>
>
> ---------------------------------------------------------------------
> 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



Re: prohibit inherritance of namespaces on child elements

by kennywest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No, this would be a manually mapped set of classes.

Werner Guttmann wrote:

> Kenneth,
>
> if you were to use the XML code generator to geenrate your Java classes
> from an XML schema (or a set thereof), this would be given to you
> automatically. But in the context of a manually mapped set of java
> classes, I am not sure this can be achieved at all.
>
> Regards
> Werner
>
> kenneth.westelinck@... wrote:
>> Dear list,
>>
>> The following mapping:
>>     <class name="SomeClass">
>>         <map-to xml="A" ns-prefix="bean" ns-uri="http://beans.be/" />
>>
>>         <field name="B" type="java.lang.String" collection="set">
>>             <bind-xml name="C" location="C" />
>>         </field>
>>
>>         <field name="D" type="SomeClass2" get-method="getClass2">
>>         </field>
>>     </class>
>> Generates the following XML:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <bean:SomeClass xmlns:bean="http://beans.be/">
>>     <bean:B>
>>         <bean:C>83021805793</bean:C>
>>     </bean:B>
>>     <bean:D>
>>         <E>83021805793</E>
>>         <E>RC</E>
>>     </bean:D>
>> </bean:SomeClass>
>>
>> The children of SomeClass should not inherit the namespace from SomeClass. So the XML should look like this:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <bean:SomeClass xmlns:bean="http://beans.be/">
>>     <B>
>>         <C>83021805793</C>
>>     </B>
>>     <D>
>>         <E>83021805793</E>
>>         <E>RC</E>
>>     </D>
>> </bean:SomeClass>
>>
>> I know it is possible to have a different namespaces on the child elements (using QName), but for some reason I cannot configure an empty namespace on the child elements.
>> Is this possible or is this a known limitation of Castor?
>>
>> Many thanks in advance.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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