Hi Gregg,
Namespace declaration must be a part of the query you want to execute:
(sedna:result->list
(sedna:execute-query conn "declare default element namespace '
http://infoml.org/infomlFile'; document('how_we_decide_2')//tag"))
Ivan Shcheklein,
Sedna Team
On Sun, Jun 21, 2009 at 4:06 AM, Gregg Williams <spa...@innerpaths.net>wrote:
> Hi! I'm a new Sedna user, programming in Scheme on a MacOS X computer.
> I have modified the client.ss example to work under PLT Scheme version
> 4.1.5, but I can't get an XQuery query to work because of my XML
> data's use of the default namespace, as shown here:
>
> -----
> <?xml version="1.0" encoding="UTF-8"?>
> <infomlFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://infoml.org/infomlFile"
> xsi:schemaLocation="http://infoml.org/infomlFile
> http://infoml.org/s/infomlFile.xsd">
> -----
>
> If I take the namespace out, my code accesses the XML document just
> fine.
>
> The code that tries to access the document with the default namespace
> is at the end of this message. Reading from various sources on the
> Internet, my assumption is that I must somehow tell Sedna what the
> default namespace is. This statement is shown below marked by ">>>>>"
> at the beginning of the line.
>
> I always get an error message that Sedna chokes on one of the keywords
> in the statement. Here are the statements I've tried:
>
> -----
> "declare default element namespace 'http://infoml.org/infomlFile'"
>
> "FORMAT XML NAMESPACE PREFIX 'http://infoml.org/infomlFile'"
>
> "declare namespace xmlns='http://infoml.org/infomlFile'"
> -----
>
> All of these give an error message that began like this (each with a
> different unexpected token):
>
> -----
> uncaught exception: ((#<procedure:condition?> (exn message "Server
> reported of an error: SEDNA Message: ERROR XPST0003\nIt is a static
> error if an expression is not a valid instance of the grammar defined
> in A.1 EBNF.\nDetails: unexpected token: 'Eof', line: 1\n")))
> >
> -----
>
> To summarize, how do I work with XML documents that use a default
> namespace?
>
> The code is below. Thanks for anything that anyone can suggest.
>
> === (End of text message; code follows) ===
>
>
>
> (require (planet lizorkin/sedna:1:2/sedna))
>
> ; Create a connection
> (define conn
> (sedna:connect-to-database "localhost" "infocards" "SYSTEM"
> "MANAGER"))
>
> ; Begin a transaction
> (sedna:begin-transaction conn)
>
> ; Bulk load
> (define infile (open-input-file "/Users/gw/Documents/99-IMPORTANT
> DOCUMENTS/permanent infocards, schema v0.90/How We Decide 2.InfoML"))
> (sedna:bulk-load-from-xml-stream conn infile "how_we_decide_2")
>
> ; Execute a statement and represent it as an SXML nodeset
> >>>>> (sedna:execute-query conn "declare namespace xmlns='
> http://infoml.org/infomlFile'
> ")
>
> (sedna:result->list
> (sedna:execute-query conn "document('how_we_decide_2')//tag"))
>
> ; Commit transaction
> (sedna:end-transaction conn 'COMMIT)
>
> ; Close the connection
> (sedna:disconnect-from-database conn)
>
> ;(close-input-port infile)
>
>
> === (End code; end of message) ===
>
>
>
>
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge
> conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
> $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
>
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> Sedna-discussion mailing list
> Sedna-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Sedna-discussion mailing list
Sedna-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sedna-discussion