Tun Lin | 2 Aug 2004 03:09
Picon
Picon

Does eXist support html and javascript files in webapp?

Hi everyone,
 

Is eXist configured to support html and javascript files in webapp? This is because when I try a html with javascript as attached on localhost, it is unable to run properly. However, if I just double click on the file, it is able to run properly. 

Can anyone help, please?

Regards,

Tun Lin.

This is a more "real life" example, powered by a single XQuery script.

The sample collection contains 71098 book description (in RDF/XML) taken from our local university library.

You may use wildcards *, ? and character ranges like [a-zA-Z] for search terms

Ron Van den Branden | 2 Aug 2004 12:11
Picon

how to minimize logging / console window output

Hi,

As Wolfgang said in a previous mail 
(http://thread.gmane.org/gmane.text.xml.exist/2376), logging can be 
quite time consuming while performing eXist queries. Therefore, I wonder

a) Does the console window output affect query time performance? If so, 
how can console window output be minimized as much as possible?
b) What is the way to disable all logging? (I tried to raise all log 
levels in all configuration files to "FATAL_ERROR" but still get a lot 
of console window output).

I would be very grateful for any means to optimize the performance of 
the querying interface I'm developing. Not in the least since it should 
be able to run completely from *CD-ROM*...  Any tip would be warmly 
appreciated!

Ron

(PS: I can gather these are very basic questions; maybe they deserve 
some space in the "Performance Issues" or Wiki FAQs at some time?)

--

-- 
Ron Van den Branden
Wetenschappelijk attaché
Centrum voor Teksteditie en Bronnenstudie (CTB)
Koninklijke Academie voor Nederlandse Taal- en Letterkunde (KANTL)
Koningstraat 18 / b-9000 Gent / Belgium
e-mail : ron.vandenbranden <at> kantl.be
http://www.kantl.be/ctb/staff/ron.htm

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
Bruno Chatel | 2 Aug 2004 15:02

Re: Re: Match Count vs Hit count

Hi, 

> Hi,
> 
> > > It isn't too complex. But we would need an additional
> > > occurence count for  every term and node in the fulltext
> > > index. I don't know right now how to  encode this in a
> > > space-efficient way. I will think about it...
> >
> > So...Since the functionality of the match-count() function hasn't
> > changed in the meantime, I would like to know whether a) it is to be
> > expected soon (:-)), or b) if someone has found a clever workaround for
> > this problem.
> 
> I can add the required count attribute as an optional feature within the next 
> days, but it will add approx. one byte per word and text node to the size of 
> words.dbx. We'll have to see if this is ok.

This would be very nice to have this feature ?
Do you think that this "on byte per word and text node" will impact performances ?

Thanks

-- bruno -- 
Bruno Chatel
Tel : (+33) (0)4 96 11 14 57
bcha <at> chadocs.com
--------------------------------------

> 
> Wolfgang
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
> digital self defense, top technical experts, no vendor pitches, 
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Exist-open mailing list
> Exist-open <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/exist-open
> 

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
Laurent Trillaud | 2 Aug 2004 16:45
Picon

BUG XQuery with empty file

