title: NullPointer Exception while using docx4j to convert HTML String to Docx
body: <p>I am using docx4j to convert html strings to docx.</p>
  
  <p>Below is the code. </p>
  
  <pre><code>package docx4j;
  
  import org.docx4j.convert.in.xhtml.FormattingOption;
  import org.docx4j.convert.in.xhtml.XHTMLImporter;
  import org.docx4j.convert.in.xhtml.XHTMLImporterImpl;
  import org.docx4j.openpackaging.exceptions.Docx4JException;
  import org.docx4j.openpackaging.io.SaveToZipFile;
  import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
  
  public class ConvertHTMLToDoc {
  
      public static void main(String[] args) throws Docx4JException {
  
          String outputfilepath = "style-example-OUT30.rtf";
  
          String text = getHTMLString();
  
          WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
  
          XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
  
  /*      xHTMLImporter.setParagraphFormatting(FormattingOption.CLASS_PLUS_OTHER);
          xHTMLImporter.setRunFormatting(FormattingOption.CLASS_PLUS_OTHER);
  */
          wordMLPackage.getMainDocumentPart().getContent().addAll(xHTMLImporter.convert(text, null));
  
  /*      wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Title", "Testing Title");
          wordMLPackage.getMainDocumentPart().addStyledParagraphOfText("Subtitle", "Testing Subtitle");
  */
          SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
          saver.save(outputfilepath);
      }
  
      private static String getHTMLString() {
          String text = "&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt;&lt;body&gt;" + "&lt;p class=\"Title\"&gt;Testing Title&lt;/p&gt;"
                  + "&lt;p class=\"Subtitle\"&gt;Testing Subtitle&lt;/p&gt;" + "&lt;/body&gt;&lt;/html&gt;";
          return text;
      }
  
  }
  </code></pre>
  
  <p>When I run this, I get the error at the following line. </p>
  
  <pre><code>wordMLPackage.getMainDocumentPart().getContent().addAll(xHTMLImporter.convert(text, null));
  </code></pre>
  
  <p>Below is the error message.</p>
  
  <pre><code>12:19:54,125 ERROR [stderr] (http-/0.0.0.0:8080-2) java.lang.NullPointerException
  
  12:19:54,125 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.jaxb.NamespacePrefixMapperUtils.setProperty(NamespacePrefixMapperUtils.java:155)
  
  12:19:54,125 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.XmlUtils.marshaltoString(XmlUtils.java:588)
  
  12:19:54,125 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.XmlUtils.marshaltoString(XmlUtils.java:559)
  
  12:19:54,125 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart.createVirtualStylesForDocDefaults(StyleDefinitionsPart.java:369)
  
  12:19:54,126 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.getStyleTree(MainDocumentPart.java:172)
  
  12:19:54,126 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.getStyleTree(MainDocumentPart.java:161)
  
  12:19:54,126 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.stylesToCSS(XHTMLImporterImpl.java:446)
  
  12:19:54,126 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.getRenderer(XHTMLImporterImpl.java:253)
  
  12:19:54,126 ERROR [stderr] (http-/0.0.0.0:8080-2)  at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.convert(XHTMLImporterImpl.java:645)
  </code></pre>
  
  <p>What could be the reason for the null pointer exception?</p>