Enhance XML parsing in index.html and add media management services to services.xml

This commit is contained in:
MayaChat
2025-11-24 00:12:19 -05:00
parent 67cb864342
commit e8c13c998c
2 changed files with 21 additions and 2 deletions

View File

@@ -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>