From: <ch...@gm...> - 2007-02-07 12:44:36
|
Hi, I currently encountered a big problem. I have a DOM document that uses various default namespaces as it is created in memory. When I save or create that resource, the default namespace declaration gets omitted thus making the document invalid. I use the following Javacode to create the document. private Resource createResource(File resource, Collection parent) throws XMLDBException { try { Document xmlData = DOMUtil.parse(new FileReader(resource)); XMLResource res = (XMLResource) parent.createResource(resource.getName(), "XMLResource"); res.setContentAsDOM(xmlData); parent.storeResource(res); return res; } catch (ParserException ex) { ex.printStackTrace(debug); } catch (IOException ex) { ex.printStackTrace(debug); } return null; } The XML file is attached. After storing, the end of the file looks like this: <qr:searchResult> <date xmlns="http://www.staffme.de/xml/ns/domain/employer/requirementSearchResult">2006-12-12T18:41:22</date> <matches>1</matches> <consultant> <id>c2a387df.xml</id> <rank>457</rank> <cv> <id>c2d31e63.xml</id> </cv> </consultant> </qr:searchResult> </qr:qualificationRequirement> You see, only the first occurence of the xmlns declaration is left putting the folling elements into the empty namespace. I am using eXist version 1.1.1. Thanks, Fabio |