@Test public void testMarcAsMods_SubjectTopic_Issue185_Issue433() throws Exception { InputStream xmlIS = TransformersTest.class.getResourceAsStream("marc_subject_65X_X9.xml"); assertNotNull(xmlIS); StreamSource streamSource = new StreamSource(xmlIS); Transformers mt = new Transformers(); try { byte[] contents = mt.transformAsBytes(streamSource, Transformers.Format.MarcxmlAsMods3); assertNotNull(contents); String xmlResult = new String(contents, "UTF-8"); XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(new HashMap() {{ put("m", ModsConstants.NS); }})); XMLAssert.assertXpathExists("/m:mods/m:subject[not(@authority)]/m:topic[text()='kočky' and @lang='cze']", xmlResult); XMLAssert.assertXpathExists("/m:mods/m:subject[not(@authority)]/m:topic[text()='cats' and @lang='eng']", xmlResult); XMLAssert.assertXpathNotExists("/m:mods/m:subject/m:name/m:namePart[text()='kočky']", xmlResult); XMLAssert.assertXpathNotExists("/m:mods/m:subject/m:name/m:namePart[text()='cats']", xmlResult); validateMods(new StreamSource(new ByteArrayInputStream(contents))); } finally { close(xmlIS); } }
public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); } }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }  }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }  Source transform(Source input, Format format); Source transform(Source input, Format format, Map<String, Object> params); byte[] transformAsBytes(Source input, Format format); byte[] transformAsBytes(Source input, Format format, Map<String, Object> params); Source toSource(byte[] buffer); Source dump(Source source, StringBuilder dump); Source dump2Temp(Source source, String filename); }
Transformers { public byte[] transformAsBytes(Source input, Format format) throws TransformerException { return transformAsBytes(input, format, Collections.<String, Object>emptyMap()); }  Source transform(Source input, Format format); Source transform(Source input, Format format, Map<String, Object> params); byte[] transformAsBytes(Source input, Format format); byte[] transformAsBytes(Source input, Format format, Map<String, Object> params); Source toSource(byte[] buffer); Source dump(Source source, StringBuilder dump); Source dump2Temp(Source source, String filename);  }