/** * [[include:src/codecs/xml/README.md]] * * @module codecs/xml */ import schema from '@stencila/schema'; import * as vfile from '../../util/vfile'; import * as xml from '../../util/xml'; import { Codec, CommonEncodeOptions } from '../types'; export declare class XmlCodec extends Codec { /** * The media types that this codec can decode/encode. */ readonly mediaTypes: string[]; /** * Decode a `VFile` with XML content to a Stencila `Node`. * * @param file The `VFile` to decode * @returns A promise that resolves to a Stencila `Node` */ readonly decode: (file: vfile.VFile) => Promise; /** * Encode a Stencila `Node` to a `VFile` with XML content. * * @param thing The Stencila `Node` to encode * @returns A promise that resolves to a `VFile` */ readonly encode: (node: schema.Node, options?: CommonEncodeOptions) => Promise; } /** * Decode an XML document to a Stencila `Node` * * @param doc The top level XML element to decode */ export declare const decodeDoc: (doc: xml.Element) => schema.Node; /** * Encode a `Node` as an XML document * * @param node The `Node` to encode * @param standalone Should the document be a standalone XML document? */ export declare const encodeDoc: (node: schema.Node, standalone?: boolean) => xml.Element; /** * Decode an XML element to a Stencila `Node` * * @param elem The XML element to decode */ export declare const decodeElem: (elem: xml.Element) => schema.Node; /** * Encode a `Node` as an XML element. * * This is a recursive function which walks, depth-first * the node tree, converting each node to an XML element. * * @param node The node to encode * @param key The `key` attribute to be added to the element */ export declare const encodeNode: (node: schema.Node, key?: string) => xml.Element;