Widget: DataExporter: Difference between revisions
From LINKS Community Center
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')) { | ||
const prop = el.getElementsByTagName('semanticmediawiki_Property') | |||
.item(0)?.getAttribute('name');// || el.getAttribute('name'); | |||
const label = el.getElementsByTagName('Label').item(0)?.textContent; | |||
output.innerHTML += ' | ' | output.innerHTML += prop + ' | ' + label + '<br>'; | ||
} | } | ||