Function will return node(), but db:output(node()) returns 'Attribute xmlns redefined'

Thursday, 1 November 2012 · 5 messages · last reply 12 Nov 2012
FB
France Baril1 Nov 2012 17:02 #
Hi, My search function used to return $html correctly
*let* *$html* := <html *xmlns*=*"http://www.w3.org/1999/xhtml"*>
    <head><link *href*=*"*{*$cssfile*}*"* *rel*=*"stylesheet"* *type*=*
"text/css"*/><title>Search help</title>
    <script *type*=*"text/javascript"* *xmlns*=*"
http://www.w3.org/1999/xhtml"*>{*app:get-google-analytics-script*()/*text*
()}</script>
    </head>
    <body>
      <div> (…)
     <div>{*$result-list*}</div>
   </div></body></html>
*return $html*
I am now trying to keep records of users most popular queries in my DB, so I made the function an updating function and adapted the return value:
*let* *$html* := <html *xmlns*=*"http://www.w3.org/1999/xhtml"*>
    <head><link *href*=*"*{*$cssfile*}*"* *rel*=*"stylesheet"* *type*=*
"text/css"*/><title>Search help</title>
    <script *type*=*"text/javascript"* *xmlns*=*"
http://www.w3.org/1999/xhtml"*>{*app:get-google-analytics-script*()/*text*
()}</script>
    </head>
    <body>
      <div> (…)
     <div>{*$result-list*}</div>
   </div></body></html>

   *return *(*feedback:analyze-user-search-and-result*(*$keywords*, *
$result-ids*, *$this-menu*, *$application*, *$carrier*, *$country*, *$lang*,
*$model*, *$os*), *db:output*(*$html*))
I got this error: error on line 30 at column 25: Attribute xmlns redefined After lots of research, I figured that when using db:output, the top element of $result-list is interpreted as coming from a different namespace. Adding xmlns="http://www.w3.org/1999/xhtml" to that top element resolved my issue, but I still don't get why this is happening, can you explain? More specifically, here are definitions of $result-lists and what they produce: let $result-list := <div/> would work when used in the 1st code sample, but not the second (updating function). let $result-list := <div xmlns:="http://www.w3.org/1999/xhtml"/> resolves the issue for the second (updating function). Thanks, France
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
CG
Christian Grün2 Nov 2012 18:03 #
Hi France, I tried a while to reproduce the issue you've been presenting, but I didn't succeed so far. Do you think you could create a runnable example for testing, or are there too many other components involved? Thanks in advance, Christian ___________________________ Christian Grün Box 188, Uni KN D-78457 Konstanz http://christian-gruen.de
Quoted text · France Baril · 68 lines
On Thu, Nov 1, 2012 at 4:01 PM, France Baril <france.baril at architextus.com> wrote: > Hi, > > My search function used to return $html correctly > > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> > <head><link href="{$cssfile}" rel="stylesheet" > type="text/css"/><title>Search help</title> > <script type="text/javascript" > xmlns="http://www.w3.org/1999/xhtml">{app:get-google-analytics-script()/text()}</script> > </head> > <body> > <div> (…) > <div>{$result-list}</div> > </div></body></html> > return $html > > > I am now trying to keep records of users most popular queries in my DB, so I > made the function an updating function and adapted the return value: > > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> > <head><link href="{$cssfile}" rel="stylesheet" > type="text/css"/><title>Search help</title> > <script type="text/javascript" > xmlns="http://www.w3.org/1999/xhtml">{app:get-google-analytics-script()/text()}</script> > </head> > <body> > <div> (…) > <div>{$result-list}</div> > </div></body></html> > > return (feedback:analyze-user-search-and-result($keywords, $result-ids, > $this-menu, $application, $carrier, $country, $lang, $model, $os), > db:output($html)) > > > I got this error: error on line 30 at column 25: Attribute xmlns redefined > > After lots of research, I figured that when using db:output, the top element > of $result-list is interpreted as coming from a different namespace. Adding > xmlns="http://www.w3.org/1999/xhtml" to that top element resolved my issue, > but I still don't get why this is happening, can you explain? > > More specifically, here are definitions of $result-lists and what they > produce: > > let $result-list := <div/> would work when used in the 1st code sample, but > not the second (updating function). > let $result-list := <div xmlns:="http://www.w3.org/1999/xhtml"/> resolves > the issue for the second (updating function). > > Thanks, > > France > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341 > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
FB
France Baril5 Nov 2012 17:37 #
Setup: - Empty DB feedback - DB named 'en-us' with some content. - The attached .xmq - BaseX 7.4 - Tested on Safari and Chrome with similar results TEST #1 Test: Call http://localhost:8984/restxq/testsearch?keywords=phone * Replace phone by a keyword available in your 'en-us' DB. You should get the following error: [image: Inline image 1] TEST #2 If you make the function non-updating and replace line 36 *return *(*searchhlp:analyze-user-search-and-result*(), *db:output*(* $html*)) by line 35 *return **$html* You'll see that the same $html is a working HTML page. TEST #3. Back to the updating function Comment our line 35 *return **$html* Get line 36 back *return *(*searchhlp:analyze-user-search-and-result*(), *db:output*(*$html *)) You are back to the code from TEST #1, and should get the same error.
Now, on line #13, change *let* *$result* := <div>
with *let* *$result* := <div *xmlns*=*"http://www.w3.org/1999/xhtml"*>
It works. CONCLUSION Sending the HTML through db:output changes something in the way @xmlns is processed. On Fri, Nov 2, 2012 at 1:03 PM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 96 lines
> Hi France, > > I tried a while to reproduce the issue you've been presenting, but I > didn't succeed so far. Do you think you could create a runnable > example for testing, or are there too many other components involved? > > Thanks in advance, > Christian > > ___________________________ > > Christian Grün > Box 188, Uni KN > D-78457 Konstanz > http://christian-gruen.de > > > On Thu, Nov 1, 2012 at 4:01 PM, France Baril > <france.baril at architextus.com> wrote: > > Hi, > > > > My search function used to return $html correctly > > > > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> > > <head><link href="{$cssfile}" rel="stylesheet" > > type="text/css"/><title>Search help</title> > > <script type="text/javascript" > > xmlns="http://www.w3.org/1999/xhtml > ">{app:get-google-analytics-script()/text()}</script> > > </head> > > <body> > > <div> (…) > > <div>{$result-list}</div> > > </div></body></html> > > return $html > > > > > > I am now trying to keep records of users most popular queries in my DB, > so I > > made the function an updating function and adapted the return value: > > > > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> > > <head><link href="{$cssfile}" rel="stylesheet" > > type="text/css"/><title>Search help</title> > > <script type="text/javascript" > > xmlns="http://www.w3.org/1999/xhtml > ">{app:get-google-analytics-script()/text()}</script> > > </head> > > <body> > > <div> (…) > > <div>{$result-list}</div> > > </div></body></html> > > > > return (feedback:analyze-user-search-and-result($keywords, > $result-ids, > > $this-menu, $application, $carrier, $country, $lang, $model, $os), > > db:output($html)) > > > > > > I got this error: error on line 30 at column 25: Attribute xmlns > redefined > > > > After lots of research, I figured that when using db:output, the top > element > > of $result-list is interpreted as coming from a different namespace. > Adding > > xmlns="http://www.w3.org/1999/xhtml" to that top element resolved my > issue, > > but I still don't get why this is happening, can you explain? > > > > More specifically, here are definitions of $result-lists and what they > > produce: > > > > let $result-list := <div/> would work when used in the 1st code sample, > but > > not the second (updating function). > > let $result-list := <div xmlns:="http://www.w3.org/1999/xhtml"/> > resolves > > the issue for the second (updating function). > > > > Thanks, > > > > France > > > > -- > > France Baril > > Architecte documentaire / Documentation architect > > france.baril at architextus.com > > (514) 572-0341 > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341
CG
Christian Grün6 Nov 2012 09:02 #
Hi France, when running your query, I'm getting the following result (and no error):
<html xmlns="http://www.w3.org/1999/xhtml"> <head/> <body> <div> <div>A
form...</div> <div/> </div> </body> </html>
It may be, however, that I've got the wrong contents in my en-us database? Do you have some helpful input? Thanks, Christian ___________________________ Christian Grün Box 188, Uni KN D-78457 Konstanz http://christian-gruen.de On Mon, Nov 5, 2012 at 4:37 PM, France Baril <france.baril at architextus.com>wrote:
Quoted text · France Baril · 159 lines
> Setup: > > - Empty DB feedback > - DB named 'en-us' with some content. > - The attached .xmq > - BaseX 7.4 > - Tested on Safari and Chrome with similar results > > TEST #1 > > Test: Call http://localhost:8984/restxq/testsearch?keywords=phone > * Replace phone by a keyword available in your 'en-us' DB. > > You should get the following error: > > [image: Inline image 1] > TEST #2 > > If you make the function non-updating and replace line 36 > > *return *(*searchhlp:analyze-user-search-and-result*(), *db:output*(* > $html*)) > > by line 35 > > *return **$html* > > You'll see that the same $html is a working HTML page. > > TEST #3. > > Back to the updating function > > Comment our line 35 > *return **$html* > > Get line 36 back > *return *(*searchhlp:analyze-user-search-and-result*(), *db:output*(* > $html*)) > > You are back to the code from TEST #1, and should get the same error. > > Now, on line #13, change *let* *$result* := <div> > with *let* *$result* := <div *xmlns*=*"http://www.w3.org/1999/xhtml"*> > > It works. > > CONCLUSION > Sending the HTML through db:output changes something in the way @xmlns is > processed. > > > On Fri, Nov 2, 2012 at 1:03 PM, Christian Grün <christian.gruen at gmail.com>wrote: > >> Hi France, >> >> I tried a while to reproduce the issue you've been presenting, but I >> didn't succeed so far. Do you think you could create a runnable >> example for testing, or are there too many other components involved? >> >> Thanks in advance, >> Christian >> >> ___________________________ >> >> Christian Grün >> Box 188, Uni KN >> D-78457 Konstanz >> http://christian-gruen.de >> >> >> On Thu, Nov 1, 2012 at 4:01 PM, France Baril >> <france.baril at architextus.com> wrote: >> > Hi, >> > >> > My search function used to return $html correctly >> > >> > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> >> > <head><link href="{$cssfile}" rel="stylesheet" >> > type="text/css"/><title>Search help</title> >> > <script type="text/javascript" >> > xmlns="http://www.w3.org/1999/xhtml >> ">{app:get-google-analytics-script()/text()}</script> >> > </head> >> > <body> >> > <div> (…) >> > <div>{$result-list}</div> >> > </div></body></html> >> > return $html >> > >> > >> > I am now trying to keep records of users most popular queries in my DB, >> so I >> > made the function an updating function and adapted the return value: >> > >> > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> >> > <head><link href="{$cssfile}" rel="stylesheet" >> > type="text/css"/><title>Search help</title> >> > <script type="text/javascript" >> > xmlns="http://www.w3.org/1999/xhtml >> ">{app:get-google-analytics-script()/text()}</script> >> > </head> >> > <body> >> > <div> (…) >> > <div>{$result-list}</div> >> > </div></body></html> >> > >> > return (feedback:analyze-user-search-and-result($keywords, >> $result-ids, >> > $this-menu, $application, $carrier, $country, $lang, $model, $os), >> > db:output($html)) >> > >> > >> > I got this error: error on line 30 at column 25: Attribute xmlns >> redefined >> > >> > After lots of research, I figured that when using db:output, the top >> element >> > of $result-list is interpreted as coming from a different namespace. >> Adding >> > xmlns="http://www.w3.org/1999/xhtml" to that top element resolved my >> issue, >> > but I still don't get why this is happening, can you explain? >> > >> > More specifically, here are definitions of $result-lists and what they >> > produce: >> > >> > let $result-list := <div/> would work when used in the 1st code sample, >> but >> > not the second (updating function). >> > let $result-list := <div xmlns:="http://www.w3.org/1999/xhtml"/> >> resolves >> > the issue for the second (updating function). >> > >> > Thanks, >> > >> > France >> > >> > -- >> > France Baril >> > Architecte documentaire / Documentation architect >> > france.baril at architextus.com >> > (514) 572-0341 >> > >> > _______________________________________________ >> > BaseX-Talk mailing list >> > BaseX-Talk at mailman.uni-konstanz.de >> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > >> > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com > (514) 572-0341 >
FB
France Baril12 Nov 2012 18:14 #
Maybe we don't have the same release. Our version of 74 is generally stable, so we are waiting for the official release to upgrade. Since we have a work around, I'll see if we have the issue after the upgrade. I can't see anything else that would create this issue. Thanks, France On Tue, Nov 6, 2012 at 3:02 AM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 187 lines
> Hi France, > > when running your query, I'm getting the following result (and no error): > > <html xmlns="http://www.w3.org/1999/xhtml"> <head/> <body> <div> <div>A > form...</div> <div/> </div> </body> </html> > > It may be, however, that I've got the wrong contents in my en-us database? > Do you have some helpful input? > > Thanks, > Christian > > > ___________________________ > > Christian Grün > Box 188, Uni KN > D-78457 Konstanz > http://christian-gruen.de > > > On Mon, Nov 5, 2012 at 4:37 PM, France Baril <france.baril at architextus.com > > wrote: > >> Setup: >> >> - Empty DB feedback >> - DB named 'en-us' with some content. >> - The attached .xmq >> - BaseX 7.4 >> - Tested on Safari and Chrome with similar results >> >> TEST #1 >> >> Test: Call http://localhost:8984/restxq/testsearch?keywords=phone >> * Replace phone by a keyword available in your 'en-us' DB. >> >> You should get the following error: >> >> [image: Inline image 1] >> TEST #2 >> >> If you make the function non-updating and replace line 36 >> >> *return *(*searchhlp:analyze-user-search-and-result*(), *db:output*(* >> $html*)) >> >> by line 35 >> >> *return **$html* >> >> You'll see that the same $html is a working HTML page. >> >> TEST #3. >> >> Back to the updating function >> >> Comment our line 35 >> *return **$html* >> >> Get line 36 back >> *return *(*searchhlp:analyze-user-search-and-result*(), *db:output*(* >> $html*)) >> >> You are back to the code from TEST #1, and should get the same error. >> >> Now, on line #13, change *let* *$result* := <div> >> with *let* *$result* := <div *xmlns*=*"http://www.w3.org/1999/xhtml"*> >> >> It works. >> >> CONCLUSION >> Sending the HTML through db:output changes something in the way @xmlns is >> processed. >> >> >> On Fri, Nov 2, 2012 at 1:03 PM, Christian Grün <christian.gruen at gmail.com >> > wrote: >> >>> Hi France, >>> >>> I tried a while to reproduce the issue you've been presenting, but I >>> didn't succeed so far. Do you think you could create a runnable >>> example for testing, or are there too many other components involved? >>> >>> Thanks in advance, >>> Christian >>> >>> ___________________________ >>> >>> Christian Grün >>> Box 188, Uni KN >>> D-78457 Konstanz >>> http://christian-gruen.de >>> >>> >>> On Thu, Nov 1, 2012 at 4:01 PM, France Baril >>> <france.baril at architextus.com> wrote: >>> > Hi, >>> > >>> > My search function used to return $html correctly >>> > >>> > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> >>> > <head><link href="{$cssfile}" rel="stylesheet" >>> > type="text/css"/><title>Search help</title> >>> > <script type="text/javascript" >>> > xmlns="http://www.w3.org/1999/xhtml >>> ">{app:get-google-analytics-script()/text()}</script> >>> > </head> >>> > <body> >>> > <div> (…) >>> > <div>{$result-list}</div> >>> > </div></body></html> >>> > return $html >>> > >>> > >>> > I am now trying to keep records of users most popular queries in my >>> DB, so I >>> > made the function an updating function and adapted the return value: >>> > >>> > let $html := <html xmlns="http://www.w3.org/1999/xhtml"> >>> > <head><link href="{$cssfile}" rel="stylesheet" >>> > type="text/css"/><title>Search help</title> >>> > <script type="text/javascript" >>> > xmlns="http://www.w3.org/1999/xhtml >>> ">{app:get-google-analytics-script()/text()}</script> >>> > </head> >>> > <body> >>> > <div> (…) >>> > <div>{$result-list}</div> >>> > </div></body></html> >>> > >>> > return (feedback:analyze-user-search-and-result($keywords, >>> $result-ids, >>> > $this-menu, $application, $carrier, $country, $lang, $model, $os), >>> > db:output($html)) >>> > >>> > >>> > I got this error: error on line 30 at column 25: Attribute xmlns >>> redefined >>> > >>> > After lots of research, I figured that when using db:output, the top >>> element >>> > of $result-list is interpreted as coming from a different namespace. >>> Adding >>> > xmlns="http://www.w3.org/1999/xhtml" to that top element resolved my >>> issue, >>> > but I still don't get why this is happening, can you explain? >>> > >>> > More specifically, here are definitions of $result-lists and what they >>> > produce: >>> > >>> > let $result-list := <div/> would work when used in the 1st code >>> sample, but >>> > not the second (updating function). >>> > let $result-list := <div xmlns:="http://www.w3.org/1999/xhtml"/> >>> resolves >>> > the issue for the second (updating function). >>> > >>> > Thanks, >>> > >>> > France >>> > >>> > -- >>> > France Baril >>> > Architecte documentaire / Documentation architect >>> > france.baril at architextus.com >>> > (514) 572-0341 >>> > >>> > _______________________________________________ >>> > BaseX-Talk mailing list >>> > BaseX-Talk at mailman.uni-konstanz.de >>> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> > >>> >> >> >> >> -- >> France Baril >> Architecte documentaire / Documentation architect >> france.baril at architextus.com >> (514) 572-0341 >> > >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com (514) 572-0341

⚡Generated with XQuery