Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/bug_872502 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #872502 in Zorba: "validation of the JSON module xqdoc fails"
  https://bugs.launchpad.net/zorba/+bug/872502

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug_872502/+merge/80463

Fix for bug lp:872502:
- in the case where library modules were using external C++ library 
dependencies (like it was the case with the reported Json module) the XQDoc XML 
generated by Zorba was not valid according to the XQDoc schema: this was fixed.
- also the XQDoc2XHTML generator was updated to reflect this change
- added 2 tests but I used a module part of the Zorba core 
(http://www.zorba-xquery.com/modules/http-client) that has an external C++ 
library dependency on Curl
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug_872502/+merge/80463
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq	2011-10-19 05:09:31 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq	2011-10-26 15:15:29 +0000
@@ -1154,7 +1154,7 @@
  : @return the XHTML for the module annotations.
  :)
 declare %private function xqdoc2html:annotations-module($comment) {
-  let $annotations := $comment/xqdoc:*[not((local-name(.) = ("description", "param", "return", "error", "deprecated", "see", "library", "project", "custom")))]
+  let $annotations := $comment/xqdoc:*[not((local-name(.) = ("description", "param", "return", "error", "deprecated", "see", "project", "custom")))]
   return
     for $annotation in $annotations
     let $annName := local-name($annotation)
@@ -1195,7 +1195,7 @@
 declare %private function xqdoc2html:module-dependencies(
     $xqdoc) {
   if (fn:count($xqdoc/xqdoc:imports/xqdoc:import) > 0 or
-      fn:count($xqdoc/xqdoc:module/xqdoc:comment/xqdoc:*[(local-name(.) = ("library"))]) > 0) then
+      fn:count($xqdoc/xqdoc:module/xqdoc:comment/xqdoc:custom[@tag="library"]) > 0) then
     (<div class="section"><span id="module_dependencies">Module Dependencies</span></div>,
     xqdoc2html:imports($xqdoc))
   else
@@ -1238,10 +1238,10 @@
     }
     </ul></p>
   else (),
-  if (fn:count($xqdoc/xqdoc:module/xqdoc:comment/xqdoc:*[(local-name(.) = ("library"))]) > 0) then
+  if (fn:count($xqdoc/xqdoc:module/xqdoc:comment/xqdoc:custom[@tag="library"]) > 0) then
     <p>External C++ library dependencies:<ul>
       {
-      for $library in $xqdoc/xqdoc:module/xqdoc:comment/xqdoc:*[(local-name(.) = ("library"))]
+      for $library in $xqdoc/xqdoc:module/xqdoc:comment/xqdoc:custom[@tag="library"]
         return
          <li>{$library/node()}</li>
       }

=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp	2011-08-11 19:09:24 +0000
+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp	2011-10-26 15:15:29 +0000
@@ -338,7 +338,7 @@
     // library
     for (lIt = lLibraryAnn.begin(); lIt != lLibraryAnn.end(); ++lIt) {
       const XQDocAnnotation lAnnotation = *lIt;
-      printCommentFragment(lCommentElem, lAnnotation.getValue().str(), "library");
+      printCommentFragment(lCommentElem, lAnnotation.getValue().str(), "library", true);
     }
 
     // example

=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_01.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_01.xml.res	2011-10-26 15:15:29 +0000
@@ -0,0 +1,1 @@
+true

=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_02.xml.res	2011-10-26 15:15:29 +0000
@@ -0,0 +1,1 @@
+true

=== added file 'test/rbkt/Queries/zorba/schemas/validate_xqdoc_01.xq'
--- test/rbkt/Queries/zorba/schemas/validate_xqdoc_01.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/validate_xqdoc_01.xq	2011-10-26 15:15:29 +0000
@@ -0,0 +1,4 @@
+import module namespace x = "http://www.zorba-xquery.com/modules/xqdoc";;
+import schema namespace xqds = "http://www.xqdoc.org/1.0";;
+
+exists(validate lax { x:xqdoc("http://www.zorba-xquery.com/modules/http-client";)  })

=== added file 'test/rbkt/Queries/zorba/schemas/validate_xqdoc_02.xq'
--- test/rbkt/Queries/zorba/schemas/validate_xqdoc_02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/validate_xqdoc_02.xq	2011-10-26 15:15:29 +0000
@@ -0,0 +1,4 @@
+import module namespace x = "http://www.zorba-xquery.com/modules/xqdoc";;
+import schema namespace xqds = "http://www.xqdoc.org/1.0";;
+
+exists(validate { x:xqdoc("http://www.zorba-xquery.com/modules/http-client";)  })

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to