Guys,
I'm trying to work out the intent behind DocumentImpl.importNamespaces() because that method is causing some broken query output to be generated at the moment. For an example:
<?xml version="1.0" encoding="ANSI_X3.4-1968"?> <xapi:resourceSet xapi:collectionURI="xmldb:xindice:///db/focus/data" xmlns:xapi="http://www.xmldb.org/xapi/ResourceSet">
<xapi:resource xapi:documentID="metalprices-01_08_2000.xml">
<metalprices
xmlns:src="http://xml.apache.org/xindice/Query"
src:col="/db/focus/data" src:key="metalprices-01_08_2000.xml"><exchange name="USD exchange rate" xmlns:src="http://xml.apache.org/xindice/Query">
<high xmlns:src="http://xml.apache.org/xindice/Query">
<current xmlns:src="http://xml.apache.org/xindice/Query">0.5813</current>
[snip]
and so on. Note the redeclaration of the 'src' namespace prefix on all descendants of the 'metalprices' element.
The culprit if obviously the recursive nature of the importNamespaces(); any NS declarations between the current element and the doument will be duplicated on the current element, as is aparent in the fragment above. The problem is, I can't work out why it's there at all, when all it is doing is copying any NS declarations to the current element, which is useless, as far as I can tell.
What it should be doing is checking the imported element to ensure that if it or any of it's attributes have prefixes, then those prefixes should map to a valid namespace. If they do not, then it should declare the namespace if it knows what that namespace should be, and probably error out if it does not.
Anyway, after commenting out the call to importNamespace() in DocumentImpl.importNode(), the output from the query that produced the above output is okay - it doesn't have the src prefix redeclared on every element.
Does anyone have any suggestions as to why importNamespaces() should stay as it is, before I attempt to fix it?
Mike.
-- Mike Gratton <[EMAIL PROTECTED]> "Every motive escalate." Blatant self-promotion: <http://web.vee.net/>
