An open API service indexing awesome lists of open source software.

https://github.com/jacoblincool/xml-svelte

This is a Svelte component for rich editing / viewing XML in the browser.
https://github.com/jacoblincool/xml-svelte

Last synced: 12 months ago
JSON representation

This is a Svelte component for rich editing / viewing XML in the browser.

Awesome Lists containing this project

README

          

# XML Svelte

This is a Svelte component for editing / viewing XML in the browser.

## Features

- Headless, works with any CSS framework (e.g. Bootstrap, Tailwind, etc.)
- Lazy loading, fetches tag components on demand

## Example

See [src/routes/+page.svelte](src/routes/+page.svelte) for an example of how to use the component to view and edit SSML (Speech Synthesis Markup Language, an XML dialect).

![example](./images/example.png)

```svelte

import { XML } from 'xml-svelte';

let xml = '<speak> ... </speak>';
let result = xml;

const render = {
speak: () => import('$lib/ssml/speak.svelte'),
emphasis: () => import('$lib/ssml/emphasis.svelte'),
prosody: () => import('$lib/ssml/prosody.svelte'),
break: () => import('$lib/ssml/break.svelte'),
'#text': () => import('$lib/ssml/content.svelte')
};

let editor: XML;

function update() {
const out = editor.result();
if (out) {
result = out;
} else {
result = 'Invalid XML';
}
}



{result}


```