Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/canonicalize-core into lp:zorba
Your comments should be fixed now -- https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 Your team Zorba Coders is subscribed to branch lp:zorba. -- 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
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/canonicalize-core into lp:zorba
Review: Needs Fixing - It looks like the merge has reverted plenty of other files. - Documentation of the function should be improved. -- https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 Your team Zorba Coders is subscribed to branch lp:zorba. -- 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
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/canonicalize-core into lp:zorba
Hi - remove from modules/w3c/xpath_functions.xq (it's not defined in the XQuery FOTS spec) Sorry my mistake, I did it for testing because the function as not being detected and forgot to remove it. - the function should handle streamable strings as well - does canonicalization allow for options? If so, we should expose them Yes it have encoding and some options http://xmlsoft.org/html/libxml-parser.html#xmlParserOption, should I add them? - the prefix of the module should not be parse-xml anymore because there are not only parsing-related functions in the module What would be a a good prefix? - the function probably shouldn't raise any errors form the spec (i.e. FODC0006) I thought that message fit the error, is there another one better for it or should I add one to the diagnostic? - the special state is not needed (theDocString doesn't seem to be used anyway) Removing it. - the function doesn't access the dynamic context, hence the zorba:accessesDynCtx element can be removed from the spec I know I removed this from the description of the function, but as soon as I removed it the implementation was not being linked with the function. I will take a look. - the condition 'if (consumeNext(result, theChildren[0].getp(), planState))' can be removed because the function is guaranteed to get one result Removing it -- https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 Your team Zorba Coders is subscribed to branch lp:zorba. -- 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
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/canonicalize-core into lp:zorba
- remove from modules/w3c/xpath_functions.xq (it's not defined in the XQuery FOTS spec) Sorry my mistake, I did it for testing because the function as not being detected and forgot to remove it. - the function should handle streamable strings as well - does canonicalization allow for options? If so, we should expose them Yes it have encoding and some options http://xmlsoft.org/html/libxml-parser.html#xmlParserOption, should I add them? Yes, probably most of them. I would start with XML_PARSE_NOENT = 2 : substitute entities XML_PARSE_DTDLOAD = 4 : load the external subset XML_PARSE_DTDATTR = 8 : default DTD attributes XML_PARSE_DTDVALID = 16 : validate with the DTD XML_PARSE_NOBLANKS = 256 : remove blank nodes XML_PARSE_NONET = 2048 : Forbid network access XML_PARSE_NSCLEAN = 8192 : remove redundant namespaces declarations XML_PARSE_NOCDATA = 16384 : merge CDATA as text nodes - the prefix of the module should not be parse-xml anymore because there are not only parsing-related functions in the module What would be a a good prefix? x - the function probably shouldn't raise any errors form the spec (i.e. FODC0006) I thought that message fit the error, is there another one better for it or should I add one to the diagnostic? I think you should define a new one. Matthias -- https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 Your team Zorba Coders is subscribed to branch lp:zorba. -- 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
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/canonicalize-core into lp:zorba
Juan Zacarias has proposed merging lp:~zorba-coders/zorba/canonicalize-core into lp:zorba. Commit message: Added Canonicalize function to modules/xml Requested reviews: Matthias Brantner (matthias-brantner) Sorin Marian Nasoi (sorin.marian.nasoi) Luis Rodriguez Gonzalez (kuraru) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 -- https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2012-11-20 01:01:49 + +++ ChangeLog 2012-11-22 21:13:24 + @@ -7,6 +7,7 @@ * (bug #1039284) Implemented jn:json-doc(). * (bug #867363) Added http-uri-resolution feature to disable HTTP when resolving URIs. + * Added canonicalize function to modules/xml. Optimizations: * Various optimizations in the implementation of the optimizer rules. === modified file 'modules/com/zorba-xquery/www/modules/xml.xq' --- modules/com/zorba-xquery/www/modules/xml.xq 2012-09-19 21:16:15 + +++ modules/com/zorba-xquery/www/modules/xml.xq 2012-11-22 21:13:24 + @@ -418,3 +418,17 @@ return parse-xml:parse($xml-string, $new_options) }; + +(:~ + : canonicalize a given XML. + : + : @param $xml-string the XML as string. + : + : @return the canonicalized XML as string. + : + : @error s:CANO0001 invalid input. + :) +declare function parse-xml:canonicalize( + $xml-string as xs:string + ) as xs:string external; + === modified file 'modules/w3c/xpath_functions.xq' --- modules/w3c/xpath_functions.xq 2012-09-19 21:16:15 + +++ modules/w3c/xpath_functions.xq 2012-11-22 21:13:24 + @@ -1056,3 +1056,5 @@ : @see for semantics please check a href=http://www.w3.org/TR/xpath-functions-30/#func-uri-collection;fn:uri-collection/a :) declare function fn:uri-collection($arg as xs:string?) as xs:anyURI* external; + +declare function fn:canonicalize($xml-string as xs:string) as xs:string === modified file 'src/functions/func_parse_fragment_impl.cpp' --- src/functions/func_parse_fragment_impl.cpp 2012-05-16 15:23:50 + +++ src/functions/func_parse_fragment_impl.cpp 2012-11-22 21:13:24 + @@ -54,6 +54,7 @@ lParseOptType, GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR), FunctionConsts::FN_ZORBA_XML_PARSE_2); + } } === modified file 'src/functions/pregenerated/func_parse_fragment.cpp' --- src/functions/pregenerated/func_parse_fragment.cpp 2012-10-08 12:09:36 + +++ src/functions/pregenerated/func_parse_fragment.cpp 2012-11-22 21:13:24 + @@ -41,6 +41,16 @@ return new FnZorbaParseXmlFragmentIterator(sctx, loc, argv); } +PlanIter_t fn_zorba_xml_canonicalize::codegen( + CompilerCB*, + static_context* sctx, + const QueryLoc loc, + std::vectorPlanIter_t argv, + expr ann) const +{ + return new FnZorbaCanonicalizeIterator(sctx, loc, argv); +} + PlanIter_t fn_parse_xml_fragment_3_0::codegen( CompilerCB*, static_context* sctx, @@ -56,6 +66,18 @@ { +DECL_WITH_KIND(sctx, fn_zorba_xml_canonicalize, +(createQName(http://www.zorba-xquery.com/modules/xml,,canonicalize;), +GENV_TYPESYSTEM.STRING_TYPE_ONE, +GENV_TYPESYSTEM.STRING_TYPE_ONE), +FunctionConsts::FN_ZORBA_XML_CANONICALIZE_1); + + } + + + + + { DECL_WITH_KIND(sctx, fn_parse_xml_fragment_3_0, (createQName(http://www.w3.org/2005/xpath-functions,,parse-xml-fragment;), GENV_TYPESYSTEM.STRING_TYPE_QUESTION, === modified file 'src/functions/pregenerated/func_parse_fragment.h' --- src/functions/pregenerated/func_parse_fragment.h 2012-10-08 12:09:36 + +++ src/functions/pregenerated/func_parse_fragment.h 2012-11-22 21:13:24 + @@ -55,6 +55,23 @@ }; +//fn-zorba-xml:canonicalize +class fn_zorba_xml_canonicalize : public function +{ +public: + fn_zorba_xml_canonicalize(const signature sig, FunctionConsts::FunctionKind kind) +: +function(sig, kind) + { + + } + + bool accessesDynCtx() const { return true; } + + CODEGEN_DECL(); +}; + + //fn:parse-xml-fragment class fn_parse_xml_fragment_3_0 : public function { === modified file 'src/functions/pregenerated/function_enum.h' --- src/functions/pregenerated/function_enum.h 2012-10-22 20:06:08 + +++ src/functions/pregenerated/function_enum.h 2012-11-22 21:13:24 + @@ -344,6 +344,7 @@ FN_FORMAT_INTEGER_2, FN_FORMAT_INTEGER_3, FN_ZORBA_XML_PARSE_2, + FN_ZORBA_XML_CANONICALIZE_1, FN_PARSE_XML_FRAGMENT_1, FN_PARSE_XML_1, FN_SERIALIZE_1, === modified file 'src/runtime/parsing_and_serializing/parse_fragment_impl.cpp' --- src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-09-19 21:16:15 + +++ src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-11-22 21:13:24 + @@ -32,6 +32,10 @@ #include types/schema/schema.h #include types/schema/validate.h +#include libxml/tree.h +#include libxml/parser.h +#include libxml/xmlreader.h +#include libxml/c14n.h
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/canonicalize-core into lp:zorba
Review: Needs Fixing - remove from modules/w3c/xpath_functions.xq (it's not defined in the XQuery FOTS spec) - the function should handle streamable strings as well - does canonicalization allow for options? If so, we should expose them - the prefix of the module should not be parse-xml anymore because there are not only parsing-related functions in the module - the function probably shouldn't raise any errors form the spec (i.e. FODC0006) - the special state is not needed (theDocString doesn't seem to be used anyway) - the function doesn't access the dynamic context, hence the zorba:accessesDynCtx element can be removed from the spec - the condition 'if (consumeNext(result, theChildren[0].getp(), planState))' can be removed because the function is guaranteed to get one result -- https://code.launchpad.net/~zorba-coders/zorba/canonicalize-core/+merge/135777 Your team Zorba Coders is subscribed to branch lp:zorba. -- 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