The problem seems to be related with a corrupted DB.
I just import the xml files again in a new DB and with this new collection everything works fine.
Why was the database corrupted? I have no idea. I hope it doesn't happen again.
Regards
Isidro
Em 23-03-2011 18:47, Isidro Vila Verde escreveu:
Greetings,
I am new here and this is my first post.
I just start to work with Basex and I am trying to migrate from eXist-db. Until know everything runs well but... I am now facing a little problem.
With the xquery bellow the result is not what I expect
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01";
let $col := collection('invoiceData/invoices') let $invoices := $col/*[not(saf:InvoiceType)] return $invoices
This is the result (unexpected)
<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01" xsi:type="spi:invoiceType" xsi:schemaLocation="http://serprest.pt/invoice1 http://serprest.pt/invoice/invoice.xsd%22%3E saf:InvoiceNo257</saf:InvoiceNo> saf:InvoiceDate2010-09-21</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!-- this element is in fact present --> [... some stuff deleted here ...]
But if I use a wildcard instead of the namespace prefix the result is what is expected
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01";
let $col := collection('invoiceData/invoices') let $invoices := $col/*[not(*:InvoiceType)] return $invoices
This is (as expected) the result for the above query
<collection xmlns:spi="http://serprest.pt/invoice1" xmlns="http://exist.sourceforge.net/NS/exist" name="/db/invoicingSystem/invoices" owner="admin" group="dba" mode="755" created="2011-02-17T23:15:07Z" version="1"> <resource type="XMLResource" name="1.xml" owner="admin" group="dba" mode="755" created="1970-01-01T01:00:00+01:00" modified="2010-07-27T13:29:12+01:00" filename="1.xml" mimetype="text/xml"/> [... some stuff deleted here ...]
Of course, I can still use wildcards but the question is what is wrong with prefix? I am asking because I have a lot of queries using namespaces and now I have no confidence on the results.
Thanks in advance
Isidro
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110323-1, 23-03-2011 Tested on: 23-03-2011 19:59:07 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com