zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #18820
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba.
Commit message:
Implemented 'assert-xml' using the new canonicalize function.
Requested reviews:
Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
Bug #1086398 in Zorba: "FOTS: add canonicalization in eval:assert-xml function"
https://bugs.launchpad.net/zorba/+bug/1086398
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1086398/+merge/152760
Implemented 'assert-xml' using the new canonicalize function.
--
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1086398/+merge/152760
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/xml.xq'
--- modules/com/zorba-xquery/www/modules/xml.xq 2013-03-06 07:39:18 +0000
+++ modules/com/zorba-xquery/www/modules/xml.xq 2013-03-11 19:42:22 +0000
@@ -89,8 +89,8 @@
: The options element must conform to the xml-options:options element type
: from the xml-options.xsd schema. Some of these
: will be passed to the underlying library (LibXml2) and further documentation
- : for them can be found at <a href="http://xmlsoft.org/html/libxml-parser.html">
- : LibXml2 parser</a>.
+ : for them can be found at <a href="http://xmlsoft.org/html/libxml-parser.html#xmlParserOption">
+ : LibXml2 parser#xmlParserOption</a>.
:
: The list of available options:
:
=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq 2013-02-26 05:21:15 +0000
+++ test/fots_driver/environment.xq 2013-03-11 19:42:22 +0000
@@ -451,7 +451,7 @@
) as xs:string
{
if (empty($env))
- then
+ then
""
else
let $namespace := $env/fots:namespace[@uri eq $env/fots:schema/@uri]
@@ -459,15 +459,18 @@
then xs:string($namespace/@prefix)
else "p"
return
- if ($prefix eq "")
- then concat('import schema default element namespace "',
- $env/fots:schema/@uri,
- '";
')
- else concat('import schema namespace ',
- $prefix,
- ' = "',
- $env/fots:schema/@uri,
- '";
')
+ if(empty($env/fots:schema/@uri))
+ then ""
+ else
+ if ($prefix eq "")
+ then concat('import schema default element namespace "',
+ $env/fots:schema/@uri,
+ '";
')
+ else concat('import schema namespace ',
+ $prefix,
+ ' = "',
+ $env/fots:schema/@uri,
+ '";
')
};
=== modified file 'test/fots_driver/evaluate.xq'
--- test/fots_driver/evaluate.xq 2013-02-26 06:30:28 +0000
+++ test/fots_driver/evaluate.xq 2013-03-11 19:42:22 +0000
@@ -482,17 +482,16 @@
$baseURI as xs:anyURI
)
{
-(:TODO call xml-canonicalization after bug #1076919 is implemented.:)
try {
- let $serRes := util:serialize-result($result),
- $result1 as xs:string := string-join($serRes,''),
- $result2 as xs:string := string-join($serRes,' '),
- $expectedResult as xs:string := util:get-value($expResult, $baseURI, "assert-xml")
+ let $serActualResult as xs:string* := util:serialize-result($result)
+ let $actualResult1 as xs:string := util:canonicalize(string-join($serActualResult,''))
+ let $actualResult2 as xs:string := util:canonicalize(string-join($serActualResult,' '))
+ let $expectedResult as xs:string := util:canonicalize(util:get-value($expResult, $baseURI, "assert-xml"))
return
- if ((normalize-space($result1) eq normalize-space(string($expectedResult))) or
- (normalize-space($result2) eq normalize-space(string($expectedResult))))
+ if (($actualResult1 eq $expectedResult) or
+ ($actualResult2 eq $expectedResult))
then ()
- else "'assert-xml' returned: result is different from the expected result."
+ else concat("'assert-xml' returned: result 
'", $actualResult1,"'
'" , $actualResult2 ,"'
 is different from the expected result 
'", $expectedResult,"'
")
} catch * {
concat("'assert-xml' returned: fail with error ",
$err:code, " : ", $err:description)
=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq 2013-03-07 13:49:26 +0000
+++ test/fots_driver/fots-driver.xq 2013-03-11 19:42:22 +0000
@@ -416,7 +416,7 @@
$expectedFailures,
$cliMode)
}
- catch *
+ catch err:FODC0002
{
error($err:code,
concat("
Please make sure the passed 'fotsPath' points to the",
@@ -566,7 +566,7 @@
$expectedFailures,
$cliMode)
}
- catch *
+ catch err:FODC0002
{
error($err:code,
concat("
Please make sure the passed 'fotsPath' points to the",
=== modified file 'test/fots_driver/reporting.xq'
--- test/fots_driver/reporting.xq 2013-02-27 12:14:01 +0000
+++ test/fots_driver/reporting.xq 2013-03-11 19:42:22 +0000
@@ -99,7 +99,7 @@
$FOTSZorbaManifestPath)
}
}
- catch *
+ catch err:FODC0002
{
error($err:code,
$err:description,
@@ -205,7 +205,7 @@
$W3CTemplate
}
}
- catch *
+ catch err:FODC0002
{
error($err:code,
$err:description,
@@ -282,7 +282,7 @@
}
}
-catch *
+catch err:FODC0002
{
error($err:code,
$err:description,
=== modified file 'test/fots_driver/util.xq'
--- test/fots_driver/util.xq 2013-02-27 11:47:33 +0000
+++ test/fots_driver/util.xq 2013-03-11 19:42:22 +0000
@@ -31,6 +31,9 @@
import module namespace fots-err =
"http://www.zorba-xquery.com/fots-driver/errors" at "errors.xq";
+import module namespace zorba-xml =
+ "http://www.zorba-xquery.com/modules/xml#2.1";
+
declare namespace err =
"http://www.w3.org/2005/xqt-errors";
@@ -96,7 +99,10 @@
where (fn:local-name-from-QName(fn:node-name($node)) eq $node-name)
return
if ($node/@file)
- then fn:unparsed-text(resolve-uri($node/@file, $baseURI))
+ then
+ if(ends-with($node/@file, ".xml"))
+ then fn:serialize(doc(resolve-uri($node/@file, $baseURI)), $util:serParamXml)
+ else fn:unparsed-text(resolve-uri($node/@file, $baseURI))
else fn:string($node)
}
catch *
@@ -120,6 +126,20 @@
xs:anyURI(fn:substring-before($path, file:base-name($path)))
};
+declare %private function util:replace-entity-references(
+ $input as xs:string
+) as xs:string
+{
+ replace(replace($input,'>','>'),'<','<')
+};
+
+declare function util:canonicalize(
+ $input as xs:string
+) as xs:string
+{
+ zorba-xml:canonicalize(concat('<root>', util:replace-entity-references($input), '</root>'))
+};
+
declare function util:serialize-result(
$result as item()*
Follow ups
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Zorba Build Bot, 2013-03-11
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1086398 into lp:zorba
From: Sorin Marian Nasoi, 2013-03-11