1.0.3 • Published 5 years ago
xml-trident v1.0.3
xml-trident
Three-way conversion between XML strings, DOM objects and JSONML representations of a DOM.
Deprecation warning: This module is not maintained. Please see slimdom-sax-parser for the DOM parsing, or use the code in src/domToJsonml.js.
API
toString (input: Node|JsonML) : stringtoDom (input: string|JsonML) : DocumentNodetoJsonml (input: string|Node) : JsonMLJsonML additions
While JsonML only provides an encoding for elements, attributes and text nodes, a secondary goal of this module is to losslessly convert to-and-fro as much as you want. Therefore some additions to JsonML have been made.
Elements, attributes, text nodes
<p class="example">Paragraph</p>[ "p", { "class": "example" }, "Paragraph" ]Processing instruction
<?my-pi as an example ?>[ "?my-pi", "as an example " ]Comment
<!-- an XML comment -->[ "!", " an XML comment " ]Document Type
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[ "!DOCTYPE", "html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" ]Document node
[ "#document" ]
Wishlist
- CDATA