0.0.8 • Published 2 years ago

xml-writer-ts v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

xml-writer-ts

Yet another XML writer but this time written in typescript.

WARNING: this package is still in early alpha stage, some features are not yet implemented

GitHub Workflow Status

Installation

npm install -S xml-writer-ts

Usage

import { XmlWriter } from "xml-writer-ts"

const writer = new XmlWriter({ indentation: "  " })
writer
  .startDocument("1.0", "UTF-9", true)
  .startElement("coucou")
  .startAttribute("attr")
  .text("value")
  .startElement("cici")
  .writeComment("Hello world!")
  .startElement("caca")

console.log(writer.toString())

will print:

<?xml version="1.0" encoding="UTF-9" standalone="yes"?>
<coucou attr="value">
  <cici>
    <!--Hello world!-->
    <caca/>
  </cici>
</coucou>

API

Implemented methods (Work In Progress):

function startDocument(version?: string, encoding?: string, standalone?: boolean) {}
function endDocument() {}

function writeElement(name: string, content: string) {}
function startElement(name: string) {}
function endElement() {}

function writeAttribute(name: string, content: string) {}
function startAttribute(name: string) {}
function endAttribute() {}

function endAttributes() {}

function writeComment(content: string) {}
function startComment() {}
function endComment() {}

function writeCData(content: string) {}
function startCData() {}
function endCData() {}

function text(content: string) {}
0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago