You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
XML-Serializer is A JavaScript complete implementation of the W3C [xml serialization](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml)spec. All specifications have been implemented and includes the following [specs](https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm):
8
+
R-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):
9
9
10
10
-[ELEMENT_NODE Serialization]
11
11
@@ -23,44 +23,36 @@ XML-Serializer is A JavaScript complete implementation of the W3C [xml serializa
23
23
24
24
## Module Availability
25
25
26
-
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.
26
+
This module is available as an [npm](https://www.npmjs.com/) 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
27
28
-
## Installing the Package
28
+
## Getting Started
29
29
30
-
The below command will install `xml-serializer` from npm into your project assuming you have the [npm](https://www.npmjs.com/) already installed.
31
-
32
-
> NB: Because of some conflicting package names that already exists on npm, this one has been turned into a scoped package with public access.
30
+
The below command will install `r-serializer` from npm into your project assuming you have the [npm](https://www.npmjs.com/) already installed.
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
### Using with [JSDOM](https://github.com/jsdom/jsdom)
58
50
59
-
Currently, JSDOM has not implemented the `XMLSerializer`feature. This can be easily integrated with JSDOM and any other similar mockup environment like below.
51
+
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.
@@ -85,7 +77,8 @@ let instance = new XMLSerializer(false) // preserveWhiteSpace is set to false. i
85
77
//preserve white spaces
86
78
```
87
79
88
-
Another improvement is that it removes all duplicate prefix definition on any xml element which is part of the specification unlike what web browsers do. Below is an example of this
80
+
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
81
+
this:
89
82
90
83
**Original XML**:
91
84
@@ -141,6 +134,8 @@ Another improvement is that it removes all duplicate prefix definition on any xm
141
134
142
135
**Chrome inbuilt XMLSerializer Output:**
143
136
137
+
Notice that all of the duplicated namespaces are removed.
138
+
144
139
```xml
145
140
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPEroot PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
0 commit comments