From 291fe7380206f20355abc971946830dbf72d07f0 Mon Sep 17 00:00:00 2001 From: Chris Barr <463685+FiniteLooper@users.noreply.github.com> Date: Wed, 10 Jan 2024 19:21:28 -0500 Subject: [PATCH] Spelling fixes in Docs & Test Descriptions (#580) * Spelling fixes in docs * Spelling fixes in test names * Spelling fix in type definitions * small grammar fix * Add spaces around MD checkboxes in PR template to allow real checkboxes to show in the markdown output --------- Co-authored-by: Chris B --- .github/pull_request_template.md | 6 +++--- docs/CONTRIBUTING.md | 8 ++++---- docs/v3/docs.md | 2 +- docs/v4/1.GettingStarted.md | 2 +- docs/v4/2.XMLparseOptions.md | 4 ++-- docs/v4/3.XMLBuilder.md | 16 ++++++++-------- docs/v4/5.Entities.md | 4 ++-- docs/v4/7.PITags.md | 2 +- spec/attr_spec.js | 10 +++++----- spec/entities_spec.js | 12 ++++++------ spec/j2x_spec.js | 2 +- spec/pi_spec.js | 2 +- spec/transform_tagname_spec.js | 2 +- spec/unpairedTags_spec.js | 4 ++-- spec/validator_spec.js | 2 +- src/fxp.d.ts | 4 ++-- 16 files changed, 41 insertions(+), 41 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a668b999..a229362e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,9 +7,9 @@ # Type Please mention the type of PR -* [ ]Bug Fix -* [ ]Refactoring / Technology upgrade -* [ ]New Feature +* [ ] Bug Fix +* [ ] Refactoring / Technology upgrade +* [ ] New Feature **Note** : Please ensure that you've read contribution [guidelines](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/CONTRIBUTING.md) before raising this PR. If your PR is in progress, please prepend `[WIP]` in PR title. Your PR will be reviewed when `[WIP]` will be removed from the PR title. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 81716697..544f0583 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,9 +1,9 @@ # Thanks -I would like to thank you for your valuable time and effort and applogies if this PR is rejected due to any reason. +I would like to thank you for your valuable time and effort and apologies if this PR is rejected due to any reason. -This repository is written with the aim of providing high performance not in terms of speed only but comfortability of the user as well. +This repository is written with the aim of providing high performance, not in terms of speed only, but comfortably of the user as well. -## No rights are resserved +## No rights are reserved Your contribution is valuable. We try to mention your name on README with the avatar. We can't promise to pay you for your contribution. @@ -11,7 +11,7 @@ Your contribution is valuable. We try to mention your name on README with the av Here is the check list to publish any change * Changes are not half implemented due to the library limitation or any other reason. -* Changes are well discussed by raising github issue. So they are well known by other contributers and users +* Changes are well discussed by raising github issue. So they are well known by other contributors and users * Echoing the above point. The purpose / goal for the PR should be mentioned in the description. * Multiple unrelated changes should not be clubbed in single PR. * Please run perf tests `$ node benchmark\XmlParser.js` or `$ node benchmark\XmlBuilder.js` before and after the changes. And mention it in PR description. diff --git a/docs/v3/docs.md b/docs/v3/docs.md index acad4fcc..8aa5e90f 100644 --- a/docs/v3/docs.md +++ b/docs/v3/docs.md @@ -77,7 +77,7 @@ Validator returns the following object in case of error; * **cdataTagName** : If specified, parser parse CDATA as nested tag instead of adding it's value to parent tag. * **cdataPositionChar** : It'll help to covert JSON back to XML without losing CDATA position. * **parseTrueNumberOnly**: if true then values like "+123", or "0123" will not be parsed as number. -* **arrayMode** : When `false`, a tag with single occurrence is parsed as an object but as an array in case of multiple occurences. When `true`, a tag will be parsed as an array always excluding leaf nodes. When `strict`, all the tags will be parsed as array only. When instance of `RegEx`, only tags will be parsed as array that match the regex. When `function` a tag name is passed to the callback that can be checked. +* **arrayMode** : When `false`, a tag with single occurrence is parsed as an object but as an array in case of multiple occurrences. When `true`, a tag will be parsed as an array always excluding leaf nodes. When `strict`, all the tags will be parsed as array only. When instance of `RegEx`, only tags will be parsed as array that match the regex. When `function` a tag name is passed to the callback that can be checked. * **tagValueProcessor** : Process tag value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only. * **attrValueProcessor** : Process attribute value during transformation. Like HTML decoding, word capitalization, etc. Applicable in case of string only. * **stopNodes** : an array of tag names which are not required to be parsed. Instead their values are parsed as string. diff --git a/docs/v4/1.GettingStarted.md b/docs/v4/1.GettingStarted.md index a75f3ed6..1624448c 100644 --- a/docs/v4/1.GettingStarted.md +++ b/docs/v4/1.GettingStarted.md @@ -29,7 +29,7 @@ if(XMLValidator.validate()){ let jsonObj = parser.parse(xmlData); const builder = new XMLBuilder(); - let samleXmlData = builder.build(jsonObj); + let sampleXmlData = builder.build(jsonObj); } ``` diff --git a/docs/v4/2.XMLparseOptions.md b/docs/v4/2.XMLparseOptions.md index 407dff35..b59f125c 100644 --- a/docs/v4/2.XMLparseOptions.md +++ b/docs/v4/2.XMLparseOptions.md @@ -620,7 +620,7 @@ const XMLdata = ` ``` ## processEntities -Set it to `true` (default) to process default and DOCTYPE entites. Check [Entities](./5.Entities.md) section for more detail. If you don't have entities in your XML document then it is recommanded to disable it `processEntities: false` for better performance. +Set it to `true` (default) to process default and DOCTYPE entities. Check [Entities](./5.Entities.md) section for more detail. If you don't have entities in your XML document then it is recommended to disable it `processEntities: false` for better performance. ## removeNSPrefix Remove namespace string from tag and attribute names. @@ -854,7 +854,7 @@ Output } } ``` -If the tag value consists whitespaces and `trimValues: false` then value will not be parsed even if `parseTagValue:true`. Similarly, if `trimValues: true` and `parseTagValue:false` then surrounding whitespace will be removed. +If the tag value consists of whitespace only and `trimValues: false` then value will not be parsed even if `parseTagValue:true`. Similarly, if `trimValues: true` and `parseTagValue:false` then surrounding whitespace will be removed. ```js const options = { diff --git a/docs/v4/3.XMLBuilder.md b/docs/v4/3.XMLBuilder.md index 2d640714..713b1481 100644 --- a/docs/v4/3.XMLBuilder.md +++ b/docs/v4/3.XMLBuilder.md @@ -54,14 +54,14 @@ const output = builder.build(cars); To recognize attribute properties in the JS object so that they can be trimmed. ## attributesGroupName -To recognize attribute properties group in the JS object so that they can be trimmed and can form attribute expresstion for a tag. +To recognize attribute properties group in the JS object so that they can be trimmed and can form attribute expression for a tag. This property is not supported when `preserveOrder: true` because attributes are already grouped. ## attributeValueProcessor -To customize the bahaviour of parsing an attribute value to the string value. It accepts attribute name and value. +To customize the behavior of parsing an attribute value to the string value. It accepts attribute name and value. ## cdataPropName -To recognize CDATA properties in a JS object so that they can be transformed correcty. +To recognize CDATA properties in a JS object so that they can be transformed correctly. Eg Input @@ -113,7 +113,7 @@ Output It is recommended to use `preserveOrder: true` when you're parsing XML to js object and building the XML back. So that the order of CDATA is maintained. ## commentPropName -To recognize comments in a JS object so that they can be transformed correcty. +To recognize comments in a JS object so that they can be transformed correctly. Eg @@ -179,7 +179,7 @@ Applicable only if `format:true` is set. When you parse a XML using XMLParser with `preserveOrder: true`, the result JS object has different structure. So parse that structure in original XML, you should set the same option while building the XML from that js object. ## processEntities -Set it to `true` (default) to process XML entities. Check [Entities](./5.Entities.md) section for more detail. If you don't have entities in your XML document then it is recommanded to disable it `processEntities: false` for better performance. +Set it to `true` (default) to process XML entities. Check [Entities](./5.Entities.md) section for more detail. If you don't have entities in your XML document then it is recommended to disable it `processEntities: false` for better performance. ## oneListGroup @@ -242,7 +242,7 @@ const options = { const builder = new XMLBuilder(options); const output = builder.build(result); ``` -Outout +Output ```xml ``` @@ -268,10 +268,10 @@ Outout ## suppressUnpairedNode -To supress an unpared tag from `
` to `
`. +To suppress an unpaired tag from `
` to `
`. ## tagValueProcessor -To customize the bahaviour of parsing the text value of a tag to the string value. It accepts tag name and value. +To customize the behavior of parsing the text value of a tag to the string value. It accepts tag name and value. ## textNodeName To recognize text value for a tag in the JS object so that they can be properly assigned to the tag. diff --git a/docs/v4/5.Entities.md b/docs/v4/5.Entities.md index d8c3bcd4..fd3788e6 100644 --- a/docs/v4/5.Entities.md +++ b/docs/v4/5.Entities.md @@ -105,7 +105,7 @@ Following attacks are possible due to entity processing * Denial-of-Service Attacks * Classic XXE * Advanced XXE -* Server-Side Requst Forgery (SSRF) +* Server-Side Request Forgery (SSRF) * XInclude * XSLT @@ -136,7 +136,7 @@ In future version of FXP, we'll be supporting more features of DOCTYPE such as ` ## External Entities -You can set external entites without using DOCTYPE. +You can set external entities without using DOCTYPE. ```js const xmlData = `&unknown; last `; diff --git a/docs/v4/7.PITags.md b/docs/v4/7.PITags.md index 82e03e43..e261c2cd 100644 --- a/docs/v4/7.PITags.md +++ b/docs/v4/7.PITags.md @@ -1,4 +1,4 @@ -Processing Instructions are supported by Fast XML parser. However, they're treated as normal tags from parsing perpective. Hence, following properties are required to be set for attributes processing; +Processing Instructions are supported by Fast XML parser. However, they're treated as normal tags from the parsing perspective. Hence, the following properties are required to be set for attributes processing; ```js ignoreAttributes: false, diff --git a/spec/attr_spec.js b/spec/attr_spec.js index f8bffe2e..f70ffa1b 100644 --- a/spec/attr_spec.js +++ b/spec/attr_spec.js @@ -214,7 +214,7 @@ id="7" data="foo bar" bug="true"/>`; expect(result).toEqual(expected); }); - it("should err for invalid atributes", function() { + it("should err for invalid attributes", function() { const xmlData = ``; const expected = { "err": { @@ -228,21 +228,21 @@ id="7" data="foo bar" bug="true"/>`; expect(result).toEqual(expected); }); - it("should validate xml with atributes", function() { + it("should validate xml with attributes", function() { const xmlData = `1val`; const result = XMLValidator.validate(xmlData); expect(result).toBe(true); }); - it("should validate xml atribute has '>' in value", function() { + it("should validate xml attribute has '>' in value", function() { const xmlData = `1val`; const result = XMLValidator.validate(xmlData); expect(result).toBe(true); }); - it("should not validate xml with invalid atributes", function() { + it("should not validate xml with invalid attributes", function() { const xmlData = ``; expect(result).toEqual(expected); }); - it("should validate xml with attributeshaving openquote in value", function () { + it("should validate xml with attributes having open quote in value", function () { const xmlData = ""; const expected = { "err": { diff --git a/spec/entities_spec.js b/spec/entities_spec.js index 8c963f6a..41ef08af 100644 --- a/spec/entities_spec.js +++ b/spec/entities_spec.js @@ -255,7 +255,7 @@ describe("XMLParser Entities", function() { expect(result).toEqual(expected); }); - it("should build by decoding defaul entities", function() { + it("should build by decoding default entities", function() { const jsObj = { "note": { "@heading": "Reminder > \"Alert", @@ -283,7 +283,7 @@ describe("XMLParser Entities", function() { const result = builder.build(jsObj); expect(result.replace(/\s+/g, "")).toEqual(expected.replace(/\s+/g, "")); }); - it("should build by decoding defaul entities in prserve mode", function() { + it("should build by decoding default entities in preserve mode", function() { const jsObj = [ { "note": [ @@ -438,7 +438,7 @@ describe("XMLParser Entities", function() { }); }); -describe("XMLParser External Entites", function() { +describe("XMLParser External Entities", function() { it("should throw error when an entity value has '&'", function() { const parser = new XMLParser(); expect( () => { @@ -471,7 +471,7 @@ describe("XMLParser External Entites", function() { expect(result.note).toEqual(`&unknown;\r\nlast`); }); - it("External Entity can change the behaviour of default entites", function() { + it("External Entity can change the behavior of default entities", function() { const xmlData = `>last `; const parser = new XMLParser(); @@ -493,7 +493,7 @@ describe("XMLParser External Entites", function() { expect(result.note).toEqual(`> , , ?>

diff --git a/spec/transform_tagname_spec.js b/spec/transform_tagname_spec.js index 73ddebfe..af6ddc3b 100644 --- a/spec/transform_tagname_spec.js +++ b/spec/transform_tagname_spec.js @@ -3,7 +3,7 @@ const {XMLParser} = require("../src/fxp"); describe("XMLParser", function() { - it("should parse lowercase tagnames", function() { + it("should parse lowercase tag names", function() { const xmlData = ` Person 1 diff --git a/spec/unpairedTags_spec.js b/spec/unpairedTags_spec.js index ff5c1f82..cd88a6c8 100644 --- a/spec/unpairedTags_spec.js +++ b/spec/unpairedTags_spec.js @@ -147,7 +147,7 @@ describe("unpaired and empty tags", function() { expect(output.replace(/\s+/g, "")).toEqual(expectedXml.replace(/\s+/g, "")); }); - it("should supress paired tag but not unpaired tag when suppressUnpairedNode:false", function() { + it("should suppress paired tag but not unpaired tag when suppressUnpairedNode:false", function() { const xmlData = ` value @@ -211,7 +211,7 @@ describe("unpaired and empty tags", function() { expect(output.replace(/\s+/g, "")).toEqual(expectedXmlData.replace(/\s+/g, "")); }); - it("should supress paired tag but not unpaired tag when suppressUnpairedNode:false (ordered)", function() { + it("should suppress paired tag but not unpaired tag when suppressUnpairedNode:false (ordered)", function() { const xmlData = ` value diff --git a/spec/validator_spec.js b/spec/validator_spec.js index 0df37518..ea07bc14 100644 --- a/spec/validator_spec.js +++ b/spec/validator_spec.js @@ -443,7 +443,7 @@ describe("XML Validator with options", function () { validate(``, {InvalidTag: "Expected closing tag 'extra' (opened in line 1, col 9) instead of closing tag 'parent'."}, 1, 16)); - it('- Maarked Unpaired tags', () =>{ + it('- Marked Unpaired tags', () =>{ const result = XMLValidator.validate(``, { unpairedTags: ["extra"] }); diff --git a/src/fxp.d.ts b/src/fxp.d.ts index ada4502a..835e44ce 100644 --- a/src/fxp.d.ts +++ b/src/fxp.d.ts @@ -387,10 +387,10 @@ export class XMLParser { parse(xmlData: string | Buffer ,validationOptions?: validationOptions | boolean): any; /** * Add Entity which is not by default supported by this library - * @param entityIndentifier {string} Eg: 'ent' for &ent; + * @param entityIdentifier {string} Eg: 'ent' for &ent; * @param entityValue {string} Eg: '\r' */ - addEntity(entityIndentifier: string, entityValue: string): void; + addEntity(entityIdentifier: string, entityValue: string): void; } export class XMLValidator{