The JCR import feature supports importing either Document View or System View documents. Both forms can use XML namespaces, but these get mapped automatically to JCR namespaces. If that's not happening correctly, then it may be a bug. Can you post the XML files (or a non-proprietary form of them) that cannot be imported correct, and describe what's going wrong? Were the XML documents exported from ModeShape, another JCR implementation, or from another mechanism?
- I figured out that the import of a XML file can't be done with a default namespace => is there any way to do that without forcing the use of a prefix ?
This should work
- Is there any difference regarding namespace registration between loading a XML file using the method importXML of Session class and the use of XML Sequencer ?
The XML Sequencer, however, does not correspond to nor is analogous to importing XML (the JCR feature). If you have the XML sequencer configured and upload any XML file, then you will get nodes of type "modexml:element" and "modexml:attribute" that correspond to the XML elements and attributes in the document. (This feature is largely used in repositories that are storing many different files, such as XMLs, XSDs, WSDLs, etc., and sequencers are used to derive a structured representation of the files' contents and store these structured representations inside the repository.)
- What's the expected processing while loading of a XML file using an already registered namespace ?
Whenever any XML namespace is encountered, ModeShape looks to see if there is already a JCR namespace with the same prefix as used in the XML namespace. If so, the JCR namespace's URI is compared to the XML namespace's URI, and if they match then nothing is done. If they don't match, then an exception is thrown (since a single prefix is used for two different namespaces). Otherwise, the XML namespace (with prefix and URI) are registered in JCR. You can see the code here.
- Why ( and in which situation ) I got a namespace registry with prefixes such "ns001" even if the prefix of the namespace in the XML file is well defined ?
This happens when ModeShape comes across content that uses a namespace that is not registered, and prefixes of the form "ns001" are generated during the namespace registration process. Can you create a test case that shows this?