Skip to content

Commit

Permalink
fix syntax in docs to import v5
Browse files Browse the repository at this point in the history
  • Loading branch information
amitguptagwl committed Sep 21, 2024
1 parent e61516a commit 4271222
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/v5/1.GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Example with no configuration

```js
const XMLParser = require("fast-xml-parser/v5/XMLParser")
const XMLParser = require("fast-xml-parser/src/v5/XMLParser")
const parser = new XMLParser();
//read xmlData your own
let result = parser.parse(xmlData, true);
Expand All @@ -12,7 +12,7 @@ let result = parser.parse(xmlData, true);
The default response of parse is built by `JsObjOutputBuilder`. FXP v5 comes with 2 more output builders. And you can set your custom output builder too to customize the output.

```js
const JsObjOutputBuilder = require("fast-xml-parser/v5/OutputBuilders/JsObjBuilder");
const JsObjOutputBuilder = require("fast-xml-parser/src/v5/OutputBuilders/JsObjBuilder");

const parser = new XMLParser({
OutputBuilder: new JsObjOutputBuilder()
Expand Down
8 changes: 4 additions & 4 deletions docs/v5/3.Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ By default `JsObjOutputBuilder` output builder is used with default options.
Example

```js
const XMLParser = require("fast-xml-parse/v5/XMLParser");
const JsObjOutputBuilder = require("fast-xml-parse/v5/OutputBuilders/JsObjBuilder");
const JsArrBuilder = require("fast-xml-parse/v5/OutputBuilders/JsArrBuilder");
const JsMinArrBuilder = require("fast-xml-parse/v5/OutputBuilders/JsMinArrBuilder");
const XMLParser = require("fast-xml-parse/src/v5/XMLParser");
const JsObjOutputBuilder = require("fast-xml-parse/src/v5/OutputBuilders/JsObjBuilder");
const JsArrBuilder = require("fast-xml-parse/src/v5/OutputBuilders/JsArrBuilder");
const JsMinArrBuilder = require("fast-xml-parse/src/v5/OutputBuilders/JsMinArrBuilder");

const xmlData = fs.readFileSync("sample.xml").toString();

Expand Down
4 changes: 2 additions & 2 deletions docs/v5/5.ValueParsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Entity and date parsers have to be set.
Example when you don't override default parsers

```js
const JsObjOutputBuilder = require("fast-xml-parser/v5/OutputBuilders/JsObjBuilder");
const JsObjOutputBuilder = require("fast-xml-parser/src/v5/OutputBuilders/JsObjBuilder");

const xmlData = `<root>
<int> 1234 </int>
Expand Down Expand Up @@ -44,7 +44,7 @@ Output
But if you override it then it will use sequence in the order you defined.

```js
const JsObjOutputBuilder = require("fast-xml-parser/v5/OutputBuilders/JsObjBuilder");
const JsObjOutputBuilder = require("fast-xml-parser/src/v5/OutputBuilders/JsObjBuilder");

const xmlData = `<root>
<int> 1234 </int>
Expand Down
15 changes: 15 additions & 0 deletions spec/importTests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "importtests",
"version": "1.0.0",
"description": "",
"main": "v5_spec.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"fast-xml-parser": "^4.5.0"
}
}
8 changes: 8 additions & 0 deletions spec/importTests/v5_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const XMLParser = require("fast-xml-parser/src/v5/XMLParser");
const XMLParser = require("fast-xml-parser/src/v5/XMLParser");

describe("XMLParser", function() {
it("should import v5", function() {
const parser = new XMLParser();
});
});

0 comments on commit 4271222

Please sign in to comment.