Hi
Hi all,
I have a very weird problem.
I start exist with an empty database.
I populate the database from scratch in batch mode with the eXist client. I
put some xml files and also an empty file like DontLetThisDirEmpty.txt, that
is also inserted with success.
I'am able to use xquery, for example the exist/xquery/functions.xq. The
query shows me the builtin function. I'am able also to see my data.
Now I stop exist and in restart it. If use again exist/xquery/functions.xq I
have this exception:
Original Exception: java.lang.NullPointerException	at
org.exist.security.Permission.setOwner(Permission.java:190)	at
org.exist.dom.DocumentImpl.read(DocumentImpl.java:521)	at
org.exist.collections.Collection.read(Collection.java:520)	at
org.exist.storage.NativeBroker.getCollection(NativeBroker.java:592)	at
org.exist.storage.NativeBroker.getCollection(NativeBroker.java:539)	at
org.exist.collections.Collection.allDocs(Collection.java:254)	at
org.exist.collections.Collection.allDocs(Collection.java:260)	at
org.exist.collections.Collection.allDocs(Collection.java:240)	at
org.exist.xmldb.LocalXPathQueryService.execute(LocalXPathQueryService.java:1
55)	at
org.exist.xmldb.LocalXPathQueryService.execute(LocalXPathQueryService.java:1
43)	at
org.exist.cocoon.XQueryGenerator.generate(XQueryGenerator.java:253)	at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLP
ipeline(AbstractProcessingPipeline.java:581)	at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
.processXMLPipeline(AbstractCachingProcessingPipeline.java:196)	at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(Abs
tractProcessingPipeline.java:525)	at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(Seri
alizeNode.java:155)	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
keNodes(AbstractParentProcessingNode.java:84)	at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
e(PreparableMatchNode.java:165)	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
keNodes(AbstractParentProcessingNode.java:107)	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(Pipel
ineNode.java:162)	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
keNodes(AbstractParentProcessingNode.java:107)	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(Pipe
linesNode.java:136)	at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcess
or.java:371)	at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcess
or.java:312)	at
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNod
e.java:133)	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
keNodes(AbstractParentProcessingNode.java:84)	at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
e(PreparableMatchNode.java:165)	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
keNodes(AbstractParentProcessingNode.java:107)	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(Pipel
ineNode.java:162)	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
keNodes(AbstractParentProcessingNode.java:107)	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(Pipe
linesNode.java:136)	at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcess
or.java:371)	at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcess
or.java:312)	at org.apache.cocoon.Cocoon.process(Cocoon.java:656)	at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366)	at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandl
er.java:293)	at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:581)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1687)	at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext
.java:544)	at
org.mortbay.http.HttpContext.handle(HttpContext.java:1637)	at
org.mortbay.http.HttpServer.service(HttpServer.java:875)	at
org.mortbay.http.HttpConnection.service(HttpConnection.java:806)	at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956)	at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:823)	at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:290)	at
org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743)	at
java.lang.Thread.run(Thread.java:534)

If I don't put this empty file, I have no crash.
Weird isn't it?
Laurent Trillaud

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
Igor Abade V. Leite | 2 Aug 2004 22:01
Picon

Quote escaping error?

Hi there,

	I swear I did my best to try to figure this out. I searched the
archives for a suitable solution, but I couldn't find anything.

	The problem is: I am trying to call a function inside an
attribute constructor, and the XQuery parser is complaining with a 
XMLDBException
<org.xmldb.api.base.XMLDBException: line 11:173: unexpected token: ">

	I tried all of the forms below:

	<my-element attr="{ fn:my-func(""my param"") }"/>
	<my-element attr='{ fn:my-func(""my param"") }'/>
	<my-element attr="{ fn:my-func('my param') }"/>
	<my-element attr="{ fn:my-func(&quot;my param&quot;) }"/>

	None of them worked. Am I doing something wrong? Or is it a bug?

	Thanks in advance,
		Igor

	P.S.: I'm using 1.0b1

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
Igor Abade V. Leite | 2 Aug 2004 23:13
Picon

Variable [x] is not bound [at line x, column y]

Can somebody tell if am I doing something wrong? I just can't tell what's 
going wrong.

I am passing a parameter to a user-defined function, but if I try to access 
the referred parameter, I get an error on line 4, column 20 (some items were 
shortened for clarity; they contained only literal data):

Please, notice that I call my function local:process() in the middle of the 
XML output, passing string literals as parameters. It doesn't seem to work.

-----------------------------------------
xquery version "1.0";

declare function local:process($label as xs:string, $prefix as xs:string, 
$list as element()+) as node {
    <teste tipo="{$label}"/>
};

string('<?xml version="1.0" encoding="ISO-8859-1"?>'),
string('<?xml-stylesheet ...?>'),
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <tabbox id="Tab" flex="1">
       <tabs flex="1">
           <tab label="..."/>
           <tab label="..."/>
           <tab label="..."/>
       </tabs>
       <tabpanels flex="1">
           <tabpanel id="contents">
               <tree flex="1" >
                   <treecols>
                       <treecol id=" ..."/>
                       <treecol id="..."/>
                   </treecols>
                   <treechildren>
                     {
                         for $library in //library
                         order by ( <at> caption)
                         return
                           <treeitem container="true">
                               <treerow>
                                   <treecell label="{$library/ <at> caption}"/>
                               </treerow>
                               <treechildren>
                                 {
                                     for $pkgGroup in $library/package-group
                                     order by ( <at> name)
                                     return
                                       <treeitem container="true">
                                           <treerow>
                                               <treecell label="..."/>
                                           </treerow>
                                           <treechildren>
                                            {
local:process("Classes", "Classe ", $pkgGroup/packages)
                                            }
                                           </treechildren>
                                       </treeitem>
                                 }
                               </treechildren>
                           </treeitem>
                     }
                   </treechildren>
               </tree>
           </tabpanel>
           <tabpanel id="index">
           </tabpanel>
           <tabpanel id="search">
           </tabpanel>
       </tabpanels>
    </tabbox>
