Nothing wrong with that code, however ... You create a new namespace without a prefix: Namespace dfNs = Namespace.get( "","http://www.w3.org/TR/REC-html40");
I assume you have created a Namespace for the 'ss' prefix as well, using something like: Namespace ssNs = Namespace.get( "ss","http://www.test.com/ss/"); And you create the QName for your element, with the 'ss' prefix (which I assume has already been defined before) however you give for the creation of the name your previously created default Namespace, which has as far as I can see nothing to do with the element you're trying to create.. QName dataName = QName.get( "ss:Data", dfNs); Instead you could have created an element in the 'ss' namespace using: QName dataName = QName.get( "Data", ssNs); Element data = DocumentHelper.createElement(dataName); After this you can add whatever namespace declaration you want to the newly created element using the add( Namespace) method: data.add( ssNs); Regards, Edwin -- http://www.edankert.com/ ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user