Skip to content

Commit 1f09fcb

Browse files
author
Harrison Ifeanyichukwu
committed
feat: update readme documentation, correct typos, add maintainers and how to contribute sections
1 parent 4dabe51 commit 1f09fcb

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

README.md

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ XML-Serializer is a complete JavaScript implementation of the W3C [xml serializa
2424

2525
## Module Availability
2626

27-
This module is available as an [npm](https://www.npmjs.com/) scoped package and also has a browser build that is located inside the `dist` folder. It can easily be integrated with [JSDOM](https://github.com/jsdom/jsdom) for mockup testing.
27+
This module is available as an [npm](https://www.npmjs.com/package/@harrison-ifeanyichukwu/xml-serializer) scoped package and also has a browser build that is located inside the `dist` folder. It can easily be integrated with [JSDOM](https://github.com/jsdom/jsdom) for mockup testing.
2828

2929
## Getting Started
3030

@@ -38,47 +38,61 @@ npm install --save-dev @harrison-ifeanyichukwu/xml-serializer
3838

3939
## Usage Guide
4040

41-
following the specification, the `XMLSerializer` interface is a constructor and has a `serializeToString(root)` method exposed on the instance. To serialize any xml node, call the `serializeToString(root)` method on a constructed instance, passing in the xml node as below
41+
Following the specification, the `XMLSerializer` interface is a constructor and has a `serializeToString(root)` method exposed on the instance. To serialize any xml node, call the `serializeToString(root)` method on a constructed instance, passing in the xml node as like shown below:
4242

4343
```javascript
44-
import XMLSerializer from 'r-serializer';
44+
import XMLSerializer from '@harrison-ifeanyichukwu/xml-serializer';
4545

4646
let instance = new XMLSerializer();
4747
console.log(instance.serializeToString(someXmlNode));
4848
```
4949

50+
The constructor can take a boolean argument that indicates if whitespace should be preserved in the serialized output. Default value is `true`;
51+
52+
```javascript
53+
// do not preserve white space
54+
let instance = new XMLSerializer(false);
55+
let xmlString = instance.serializeToString(document);
56+
```
57+
5058
### Using with [JSDOM](https://github.com/jsdom/jsdom)
5159

5260
Currently, JSDOM has not implemented the `XMLSerializer` interface. This can be easily integrated with JSDOM and any other similar mockup environment or for web scrapping and xml feed parsing like below.
5361

5462
```javascript
5563
//assumes jsdom has been installed.
56-
import XMLSerializer from 'r-serializer';
64+
import XMLSerializer from '@harrison-ifeanyichukwu/xml-serializer';
5765
import {JSDOM} from 'jsdom';
5866

5967
let dom = new JSDOM();
60-
6168
dom.window.XMLSerializer = XMLSerializer;
62-
6369
global.window = dom.window;
6470

6571
//start running your tests or do something else.
6672
```
6773

6874
### Using on the browser
6975

70-
The browser build is available inside the dist folder. It exposes the `XMLSerialzer` construct on the `window` object.
76+
The browser build is available inside the `dist` folder when you npm install the package. You can also this repo and run the build command locally. It exposes an `XMLSerializer` construct on the `window` object.
77+
78+
```html
79+
<script type="text/javascript" src="node_modules/@harrison-ifeanyichukwu/xml-serializer/dist/main.min.js"><script>
80+
<script type="text/javascript">
81+
let serializer = new XMLSerializer();
82+
// do some serialization stuffs
83+
</script>
84+
```
7185

72-
## New Features & Improvements
86+
## Features & Improvements
7387

74-
By default, the serializer preserves white space during the serialization process. This can be turned off by passing in false to the constructor at the time of creating an instance.
88+
By default, the serializer preserves white space during the serialization process. This can be turned off if you want a compact output by passing in `false` to the constructor at the time of creating an instance.
7589

7690
```javascript
77-
let instance = new XMLSerializer(false) // preserveWhiteSpace is set to false. it wont
78-
//preserve white spaces
91+
//do not preserve white space
92+
let instance = new XMLSerializer(false);
7993
```
8094

81-
Another improvement is that it removes all duplicate prefix definition on any xml element as recommended in the specification document unlike what web browsers do. Below is an example of
95+
Another improvement is that it removes all duplicate xml prefix definition on as recommended in the specification document unlike what web browsers do. Below is an example of
8296
this:
8397

8498
**Original XML**:
@@ -239,8 +253,28 @@ Notice that all of the duplicated namespaces are removed.
239253
</root>
240254
```
241255

256+
## Contributing
257+
258+
We welcome your own contributions, ranging from code refactoring, documentation improvements, new feature implementations, bugs/issues reporting, etc. We recommend you follow the steps below to actively contribute to this project:
259+
260+
1. Decide on what to help us with.
261+
262+
2. Fork this repo to your machine.
263+
264+
3. Implement your ideas, and once stable,
265+
266+
4. Create a pull request, explaining your improvements/features
267+
268+
All future contributors will be included below and immensely appreciated. We look forward to your contributions.
269+
270+
## About Project Maintainers
271+
272+
This project is maintained by [harrison ifeanyichukwu](mailto:[email protected]), a young, passionate full stack web developer, an [MDN](https://developer.mozilla.org/en-US/profiles/harrison-feanyichukwu) documentator, maintainer of node.js [rollup-all](https://www.npmjs.com/package/rollup-all) project, [R-Server](https://github.com/harrison-ifeanyichukwu/r-server) (a web server project), and other amazing projects.
273+
274+
He is available for hire, ready to work on `PHP` projects, `Node.js` projects, `React` and `Angular` projects and stuffs like that. Looks forward to hearing from you soon!!!
275+
242276
## Acknowledgments
243277

244278
In addition to the spec, the following sections as well as outside resources were consulted and proved very useful:
245279

246-
[serialize-doc-type](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-doctype), [serialize-xml-attribute](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml-attributes), [serialize-attr-value](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-attr-value), [record-element-namespace-info](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-record-namespace-info), [generate-prefix](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-generate-prefix), [xml-character-sets](https://www.w3.org/TR/xml/), [detect-non-valid-xml-characters](https://stackoverflow.com/questions/29031792/detect-non-valid-xml-characters-javascript)
280+
[serialize-doc-type](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-doctype), [serialize-xml-attribute](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml-attributes), [serialize-attr-value](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-attr-value), [record-element-namespace-info](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-record-namespace-info), [generate-prefix](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-generate-prefix), [xml-character-sets](https://www.w3.org/TR/xml/), [detect-non-valid-xml-characters](https://stackoverflow.com/questions/29031792/detect-non-valid-xml-characters-javascript)

0 commit comments

Comments
 (0)