[CITE-Forum] WFS-T Update syntactic vs. semantic value equivalence
Tsvetan.Penev at avitech.aero
Tue Jul 15 04:46:20 EDT 2014
while testing our WFS implementation against the WFS 2.0-r16 test suite we identified a quite tricky spot in the Transaction part of the test suite. The exact location is org.opengis.cite.iso19142.transaction.Update.updateGMLName
The test that fails uses a Transaction>Update operation to change the value of the first gml:name property to this string: Ce n'est pas Vieux-Port de MontrÃ©al!
Once the update is completed the reported fes:ResourceId of the updated feature is returned and the test suite requests the updated feature from the service and tests to see if the property has been updated properly. The problem however is that our service reports back the updated property with apostrophe symbol as it is and not represented with an XML entity as '. This causes the test to fail.
Issue 947 (http://cite.opengeospatial.org/issues) addresses another problem which was related to this. That issue addressed the problem that XPath is used for the comparison of values which needs to have the apostrophe in the value escaped. As a result of this ' was introduced which leads solved the problem with XPath but leads to this issue.
Following the rules of XML both "Ce n'est pas Vieux-Port de MontrÃ©al!" and "Ce n'est pas Vieux-Port de MontrÃ©al!" are semantically identical but are obviously syntactically different. So what is identical and what is not? The line of thought goes like this. Should all values which have to be inserted/updated be escaped or not. The logical answer to this could be yes, because XML has some limitations and some characters must always be escaped so that XML parsers can parse the documents properly. However there is no guarantee that all the values which have to be inserted have not been escaped before. This could cause problems in particular with the "&" symbol which in XML is escaped as &. Escaping this once more would change this to & which strictly speaking is identical and requires just a recursive replacement of the entity reference that in the end will return the "&" symbol. So comparing two XML element/attribute values character by character in their native XML representation without replacing all entity references with their true characters is not reliable. Here is another example:
"This is ampersand & and apostrophe '!" and "This is ampersand & and apostrope '!". Are these identical? I believe so. However comparing those character by character would say they are different.
The only true way in my view to compare such values is to replace all entity references with the actual characters first and then to make a comparison. This way we have a common ground which does not suffer from some XML limitations and is unique. May be the test suite should make value comparisons only with all entity references replaced for the true characters.
What do you think? Does that make sense?
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
VAT No.: DE223719716
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the CITE-Forum