[xquery-talk] run time error

andrew welch andrew.j.welch at gmail.com
Tue May 9 10:38:36 PDT 2006


On 5/9/06, fatma helmy <fatmahelmy2000 at yahoo.com> wrote:
> dear all
> i used saxon xquery to run  this xquery.
> declare function local:pathOfNode($node)
> {if(empty($node/..)) then "" else
> concat(local:pathOfNode($node/..), "/",
> local-name($node))};
> let $j:= doc("test.XML")
> let $paths := for $n in $j//* return
> local:pathOfNode($n)
> let $childpaths:= (for $item in $paths where
> count(tokenize(substring-after(string($item),
> "/"),"/")) >1 return $item)
> for $p in distinct-values($childpaths)
> let $toks:= tokenize(string($p),"/")
> let $papa:= string-join(subsequence($toks, 1,
> count($toks) - 1), "/")
> let $var:=substring-after(string($p),"/")
> let $leafs
> :=$j//text()[normalize-space()][string-join(ancestor-or-self::element()/name(),'/')
> eq $var]
> return
> <STATISTICS>
> <PATH>
> {string($p)}
> </PATH>
> <RATIO>
> {string( round( count($childpaths[.=$p]) div
> count($paths[.=$papa]) * 100 ) )}
> </RATIO>
> {for $val in distinct-values($leafs)
> return <value-per-path value='{normalize-space($val)}'
>
> count='{count($leafs[. eq normalize-space($val)])}'/>}
>
> </STATISTICS>
>
> i put it in t.xq file and supplied an xml file
> test.xml size 11MG
> and used this command
>
>
> C:\Documents and
> Settings\Csc_Staff.MIU-NET\Desktop\saxonsa8-7-1j>
> java -cp saxon
> 8.jar net.sf.saxon.Query -t -s test.xml  t.xq  > rere
>
> it produced this output
>
> Saxon 8.7.1J from Saxonica
> Java version 1.4.2_06
> Compiling query from t.xq
> Compilation time: 297 milliseconds
> Processing
> file:/C:/Documents%20and%20Settings/Csc_Staff.MIU-NET/Desktop/saxonsa
> 8-7-1j/test.xml
> Building tree for
> file:/C:/Documents%20and%20Settings/Csc_Staff.MIU-NET/Desktop/
> saxonsa8-7-1j/test.XML using class
> net.sf.saxon.tinytree.TinyBuilder
> Exception in thread "main" java.lang.OutOfMemoryError
>
> and rere file is empty !!!!!

Use the -Xmx switch to give the JVM more memory:

 java -Xmx512m -cp saxon8.jar net.sf.saxon.Query -t -s test.xml  t.xq  > rere

cheers
andrew



More information about the talk mailing list