[ https://issues.apache.org/jira/browse/WSCOMMONS-327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Veithen resolved WSCOMMONS-327. --------------------------------------- Resolution: Invalid Assignee: Andreas Veithen The issue here is that XMLBeans' XmlTokenSource#newXMLStreamReader(XmlOptions) doesn't take into account the XmlOptions#setSaveAggressiveNamespaces() setting (in contrast to the save methods). Therefore this is not an Axiom bug. As a workaround for this XMLBeans issue, I suggest to use XmlTokenSource#save(ContentHandler, LexicalHandler, XmlOptions) in conjunction with Axiom's SAXOMBuilder: SAXOMBuilder builder = new SAXOMBuilder(); document.save(builder, builder, xmlOptions); OMElement element = builder.getRootElement(); This is probably less efficient than using StAXOMBuilder, but will allow you to leverage the namespace optimization features in XMLBeans. Note that because of an issue in SAXOMBuilder, this will only work with the latest Axiom code (minimum revision 724197). > Namespace High verbosity combined with XMLBeans > ----------------------------------------------- > > Key: WSCOMMONS-327 > URL: https://issues.apache.org/jira/browse/WSCOMMONS-327 > Project: WS-Commons > Issue Type: Bug > Components: AXIOM > Environment: All > Reporter: Philippe Mouawad > Assignee: Andreas Veithen > Attachments: NamespaceBug.zip > > > Serializing an XMLBeans generated Document with: > org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new > org.apache.axiom.om.impl.builder.StAXOMBuilder( > OMAbstractFactory.getOMFactory(), > new > org.apache.axis2.util.StreamWrapper(document.newXMLStreamReader(xmlOptions))); > org.apache.axiom.om.OMElement documentElement = builder > .getDocumentElement(); > > ((org.apache.axiom.om.impl.OMNodeEx)documentElement).setParent(null); > documentElement.serialize(System.out, new OMOutputFormat()); > Generated stream contains namespace redeclaration : > <getLocatedProducts > xmlns="http://v1.product.ws.store.kingfisher.com"><param0><callType > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0><param0><callType > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</callType><familyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</familyCode><moduleCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</moduleCode><subFamilyCode > > xmlns="http://data.v1.product.ws.store.kingfisher.com/xsd">1</subFamilyCode></param0></getLocatedProducts> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.