# openforcefield.typing.engines.smirnoff.io.XMLParameterIOHandler

class `openforcefield.typing.engines.smirnoff.io.``XMLParameterIOHandler`

  Handles serialization/deserialization of SMIRNOFF ForceField objects from OFFXML format.

  Methods

  `parse_file`(self, source) | Parse a SMIRNOFF force field definition in XML format, read from a file.
  `parse_string`(self, data) | Parse a SMIRNOFF force field definition in XML format.
  `to_file`(self, filename, smirnoff_data) | Write the current forcefield parameter set to a file, autodetecting the type from the extension.
  `to_string`(self, smirnoff_data) | Write the current forcefield parameter set to an XML string.
  `to_xml`(self, smirnoff_data) | Render the forcefield parameter set to XML.

  `__init__`(self)

    Create a new ParameterIOHandler.

  Methods

  `__init__`(self) | Create a new ParameterIOHandler.
  `parse_file`(self, source) | Parse a SMIRNOFF force field definition in XML format, read from a file.
  `parse_string`(self, data) | Parse a SMIRNOFF force field definition in XML format.
  `to_file`(self, filename, smirnoff_data) | Write the current forcefield parameter set to a file, autodetecting the type from the extension.
  `to_string`(self, smirnoff_data) | Write the current forcefield parameter set to an XML string.
  `to_xml`(self, smirnoff_data) | Render the forcefield parameter set to XML.

  `parse_file`(self, source)

    Parse a SMIRNOFF force field definition in XML format, read from a file.

    A `ParseError` is raised if the XML cannot be processed.

    Parameters
      source str or file-like obj

        File path of file-like obj specifying a SMIRNOFF force field definition in the SMIRNOFF XML format.

      .. notes ::

        - New SMIRNOFF sections are handled independently, as if they were specified in the same file.

        - If a SMIRNOFF section that has already been read appears again, its definitions are appended to the end of the previously-read definitions if the sections are configured with compatible attributes; otherwise, an `IncompatibleTagException` is raised.

  `parse_string`(self, data)

    Parse a SMIRNOFF force field definition in XML format.

    A `ParseError` is raised if the XML cannot be processed.

    Parameters
      data str

        A SMIRNOFF force field definition in the SMIRNOFF XML format.

  `to_file`(self, filename, smirnoff_data)

    Write the current forcefield parameter set to a file, autodetecting the type from the extension.

    Parameters
      filename str

        The name of the file to be written. The .offxml file extension must be present.

      smirnoff_data dict

        A dict structured in compliance with the SMIRNOFF data spec.

  `to_string`(self, smirnoff_data)

    Write the current forcefield parameter set to an XML string.

    Parameters
      smirnoff_data dict

        A dictionary structured in compliance with the SMIRNOFF spec

    Returns
      serialized_forcefield str

        XML String representation of this forcefield.

  `to_xml`(self, smirnoff_data)

    Render the forcefield parameter set to XML.

    Returns
      smirnoff_data dict

        A dictionary structures in comliance with the SMIRNOFF data spec.