Internally XMLWriter uses a NamespaceStack to know if it needs to output new namespace declarations with new nodes. It could be that the way that you're using it, the XMLWriter isn't properly popping the namespace stack, so that the required namespace definitions don't appear.
Any chance you could create a little unit test to demonstrate the problem? I.e. a bit of code and a test document. Then it'd be easier to see the problem. If you could add an existing test method to an existing test case, such as in dom4j/src/test/org/dom4j/TestXMLWriter, that'd be even better! :-) James ----- Original Message ----- From: "Wilson, Terry" <[EMAIL PROTECTED]> To: "Dom4j-User (E-mail)" <[EMAIL PROTECTED]> Sent: Wednesday, May 01, 2002 5:36 PM Subject: [dom4j-user] Namespaces and writeOpen() > Hi all, > > I'm a new dom4j user and have a question I could not find an answer for from > the api or other documentation. > > I have a fairly classical situation where I have a "database" type XML file > (large, up to .5GB) that has a root node that has a set or child, record > nodes. I need to apply XSLT transformations to this document, which I'm > acchieving efficiently by utilizing the excellent ElementHandler interface. > I apply the stylesheets to a chunk of records at a time, serialize the > results and move on to the next chunk. This seems to work fine, but I hit a > problem with the root node, which I also need to style. > > The root node has some namespace definitions that are causing me grief. If I > print out the transformed root node with asXML() the namespace definitions > are still there, but when I use the writeOpen(rootElement) method in the > XMLWriter class to serialize the output, it is missing the namespace > definitions. Is there something special I need to do to have the namespaces > included when calling writeOpen()? The api doc says that attributes would be > included in the writeOpen() output, but what about namespace definitions? > Are they left out on purpose and if so, how can I have them included in my > output? > > I've tried this with two separate daily builds, the latest I downloaded > yesterday (4/30/02). > > Hope I made some sense, any help appreciated. > > > Thanks, > > Terry _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
