Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vitkarpov/fast-xml-parser
🚀 Is a fast XML parser in TypeScript with zero dependencies
https://github.com/vitkarpov/fast-xml-parser
dom html-parser html-parser-library javascript typescript
Last synced: 3 months ago
JSON representation
🚀 Is a fast XML parser in TypeScript with zero dependencies
- Host: GitHub
- URL: https://github.com/vitkarpov/fast-xml-parser
- Owner: vitkarpov
- License: mit
- Created: 2019-02-26T14:22:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-25T07:25:37.000Z (almost 6 years ago)
- Last Synced: 2024-10-15T15:11:48.451Z (4 months ago)
- Topics: dom, html-parser, html-parser-library, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 103 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚀 Fast-XML-parser
> Is a fast XML parser in TypeScript with zero dependencies
[![CircleCI](https://circleci.com/gh/vitkarpov/fast-xml-parser.svg?style=svg)](https://circleci.com/gh/vitkarpov/fast-xml-parser)
[![Code Style: Google](https://img.shields.io/badge/code%20style-google-blueviolet.svg)](https://github.com/google/gts)- blazing fast âš¡
- zero dependencies 📦## Talk is cheap show me the code, or API overview
```ts
import {parse} from 'fast-xml-parser';// Node { name: 'root', children: [
// Node { name: 'html', children: [...]
// }] }
const root = parse('hello');
````Parse` returns a `Node` object, the root of the document tree. `Node` is an object with the following interface:
```ts
interface Node {
type: TYPES;
name: string;
children?: Node[];
attrs?: Record;
}
```You can manipulate the tree and serialize it back to HTML:
```ts
import {parse, stringify} from 'fast-xml-parser';const root = parse('hello');
// change text node
root.children[1].children[0].name = 'hello, world!'// hello, world!
console.log(stringify(root));
```> TBD: DOM API to manipulate the tree in a handy way