Top Description Fields Constructors Methods
org.jabref.logic.importer.fileformat

public Class MsBibImporter

extends Importer
Class Inheritance
Annotations
@NullMarked
Imports
java.io.BufferedReader, .IOException, java.util.Objects, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, .ParserConfigurationException, org.jabref.logic.importer.Importer, .ParserResult, org.jabref.logic.msbib.MSBibDatabase, org.jabref.logic.util.StandardFileType, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory, org.w3c.dom.Document, org.xml.sax.ErrorHandler, .InputSource, .SAXException, .SAXParseException

Importer for the MS Office 2007 XML bibliography format

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final DocumentBuilderFactory
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getDescription()

Implements abstract org.jabref.logic.importer.Importer.getDescription.

Returns the description of the import format.

public StandardFileType
getFileType()

Implements abstract org.jabref.logic.importer.Importer.getFileType.

Returns the type of files that this importer can read

public String
getName()

Implements abstract org.jabref.logic.importer.Importer.getName.

Returns the name of this import format.

public ParserResult
importDatabase(BufferedReader
the input to read from
reader
)

Implements abstract org.jabref.logic.importer.Importer.importDatabase.

Parse the database in the source.

public boolean
isRecognizedFormat(BufferedReader reader)

Implements abstract org.jabref.logic.importer.Importer.isRecognizedFormat.

The correct behavior is to return false if it is certain that the file is not of the MsBib type, and true otherwise.

private static DocumentBuilderFactory

Returns:

If supported, XXE safe DocumentBuilderFactory. Else, returns original builder given
makeSafeDocBuilderFactory
(DocumentBuilderFactory
| DocumentBuilderFactory to be made XXE safe.
dBuild
)

DocumentBuilderFactory makes a XXE safe Builder factory from dBuild.

Inherited from org.jabref.logic.importer.Importer:
compareToequalsgetCharsetgetIdgetReadergetReaderhashCodeimportDatabaseimportDatabaseisRecognizedFormatisRecognizedFormattoString

Field Detail

DISABLEDTDback to summary
private static final String DISABLEDTD
DISABLEEXTERNALDTDback to summary
private static final String DISABLEEXTERNALDTD
DOCUMENT_BUILDER_FACTORYback to summary
private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY
LOGGERback to summary
private static final Logger LOGGER

Hides org.jabref.logic.importer.Importer.LOGGER.

Constructor Detail

MsBibImporterback to summary
public MsBibImporter()

Method Detail

getDescriptionback to summary
public String getDescription()

Implements abstract org.jabref.logic.importer.Importer.getDescription.

Doc from org.jabref.logic.importer.Importer.getDescription.

Returns the description of the import format.

The description should specify

  • what kind of entries from what sources and based on what specification it is able to import
  • by what criteria it recognizes an import format
Returns:String

description of the import format

Annotations
@Override
getFileTypeback to summary
public StandardFileType getFileType()

Implements abstract org.jabref.logic.importer.Importer.getFileType.

Doc from org.jabref.logic.importer.Importer.getFileType.

Returns the type of files that this importer can read

Returns:StandardFileType

FileType corresponding to the importer

Annotations
@Override
getNameback to summary
public String getName()

Implements abstract org.jabref.logic.importer.Importer.getName.

Doc from org.jabref.logic.importer.Importer.getName.

Returns the name of this import format.

The name must be unique.

Returns:String

format name, must be unique and not null

Annotations
@Override
importDatabaseback to summary
public ParserResult importDatabase(BufferedReader reader) throws IOException

Implements abstract org.jabref.logic.importer.Importer.importDatabase.

Doc from org.jabref.logic.importer.Importer.importDatabase.

Parse the database in the source.

This method can be called in two different contexts - either when importing in a specified format, or when importing in unknown format. In the latter case, JabRef cycles through all available import formats. No error messages or feedback is displayed from individual import formats in this case.

If importing in a specified format and an empty library is returned, JabRef reports that no entries were found.

This method should never return null.

Parameters
reader:BufferedReader

the input to read from

Annotations
@Override
isRecognizedFormatback to summary
public boolean isRecognizedFormat(BufferedReader reader) throws IOException

Implements abstract org.jabref.logic.importer.Importer.isRecognizedFormat.

The correct behavior is to return false if it is certain that the file is not of the MsBib type, and true otherwise. Returning true is the safe choice if not certain.

Annotations
@Override
makeSafeDocBuilderFactoryback to summary
private static DocumentBuilderFactory makeSafeDocBuilderFactory(DocumentBuilderFactory dBuild)

DocumentBuilderFactory makes a XXE safe Builder factory from dBuild. If not supported by current XML then returns original builder given and logs error.

Parameters
dBuild:DocumentBuilderFactory

| DocumentBuilderFactory to be made XXE safe.

Returns:DocumentBuilderFactory

If supported, XXE safe DocumentBuilderFactory. Else, returns original builder given