basex

Run xquery on updated xml file


Im new to BaseX so I apologize if my question sounds silly. I was looking for a tool where I can simply run xquery on an xml with ease so I found your tool basex which seems very powerful and probably overkill to what Im trying to do because I noticed the complexity with the steps I have to take in order to add new xml by creating new database ...etc. Anyway I managed to create the "database" with single xml file, I copied and pasted my xquery on the editor labeled as file and click the green run button and it worked the first time, I opened the xml file and made a change to get different result but every time I ran the query I get the same result as the first time like nothing was changed! so after spending a lot of time I noticed if I right click on the xml file then click "Set as Context" then I will get the updated result! My question is , do I have to do that every time I change and save the xml? Im trying to test my xquery on different input scenarios.


Solution

  • BaseX can be used with and without database instances. If you use the “Set as Context” feature in the GUI, you don’t need to create a database from your documents, as all queries will be executed on your local file.

    If you do create a database, the database contents will exist separately from your input documents, and you can use XQuery Update and the functions from the Database Module to modify the database contents.