3dcitydb / importer-exporter

3D City Database client for high-performance import and export of 3D city model data
Apache License 2.0
126 stars 53 forks source link

Failed to process a valid XML query #220

Closed yaozhihang closed 2 years ago

yaozhihang commented 3 years ago

The following query is valid, but cannot be parsed by the Importer/Exporter

<query xmlns="http://www.3dcitydb.org/importer-exporter/config">
  <typeNames>
    <typeName xmlns:bldg="http://www.opengis.net/citygml/building/2.0">bldg:Building</typeName>
  </typeNames>
  <filter>
    <propertyIsEqualTo>
      <valueReference>core:externalReference[core:informationSystem="http://somewhere"]/core:externalObject/core:name</valueReference>
      <literal>FOO</literal>
    </propertyIsEqualTo>
  </filter>
</query>
clausnagel commented 2 years ago

The issue is the use of forward slashes in the string literal "http://somewhere". Forward slashes are interpreted as slash operator by the query compiler but not as part of the string literal. I am not sure whether slashes are allowed in strings or should rather be esacped according to the XPath specification?

On a XML schema level, the value of <valueReference> is defined as simple xs:string. That's why the XML validates against the schema, although the XPath expression cannot be processed.

clausnagel commented 2 years ago

Ok, I checked it: forward slashes don't need to be escaped. This means you have found a bug here.

clausnagel commented 2 years ago

I created a PR (#221) to support slashes in string literals.

Yet, the Validate XML query process only checks whether the XML query entered into the input field conforms to the XML schema. Should we also compile the query to identify more possible errors when clicking this button (like incorrect names and namespaces of features and attributes, incorrect XPath expressions, data type issues, etc.)? Not sure if this is easy to implement though.

yaozhihang commented 2 years ago

Moved the question above to a separate ticket #224