When I do { 'method': 'text'} I just get the text from the XML, not the XML itself:
<testcase name="test-element-info" time="PT0.011S"> <failure message="Failed input Input: input Expected: output Got: {removed}" type="UNIT0001"/> </testcase>
What I would like is ".. Expected: <result>output</result> ..." since what is being returned is XML.
On Thu, Dec 5, 2013 at 3:02 AM, Christian Grün christian.gruen@gmail.comwrote:
Hi Joe,
one solution is to use "text" as serialization method:
serialize("<a/>", { 'method': 'text'})
As an alternative, you can specify in the query prolog (the beginning) of your query that all results are to be output as text:
declare option output:method "text";
Hope this helps, Christian ___________________________
On Thu, Dec 5, 2013 at 4:59 AM, Joe Templeman joe@inkling.com wrote:
Hi all,
Is there a way to output unescaped XML to a string for debugging
purposes?
In unittests we would like to output the XML returned when a test fails, here is my example:
declare %unit:test function elementinfo-test:test-element-info() { let $cases :=
<cases> <case> <comment>Failed input</comment> <input>input</input> <output> <result> output </result> </output> </case> </cases> for $case in $cases/case let $result := {some function which returns XML} let $u := unit:assert(deep-equal($case/output, result), $case/comment/text() || " Input: " || $case/input/text() || " Expected: " || fn:serialize($case/output) || " Got: " || fn:serialize($result)) return $u };
But when a test fails, I get escaped XML as the output. Is there any way
to
get this as actual XML?
Thanks, Joe
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk