xml2o
Version:
Helps you convert XML into an object for easy reading.
50 lines (49 loc) • 1.37 kB
TypeScript
interface AttributeInput {
name: string;
local: string;
value: string;
prefix: string;
uri: string;
}
interface NodeInput {
name: string;
local: string;
prefix: string;
uri: string;
attributes: {
[key: string]: AttributeInput;
};
}
declare const text: unique symbol;
export declare class Node extends Array<Node> {
parent: Node | null;
[text]: string[];
readonly name: string;
readonly local: string;
readonly path: string;
readonly prefix: string;
readonly uri: string;
protected readonly attributes: {
[key: string]: Attribute;
};
constructor(opt: NodeInput, parent: Node | null);
get root(): Node;
get text(): string;
static pushText(node: Node, value: string): void;
static addNode(parent: Node, opt: NodeInput): Node;
getAttributes(uri?: string): any;
getAttribute(name: string, uri?: string): string | undefined;
getAttributeNode(name: string, uri?: string): Attribute | undefined;
hasAttribute(name: string, uri?: string): boolean;
query(path: string, uri?: string): Node[];
}
export declare class Attribute {
readonly name: string;
readonly local: string;
readonly value: string;
readonly prefix: string;
readonly uri: string;
constructor(opt: AttributeInput);
toString(): string;
}
export {};