Le vendredi 15 avril 2016 16:21:31, Rahkonen Jukka (MML) a écrit : > Hi, > > I was thinking that the output of GetCapabilities is XML and & must be > escaped in XML. So if I write & into the abstract and Mapserver works > correctly it should write my test abstract “test ä &” escaped perhaps as > test ä & > That is the output from the online tool at > http://www.freeformatter.com/xml-escape.html#ad-output > > So my conclusion was that because Mapserver does not do it right here it > won’t do it right elsewhere. > > But now I made another test by editing the Geoserver test file “states.shp” > in Spatialite as UPDATE states set STATE_NAME=’Colo&rado’ WHERE > STATE_NAME=’Colorado’; > > Output of GetFeature from WFS 1.1.0 from Mapserver 7.0.0 includes > <ms:STATE_NAME>Colo&rado</ms:STATE_NAME> > > So my current conclusion is that my Mapserver does not escape “&” correctly > when it is used inside a mapfile and when I do GetCapabilities request. > However, when data come from Spatialite database and they are consumed by > GetFeature then escaping happens correctly. > > We are still comparing different things because you have PostGIS and I have > Spatialite. > > -Jukka Rahkonen- > > > Ian Walberg wrote: > > Jukka, > > I am not sure I understand the test you did. > > The data we are referring to is from the database field for the individual > features name. > > Regards > > Ian > > From: Rahkonen Jukka (MML) [mailto:[email protected]] > Sent: Thursday, April 14, 2016 10:19 PM > To: Ian Walberg > <[email protected]<mailto:[email protected]>>; > MapserverList OSGEO > <[email protected]<mailto:[email protected]>> > Subject: Re: WFS layer - XML/JSON safe chars > > Hi Ian, > > Thanks for the clarification. > I made a simple test by adding an abstract into layer metadata. This shows > “test ä” as an abstract "wfs_abstract" "test ä” > > This one shows an empty abstract > "wfs_abstract" "test ä &" > > So it looks like Mapserver doesn’t know to convert “&” into “&” for > XML.
Actually it works for WFS 1.0, but not for 1.1 & 2.0. The reason is that the later use xmlNewChild() that expect values to be already XML-encoded, instead of xmlNextTextChild(). Working on a fix > > -Jukka Rahkonen- > > Ian Walberg wrote: > > Jukka, > > Our question was for the data/text read from the database and then > published as XML by the WFS service. > > So a pub with the name ‘Dog & bone’ created illegal xml as the & is not > converted to & > > Regards > > Ian > > From: Rahkonen Jukka (MML) [mailto:[email protected]] > Sent: Thursday, April 14, 2016 3:10 PM > To: Ian Walberg > <[email protected]<mailto:[email protected]>>; > MapserverList OSGEO > <[email protected]<mailto:[email protected]>> > Subject: Re: WFS layer - XML/JSON safe chars > > Hi, > > You can’t have & in feature type names or attribute names in WFS because > they are defined in the XML schema to be “QName”. The prefix and LocalPart > are of type NCName https://en.wikipedia.org/wiki/QName and from > http://stackoverflow.com/questions/1631396/what-is-an-xsncname-type-and-wh > en-should-it-be-used > > The practical restrictions of NCName are that it cannot contain several > symbol characters like :, @, $, %, &, /, +, ,, ;, whitespace characters or > different parenthesis. Furthermore an NCName cannot begin with a number, > dot or minus character although they can appear later in an NCName. > > -Jukka Rahkonen- > > Lähettäjä: mapserver-users [mailto:[email protected]] > Puolesta Ian Walberg Lähetetty: 14. huhtikuuta 2016 19:23 > Vastaanottaja: MapserverList OSGEO > Aihe: [mapserver-users] WFS layer - XML/JSON safe chars > > Folks, > > Can mapserver produce XML or JSON safe characters for WFS served data or do > we need to ensure the source data has the escaped values. > > We got tripped up today as there were some ‘&’ in our names which we had > not considered. > > Thanks > > Ian -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
