A couple of point here: * I recommend you trying to run each of these in Query Console to help you understand what is going on. * The way you have written the queries they will need to put the whole db in memory. Avoid the following idiom:
for $x in doc().... unless you really have to. You can simplify the first query to something like this: declare namespace bb="http://www.aaa.com/namespace/aa/bb/"; //bb:title * To find out if your documents are in the bb namespace, look at the document with something like: doc("/uri-of-doc.xml") The serialization should print out the namespaces. * Another possibility: is the string for your namespace being constructed correctly in c#? -Danny -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mailing Lists Mail Sent: Wednesday, September 12, 2012 3:08 PM To: MarkLogic Developer Discussion Cc: [email protected] Subject: [MarkLogic Dev General] Help with namespace Declaration in Marklogic Dear All, I had posted a mail regarding some xquery help running from C# program to Marklogic DB. I am using the SimpleQueryRunner.Cs from the Marklogic Sample files. I wrote 2 queries as follows String query1 = "declare namespace bb= \"http://www.aaa.com/namespace/aa/bb/\"; for $doc in doc() let $title := $doc//bb:title return $title"; String query2 = "for $doc in doc() let $title := $doc//title return $title"; The query 1 runs on XMLs that have the namespace bb for the title. The query 2 runs on XMLs that do not have any namespace for the title. Query2 produces valid results but Query1 brings out empty result. I am definitely sure it is the devils works of namespaces here that is bothoring me because removing them from XML works fine. I want to know if there is anything special we need to for the namespaces? I am using the SimpleQueryRunner.Cs as is without any changes to it. Your help will be highgly appreciated DakTapaal.. _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
