MCPcopy
hub / github.com/ionic-team/capacitor / readXML

Function readXML

cli/src/util/xml.ts:4–15  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

2import xml2js from 'xml2js';
3
4export async function readXML(path: string): Promise<any> {
5 try {
6 const xmlStr = await readFile(path, { encoding: 'utf-8' });
7 try {
8 return await xml2js.parseStringPromise(xmlStr);
9 } catch (e: any) {
10 throw `Error parsing: ${path}, ${e.stack ?? e}`;
11 }
12 } catch (e) {
13 throw `Unable to read: ${path}`;
14 }
15}
16
17export function parseXML(xmlStr: string, options?: xml2js.OptionsV2): any {
18 const parser = options !== undefined ? new xml2js.Parser({ ...options }) : new xml2js.Parser();

Callers 4

logiOSPlistFunction · 0.90
getCordovaPreferencesFunction · 0.90
resolvePluginFunction · 0.90
checkAndroidManifestFileFunction · 0.90

Calls 1

readFileFunction · 0.85

Tested by

no test coverage detected