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

Function parseXmlToSearchable

cli/src/cordova.ts:331–353  ·  view source on GitHub ↗
(childElementsObj: any[], arrayToAddTo: any[])

Source from the content-addressed store, hash-verified

329 xml = `<plist version="1.0"><dict>${xml}</dict></plist>`;
330
331 const parseXmlToSearchable = (childElementsObj: any[], arrayToAddTo: any[]) => {
332 for (const childElement of childElementsObj) {
333 const childElementName = childElement['#name'];
334 const toAdd: {
335 name: string;
336 attrs?: { [key: string]: any } | undefined;
337 children?: any[] | undefined;
338 value?: any | undefined;
339 } = { name: childElementName };
340 if (childElementName === 'key' || childElementName === 'string') {
341 toAdd.value = childElement['_'];
342 } else {
343 if (childElement['$']) {
344 toAdd.attrs = { ...childElement['$'] };
345 }
346 if (childElement['$$']) {
347 toAdd.children = [];
348 parseXmlToSearchable(childElement['$$'], toAdd['children']);
349 }
350 }
351 arrayToAddTo.push(toAdd);
352 }
353 };
354
355 const existingElements = parseXML(trimmedPlistData, {
356 explicitChildren: true,

Callers 2

logiOSPlistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected