Search code examples
jaxbdocx4j

Docx4j, there is no prefix registered for Bibliography


I'm trying to add bibliography & citation to docx file using Docx4j. However the XML generated by library has automatically created namespace:

<ns30:Source>

MS Word unfortunetely doesnt show such kind of source as a source. After some trials & erros I discovered that enough is to change the namespace:

<b:Source>

Probably the problem is that in Docx4J this namespace is not defined in NamespacePrefixMappings class.

How Can I add or define my own namespace prefix mappings? Or can I somehow force Docx4j for using particular prefix for part? Anything where the result will be XML with namespace "b" will be good advice for me. I would like to avoid downloading Docx4j source, modyfing source and having customized version of library.


Solution

  • http://www.docx4java.org/docx4j/docx4j-3.3.0-SNAPSHOT-20151020.jar contains https://github.com/plutext/docx4j/commit/089bce035e847dc473b95080a7106f35470fa48e which adds the mapping to NamespacePrefixMappings