Skip to main content

Hello.

 

I am trying to run a bunch of online and zipped INSPIRE GML's through a Feature Reader with the dataset parameter set to a URL defined in an attribute.

 

All is good and stuff is happening for most of the data except the URL's that have a space in them, for example: 'http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS IBAÑEZ/A.ES.SDGC.CP.02024.zip'

 

And those get sent to the reject port with the error message:

XML Parser error: ''Error in input dataset: 'URL' line: 1 column: 50 message: whitespace expected''

 

I did check out this one here:

How do I remove a non breaking space from an attribute? (safe.com)

But no luck , so any ideas?

Generally speaking, spaces are not allowed in URLs. If the URL works in e.g. a browser, it's because the browser automatically does some work behind the scenes to make it work for you.

Try replacing the spaces with "%20", which represents a URL-encoded space. While you're at it, you may also have to encode the Ñ:

http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS%20IBA%C3%91EZ/A.ES.SDGC.CP.02024.zip

 

You can also use the TextEncoder set to URL encoding, just make sure you don't encode the meaningful characters, such as the forward slash.


Generally speaking, spaces are not allowed in URLs. If the URL works in e.g. a browser, it's because the browser automatically does some work behind the scenes to make it work for you.

Try replacing the spaces with "%20", which represents a URL-encoded space. While you're at it, you may also have to encode the Ñ:

http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS%20IBA%C3%91EZ/A.ES.SDGC.CP.02024.zip

 

You can also use the TextEncoder set to URL encoding, just make sure you don't encode the meaningful characters, such as the forward slash.

hey and thanks for this, turned out that the space wasn't a problem after all, it was the "weirdo N letter".  And using TextEncoder and setting the attribute to URL failed cause, like you pointed out, replaced all slashes etc..


To be "safe" I usually end up doing something like this to urlencode the filename and the previous folder. Using the FilenamePartExtractor + TextEncoder + StringReplacer prepares the url quite good for the FeatureReader.

 

image


To be "safe" I usually end up doing something like this to urlencode the filename and the previous folder. Using the FilenamePartExtractor + TextEncoder + StringReplacer prepares the url quite good for the FeatureReader.

 

image

Nice, thank you as well Sigbjørn & Antonio!


Reply