Enhance XML parsing in index.html and add media management services to services.xml
This commit is contained in:
12
index.html
12
index.html
@@ -47,16 +47,26 @@
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(text, 'application/xml');
|
||||
|
||||
// Check for XML parsing errors
|
||||
const parseError = doc.querySelector('parsererror');
|
||||
if(parseError){
|
||||
throw new Error('XML parsing error: ' + parseError.textContent);
|
||||
}
|
||||
|
||||
// Check if we have groups or just services
|
||||
const groups = Array.from(doc.getElementsByTagName('group'));
|
||||
const hasGroups = groups.length > 0;
|
||||
|
||||
console.log('Found', groups.length, 'groups');
|
||||
|
||||
if(hasGroups){
|
||||
// Render grouped services
|
||||
groups.forEach(group => {
|
||||
const groupName = group.getAttribute('name') || 'Services';
|
||||
const services = Array.from(group.getElementsByTagName('service'));
|
||||
|
||||
console.log('Group:', groupName, 'has', services.length, 'services');
|
||||
|
||||
if(services.length === 0) return;
|
||||
|
||||
// Create group section
|
||||
@@ -310,7 +320,7 @@
|
||||
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
grid.innerHTML = '<p class="notes">Error loading services.xml — see console for details.</p>';
|
||||
container.innerHTML = '<p class="notes">Error loading services.xml — see console for details.</p>';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user