Dear Team,
I am trying to insert few nodes in a XML File. But in reality the nodes are not inserting in the XML File!!
Below is my query
for $x in doc('C:\sample.xml')//CInfos return insert node <Info><Name>James Stuart</Name><Key>7709422869</Key></Info> as last into $x
I tried with another query -
insert node <Info> <Name>James Stuart</Name> <Key>7709422869</Key> </Info> as last into doc('C:\sample.xml')//CInfos
This too not working
If I create a XML DB and then it works... What am I missing?
Hello John,
All updates in BaseX are performed on database nodes or in main memory as specified by the XQuery Update spec. You are trying to update a document in the filesystem. You can update thr document in main mamory and afterwards store it using the fn:put function (see http://www.w3.org/TR/xquery-update-10/#id-func-put).
Cheers, Dirk
On 06/14/2013 10:29 AM, John Best wrote:
Dear Team,
I am trying to insert few nodes in a XML File. But in reality the nodes are not inserting in the XML File!!
Below is my query
for $x in doc('C:\sample.xml')//CInfos return insert node <Info><Name>James Stuart</Name><Key>7709422869</Key></Info> as last into $x
I tried with another query -
insert node <Info> <Name>James Stuart</Name> <Key>7709422869</Key> </Info> as last into doc('C:\sample.xml')//CInfos
This too not working
If I create a XML DB and then it works... What am I missing?
-- Have a nice day JBest
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi John,
there is one (pretty unknown) option called WRITEBACK [1], which can also be activated via -u on command line [2]; it ensures that changes will be written back to the original file.
Best, Christian
[1] http://docs.basex.org/wiki/Options#WRITEBACK [2] http://docs.basex.org/wiki/Startup_Options#BaseX_Standalone _____________________________________
Hello John,
All updates in BaseX are performed on database nodes or in main memory as specified by the XQuery Update spec. You are trying to update a document in the filesystem. You can update thr document in main mamory and afterwards store it using the fn:put function (see http://www.w3.org/TR/xquery-update-10/#id-func-put).
Cheers, Dirk
On 06/14/2013 10:29 AM, John Best wrote:
Dear Team,
I am trying to insert few nodes in a XML File. But in reality the nodes are not inserting in the XML File!!
Below is my query
for $x in doc('C:\sample.xml')//CInfos return insert node <Info><Name>James Stuart</Name><Key>7709422869</Key></Info> as last into $x
I tried with another query -
insert node <Info> <Name>James Stuart</Name> <Key>7709422869</Key> </Info> as last into doc('C:\sample.xml')//CInfos
This too not working
If I create a XML DB and then it works... What am I missing?
-- Have a nice day JBest
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de