-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
789 additions
and
708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
import Serializer from './modules/Serializer.js'; | ||
|
||
export default class XMLSerializer { | ||
/** | ||
*@param {boolean} [preserveWhiteSpace=true] - boolean value indicating if white spaces | ||
* should be preserved as it is in the source | ||
*/ | ||
constructor(preserveWhiteSpace) { | ||
this.serializer = new Serializer(preserveWhiteSpace); | ||
} | ||
export class XMLSerializer { | ||
/** | ||
*@param {boolean} [preserveWhiteSpace=true] - boolean value indicating if white spaces | ||
* should be preserved as it is in the source | ||
*/ | ||
constructor(preserveWhiteSpace) { | ||
this.serializer = new Serializer(preserveWhiteSpace); | ||
} | ||
|
||
/** | ||
* return XMLSerializer as modules name | ||
*/ | ||
get [Symbol.toStringTag]() { | ||
return 'XMLSerializer'; | ||
} | ||
/** | ||
* return XMLSerializer as modules name | ||
*/ | ||
get [Symbol.toStringTag]() { | ||
return 'XMLSerializer'; | ||
} | ||
|
||
/** | ||
* produces an XML serialization of root passing a value of false for the | ||
* require well-formed parameter, and return the result. | ||
*@param {Node} root - the root node | ||
*@param {boolean} [requireWellFormed=false] - boolean value indicating if it should require xml | ||
* well formedness | ||
*@returns {string} | ||
*/ | ||
serializeToString(root, requireWellFormed) { | ||
return this.serializer.serializeToString(root, requireWellFormed); | ||
} | ||
} | ||
/** | ||
* produces an XML serialization of root passing a value of false for the | ||
* require well-formed parameter, and return the result. | ||
*@param {Node} root - the root node | ||
*@param {boolean} [requireWellFormed=false] - boolean value indicating if it should require xml | ||
* well formedness | ||
*@returns {string} | ||
*/ | ||
serializeToString(root, requireWellFormed) { | ||
return this.serializer.serializeToString(root, requireWellFormed); | ||
} | ||
} | ||
|
||
/** | ||
* installs the serialize to the given target object | ||
*/ | ||
XMLSerializer.install = target => { | ||
target.XMLSerializer = XMLSerializer; | ||
}; |
Oops, something went wrong.