scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
88 lines (85 loc) • 2.38 kB
text/typescript
import { AbsXMLParser } from 'scriptable-abstract';
interface XMLParserState {
string: string;
didStartDocument: () => void;
didEndDocument: () => void;
didStartElement: (name: string, attributes: {
[key: string]: string;
}) => void;
didEndElement: (name: string) => void;
foundCharacters: (str: string) => void;
parseErrorOccurred: (error: string) => void;
}
/**
* Mock implementation of Scriptable's XMLParser
* Used to parse XML documents
*/
declare class MockXMLParser extends AbsXMLParser<XMLParserState> {
constructor(string: string);
/**
* Text to parse
*/
get string(): string;
/**
* Sets the text to parse
*/
set string(value: string);
/**
* Function called when parsing starts
*/
get didStartDocument(): () => void;
/**
* Sets the function called when parsing starts
*/
set didStartDocument(value: () => void);
/**
* Function called when parsing ends
*/
get didEndDocument(): () => void;
/**
* Sets the function called when parsing ends
*/
set didEndDocument(value: () => void);
/**
* Function called when an element starts
*/
get didStartElement(): (name: string, attributes: {
[key: string]: string;
}) => void;
/**
* Sets the function called when an element starts
*/
set didStartElement(value: (name: string, attributes: {
[key: string]: string;
}) => void);
/**
* Function called when an element ends
*/
get didEndElement(): (name: string) => void;
/**
* Sets the function called when an element ends
*/
set didEndElement(value: (name: string) => void);
/**
* Function called when characters are found
*/
get foundCharacters(): (str: string) => void;
/**
* Sets the function called when characters are found
*/
set foundCharacters(value: (str: string) => void);
/**
* Function called when a parse error occurs
*/
get parseErrorOccurred(): (error: string) => void;
/**
* Sets the function called when a parse error occurs
*/
set parseErrorOccurred(value: (error: string) => void);
/**
* Parses the XML document
* @returns true if parsing was successful, false otherwise
*/
parse(): boolean;
}
export { MockXMLParser };