HI! We ran into another namespace problem after switching to Xerces 2.4.0. We are searching a node with Xalan 2.4.1 and then output the node as string. Xerces 2.4.0 Serializer does not provide the full namespace information of that node, where 2.0.1 does, so that this node cannot stand alone anymore. The namespace information is still there, maybe Xalan somehow corrupts it.
Maybe (or likely) we are doing something wrong. Any help (or workaround) is greatly appreciated. 2.0.1: TestNamespace <a:child xmlns:a="TestNamespace">text</a:child> 2.4.0: TestNamespace <a:child>text</a:child> Regards, Thomas Source: ------- import java.io.*; import javax.xml.parsers.*; import org.apache.xml.serialize.*; import org.apache.xpath.*; import org.w3c.dom.*; import org.xml.sax.*; public class NamespaceTest2 { public static void main(String[] args) throws Exception { Document doc; Element tag; doc = getDocument("<a:root xmlns:a=\"TestNamespace\"><a:child>text</a:child></a:root>"); tag = (Element)XPathAPI.selectSingleNode(doc, "/a:root/a:child"); System.out.println(tag.getNamespaceURI()); System.out.println(elementToString(tag)); } public static Document getDocument(String xml) throws Exception { DocumentBuilderFactory dbf; DocumentBuilder db; Document doc; dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(true); dbf.setAttribute("http://apache.org/xml/features/validation/dynamic", new Boolean(true)); dbf.setAttribute("http://apache.org/xml/features/validation/schema", new Boolean(true)); db = dbf.newDocumentBuilder(); doc = db.parse(new InputSource(new StringReader(xml))); return(doc); } public static String elementToString(Element element) throws Exception { OutputFormat outputFormat; XMLSerializer xmlSerializer; StringWriter sw; try { sw = new StringWriter(); outputFormat = new OutputFormat(); outputFormat.setOmitXMLDeclaration(true); outputFormat.setEncoding("utf-16"); outputFormat.setPreserveSpace(true); xmlSerializer = new XMLSerializer(sw, outputFormat); xmlSerializer.serialize(element); return(sw.toString()); } catch (IOException ioe) { return(ioe.getMessage()); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]