From: Peter C. <Pet...@me...> - 2005-05-25 14:24:28
|
At present, the XML repository has no notion of namespace URIs or namespace prefixes. This give rise to some rather entertaining problems with more recent IMS content packages (basically anything 1.1 and above). For example, the <record> element of Aggie's 1.1.2 content package is stored as <imsmd:record> - which means that a content package import fails as the code can't find <record> under the <metadata> tag. There are a number of ways around this. I'm looking for input on which of these might be appropriate for other developments. The simplest is to strip the namespace information during import, as nature appears to have intended things. This works fine... until the time comes to reconstruct the XML for output, at which point the information loss may well be sufficient that it is not possible to reconstruct anything useful. The next simplest is to store the namespace URI with each row in xml_elements and xml_attributes. Cheap'n'cheerful, full-fidelity reconstruction, works with any SAX2 parser, but expensive on disk space. Next harder is trying to store a mapping of namespace prefixes to namespace URIs, and store the prefixes with each element and attribute. It's harder because there's always the possibility of getting something without namespace prefixes, at which point they need to be manufactured. It's also not guaranteed to work with all SAX2 parsers, as returning the namespace prefix is an optional facility. However, it reduces the disk space considerably. Hardest is ripping out the existing XML repository and replacing it with an off-the-shelf XML database - I'd probably use eXist, as I have some experience with it and it would work for this job. This adds the complexity of another component and another data store (eXist uses its own .dbx files), but removes one more bespoke piece from Bodington. I'm not going to be able to do this within the timeframe of the existing project unless someone comes up with some more dosh! Does anyone have any preferences, before I shrug and go for the easiest approach that serves my needs for now? - Peter |