Hi all,

There is a problem in ToXMLStream (org.apache.xml.serializer.ToXMLStream) if there is an attribute of a namespace that is never used before, the namespace is never defined in this case. As attachment you can find a small test program that demonstrates the problem and a patch file that solves the problem. I am not sure if it is the patch is the way that the problem needs to be solved, but it works. Can the patch be applied on the CVS tree? Or can the problem be solved on the CVS in an other way? If you need more information please feel free to ask.

Thanks in advance,
Nick Van den Bleeken
import java.io.ByteArrayOutputStream;

import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.xml.serializer.DOMSerializer;
import org.apache.xml.serializer.ToXMLStream;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Test
{	
	public static void main(String[] args) throws Exception
	{
		Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
		document.appendChild(document.createElement("joske"));
		Element houseEl = document.createElement("house");
		houseEl.setAttributeNS("http://joske.mydomain/bla";, "jo:ta", "blabla");
		document.getDocumentElement().appendChild(houseEl);
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		ToXMLStream toXMLStream = new ToXMLStream();
		toXMLStream.setOutputStream(out);
		DOMSerializer serializer = toXMLStream.asDOMSerializer();
		serializer.serialize(document);
		System.out.println(out.toString());
	}
}


Attachment: Xalan_ToStream.patch
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to