xmlserializer

WebJar for xmlserializer

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

xmlserializer
Последняя версия

Последняя версия

0.6.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

xmlserializer
WebJar for xmlserializer
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/cburgmer/xmlserializer

Скачать xmlserializer

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/xmlserializer/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>xmlserializer</artifactId>
    <version>0.6.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/xmlserializer/
implementation 'org.webjars.npm:xmlserializer:0.6.1'
// https://jarcasting.com/artifacts/org.webjars.npm/xmlserializer/
implementation ("org.webjars.npm:xmlserializer:0.6.1")
'org.webjars.npm:xmlserializer:jar:0.6.1'
<dependency org="org.webjars.npm" name="xmlserializer" rev="0.6.1">
  <artifact name="xmlserializer" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='xmlserializer', version='0.6.1')
)
libraryDependencies += "org.webjars.npm" % "xmlserializer" % "0.6.1"
[org.webjars.npm/xmlserializer "0.6.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

xmlserializer serializes a DOM subtree or DOM document into XML/XHTML. NPM version

It understands documents generated by parse5 and regular browser DOMs (and thus can act as a drop-in replacement for XMLSerializer which for some browsers only serializes true XML documents).

Limitations

See the wiki for limitations in HTML to XML conversion.

Currently some cases are treated differently to the XMLSerializer implementation of the browsers:

  • Invalid characters (ASCII control characters) that are invalid in XML 1.0 are removed on serialization. The browsers silently include those characters and on reparsing those documents throw a parser exception.
  • Dashes in comments are escaped to provide valid comments in XHTML. Firefox does not do this.
  • The xmlns attribute has higher precedence than the type of the DOM object passed to the serializer.
  • Small differences in style: no space in self-closing tag, empty value for boolean attributes, quoting of single apostrophes in attribute values.

This behaviour might become optional in the future.

Demo

See https://runkit.com/embed/siinwcyjdcjw

Run tests and build for the browser

$ npm install && npm test

Build Status

Example

For a browser based example run npm test and see example.html.

The same code for Node.js:

var xmlserializer = require('xmlserializer');
var html2xhtml = function (htmlString) {
    var parser = require('parse5'),
        dom = parser.parse(htmlString);

    return xmlserializer.serializeToString(dom);
};
console.log(html2xhtml('<br>'));
// => <html xmlns="http://www.w3.org/1999/xhtml"><head/><body><br/></body></html>

Версии библиотеки

Версия
0.6.1
0.4.0