
    NgU                     V    d Z ddlmZ ddlmZmZmZ ddlmZm	Z	  G d de          Z
dS )zLoads Microsoft Excel files.    )Path)AnyListUnion)UnstructuredFileLoadervalidate_unstructured_versionc                   P     e Zd ZdZ	 d	deeef         dedef fdZde	fdZ
 xZS )
UnstructuredXMLLoadera  Load `XML` file using `Unstructured`.

    You can run the loader in one of two modes: "single" and "elements".
    If you use "single" mode, the document will be returned as a single
    langchain Document object. If you use "elements" mode, the unstructured
    library will split the document into elements such as Title and NarrativeText.
    You can pass in additional unstructured kwargs after mode to apply
    different unstructured settings.

    Examples
    --------
    from langchain_community.document_loaders import UnstructuredXMLLoader

    loader = UnstructuredXMLLoader(
        "example.xml", mode="elements", strategy="fast",
    )
    docs = loader.load()

    References
    ----------
    https://unstructured-io.github.io/unstructured/bricks.html#partition-xml
    single	file_pathmodeunstructured_kwargsc                 ~    t          |          }t          d            t                      j        d||d| d S )Nz0.6.7)min_unstructured_version)r   r    )strr   super__init__)selfr   r   r   	__class__s       d/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/document_loaders/xml.pyr   zUnstructuredXMLLoader.__init__$   sL     	NN	%wGGGGO94OO;NOOOOO    returnc                 6    ddl m}  |dd| j        i| j        S )Nr   )partition_xmlfilenamer   )unstructured.partition.xmlr   r   r   )r   r   s     r   _get_elementsz#UnstructuredXMLLoader._get_elements.   s4    <<<<<<}QQdnQ8PQQQr   )r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r   __classcell__)r   s   @r   r
   r
      s         4 P Pd#P P  #	P P P P P PRt R R R R R R R Rr   r
   N)r"   pathlibr   typingr   r   r   1langchain_community.document_loaders.unstructuredr   r   r
   r   r   r   <module>r'      s    " "       # # # # # # # # # #       %R %R %R %R %R2 %R %R %R %R %Rr   