Author: dims Date: Fri Sep 15 10:30:03 2006 New Revision: 446664 URL: http://svn.apache.org/viewvc?view=rev&rev=446664 Log: Fix for AXIS2-1162 - Build Failure: testScenarioOne(org.apache.axis2.wsdl.codegen.extension.SchemaUnwrapperExtensionTest): Caused an ERROR
Basic problem is probable this one: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6305029 The identity transform we used to create the dom node loses it's namespaces. So instead of using the identity transform use the trick we use in Axis 1.X to generate InputSource's from Source's. Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?view=diff&rev=446664&r1=446663&r2=446664 ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java Fri Sep 15 10:30:03 2006 @@ -32,7 +32,10 @@ import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; +import javax.xml.transform.sax.SAXSource; import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.resolver.DefaultURIResolver; @@ -41,6 +44,7 @@ import org.apache.ws.commons.schema.utils.NamespacePrefixList; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -280,13 +284,24 @@ } public XmlSchema read(Source source, ValidationEventHandler veh) { - try { - TransformerFactory trFac = TransformerFactory.newInstance(); - DOMResult result = new DOMResult(); - trFac.newTransformer().transform(source, result); - return read((Document) result.getNode(), veh); - } catch (TransformerException e) { - throw new XmlSchemaException(e.getMessage(), e); + if (source instanceof SAXSource) { + return read(((SAXSource) source).getInputSource(), veh); + } else if (source instanceof DOMSource) { + Node node = ((DOMSource) source).getNode(); + if (node instanceof Document) { + node = ((Document) node).getDocumentElement(); + } + return read((Document) node, veh); + } else if (source instanceof StreamSource) { + StreamSource ss = (StreamSource) source; + InputSource isource = new InputSource(ss.getSystemId()); + isource.setByteStream(ss.getInputStream()); + isource.setCharacterStream(ss.getReader()); + isource.setPublicId(ss.getPublicId()); + return read(isource, veh); + } else { + InputSource isource = new InputSource(source.getSystemId()); + return read(isource, veh); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
