SaajXmlReader extends AbstractXmlReader { @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (NAMESPACES_FEATURE_NAME.equals(name)) { this.namespacesFeature = value; } else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) { this.namespacePrefixesFeature = value; } else { super.setFeature(name, value); } } SaajXmlReader(Node startNode); @Override boolean getFeature(String name); @Override void setFeature(String name, boolean value); @Override final void parse(InputSource ignored); @Override final void parse(String ignored);  }
@Test public void testNamespacesPrefixes() throws Exception { saajReader.setFeature("http: saajReader.setFeature("http: DOMResult result = new DOMResult(); Source source = new SAXSource(saajReader, new InputSource()); transformer.transform(source, result); DOMResult expected = new DOMResult(); transformer.transform(new DOMSource(message.getSOAPPart().getEnvelope()), expected); assertXMLEqual((Document) expected.getNode(), (Document) result.getNode()); }
@Test public void testNamespacesNoPrefixes() throws Exception { saajReader.setFeature("http: saajReader.setFeature("http: DOMResult result = new DOMResult(); Source source = new SAXSource(saajReader, new InputSource()); transformer.transform(source, result); DOMResult expected = new DOMResult(); transformer.transform(new DOMSource(message.getSOAPPart().getEnvelope()), expected); assertXMLEqual((Document) expected.getNode(), (Document) result.getNode()); }