Widget: DataExporter: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
Line 24: Line 24:
                 const doc = (new DOMParser).parseFromString(schema, 'text/xml');
                 const doc = (new DOMParser).parseFromString(schema, 'text/xml');


                 for (const el of doc.querySelectorAll('Field')) {
                 for (const field of doc.querySelectorAll('Field')) {
                     const prop = el.getElementsByTagName('semanticmediawiki_Property')
                     const prop = field.querySelector('semanticmediawiki_Property')?.getAttribute('name') || field.getAttribute('name');
                        .item(0)?.getAttribute('name');// || el.getAttribute('name');
                     const label = field.querySelector('Label')?.textContent;
                     const label = el.getElementsByTagName('Label').item(0)?.textContent;
                     output.innerHTML += prop + ' | ' + label + '<br>';
                     output.innerHTML += prop + ' | ' + label + '<br>';
                 }
                 }

Revision as of 13:06, 15 August 2023