### Question:
PSWriter { @Nonnull public ESuccess writeToFile (@Nonnull final IPSElement aPSElement, @Nonnull final File aFile) { ValueEnforcer.notNull (aPSElement, "PSElement"); final IMicroElement eXML = aPSElement.getAsMicroElement (); return MicroWriter.writeToFile (getAsDocument (eXML), aFile, m_aWriterSettings.getXMLWriterSettings ()); } PSWriter();  PSWriter(@Nonnull final IPSWriterSettings aWriterSettings); @Nonnull IPSWriterSettings getWriterSettings(); @Nonnull ESuccess writeToFile(@Nonnull final IPSElement aPSElement, @Nonnull final File aFile); @Nonnull ESuccess writeToStream(@Nonnull final IPSElement aPSElement, @Nonnull @WillClose final OutputStream aOS); @Nonnull ESuccess writeToWriter(@Nonnull final IPSElement aPSElement, @Nonnull @WillClose final Writer aWriter); @Nullable String getXMLString(@Nonnull final IPSElement aPSElement); @Nullable String getXMLStringNotNull(@Nonnull final IPSElement aPSElement); @Override String toString();  }### Answer:
@Test public void testWriteWithNamespacePrefix () throws SchematronReadException { final IReadableResource aRes = SchematronTestHelper.getAllValidSchematronFiles ().getFirst (); final PSSchema aSchema = new PSReader (aRes).readSchema (); final MapBasedNamespaceContext aNSCtx = PSWriterSettings.createNamespaceMapping (aSchema); aNSCtx.removeMapping (XMLConstants.DEFAULT_NS_PREFIX); aNSCtx.addMapping ("sch", CSchematron.NAMESPACE_SCHEMATRON); final PSWriterSettings aPSWS = new PSWriterSettings (); aPSWS.setXMLWriterSettings (new XMLWriterSettings ().setNamespaceContext (aNSCtx).setPutNamespaceContextPrefixesInRoot (true)); new PSWriter (aPSWS).writeToFile (aSchema, new File ("target/test-with-nsprefix.xml")); }