Re: [basex-talk] do not interpret text nodes as embedded expressions (Expecting '}' but found...)

2013-10-23 Thread Erdal Karaca
FYI: solved using parse-xml():

QueryProcessor query = new QueryProcessor("replace node . with
parse-xml($replacement)", context);
query.bind("replacement", "main(){int i=0;}");



2013/10/18 Erdal Karaca 

> Sorry, all, here is a more specific question:
>
> The query is constructed at runtime and executed using the QueryProcessor
> command.
>
> Query: replace node . with main(){int i=0;}
> Execution error: Expecting '}' found ...
>
> If I try to bind the replacement as a global parameter, the error message
> is: Single element, text, attribute, comment or pi expected as replace
> target.
>
> The java code:
>
> QueryProcessor query = new QueryProcessor("replace node . with
> $replacement", context);
> query.bind("replacement", "main(){int i=0;}");
>
> The problem with escpaing the curly braces (or wrapping all text content
> nodes and maybe attribute values, too) is the extra overhead which would
> decrease performance.
>
>
>
> 2013/10/18 Wendell Piez 
>
>> Erdal,
>>
>> Escaping the curly braces by doubling them would be the "normal" way.
>> You ask for a better way; can you be more specific as to what needs to
>> be improved? Would this be an improvement?
>>
>> let $expr := 'main(){int i=0;}'
>> let $x := doc({ $expr })
>> return ...
>>
>> Cheers, Wendell
>> Wendell Piez | http://www.wendellpiez.com
>> XML | XSLT | electronic publishing
>> Eat Your Vegetables
>> _oo_o_o___oooo_^
>>
>>
>> On Fri, Oct 18, 2013 at 9:05 AM, Erdal Karaca 
>> wrote:
>> > Hi all,
>> > How can I process this query in basex:
>> >
>> > let $x := doc(main(){int i = 0;})
>> > return replace value of node $x with ""
>> >
>> >
>> > There are text contents that contain, for example, c code with curly
>> braces
>> > which I do not want to be interpreted as embeded expressions.
>> >
>> > As a workaround I could escape the curly braces, But, is there a better
>> > way/option to suppress interpreting text contents that look like
>> embedded
>> > expressions?
>> >
>> > Thanks!
>> >
>> >
>> > ___
>> > BaseX-Talk mailing list
>> > BaseX-Talk@mailman.uni-konstanz.de
>> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>> >
>> ___
>> BaseX-Talk mailing list
>> BaseX-Talk@mailman.uni-konstanz.de
>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>>
>
>
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] Feature request: output params for db:replace

2013-10-23 Thread France Baril
Hi,

I have a feature request.

I have a nice file with just the correct indent, that I was able to create
by adding the xml:space="preserve" attribute to the root before making my
inserts. [From previous thread]

Ex. 
   This is a test sentence.
 

Note: I can't use the output indent = no declaration at the top of my query
because I'm in a library module, and I need this function to stay there for
sharing.

Now, I can't save the content like this (with @xml:space). My DTD doesn't
allow for xml:space="preserve", and I don't want it to. Authors can't get
the correct indent (based on our DTD) in the editor as long as the
xml:space="preserve" remains.

If I apply:

*let* *$clean-file* := *copy* *$copy* := *$new*
   *modify* (*delete* *node* *$copy*/*/*
@xml:space*)
   *return **$copy*

file:write('file.xml', $clean-file, $param), where param contains
indent="no". It saves correctly, indicating that removing the @xml:space
did not cause a the insertion of an indent space between  and .

However, the db:replace('db', 'path', $clean-file) function forces an
indent on the content between the  and the . Since this is a BaseX
function, and not an XQuery fonction, I'm hoping we could
get db:replace('db', 'path', $clean-file, $param), where param can include
output params such as indent=no.

Thank you!


-- 
France Baril
Architecte documentaire / Documentation architect
france.ba...@architextus.com
(514) 572-0341
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Out Of Main Memory error while creating BaseX DB

2013-10-23 Thread Christian GrĂ¼n
Hi Elangovan,

> I am using BaseX to evaluate Xpaths (Xqueries) for larger size of XML files.
> I have created BaseX database initially using CreateDB.execute(ctx) API.

What do you mean with "CreateDB.execute(ctx) API"? Could you provide
us with a minimized example?

Best,
Christian


>
> And every time when I need to evaluate Xpath I open database using
> Open("database name") API and get a context. Using this context I evaluate
> the xpath. Once I complete my evaluation I close the context using
> Close.execute(ctx) API.
>
> My application is running without any issues. If the server runs for few
> weeks, I have observed "Out Of Main memory error" while updating the BaseX
> database.
>
> Could any one please help me in this issue. Is there any possibility of
> memory leak in BaseX in my work flow?
>
> Note: I am using same CreateDB(...) API to update / overwrite the existing
> Database.
>
> XML file Size may vary from 3Mb to 10 Mb.
>
> --
> Regards,
> Elango.
>
> ___
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] Out Of Main Memory error while creating BaseX DB

2013-10-23 Thread elangovan MuthuSwamy
Hi All,

I am using BaseX to evaluate Xpaths (Xqueries) for larger size of XML
files. I have created BaseX database initially using *CreateDB*.execute(ctx)
API.

And every time when I need to evaluate Xpath I open database using
Open("database name") API and get a context. Using this context I evaluate
the xpath. Once I complete my evaluation I close the context using
Close.execute(ctx) API.

My application is running without any issues. If the server runs for few
weeks, I have observed "Out Of Main memory error" while updating the BaseX
database.

Could any one please help me in this issue. Is there any possibility of
memory leak in BaseX in my work flow?

Note: I am using same CreateDB(...) API to update / overwrite the existing
Database.

XML file Size may vary from 3Mb to 10 Mb.

-- 
Regards,
Elango.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk