Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] Problem reading namespace (newbie)

crazykz

2012-06-11

Replies: Find Java Web Hosting

Author LoginPost Reply

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">
     <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

--
Sent from the Castor - User mailing list archive at Nabble.com.


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

  http://xircles.codehaus.org/manage_email


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