Difference between revisions of "Widget:DataExporter"

From LINKS Community Center
Jump to: navigation, search
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 14:06, 15 August 2023