Toad World® Forums

Testing function that returns XML


I set up a test case for a function that returns an XML document. If the function “fails” it returns an empty root node. I tried to set up the outcome to check for a node down from the root (i.e. selected EXISTS operator - “XPath expression locates a node in the XML document?”). It sounds like this would provide exactly what I need. However, after selecting EXISTS, I click OK and get an exception (Internal error) and it attempts to generate a support bundle. Unfortunately, this is on a separate network and, therefore, I cannot actually send the bundle.

Any suggestions?
Let me know if you need further details.

Thanks a lot,



It would be extremely helpful to me if you would log a bug with Quest Support and generate a support bundle that includes the source code of the program you are testing and an export of the test definition (the support bundle creator will do this for you as long as you specify the name of the program on the appropriate page. If you don’t want to bother with Quest Support please send the information directly to me at

Many thanks, SF



In general, does it sound like the feature I was trying to use would meet my need (i.e. is that what the EXISTS operator is supposed to do with an XML doc)?

I’ll take a look to see how long it would take to get the support bundle reviewed and approved for transfer. I’ll let you know…



Yes, Mitch, I think that is what you should be using. We clearly have an error there.

I will open a bug report and we will take a look at it.



Could you do this:

Email to me ( an example of the XML document with an “empty root node” on which the test is failing? We will then hopefully be able to reproduce this more easily.




An update: it looks like we can reproduce it. One request:

When you get the internal error, could you take and send me the screenshot of the error?

Thanks, SF


Another update:

Please try connecting to your repository schema and run this script:

UPDATE qu_assertion a
SET a.exp_dt_guid = NULL
WHERE a.universal_id IN
, ‘{C35BCF76-1C78-44EC-8785-D508C8CB1D7F}’);


Then start up Code Tester and see if the problem goes away. Let me know what happens.

Thanks, SF



Sorry for the delay in my response.
It appears your suggestion has resolved the issue. The test case now compiles fine. I’m able to set the XPath expression, but I still need to figure out where I should define the namespace I use. Any suggestions?

Thanks a lot for the help,


Regarding namespace: I am sorry, but I am being slow on this one. What namespace do you need to specify, and for what?

Thanks, SF


The namespace is referenced in the XML that is returned from the function. Therefore, the XPath expression seems to be having trouble without the namespace definition. For example, say the XML output is something simple like:

PL/SQL Pocket Reference

In PL/SQL if you try to call vXML.existsnode(’/book/lib:title’), it will complain b/c you don’t tell it what “lib” is. So, you need to say something like vXML.existsnode(’/book/lib:title’, ‘xmlns:“lib=http://mitch/library_schema”’). I’m guessing the issue with my test case in Code Tester is that I don’t specify the 2nd part anywhere.
Make sense?