Hi, I'm having some difficulties to support the reading of an XML instance document that could belong to two different target namespaces. I'm using XMLBeans to compile a schema and then read and browse instances using the generated Java data structures.
Originally, my schema was in a first namespace: http://ode.fivesight.com/schemas/2006/06/27/dd. So my schema header declaration was something like: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ode.fivesight.com/schemas/2006/06/27/dd" .... And in my xsdconfig I had the following: <xb:namespace uri="http://ode.fivesight.com/schemas/2006/06/27/dd"> <xb:package>org.apache.ode.bpel.dd</xb:package> </xb:namespace> Now I want to update that target namespace to http://www.apache.org/ode/schemas/dd/2007/03 while still maintaining backward compatibility with older documents. So if someone gives me a document that looks like: <deploy xmlns="http://ode.fivesight.com/schemas/2006/06/27/dd" ... I would like XMLBeans to either ignore this namespace and replace it with the new one or generate exactly the same data structure as with the new namespace so I don't need to change my whole java code. I've tried different approaches, the first one was to declare the two namespaces in my xsdconfig: <xb:namespace uri="http://ode.fivesight.com/schemas/2006/06/27/dd"> <xb:package>org.apache.ode.bpel.dd</xb:package> </xb:namespace> <xb:namespace uri="http://www.apache.org/ode/schemas/dd/2007/03"> <xb:package>org.apache.ode.bpel.dd</xb:package> </xb:namespace> The gotcha is that my schema can only have one target namespace anyway so that doesn't quite fly. My second try was to do: XmlOptions options = new XmlOptions(); HashMap otherNs = new HashMap(); otherNs.put("http://ode.fivesight.com/schemas/2006/06/27/dd", "http://www.apache.org/ode/schemas/dd/2007/03"); options.setLoadSubstituteNamespaces(otherNs); _dd = DeployDocument.Factory.parse(ddLocation); When I load the instance. That didn't work either, in both cases XMLBeans complains with: org.apache.xmlbeans.XmlException: /home/dusty/Dev/Tools/Platform/apache- tomcat-5.5.17/webapps/ode/WEB-INF/processes/DynPartner/deploy.xml:0: error: The document is not a [EMAIL PROTECTED]://www.apache.org/ode/schemas/dd/2007/03: document element namespace mismatch expected " http://www.apache.org/ode/schemas/dd/2007/03" got " http://ode.fivesight.com/schemas/2006/06/27/dd". Is there any solution to my problem? Thanks, Matthieu

