Skip to content

Commit

Permalink
Spelling fixes in Docs & Test Descriptions (#580)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
ChrisMBarr and ChrisMBarr authored Jan 11, 2024
1 parent 78adc6e commit 291fe73
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# Type
Please mention the type of PR
<!-- choose one by changing [ ] to [x] -->
* [ ]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.

Expand Down
8 changes: 4 additions & 4 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# 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.

### DoD
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.
Expand Down
2 changes: 1 addition & 1 deletion docs/v3/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/v4/1.GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/v4/2.XMLparseOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 = {
Expand Down
16 changes: 8 additions & 8 deletions docs/v4/3.XMLBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -242,7 +242,7 @@ const options = {
const builder = new XMLBuilder(options);
const output = builder.build(result);
```
Outout
Output
```xml
<?textinfo whitespace is allowed?>
```
Expand All @@ -268,10 +268,10 @@ Outout

## suppressUnpairedNode

To supress an unpared tag from `<br/>` to `<br>`.
To suppress an unpaired tag from `<br/>` to `<br>`.

## 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.
Expand Down
4 changes: 2 additions & 2 deletions docs/v4/5.Entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = `<note>&unknown;&#xD;last</note> `;
Expand Down
2 changes: 1 addition & 1 deletion docs/v4/7.PITags.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
10 changes: 5 additions & 5 deletions spec/attr_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<rootNode =''></rootNode>`;
const expected = {
"err": {
Expand All @@ -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 = `<rootNode attr="123"><tag></tag><tag>1</tag><tag>val</tag></rootNode>`;

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 = `<rootNode attr="123>234"><tag></tag><tag>1</tag><tag>val</tag></rootNode>`;

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 = `<rootNode attr="123><tag></tag><tag>1</tag><tag>val</tag></rootNode>`;
const expected = {
"err": {
Expand Down Expand Up @@ -315,7 +315,7 @@ id="7" data="foo bar" bug="true"/>`;
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 = "<rootNode 123 abc='1\"23' bc=\"56'7\" />";
const expected = {
"err": {
Expand Down
12 changes: 6 additions & 6 deletions spec/entities_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
Expand Down Expand Up @@ -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( () => {
Expand Down Expand Up @@ -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 = `<note>&gt;last</note> `;

const parser = new XMLParser();
Expand All @@ -493,7 +493,7 @@ describe("XMLParser External Entites", function() {

expect(result.note).toEqual(`><last`);
});
it("should build by decoding '&' prserve mode", function() {
it("should build by decoding '&' preserve mode", function() {
const jsObj = [
{
"note": [
Expand Down Expand Up @@ -593,7 +593,7 @@ describe("XMLParser External Entites", function() {
expect(result).toEqual(expected);
});

it("should support entites with tags in content", function() {
it("should support entities with tags in content", function() {
const xmlData = `
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
Expand Down
2 changes: 1 addition & 1 deletion spec/j2x_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe("XMLBuilder", function() {
expect(result).toEqual(expected);
});

it("should supress undefined nodes", function() {
it("should suppress undefined nodes", function() {
const jObj = {
a: {
b: [
Expand Down
2 changes: 1 addition & 1 deletion spec/pi_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe("XMLParser", function() {
// console.log(output);
});

it("should strip xml declarion tag", function(){
it("should strip xml declaration tag", function(){
const xmlData = `<?xml version="1.0"?>
<?elementnames <fred>, <bert>, <harry> ?>
<h1></h1>
Expand Down
2 changes: 1 addition & 1 deletion spec/transform_tagname_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<?xml version='1.0'?>
<root>
<person>Person 1</person>
Expand Down
4 changes: 2 additions & 2 deletions spec/unpairedTags_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<rootNode>
<tag>value</tag>
<empty />
Expand Down Expand Up @@ -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 = `<rootNode>
<tag>value</tag>
<empty />
Expand Down
2 changes: 1 addition & 1 deletion spec/validator_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ describe("XML Validator with options", function () {
validate(`<parent><extra></parent>`,
{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(`<parent><extra></parent>`, {
unpairedTags: ["extra"]
});
Expand Down
4 changes: 2 additions & 2 deletions src/fxp.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 291fe73

Please sign in to comment.