.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2025 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.richtext.RichTextXMLHandler:

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextXMLHandler**
==========================================================================================================================================

A handler for loading and saving content in an ``XML`` format specific to :ref:`wx.richtext.RichTextBuffer`. 
         

You can either add the handler to the buffer and load and save through the buffer or control API, or you can create an instance of the handler on the stack and call its functions directly. 



|phoenix_title| Handler flags
=============================

The following flags can be used with this handler, via the handler's :meth:`~wx.richtext.RichTextFileHandler.SetFlags`  function or the buffer or control's SetHandlerFlags() function: 

- ``wx.richtext.RICHTEXT_HANDLER_INCLUDE_STYLESHEET`` Include the style sheet in loading and saving operations. 






|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div class="collabsible-wrapper">
      <input id="collapsible-inheritance" class="collapsible-checkbox" type="checkbox">
      <label for="collapsible-inheritance" tabindex="0" title="Show inheritance diagram" class="collapsible-label">Inheritance diagram for class <strong>RichTextXMLHandler</strong>:</label>
      <div class="collapsible-content">
         <p class="graphviz">
            <center><img src="_static/images/inheritance/wx.richtext.RichTextXMLHandler_inheritance.svg" alt="Inheritance diagram of RichTextXMLHandler" usemap="#dummy" class="inheritance invert-in-dark-mode"/></center>
            <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextXMLHandler.html" title="A handler for loading and saving content in an ``XML`` format specific to wx.richtext.RichTextBuffer." alt="" coords="5,159,265,188"/> <area shape="rect" id="node2" href="wx.richtext.RichTextFileHandler.html" title="The base class for file handlers." alt="" coords="8,82,262,111"/> <area shape="rect" id="node3" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="86,5,185,34"/> </map> 
         </p>
      </div>
   </div>
   <script type="text/javascript" src="_static/inheritancetoggle.js"></script>



|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextXMLHandler.__init__`                                 Constructor.
:meth:`~wx.richtext.RichTextXMLHandler.CanLoad`                                  Returns ``True``.
:meth:`~wx.richtext.RichTextXMLHandler.CanSave`                                  Returns ``True``.
:meth:`~wx.richtext.RichTextXMLHandler.ClearNodeToClassMap`                      Cleans up the mapping between node name and C++ class.
:meth:`~wx.richtext.RichTextXMLHandler.ExportXML`                                Recursively exports an object to the stream.
:meth:`~wx.richtext.RichTextXMLHandler.ImportXML`                                Recursively imports an object.
:meth:`~wx.richtext.RichTextXMLHandler.RegisterNodeName`                         Call with ``XML`` node name, C++ class name so that ``RTC`` can read in the node.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.richtext.RichTextXMLHandler(RichTextFileHandler)

   **Possible constructors**::

       RichTextXMLHandler(name="XML", ext="xml", type=RICHTEXT_TYPE_XML) ->
                          None
       
   
   A handler for loading and saving content in an ``XML`` format specific to
   RichTextBuffer.



   .. method:: __init__(self, name="XML", ext="xml", type=RICHTEXT_TYPE_XML)

      Constructor. 
                 


      :param `name`: 
      :type `name`: string
      :param `ext`: 
      :type `ext`: string
      :param `type`: 
      :type `type`: int




      :rtype: `None`     








   .. method:: CanLoad(self)

      Returns ``True``. 
                 

      :rtype: `bool`








   .. method:: CanSave(self)

      Returns ``True``. 
                 

      :rtype: `bool`








   .. staticmethod:: ClearNodeToClassMap()

      Cleans up the mapping between node name and C++ class. 
                 

      :rtype: `None`     








   .. method:: ExportXML(self, stream, obj, level)

      Recursively exports an object to the stream. 
                 


      :param `stream`: 
      :type `stream`: wx.OutputStream
      :param `obj`: 
      :type `obj`: wx.richtext.RichTextObject
      :param `level`: 
      :type `level`: int




      :rtype: `bool`








   .. method:: ImportXML(self, buffer, obj, node)

      Recursively imports an object. 
                 


      :param `buffer`: 
      :type `buffer`: wx.richtext.RichTextBuffer
      :param `obj`: 
      :type `obj`: wx.richtext.RichTextObject
      :param `node`: 
      :type `node`: wx.xml.XmlNode




      :rtype: `bool`








   .. staticmethod:: RegisterNodeName(nodeName, className)

      Call with ``XML`` node name, C++ class name so that ``RTC`` can read in the node. 
                 

      If you add a custom object, call this. 
                 


      :param `nodeName`: 
      :type `nodeName`: string
      :param `className`: 
      :type `className`: string




      :rtype: `None`     







