Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guid75/xml-writer
A fast XML writer
https://github.com/guid75/xml-writer
Last synced: about 1 month ago
JSON representation
A fast XML writer
- Host: GitHub
- URL: https://github.com/guid75/xml-writer
- Owner: Guid75
- License: mit
- Created: 2022-08-05T13:22:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-25T07:23:36.000Z (over 2 years ago)
- Last Synced: 2024-11-10T12:17:29.259Z (about 2 months ago)
- Language: TypeScript
- Size: 623 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://img.shields.io/github/workflow/status/guid75/xml-writer/Node.js%20CI?label=tests)
## Installation
```sh
npm install -S xml-writer-ts
```## Usage
```javascript
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
```
## API
Implemented methods (Work In Progress):
```typescript
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) {}
```