-
Notifications
You must be signed in to change notification settings - Fork 2
Using XML
If you want to use xml instead of json, it's quite simple. You just need to replace the json-adapter with a xml-adapter and install the xml-js
api
install xml-js
using npm
npm i xml-js
install xml-js
using yarn
yarn add xml-js
(You can remove the import of the json adapter and replace it with this one)
Import using Typescript
import { XMLFileAdapter } from 'nscdb/xml_adapter';
Import using Javascript
const { XMLFileAdapter } = require('nscdb/xml_adapter');
When creating a database you have to use the XMLFileAdapter instead of the JsonFileAdapter.
let database = await createDatabase(new XMLFileAdapter ("./database.xml"));
From here it is the same as with the json adapter. The database should act exactly the same.
(You can remove the import of the json adapter and replace it with this one)
Import using Typescript
import { SyncXMLFileAdapter } from 'nscdb/xml_adapter';
Import using Javascript
const { SyncXMLFileAdapter } = require('nscdb/xml_adapter');
When creating a database you have to use the SyncXMLFileAdapter instead of the SyncXMLFileAdapter.
let database = createDatabase(new SyncXMLFileAdapter ("./database.xml"));
From here it is the same as with the json adapter. The database should act exactly the same.