← Back to team overview

zorba-coders team mailing list archive

Re: [Merge] lp:~zorba-coders/zorba/fixing_issues_FOTS_driver into lp:zorba

 

> I don't think it's correct to try deep-equal() for <assert-xml> test cases.
> Certainly this doesn't match with the description of that assertion at
> http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml.
"As an alternative to canonicalizing, the results may be compared using the fn:deep-equal() function."
 
> Can you tell me why you did that? I'm also confused how this could have
> corrected 4 test cases.
These fixed 4 test cases where the parsing of the serialized XML content with libxml2 raised errors.
Although parsing the same exact thing with parse-xml did not. This is how, for these 4 cases, 
fn:deep-equal(parse-xml($x1), parse-xml($x2)) returned correct result while
$x1 eq $x2 raised errors where $x1, $x2 are xml:canonicalize(....)

Take for example this example "namespaceDecl-24" from "prod-NamespaceDecl":

This works:
import module namespace zorba-xml =  "http://www.zorba-xquery.com/modules/xml#2.1";;
import schema namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";;

 declare variable $serParamXml :=
  <output:serialization-parameters>
    <output:method                value="xml" />
    <output:indent                value="no"  />
    <output:omit-xml-declaration  value="yes" />
  </output:serialization-parameters>;

let $content := <abc:someElement xmlns:abc="mailto:someuser@xxxxxxxxxxxxxx";>some content</abc:someElement>
return
parse-xml(fn:serialize($content, $serParamXml))



while this fails:
import module namespace zorba-xml =
  "http://www.zorba-xquery.com/modules/xml#2.1";;

import schema namespace output =
  "http://www.w3.org/2010/xslt-xquery-serialization";;

 declare variable $serParamXml :=
  <output:serialization-parameters>
    <output:method                value="xml" />
    <output:indent                value="no"  />
    <output:omit-xml-declaration  value="yes" />
  </output:serialization-parameters>;

let $content := <abc:someElement xmlns:abc="mailto:someuser@xxxxxxxxxxxxxx";>some content</abc:someElement>
return
zorba-xml:canonicalize(fn:serialize($content, $serParamXml))

Error:

C14N error : Relative namespace UR is invalid here : mailto
C14N error : Internal error : checking for relative namespaces
C14N error : Internal error : processing docs children list
C14N error : Internal error : saving doc to output buffer
</home/spungi/work/zorba/repo/tmp/bump_FOTS_snapshot/build/URI_PATH/com/zorba-xquery/www/modules/xml_2.xq>:444,3: dynamic error [err:FOCZ0001]: invalid content passed to x:canonicalize(): "<abc:someElement xmlns:abc="mailto:someuser@xxxxxxxxxxxxxx";>some content</abc:someElement>"
-- 
https://code.launchpad.net/~zorba-coders/zorba/fixing_issues_FOTS_driver/+merge/155294
Your team Zorba Coders is subscribed to branch lp:zorba.


References