</window>

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
Tun Lin | 3 Aug 2004 03:18
Picon
Picon

Javascript - a client side scripting, why unable to load xml document in javascript in eXist?

Hi eXist experts,
 
I have a problem regarding javascript in eXist. 

As we all know Javascript is a client side scripting, why is the browser unable to load xml document in javascript in eXist, giving me an error "object required"? It seems it is unable to load the rdf document in javascript.

Can anyone help?

Below is a fragment of the code I used:

 

<script type="text/javascript">
<!--
var arrTags = new Array();
var uarrTags = new Array();
var strContent = "";
var ie = (typeof window.ActiveXObject != 'undefined');
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var xmlDoc;

function importXML(file)
{
  if (moz)
  {
    xmlDoc = document.implementation.createDocument("", "doc", null);
    xmlDoc.onload = readXML;
    xmlDoc.load(file);
  }
  else if (ie)
  {
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    while(xmlDoc.readyState != 4) {};
    xmlDoc.load(file);
    root = xmlDoc.documentElement;
   crawl(root, 0);
    readXML();
  }
}

function readXML()
{
  root = xmlDoc.documentElement;
  crawl(root, 0);
  uarrTags=findUniqueTags(arrTags);
  for ( var i = 0; i < uarrTags.length; i++ )
  {
        document.myform.field1.options[i].text  = uarrTags[i];
        document.myform.field1.options[i].value = uarrTags[i];
        document.myform.field2.options[i].text  = uarrTags[i];
        document.myform.field2.options[i].value = uarrTags[i];
  }
  //if (document.getElementById)
  //{
    //document.getElementById("content").innerHTML = strContent + document.getElementById("content").innerHTML;
 //document.myform.example.options[0]=strContent;
  //}
  //else if (document.all)
  //{
  //  document.all["content"].innerHTML = strContent + document.all["content"].innerHTML;
  //  document.myform.example.options[0]=strContent;
  //}
}

function crawl(node,level){
  var test = node.nodeName;
  if (node.nodeType == 3 /*Node.TEXT_NODE*/)
  {
    // Don't process empty text nodes in Mozilla (IE ignores them anyway).
  }
  else
  {
    var indent = "";
    var index=0;
    for (var i = 0; i < level; i++)
    {
      //indent = indent + "&nbsp;&nbsp;&nbsp;&nbsp;";
    }
    //strContent = strContent + "<p>";
    //strContent = strContent + indent + "attributes = " + node.attributes + "<br/>";
    //strContent = strContent + indent + "childNodes = " + node.childNodes + "<br/>";
    //strContent = strContent + indent + "firstChild = " + node.firstChild + "<br/>";
    //strContent = strContent + indent + "lastChild = " + node.lastChild + "<br/>";
    //strContent = strContent + indent + "nextSibling = " + node.nextSibling + "<br/>";
    //strContent = strContent + indent + "nodeName = " + node.nodeName + "<br/>";
    strContent = strContent + node.nodeName + "<br/>";
 var no = node.nodeName;
 var tokenizer = no.split(":")
 if(no!="#text")
 {
  arrTags.push(tokenizer[1]);
 }
    //if(strContent.equals("rdf:RDF"))
    //{
 //strContent = strContent;
    //}

 //index++;
    //arrTags.add(strContent);
    //document.myform.example.options[0]=strContent;
    //strContent = strContent + indent + "nodeType = " + node.nodeType + "<br/>";
    //strContent = strContent + indent + "nodeValue = " + node.nodeValue + "<br/>";
    //strContent = strContent + indent + "ownerDocument = " + node.ownerDocument + "<br/>";
    //strContent = strContent + indent + "parentNode = " + node.parentNode + "<br/>";
    //strContent = strContent + indent + "previousSibling = " + node.previousSibling + "<br/>";
    if (node.attributes)
    {
      if (node.attributes.length > 0)
      {
        for (var i = 0; i < node.attributes.length; i++) {
          attribute = node.attributes.item(i);
          //strContent = strContent + indent + "&nbsp;&nbsp;&nbsp;&nbsp;" + "attribute name = " + attribute.name + "<br/>";
          //strContent = strContent + indent + "&nbsp;&nbsp;&nbsp;&nbsp;" + "attribute specified = " + attribute.specified + "<br/>";
          //strContent = strContent + indent + "&nbsp;&nbsp;&nbsp;&nbsp;" + "attribute value = " + attribute.value + "<br/>";
        }
      }
    }
  }

  if (node.firstChild) {
    crawl(node.firstChild, level + 1);
  }
  if (node.nextSibling) {
    crawl(node.nextSibling, level);
  }
  strContent = strContent + "</p>";
}

