|
From: peter murray-r. <pm...@ca...> - 2006-03-07 13:36:15
|
At 12:52 07/03/2006, Egon Willighagen wrote: > > > > This only works if the rootElement is a NAMESPACED CMLElement, else > > it produces a simple Element. My guess is that you need to change the > > namespace. > >I'm quite positive that this indeed is the problem. For some reason the >namespace of the XOM Node was not set, while it did use "cml" prefix. > >I can imagine this to be the case for Tobias as well, because Bioclipse >actually interprets CML at the Resource level, and splits up a CML file with >a <molecule> and a <spectrum> on the same level into two childs below the >CMLReource... and I can very well imagine that in this case too, XOM does not >set the namespace for these Element's specifically, if set at a parent Node. > >:( > > > Namespaces are a problem since we haven't been very consistent in > > CML. The current suggestion is that we always use > > "http://www.xml-cml.org/schema". What we could then do is strip off > > all other old CML namespaces at start of parse and replace by this one. > >Yes, stripping might be a good idea. At least they have the above in common. I have had quite a lot of discussion on the XOM list about namespaces - they are not trivial. So my current idea is: - read in a potential CML file. - does if have namespace http://www.xml-cml.org/schema on the root - if not use heuristics to judge whether it is a CML file (if there is an obsolete CML namespace on root? or whether all elements have local names in CML. Then strip old CML namespaces and replace by current one. This means that all CML files will be emitted with the current namespace. There is a problem for software that uses other CML namespaces and I think these will have to be deprecated and fade away. In stylesheet I always use local-name() for this reason. In principle you can also get the namespace and see whether it looks like CML ** Please can any let the list know whether they use other CML namespaces and in particular whether they differentiate between different flavours of CML namespaces. Would there be a problem if there were only a single, permanent, CML namespaceURI? *** P Peter Murray-Rust Unilever Centre for Molecular Sciences Informatics University of Cambridge, Lensfield Road, Cambridge CB2 1EW, UK +44-1223-763069 |