(self, prefix_root=None,
                    self_only=False, pretty_print=True, debug_context=None)
Generates an XML string corresponding to this MJCF element.

    Args:
      prefix_root: (optional) A `NameScope` object to be treated as root
        for the purpose of calculating the prefix.
        If `None` then no prefix is included.
      self_only: (optional) A boolean, whether to generate an XML corresponding
        only to this element without any children.
      pretty_print: (optional) A boolean, whether to the XML string should be
        properly indented.
      debug_context: (optional) A `debugging.DebugContext` object to which
        the debugging information associated with the generated XML is written.
        This is intended for internal use within PyMJCF; users should never need
        manually pass this argument.

    Returns:
      A string.
Generates an XML string corresponding to this MJCF element.
Generates an XML string corresponding to this MJCF element .
def to_xml_string(self, prefix_root=None,
                    self_only=False, pretty_print=True, debug_context=None):
    """Generates an XML string corresponding to this MJCF element.

    Args:
      prefix_root: (optional) A `NameScope` object to be treated as root
        for the purpose of calculating the prefix.
        If `None` then no prefix is included.
      self_only: (optional) A boolean, whether to generate an XML corresponding
        only to this element without any children.
      pretty_print: (optional) A boolean, whether to the XML string should be
        properly indented.
      debug_context: (optional) A `debugging.DebugContext` object to which
        the debugging information associated with the generated XML is written.
        This is intended for internal use within PyMJCF; users should never need
        manually pass this argument.

    Returns:
      A string.
    """
    xml_element = self.to_xml(prefix_root, debug_context)
    if self_only and len(xml_element) > 0:  # pylint: disable=g-explicit-length-test
      etree.strip_elements(xml_element, '*')
      xml_element.text = '...'
    if (self_only and self._spec.identifier and
        not self._attributes[self._spec.identifier].to_xml_string(prefix_root)):
      del xml_element.attrib[self._spec.identifier]
    xml_string = util.to_native_string(
        etree.tostring(xml_element, pretty_print=pretty_print))
    if pretty_print and debug_context:
      return debug_context.commit_xml_string(xml_string)
    else:
      return xml_string
def to_xml_string ( self , prefix_root = None , self_only = False , pretty_print = True , debug_context = None ) : xml_element = self . to_xml ( prefix_root , debug_context ) if self_only and len ( xml_element ) > 0 : # pylint: disable=g-explicit-length-test etree . strip_elements ( xml_element , '*' ) xml_element . text = '...' if ( self_only and self . _spec . identifier and not self . _attributes [ self . _spec . identifier ] . to_xml_string ( prefix_root ) ) : del xml_element . attrib [ self . _spec . identifier ] xml_string = util . to_native_string ( etree . tostring ( xml_element , pretty_print = pretty_print ) ) if pretty_print and debug_context : return debug_context . commit_xml_string ( xml_string ) else : return xml_string