AnsweredAssumed Answered

Cannot import XML that uses the default namespace

Question asked by ifairman on Sep 17, 2008

I'm using the JCR interface to import a load of files, some of which are XML. I can import them all as "cm:content" properties without a problem but cannot import the XML specifically with the "importXML" method on Session. The XML contains elements and attributes from two namespaces, xlink and our own namespace. Only xlink attributes have a prefix, the elements and attributes from our own DTD are in the default namespace and therefore have no prefix (although there is a valid xmlns attribute on the top level element). I have confirmed with Oxygen that the files are well-formed and valid.

At first Alfresco complained that it did not recognise the namespaces so I created entries in a model file that I reference like this:

      <namespace uri="" prefix="foo"/>
      <namespace uri="" prefix="xlink"/>
      <namespace uri="" prefix=""/>

Alfresco now seems happy with the xlink attributes but isn't happy with the CBML elements which are not prefixed.

Has anyone successfully imported XML that uses the default namespace? It must be possible given that most XML files use it.

Many thanks,