function findUniqueTags(arrAllTags)
{

var arrUniqueTags = new Array();
var tagsPresentCounter = 0;

for (i=0; i<arrAllTags.length; i++) {

var foundIt = false;

for (j=0; j<arrUniqueTags.length; j++) {
if (arrUniqueTags[j] == arrAllTags[i]) { foundIt = true; break; } }

if (foundIt != true) {

//Meaning it's not already in tagsPresent

arrUniqueTags[tagsPresentCounter] = arrAllTags[i]; tagsPresentCounter++; }

}

return arrUniqueTags;

}

function isEmptyNode(arg)
{
  reg = /\n/g;
  arg = arg.replace(reg, "");
  reg = / /g;
  arg = arg.replace(reg, "");
  if (arg.length == 0)
  {
    return true;
  }
  return false;
}
//-->
</script>
</head>
<body onLoad="importXML('biblio.rdf');">      

Tun Lin | 3 Aug 2004 09:05
Picon
Picon

xquery/biblio.xml question.

Hi everyone,
 
It seems the biblio.xml is transformed using xsl in eXist but I am not sure which xsl is using.
 
Can anyone tell me?
 
Also, may I know what is the sitemap.xmap used for?
 
Hope to hear from you soon.
 
Alessandro Evangelista | 3 Aug 2004 11:50
Picon

Document name changes across "store" calls

Hi there

I am using eXist-1.0b snapshot from 27 Jul 2004. My program - snippets 
reported below - creates a new XMLResource and store in the database. 
Then, via XPathQueryService the newly created document is retrieved by 
its name and modified. When the document is stored after the 
modification its name is changed for example from "1091495850136.xml" to 
"1091495850136.xml_-1" where "-1" is the id associated with the 
RemoteXMLResource.

I could not really get the behavior RemoteXMLResource.getId(). Any help?

Ale

------------------------------------------------------------------
RemoteXMLResource.getId():
------------------------------------------------------------------

public String getId() throws XMLDBException {
        if (id == null || id.equals("1"))
            return documentName;
        return documentName + '_' + id;
    }

------------------------------------------------------------------
My program
------------------------------------------------------------------

// Create a document
XMLResource document = (XMLResource) 
_xmldbCollection.createResource(customIdentifier
          + ".xml", "XMLResource");
ContentHandler ch = document.setContentAsSAX();

... feed ch here....

// Store the newly created document
_xmldbCollection.storeResource(document);

// Retrieve via XPathQueryService the document and modify it
XPathQueryService queryService = (XPathQueryService) _xmldbCollection
          .getService("XPathQueryService", "1.0");
      ResourceSet set = queryService.query("document(\"" + id + "\")");
.....

// Now store the document again
_xmldbCollection.storeResource(document);

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
Wolfgang Meier | 3 Aug 2004 15:11
Picon

Re: Quote escaping error?

> 	The problem is: I am trying to call a function inside an
> attribute constructor, and the XQuery parser is complaining with a
> XMLDBException
> <org.xmldb.api.base.XMLDBException: line 11:173: unexpected token: ">
>
> 	I tried all of the forms below:
>
> 	<my-element attr="{ fn:my-func(""my param"") }"/>
> 	<my-element attr='{ fn:my-func(""my param"") }'/>
> 	<my-element attr="{ fn:my-func('my param') }"/>
> 	<my-element attr="{ fn:my-func(&quot;my param&quot;) }"/>
>
> 	None of them worked. Am I doing something wrong? Or is it a bug?

I tested this with the current CVS version and

<my-element attr="{ fn:my-func('my param') }"/>

definitely works. 

However, using a single quote for the attribute doesn't work. The "" escape 
also generates an error if used within an attribute value. These are 
obviously not correctly recognized by the lexer. I have to fix that.

Wolfgang

-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com

Gmane