@aurahelper/languages
Version:
Language Libraries to work with XML, Aura, Apex... files. tokenizers, parsers, system classes and much more
101 lines (100 loc) • 3.57 kB
TypeScript
/**
* Class to parse and extract data from XML files
*/
export declare class XMLParser {
/**
* Method to get the XML to JSON Options
* @returns Return XML To JSON Options object
*/
static getParserXMLToJSONOptions(): {
attributeNamePrefix: string;
attributesGroupName: string;
textNodeName: string;
ignoreAttributes: boolean;
removeNSPrefix: boolean;
allowBooleanAttributes: boolean;
ignoreDeclaration: boolean;
parseTagValue: boolean;
parseAttributeValue: boolean;
trimValues: boolean;
cdataPropName: string;
cdataPositionChar: string;
localeRange: string;
parseTrueNumberOnly: boolean;
arrayMode: boolean;
commentPropName: string;
attributeValueProcessor: (_tagName: any, val: any) => any;
tagValueProcessor: (_tagName: any, val: any) => any;
stopNodes: string[];
};
/**
* Method to get the JSON to XML Options
* @returns Return JSON To XML Options object
*/
static getParserJSONToXMLOptions(): {
attributeNamePrefix: string;
attributesGroupName: string;
textNodeName: string;
ignoreAttributes: boolean;
cdataPropName: string;
cdataPositionChar: string;
format: boolean;
indentBy: string;
suppressEmptyNode: boolean;
commentPropName: string;
};
/**
* Method to parse XML file
* @param {string} [content] XML file content
* @param {boolean} [parseComments] true tu parse comments too.
* @returns {any} Return the XML file data
*/
static parseXML(content?: string, parseComments?: boolean): any;
/**
* Method to transform JSON Object into XML file
* @param {any} jsonObj JSON to transform
* @returns {string} Return the XML Content
*/
static toXML(jsonObj: any): string;
/**
* Method to get the XML first line
* @returns {string} Return XML first line
*/
static getXMLFirstLine(): string;
/**
* Method to check if start tags exists on string
* @param {string} text Text to get tag
* @param {string} tag tag name
* @returns {string | undefined} return the tag name or undefined if not exists
*/
static startTag(text: string, tag: string): string | undefined;
/**
* Method to check if end tag exists on string
* @param {string} text Text to get tag
* @param {string} tag tag name
* @returns {string | undefined} return the tag name or undefined if not exists
*/
static endTag(text: string, tag: string): string | undefined;
/**
* Method to get an XML Element String
* @param {string} tag Tag name
* @param {string[]} attributes Attributes to add
* @param {any} value value to add
* @returns
*/
static getXMLElement(tag: string, attributes?: string[], value?: any): string;
/**
* Method to get start tag string
* @param {string} tag Tag name
* @param {string[]} attributes Attributes to add
* @param {boolean} empty true if tag is empty
* @returns {string} Return an string with starts tag
*/
static getStartTag(tag: string, attributes?: string[], empty?: boolean): string;
/**
* Method to get end tag string
* @param {string} tag Tag name
* @returns {string} Return end tag as string
*/
static getEndTag(tag: string): string;
}