import { BS } from './bs';
export declare type Attribute = {
name: BS;
value: BS;
};
export declare type Ns = {
name?: BS;
uriString: string;
uri: BS;
};
/**
* Defininition of the tokens emmited by the parser
* @public
*/
export declare namespace Token {
/** @internal */
type Token = Token.EndTag | Token.StartTag | Token.Text | Token.CDATA | Token.Comment;
/**
* Represent a start-tag, ie, ``
* @public
*/
class StartTag {
readonly name: BS;
constructor(name: BS, atts: Attribute[], ns: Ns[], selfclosing?: true);
/** @internal */
readonly atts?: {
name: BS;
value: BS;
}[];
/** @internal */
readonly ns?: Ns[];
/** self-closing start-tag, like `` */
readonly selfClosing?: true;
/**
* namespace URI
*
* with ``, aStartTag.namespaceUri === '//uri/x'
*/
get namespaceUri(): string | undefined;
/**
* with ``, aStartTag.tagName === 'x:a'
*/
get tagName(): string;
/**
* with ``, aStartTag.localName === 'a'
*/
get localName(): string;
/**
* with ``, aStartTag.getAttribute('att') === 'value'
*/
getAttribute(name: string): string | undefined;
/** @internal */
getAttributeFQN(fqName: BS): string | undefined;
/**
* with ``, aStartTag.getAttributeNS('//uri/x', 'att') === 'value'
*/
getAttributeNS(nsUri: string, localName: string): string | undefined;
/** @internal */
get length(): number;
/** @internal */
get bs(): BS;
/** return this tag as a string (extra space-like character ommited) */
toString(): string;
}
/**
* Represent a CDATA node, ie, ``
* @public
*/
class CDATA {
readonly content: BS;
constructor(content: BS);
/** return text as a string */
get textContent(): string;
/** return this tag as a string */
toString(): string;
}
/**
* Represent a Text node
* @public
*/
class Text {
readonly content: BS;
constructor(content: BS);
/** return text as a string, decoding xml entities */
toString(): string;
/** return text as a string */
get textContent(): string;
private decode;
/** Supported entities (in addition to hex and dec codepoints)
*
* @remarks
*
* Default entities: `&`, `>`, `<`, `"` and `'`
*/
static entities: {
c: string;
bs: number[];
}[];
}
/**
* Represent a comment node, ie, ``
* @public
*/
class Comment {
readonly content: BS;
constructor(content: BS);
toString(): string;
/** return comment as a string */
get textContent(): string;
}
/**
* Represent a end-tag, ie ``
* @public
*/
class EndTag {
readonly name: BS;
constructor(name: BS);
toString(): string;
}
}