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

2012-06-12 Thread Werner Guttmann

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.Stringuert,
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




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

2012-06-12 Thread Werner Guttmann

Hi,

no worries .. ;-).

On 12.06.2012 13:58, crazykz wrote:


Hi Werner,

Thanks.  I'm just starting to learn all of the ins and outs of XML schemas,
etc. and I didn't know what Castor is doing for me and what I need to do.
I'm reading in a file that is generated by another program so I just needed
to make sure I cover as much of it as possible.  I know that when I write
out the file Castor is not writing out the two attributes you mentioned.  I
guess if I don't need them I'll just leave that piece alone.  Just curious
if there's a way to tell Castor to print those out?

If you are talking about the schemaLocation attribute, have a look at

http://www.castor.org/javadoc/org/exolab/castor/xml/Marshaller.html#setSchemaLocation(java.lang.String)

That should do the trick.

Kind regards
Werner


Thanks for the help.

Curt



Werner Guttmann-6 wrote:


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.Stringuert,
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









-
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




[castor-user] Problem reading namespace (newbie)

2012-06-11 Thread crazykz

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

-- 
View this message in context: 
http://old.nabble.com/Problem-reading-namespace-%28newbie%29-tp33996053p33996053.html
Sent from the Castor - User mailing list archive at Nabble.com.


-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email