cjcodeproj / medialibrary

Python code to read XML media files
MIT License
2 stars 0 forks source link

Ability to add more XML namespaces dynamically. #191

Open cjcodeproj opened 2 weeks ago

cjcodeproj commented 2 weeks ago

The XML parser isn't directly accessible to third party users of the code; and it's impossible to add namespaces to the running code after it's loaded.. If someone is using the Python shell, this would be the existing pattern.

>>> import media.fileops.repo
>>> repo = media.fileops.repo.Repo('/home/user/xml/movies/data')
>>> repo.scans()
>>> repo.load()

In the future, end users may want to follow this pattern.

>>> import media.fileops.repo
>>> repo = media.fileops.repo.Repo('/home/user/xml/movies/data')
>>> repo.loader.add_namespace('prefix', 'uri')
>>> repo.scans()
>>> repo.load()

This wouldn't actually load any of the unexpected elements, but it's the first necessary step in order to support the feature.