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 23: Line 23:
                 const schema = await fetch(dat).then(rsp => rsp.text());
                 const schema = await fetch(dat).then(rsp => rsp.text());
                 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 el of doc.querySelectorAll('Field')) {
                     output.innerHTML += el.getAttribute('name');
                     const prop = el.getElementsByTagName('semanticmediawiki_Property')
                    output.innerHTML += ' | '
                        .item(0)?.getAttribute('name');// || el.getAttribute('name');
                     output.innerHTML += el.getElementsByTagName('Label').item(0)?.textContent;
                     const label = el.getElementsByTagName('Label').item(0)?.textContent;
                     output.innerHTML += ' | '
                     output.innerHTML += prop + ' | ' + label + '<br>';
                    output.innerHTML += el.getElementsByTagName('semanticmediawiki_Property').item(0)?.getAttribute('name');
                    output.innerHTML += '<br>';
                 }
                 }



Revision as of 13:01, 15 August 2023