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
Werner
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"
ns-uri="http://www.topografix.com/GPX/1/0"
ns-prefix=""/>
could and should be shortened to
<map-to xml="gpx"
ns-uri="http://www.topografix.com/GPX/1/0" />
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 - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0
http://www.topografix.com/GPX/1/0/gpx.xsd">
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="http://www.topografix.com/GPX/1/0"
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:
http://xircles.codehaus.org/manage_email