Hi all,
How is JSON converted to XML in order to ADD to a database?
JSONObject jsonTweet = tweets.getJSONObject(Long.toString(id)); xmlStringTweet = XML.toString(jsonTweet);
alternately, could the JSON simply get directly added to the database?
see also: https://stackoverflow.com/q/60034291/262852
thanks,
Thufir
How is JSON converted to XML in order to ADD to a database?
JSONObject jsonTweet = tweets.getJSONObject(Long.toString(id)); xmlStringTweet = XML.toString(jsonTweet);
Do you know how to create a database and add documents as JSON via the BaseX GUI? If yes, you can enable the InfoView panel, and you will see the commands that are called in the background. In the next step, you can call these commands with Java.
See [1] for the available BaseX options, and see [2] for an example the assigns an option via the SET command.
[1] http://docs.basex.org/wiki/Options [2] https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/or...
is this what you're referring to?
Command: SET PARSER json Command: CREATE DB tweet /home/thufir/json/tweet.json Result: Database 'tweet' created in 166.11 ms.
Which, yes, is exactly the sequence which I'm looking to capture or replicate -- but not from a file as above. It's more the usage of "Add" to add a string.
I've converted the JSON to XML, so that rather than tweet.json I have tweet.xml for convenience.
Using either ADD or CREATE is my goal -- but not with files. Trying to use Strings.
thanks,
Thufir
On 2020-02-03 6:40 a.m., Christian Grün wrote:
How is JSON converted to XML in order to ADD to a database?
JSONObject jsonTweet = tweets.getJSONObject(Long.toString(id)); xmlStringTweet = XML.toString(jsonTweet);
Do you know how to create a database and add documents as JSON via the BaseX GUI? If yes, you can enable the InfoView panel, and you will see the commands that are called in the background. In the next step, you can call these commands with Java.
See [1] for the available BaseX options, and see [2] for an example the assigns an option via the SET command.
[1] http://docs.basex.org/wiki/Options [2] https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/or...
basex-talk@mailman.uni-konstanz.de