Java Mailing List Archive

Home » user.castor »

Re: [castor-user] Problem reading namespace (newbie)

Werner Guttmann


Replies: Find Java Web Hosting

Author LoginPost Reply
Hi Curt,

please do not try to map 'attributes' such as 'xmlns:xsi' or
'xsi:schemaLocation', as those are handled by Castor internally (and
completely automatically). As those are mainly namespace definitions,
please leave this to Castor XML to handle.

Once you remove those from your mapping, you should be fine.

Kind regards

PS If you don't use a prefix for a namespace (please see your default
namespace definition), there's no need to specify a prefix. So

<map-to xml="gpx"

could and should be shortened to

<map-to xml="gpx"
     ns-uri="" />

On 11.06.2012 22:16, crazykz wrote:
> Hi,
> I'm trying to read in a GPX file and the header looks like this:
> <gpx
>   version="1.0"
>   creator="GPSBabel -"
>   xmlns:xsi=""
>   xmlns=""
>   xsi:schemaLocation="
> I've created the mapping and up until now have excluded everything in the
> GPX header to get the mapping correct. Now I'm trying to add in the 5
> attributes of the GPX header that are here and I'm getting an error. I'm
> sure it's because I don't know how to configure the mapping with the proper
> namespace prefix or something like that.
> Here's the relevant mapping part:
> <class name="parser.GPX">
>    <map-to xml="gpx" ns-uri=""
>             ns-prefix=""/>
>    <field name="version" type="java.lang.String">
>      <bind-xml name="version" node="attribute" />
>    </field>
>    <field name="creator" type="java.lang.String">
>      <bind-xml name="creator" node="attribute" />
>    </field>
>    <field name="xmlnsXsi" type="java.lang.String">
>      <bind-xml name="xmlns:xsi" node="attribute" />
>    </field>
>    <field name="xmnls" type="java.lang.String">uert,
>      <bind-xml name="xmnls" node="attribute" />
>    </field>
>    <field name="xsiSchemaLocation" type="java.lang.String">
>      <bind-xml name="xsi:schemaLocation" node="attribute" />
>    </field>
>  </class>
> Here's the error output I'm getting:
> org.exolab.castor.xml.MarshalException: The namespace associated with the
> prefix: 'xmlns' is null.{File: file: GPXMapping.xml; line: 17; column: 50}
> Would anyone be able to help me with how to properly map this if that is the
> issue?
> Thanks,
> Curt

To unsubscribe from this list, please visit:

©2008 - Jax Systems, LLC, U.S.A.