Skip to content

Commit

Permalink
fix: moved to teclone namespace, fixed readme, generated esm build
Browse files Browse the repository at this point in the history
  • Loading branch information
teclone committed Mar 2, 2020
1 parent 7df9a3d commit 16a1c58
Show file tree
Hide file tree
Showing 8 changed files with 12,146 additions and 13,314 deletions.
12 changes: 0 additions & 12 deletions .buildrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules

/build
.nyc_output
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ cache:
notifications:
email: false
node_js:
- "9"
- "8"
- '10'
- '12'
script:
- npm run test
jobs:
include:
- stage: release
node_js: "10"
node_js: '12'
script:
- npm run test
- npm run build
Expand Down
55 changes: 22 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# XML-Serializer

[![Build Status](https://travis-ci.org/harrison-ifeanyichukwu/xml-serializer.svg?branch=master)](https://travis-ci.org/harrison-ifeanyichukwu/xml-serializer)
[![Coverage Status](https://coveralls.io/repos/github/harrison-ifeanyichukwu/xml-serializer/badge.svg?branch=master)](https://coveralls.io/github/harrison-ifeanyichukwu/xml-serializer?branch=master)
[![Build Status](https://travis-ci.org/teclone/xml-serializer.svg?branch=master)](https://travis-ci.org/teclone/xml-serializer)
[![Coverage Status](https://coveralls.io/repos/github/teclone/xml-serializer/badge.svg?branch=master)](https://coveralls.io/github/teclone/xml-serializer?branch=master)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![npm version](https://badge.fury.io/js/%40harrison-ifeanyichukwu%2Fxml-serializer.svg)](https://badge.fury.io/js/%40harrison-ifeanyichukwu%2Fxml-serializer)
![npm](https://img.shields.io/npm/dt/%40harrison-ifeanyichukwu%2Fxml-serializer.svg)
[![npm version](https://badge.fury.io/js/%40teclone%2Fxml-serializer.svg)](https://badge.fury.io/js/%40teclone%2Fxml-serializer)
![npm](https://img.shields.io/npm/dt/%40teclone%2Fxml-serializer.svg)

XML-Serializer is a complete JavaScript implementation of the W3C [xml serialization](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml) specifications. All specifications have been implemented and includes the following [specs](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm):

Expand All @@ -24,7 +24,7 @@ XML-Serializer is a complete JavaScript implementation of the W3C [xml serializa

## Module Availability

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.
This module is available as an [npm](https://www.npmjs.com/package/@teclone/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.

## Getting Started

Expand All @@ -33,15 +33,15 @@ The below command will install `xml-serializer` from npm into your project assum
**Install as a development dependency**:

```bash
npm install --save-dev @harrison-ifeanyichukwu/xml-serializer
npm install --save-dev @teclone/xml-serializer
```

## Usage Guide

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:

```javascript
import XMLSerializer from '@harrison-ifeanyichukwu/xml-serializer';
import XMLSerializer from '@teclone/xml-serializer';

let instance = new XMLSerializer();
console.log(instance.serializeToString(someXmlNode));
Expand All @@ -61,8 +61,8 @@ Currently, JSDOM has not implemented the `XMLSerializer` interface. This can be

```javascript
//assumes jsdom has been installed.
import XMLSerializer from '@harrison-ifeanyichukwu/xml-serializer';
import {JSDOM} from 'jsdom';
import XMLSerializer from '@teclone/xml-serializer';
import { JSDOM } from 'jsdom';

let dom = new JSDOM();
dom.window.XMLSerializer = XMLSerializer;
Expand All @@ -76,10 +76,14 @@ global.window = dom.window;
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.

```html
<script type="text/javascript" src="node_modules/@harrison-ifeanyichukwu/xml-serializer/dist/main.min.js"><script>
<script type="text/javascript">
let serializer = new XMLSerializer();
// do some serialization stuffs
<script
type="text/javascript"
src="node_modules/@teclone/xml-serializer/dist/main.min.js"
>
<script>
<script type="text/javascript">
let serializer = new XMLSerializer();
// do some serialization stuffs
</script>
```

Expand Down Expand Up @@ -149,7 +153,7 @@ this:

**Chrome inbuilt XMLSerializer Output:**

Notice that all of the duplicated namespaces are removed.
Notice that none of the duplicated namespaces is removed.

```xml
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE root PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Expand All @@ -158,10 +162,9 @@ Notice that all of the duplicated namespaces are removed.
<?xml-stylesheet href="classic.css" alternate="yes" title="Classic"
media="screen, print" type="text/css"?>

<!--notice that two namespaces have been defined on the root element-->
<root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="https://www.w3schools.com/furniture">

<!--notice that it is declared again here. this is a duplicate-->
<!-- duplicates still remains -->
<h:table xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="https://www.w3schools.com/furniture">
<h:tr>
<h:td>
Expand All @@ -170,7 +173,7 @@ Notice that all of the duplicated namespaces are removed.
</h:tr>
</h:table>

<!--one is duplicated here-->
<!--still remains-->
<f:table xmlns:f="https://www.w3schools.com/furniture">
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
Expand Down Expand Up @@ -214,7 +217,7 @@ Notice that all of the duplicated namespaces are removed.
<!--notice that two namespaces have been defined on the root element-->
<root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="https://www.w3schools.com/furniture">

<!--notice that it is declared again here. this is a duplicate-->
<!--duplicates removed-->
<h:table>
<h:tr>
<h:td>
Expand All @@ -223,7 +226,7 @@ Notice that all of the duplicated namespaces are removed.
</h:tr>
</h:table>

<!--one is duplicated here-->
<!--duplicate removed-->
<f:table>
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
Expand Down Expand Up @@ -264,17 +267,3 @@ We welcome your own contributions, ranging from code refactoring, documentation
3. Implement your ideas, and once stable,

4. Create a pull request, explaining your improvements/features

All future contributors will be included below and immensely appreciated. We look forward to your contributions.

## About Project Maintainers

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.

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!!!

## Acknowledgments

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

[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)
Loading

0 comments on commit 16a1c58

Please sign in to comment.