gersemi
Version:
38 lines (37 loc) • 1.24 kB
TypeScript
import * as DOM from './DOM';
export declare function getAbbr(uri: string): string | undefined;
export declare function getURI(abbr: string): string;
export declare function setURI(abbr: string, uri: string): void;
export declare function setURIs(uris: {
[abbr: string]: string;
}): void;
export declare abstract class Node {
name: string;
namespace: string;
type: string;
constructor(name: string);
abstract toString(): string;
}
export declare type content = string | number | boolean;
export interface AttributeMap {
[name: string]: content;
}
export declare function fromJSON(json: DOM.JSONObject, root?: Element, ns?: string): Element;
export declare class Element extends Node {
name: string;
children: Array<Element | content>;
attributes: Attribute[];
constructor(name: string, attrs?: AttributeMap);
attr(name: string, value: content): this;
ns(name: string, uri: string): this;
add(...children: Array<Element | content>): this;
render(tab: string | 0): string;
toString(): string;
toNiceString(): string;
}
export declare class Attribute extends Node {
name: string;
value: content;
constructor(name: string, value: content);
toString(): string;
}