
    Mh                        S r SSKJr  SSKrSSKJr  SSKJrJrJ	r	  SSK
r
SSKJr  SSKJr  SSKJrJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJrJrJrJ r J!r!J"r"J#r#  SSK$J%r%  \(       a.  SSK&J'r'  SSK(J)r)  SSK*J+r+  SSK,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5  SSK6J7r7  \" \S   \S   S-  S9 " S S5      5       r8 " S S\85      r9 " S S\85      r:          S*S jr;S+S  jr<S,S! jr=\R|                  4                                 S-S" jjr?\" \S   \S   S-  S9S#SS$S$SSSSS%S&SSS'S\R|                  S(.                                 S.S) jj5       r@g)/z5
:mod:``pandas.io.xml`` is a module for reading XML.
    )annotationsN)PathLike)TYPE_CHECKINGAnyCallable)lib)import_optional_dependency)AbstractMethodErrorParserError)doc)find_stack_level)check_dtype_backend)is_list_like)_shared_docs)file_exists
get_handleinfer_compressionis_file_likeis_fsspec_urlis_urlstringify_path)
TextParser)Sequence)Element)etree)	CompressionOptionsConvertersArgDtypeArgDtypeBackendFilePathParseDatesArg
ReadBufferStorageOptions
XMLParsers)	DataFramestorage_optionsdecompression_optionspath_or_buffer)r&   r'   c                      \ rS rSrSr                              SS jrSS jrSS jrSS jrSS jr	SS jr
    SS	 jrS
rg)_XMLFrameParser>   a  
Internal subclass to parse XML into DataFrames.

Parameters
----------
path_or_buffer : a valid JSON ``str``, path object or file-like object
    Any valid string path is acceptable. The string could be a URL. Valid
    URL schemes include http, ftp, s3, and file.

xpath : str or regex
    The ``XPath`` expression to parse required set of nodes for
    migration to :class:`~pandas.DataFrame`. ``etree`` supports limited ``XPath``.

namespaces : dict
    The namespaces defined in XML document (``xmlns:namespace='URI'``)
    as dicts with key being namespace and value the URI.

elems_only : bool
    Parse only the child elements at the specified ``xpath``.

attrs_only : bool
    Parse only the attributes at the specified ``xpath``.

names : list
    Column names for :class:`~pandas.DataFrame` of parsed XML data.

dtype : dict
    Data type for data or columns. E.g. {{'a': np.float64,
    'b': np.int32, 'c': 'Int64'}}

    .. versionadded:: 1.5.0

converters : dict, optional
    Dict of functions for converting values in certain columns. Keys can
    either be integers or column labels.

    .. versionadded:: 1.5.0

parse_dates : bool or list of int or names or list of lists or dict
    Converts either index or select columns to datetimes

    .. versionadded:: 1.5.0

encoding : str
    Encoding of xml object or document.

stylesheet : str or file-like
    URL, file, file-like object, or a raw string containing XSLT,
    ``etree`` does not support XSLT but retained for consistency.

iterparse : dict, optional
    Dict with row element as key and list of descendant elements
    and/or attributes as value to be retrieved in iterparsing of
    XML document.

    .. versionadded:: 1.5.0

{decompression_options}

    .. versionchanged:: 1.4.0 Zstandard support.

{storage_options}

See also
--------
pandas.io.xml._EtreeFrameParser
pandas.io.xml._LxmlFrameParser

Notes
-----
To subclass this class effectively you must override the following methods:`
    * :func:`parse_data`
    * :func:`_parse_nodes`
    * :func:`_iterparse_nodes`
    * :func:`_parse_doc`
    * :func:`_validate_names`
    * :func:`_validate_path`


See each method's respective documentation for details on their
functionality.
c                    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        S U l        Xl        Xl        g )N)r(   xpath
namespaces
elems_only
attrs_onlynamesdtype
convertersparse_datesencoding
stylesheet	iterparseis_stylecompressionr&   )selfr(   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r9   r&   s                  ?/var/www/html/env/lib/python3.13/site-packages/pandas/io/xml.py__init___XMLFrameParser.__init__   sU    " -
$$$

$& $"/:.    c                    [        U 5      e)z
Parse xml data.

This method will call the other internal methods to
validate ``xpath``, names, parse and return specific nodes.
r
   r:   s    r;   
parse_data_XMLFrameParser.parse_data   s     "$''r>   c                	   U R                   (       a  U R                  (       a  [        S5      eU R                   (       Ga'  U R                  (       a  U VVVs/ s H  n0 UR                  (       a7  UR                  R                  5       (       d  UR                  UR                  0O0 E[        U R                  UR                  S5      5       VVs0 s H$  u  p4X4R                  (       a  UR                  OS_M&     snnEPM     nnnnGOCU VVs/ s HL  nUR                  S5       Vs0 s H,  oDR                  UR                  (       a  UR                  OS_M.     snPMN     nnnGOU R                  (       aM  U VVVs/ s H:  o"R                  R                  5        VVs0 s H  u  pgXg(       a  UOS_M     snnPM<     nnnnGOU R                  (       a  U VVVs/ s H  n0 UR                  EUR                  (       a7  UR                  R                  5       (       d  UR                  UR                  0O0 E[        U R                  UR                  S5      5       VVs0 s H$  u  p4X4R                  (       a  UR                  OS_M&     snnEPM     nnnnOU VVs/ s H  n0 UR                  EUR                  (       a7  UR                  R                  5       (       d  UR                  UR                  0O0 EUR                  S5       Vs0 s H,  oDR                  UR                  (       a  UR                  OS_M.     snEPM     nnnU VVVs/ s HB  oR                  5        VVs0 s H"  u  pgSU;   a  UR                  S5      S   OUU_M$     snnPMD     nnnn[        [        R                  U VVs/ s H  oR                  5         H  ofPM     M     snn5      5      n	U VVs/ s H,  o Vs0 s H  ofXhR                  5       ;   a  X   OS_M     snPM.     nnnU R                  (       a=  U Vs/ s H0  n[        [        U R                  UR!                  5       5      5      PM2     nnU$ s  snnf s  snnnf s  snf s  snnf s  snnf s  snnnf s  snnf s  snnnf s  snf s  snnf s  snnf s  snnnf s  snnf s  snf s  snnf s  snf )a  
Parse xml nodes.

This method will parse the children and attributes of elements
in ``xpath``, conditionally for only elements, only attributes
or both while optionally renaming node names.

Raises
------
ValueError
    * If only elements and only attributes are specified.

Notes
-----
Namespace URIs will be removed from return node values. Also,
elements with missing children or attributes compared to siblings
will have optional keys filled with None values.
z4Either element or attributes can be parsed not both.*N}   )r/   r0   
ValueErrorr1   textisspacetagzipfindallattribitemssplitlistdictfromkeyskeysvalues)
r:   elemselnmchdictskvdrT   s
             r;   _parse_nodes_XMLFrameParser._parse_nodes   s   , ??tSTT???zz $ $
  "wwrww/@/@  VVRWW-!#	
 +.djj"**S/*J*J 77<*J
 $  " $# EGJJsOTObVVRWWT9OT#  
 __NSNS1BC1BA$1BCe  E ZZ  
  Bii,.GGBGGOO<M<M(SU
 '*$**bjjo&F&FFB wwBGGD8&F    
E&    Bii,.GGBGGOO<M<M(SU GIjjQToVovv"''rwwt;oV
     TY
SXawwyIytqqQWWS\!_a2yISX 	 
 DMMe"FeVVX1X1e"FGHMRSUdCdQ&&(]QT4dCUS::@EF1T#djj!((*56EFg  U D	
" W	 J
 #GCS Gs   A9Q8+Q2;	Q8R(3Q?R>"R R
7RBR!+R	RA0R)3R$R)R5+)R/R59"R<,	S5#SS77S2Q8?R
RR$R)/R5Sc                *
   / nSn[        U R                  [        5      (       d+  [        [	        U R                  5      R
                   S35      eU R                  (       a,  [        [        U R                  R                  5       5      5      OSn[        U R                  U   5      (       d$  [        [	        U R                  U   5       S35      e[        U R                  S5      (       d  [        U R                  [        [        45      (       a  [        U R                  5      (       dp  [        U R                  5      (       dV  [        U R                  [        5      (       a   U R                  R!                  S5      (       d  [#        U R                  S5      b  [%        S5      e['        U R                  U   5      ['        [)        U R                  U   5      5      :g  nU" U R                  S	S
9 GH(  u  pgSUR*                  ;   a  UR*                  R-                  S5      S   OUR*                  nUS:X  a  X:X  a  0 nUGb/  U R.                  (       a  U(       a  [1        U R                  U   U R.                  5       H  u  pX:X  a;  UR2                  (       a  UR2                  OSnXR5                  5       ;  a	  X;  a  XU
'   XR6                  ;   d  MV  UR6                  U	   UR5                  5       ;  d  My  X;  d  M  UR6                  U	   X:'   M     O^U R                  U    HK  n	X:X  a!  UR2                  (       a  UR2                  OSX9'   XR6                  ;   d  M:  UR6                  U	   X9'   MM     US:X  d  GM  X:X  a  Ub  UR9                  U5        SnUR;                  5         [        US5      (       d  GM  UR=                  5       c  GM  UR?                  5       c  GM  UR?                  5       S	 UR=                  5       c  GM  UR?                  5       b  M8  GM+     U/ :X  a  [%        S5      e[A        [        RC                  U VVs/ s H  oR                  5         H  oPM     M     snn5      5      nU VVs/ s H,  o Vs0 s H  oXR                  5       ;   a  X   OS_M     snPM.     nnnU R.                  (       a=  U Vs/ s H0  n[        [1        U R.                  UR5                  5       5      5      PM2     nnU$ s  snnf s  snf s  snnf s  snf )a  
Iterparse xml nodes.

This method will read in local disk, decompressed XML files for elements
and underlying descendants using iterparse, a method to iterate through
an XML tree without holding entire XML tree in memory.

Raises
------
TypeError
    * If ``iterparse`` is not a dict or its dict value is not list-like.
ParserError
    * If ``path_or_buffer`` is not a physical file on disk or file-like object.
    * If no data is returned from selected items in ``iterparse``.

Notes
-----
Namespace URIs will be removed from return node values. Also,
elements with missing children or attributes in submitted list
will have optional keys filled with None values.
Nz" is not a valid type for iterparse z+ is not a valid type for value in iterparsereadz<?xml<inferziterparse is designed for large XML files that are fully extracted on local disk and not as compressed files or online sources.)startend)eventsrF   rG   rf   rg   getpreviousr   z+No result from selected items in iterparse.)"
isinstancer7   rR   	TypeErrortype__name__nextiterrT   r   hasattrr(   strr   r   r   
startswithr   r   lensetrK   rP   r1   rL   rI   rU   rN   appendclearri   	getparentrQ   rS   )r:   r7   rZ   rowrow_nodeiterparse_repeatseventelem	curr_elemcolrX   elem_valr]   r[   rT   s                  r;   _iterparse_nodes _XMLFrameParser._iterparse_nodes  s   . .0,0$..$//'0011ST  9=4T^^00234BDNN8455x012 3) ) 
 ++V444..h@@d))**T00114..44''22>BB !4!4g>JL 
  x 89Sx()>
 
 %T%8%8AQRKE25/s+A.txxI(C::"3#&t~~h'?#L$+48IItyy4H'zz|;*2B++-#{{3/szz|C*.++c*: $M  $~~h7$+48IItyy4CH++-'+{{3'7CH	  8 ~(S_LL%C

4//((*64>>;K;W NN,Q/ ((*64>>;K;WC SJ B;KLLDMMe"FeVVX1X1e"FGHMRSUdCdQ&&(]QT4dCUS::@EF1T#djj!((*56EF #GCS Gs$   "S?9	T
#T%T
7TT
c                    [        U 5      e)z
Validate ``xpath``.

This method checks for syntax, evaluation, or empty nodes return.

Raises
------
SyntaxError
    * If xpah is not supported or issues with namespaces.

ValueError
    * If xpah does not return any nodes.
r@   rA   s    r;   _validate_path_XMLFrameParser._validate_path  s     "$''r>   c                    [        U 5      e)z
Validate names.

This method will check if names is a list-like and aligns
with length of parse nodes.

Raises
------
ValueError
    * If value is not a list and less then length of nodes.
r@   rA   s    r;   _validate_names_XMLFrameParser._validate_names  s     "$''r>   c                    [        U 5      e)zy
Build tree from path_or_buffer.

This method will parse XML object into tree
either from string/bytes or file location.
r@   )r:   raw_docs     r;   
_parse_doc_XMLFrameParser._parse_doc  s     "$''r>   )r0   r9   r3   r2   r/   r5   r8   r7   r1   r.   r4   r(   r&   r6   r-   N)r(   .FilePath | ReadBuffer[bytes] | ReadBuffer[str]r-   rq   r.   dict[str, str] | Noner/   boolr0   r   r1   Sequence[str] | Noner2   DtypeArg | Noner3   ConvertersArg | Noner4   ParseDatesArg | Noner5   
str | Noner6   5FilePath | ReadBuffer[bytes] | ReadBuffer[str] | Noner7   dict[str, list[str]] | Noner9   r   r&   r#   returnNoner   list[dict[str, str | None]])rV   	list[Any]r   r   )r7   r   r   r   r   r   r   r   )r   r   r   zElement | etree._Element)rm   
__module____qualname____firstlineno____doc__r<   rB   r^   r   r   r   r   __static_attributes__ r>   r;   r*   r*   >   s    
Qf/F/ / *	/
 / / $/ / )/ */ / J/ // (/ (/  
!/B(TlgR("(	(E	(	!	(r>   r*   c                  H    \ rS rSrSrS	S jrS
S jrSS jr    SS jrSr	g)_EtreeFrameParseri  zs
Internal class to parse XML into DataFrames with the Python
standard library XML module: `xml.etree.ElementTree`.
c                >   SSK Jn  U R                  b  [        S5      eU R                  c0  U R	                  U R
                  5      U l        U R                  5       nU R                  5         U R                  c  U R                  W5      nU$ U R                  U5      nU$ )Nr   r7   zBTo use stylesheet, you need lxml installed and selected as parser.)xml.etree.ElementTreer7   r6   rH   r   r(   xml_docr   r   r^   r   r:   r7   rV   	xml_dictss       r;   rB   _EtreeFrameParser.parse_data  s    3??&T  >>!??4+>+>?DL'')E ~~% e$ 	  &&y1 	 r>   c                `   Sn U R                   R                  U R                  U R                  S9nU VVs/ s H  o3R                  S5        H  oDPM     M     nnnU VVVs0 s H(  o3R                  R                  5         H  u  pgXg_M	     M*     nnnnUc  [        U5      eUb[  U R                  (       a  U/ :X  a  [        U5      eU R                  (       a  U0 :X  a  [        U5      eU/ :X  a  U0 :X  a  [        U5      eU$ s  snnf s  snnnf ! [        [        4 a    [        S5      ef = f)zw
Notes
-----
``etree`` supports limited ``XPath``. If user attempts a more complex
expression syntax error will raise.
xpath does not return any nodes or attributes. Be sure to specify in `xpath` the parent nodes of children and attributes to parse. If document uses namespaces denoted with xmlns, be sure to define namespaces and use them in xpath.r.   rE   zxYou have used an incorrect or unsupported XPath expression for etree library or you used an undeclared namespace prefix.)r   rM   r-   r.   rN   rO   rH   r/   r0   KeyErrorSyntaxError	r:   msgrV   rW   rY   childrenr[   r\   attrss	            r;   r    _EtreeFrameParser._validate_path  s   ! 		LL(((PE%*EUrZZ_r_UHE$)HEbiioo6GdaQT6GQEEH} o% ??x2~$S/)??u{$S/)r>erk$S/) + FH +& 	/ 	s)   3D #D	D #/D
A0D D D-c                   U R                   (       a  U R                  (       a,  U R                  [        [        U R                  5      5         nODU R                  R                  U R                  U R                  S9nUb  UR                  S5      O/ n[        U R                   5      (       a.  [        U R                   5      [        U5      :  a  [        S5      eg [        [        U R                   5      R                   S35      eg )Nr   rE   7names does not match length of child elements in xpath. is not a valid type for names)r1   r7   rn   ro   r   findr-   r.   rM   r   rs   rH   rk   rl   rm   )r:   r   parents      r;   r   !_EtreeFrameParser._validate_names  s     ::~~>>$tDNN/C*DE**4::$//*R282D6>>#."DJJ''tzz?S]2$Q  3
  DJJ'0011OP  r>   c                   SSK JnJn  [        UU R                  U R
                  U R                  S9n[        U5       nU" U R                  S9nU" XVS9nS S S 5        UR                  5       $ ! , (       d  f       WR                  5       $ = f)Nr   )	XMLParserparsefilepath_or_bufferr5   r9   r&   r5   parser)	r   r   r   get_data_from_filepathr5   r9   r&   preprocess_datagetroot)r:   r   r   r   handle_dataxml_datacurr_parserdocuments           r;   r   _EtreeFrameParser._parse_doc  s    	

 -&]](( 00	
 [)X#T]];KX:H * !!	 *) !!s   A--
B
)r   Nr   r   r   )r   r   r   r   )
rm   r   r   r   r   rB   r   r   r   r   r   r>   r;   r   r     s,    
,'R("E"	"r>   r   c                  R    \ rS rSrSrS
S jrSS jrSS jr    SS jrSS jr	Sr
g	)_LxmlFrameParseri  z
Internal class to parse XML into :class:`~pandas.DataFrame` with third-party
full-featured XML library, ``lxml``, that supports
``XPath`` 1.0 and XSLT 1.0.
c                   SSK Jn  U R                  cv  U R                  U R                  5      U l        U R
                  (       a5  U R                  U R
                  5      U l        U R                  5       U l        U R                  5       nU R                  5         U R                  c  U R                  W5      nU$ U R                  U5      nU$ )z
Parse xml data.

This method will call the other internal methods to
validate ``xpath``, names, optionally parse and run XSLT,
and parse original or transformed XML and return specific nodes.
r   r   )
lxml.etreer7   r   r(   r   r6   xsl_doc_transform_docr   r   r^   r   r   s       r;   rB   _LxmlFrameParser.parse_data!  s     	)>>!??4+>+>?DL#t?#224'')E ~~% e$ 	  &&y1 	 r>   c                ,   SnU R                   R                  U R                  U R                  S9nU VVs/ s H  o3R                  S5        H  oDPM     M     nnnU VVVs0 s H(  o3R                  R	                  5         H  u  pgXg_M	     M*     nnnnU/ :X  a  [        U5      eU/ :w  a[  U R                  (       a  U/ :X  a  [        U5      eU R                  (       a  U0 :X  a  [        U5      eU/ :X  a  U0 :X  a  [        U5      eU$ s  snnf s  snnnf )Nr   r   rE   )r   r-   r.   rN   rO   rH   r/   r0   r   s	            r;   r   _LxmlFrameParser._validate_path>  s    ! 	 ""4::$//"J!&?2#2BB? %D"))//2C$!2CDB;S/!B;8r> o%5B; o%2~%2+ o% @Ds   #D	"/Dc                   U R                   (       a  U R                  (       a,  U R                  [        [        U R                  5      5         nO1U R                  R                  U R
                  S-   U R                  S9n[        U R                   5      (       a.  [        U R                   5      [        U5      :  a  [        S5      eg [        [        U R                   5      R                   S35      eg )Nz[1]/*r   r   r   )r1   r7   rn   ro   r   r-   r.   r   rs   rH   rk   rl   rm   )r:   r   s     r;   r    _LxmlFrameParser._validate_namesY  s     ::~~>>$tDNN/C*DE<<--JJ(T__ .  DJJ''tzz?S]2$Q  3
  DJJ'0011OP  r>   c                   SSK JnJnJn  [	        UU R
                  U R                  U R                  S9n[        U5       nU" U R
                  S9n[        U[        R                  5      (       aG  U R
                  c  [        S5      eU" UR                  5       R                  U R
                  5      US9nOU" XgS9nS S S 5        U$ ! , (       d  f       W$ = f)Nr   )r   
fromstringr   r   r   z2Can not pass encoding None when input is StringIO.r   )r   r   r   r   r   r5   r9   r&   r   rj   ioStringIOrk   getvalueencode)	r:   r   r   r   r   r   r   r   r   s	            r;   r   _LxmlFrameParser._parse_docn  s    	
 	
 -&]](( 00	
 [)X#T]];K(BKK00==(#L  &%%'..t}}=k !> *  *) s    A=C
Cc                Z    SSK Jn  U" U R                  5      nU" U R                  5      nU$ )z
Transform original tree using stylesheet.

This method will transform original xml using XSLT script into
am ideally flatter xml document for easier parsing and migration
to Data Frame.
r   )XSLT)r   r   r   r   )r:   r   transformernew_docs       r;   r   _LxmlFrameParser._transform_doc  s(     	$4<<(dll+r>   )r   r   Nr   r   r   )r   r   r   zetree._Element)r   zetree._XSLTResultTree)rm   r   r   r   r   rB   r   r   r   r   r   r   r>   r;   r   r     s1    :6*E	Br>   r   c                   [        U [        5      (       d  [        U 5      n [        U [        5      (       a  U R	                  S5      (       d  [        U [        5      (       a0  [        U 5      (       d   [        U 5      (       d  [        U 5      (       aY  [        U SUUUS9 n[        UR                  S5      (       a  UR                  R                  5       OUR                  n SSS5        U $ U $ ! , (       d  f       U $ = f)a'  
Extract raw XML data.

The method accepts three input types:
    1. filepath (string-like)
    2. file-like object (e.g. open file object, StringIO)
    3. XML string or bytes

This method turns (1) into (2) to simplify the rest of the processing.
It returns input types (2) and (3) unchanged.
rc   r)r5   r9   r&   rb   N)rj   bytesr   rq   rr   r   r   r   r   rp   handlerb   )r   r5   r9   r&   
handle_objs        r;   r   r     s    " (%00+,>? 	%s++"--n==)3//$%%+,,)**#+
  :,,f55 !!&&(&& 
 
 
 s   AC,,
C;c                    [        U [        5      (       a  [        R                  " U 5      n U $ [        U [        5      (       a  [        R
                  " U 5      n U $ )z
Convert extracted raw data.

This method will return underlying data of extracted XML content.
The data either has a `read` attribute (e.g. a file object or a
StringIO/BytesIO) or is a string or bytes that is an XML document.
)rj   rq   r   r   r   BytesIO)datas    r;   r   r     sH     ${{4 
 K 
D%	 	 zz$Kr>   c                ,   [        [        U 5      5      nU  Vs/ s H  n[        UR                  5       5      PM     nn [	        U4SU0UD6 nUR                  5       sSSS5        $ s  snf ! , (       d  f       g= f! [         a    [        S5      ef = f)z
Convert parsed data to Data Frame.

This method will bind xml dictionary data of keys and values
into named columns of Data Frame using the built-in TextParser
class that build Data Frame and infers specific dtypes.
r1   NzqXML document may be too complex for import. Try to flatten document and use distinct element and attribute names.)rn   ro   rQ   rU   r   rb   r   )r   kwargstagsr]   nodestps         r;   _data_to_framer     s     T
D'+,t!T!((*tE,
4T4V4779 54 - 54 
+
 	

s.   #A'A= A,	A= ,
A:6A= :A= =Bc                   [        U [        5      (       aZ  [        [        U 5      [	        U 5      [        U 5      [        U 5      /5      (       d"  [        R                  " S[        [        5       S9  U
S:X  a1  [        SSS9nUb  [        U UUUUUUUUU	UUUU5      nO5[        S5      eU
S:X  a  [        U UUUUUUUUU	UUUU5      nO[        S	5      eUR!                  5       n[#        SUUUUUS
.UD6$ )z
Call internal parsers.

This method will conditionally call internal parsers:
LxmlFrameParser and/or EtreeParser.

Raises
------
ImportError
    * If lxml is not installed if selected as parser.

ValueError
    * If parser is not lxml or etree.
zPassing literal xml to 'read_xml' is deprecated and will be removed in a future version. To read from a literal string, wrap it in a 'StringIO' object.)
stacklevellxmlz
lxml.etreeignore)errorsz7lxml not found, please install or use the etree parser.r   z,Values for parser can only be lxml or etree.)r   r2   r3   r4   dtype_backendr   )rj   rq   anyr   r   r   r   warningswarnFutureWarningr   r	   r   ImportErrorr   rH   rB   r   )r(   r-   r.   r/   r0   r1   r2   r3   r4   r5   r   r6   r7   r9   r&   r   r   r   p
data_dictss                       r;   _parser     s?   H .#&&s('>".)		
0 0 	> ')	
 ),xH A" WXX	7	
" GHHJ #  r>   z./*Fzutf-8r   re   )r-   r.   r/   r0   r1   r2   r3   r4   r5   r   r6   r7   r9   r&   r   c                   [        U5        [        S0 SU _SU_SU_SU_SU_SU_SU_SU_S	U_S
U	_SU
_SU_SU_SU_SU_SU_6$ )a#  
Read XML document into a :class:`~pandas.DataFrame` object.

.. versionadded:: 1.3.0

Parameters
----------
path_or_buffer : str, path object, or file-like object
    String, path object (implementing ``os.PathLike[str]``), or file-like
    object implementing a ``read()`` function. The string can be any valid XML
    string or a path. The string can further be a URL. Valid URL schemes
    include http, ftp, s3, and file.

    .. deprecated:: 2.1.0
        Passing xml literal strings is deprecated.
        Wrap literal xml input in ``io.StringIO`` or ``io.BytesIO`` instead.

xpath : str, optional, default './\*'
    The ``XPath`` to parse required set of nodes for migration to
    :class:`~pandas.DataFrame`.``XPath`` should return a collection of elements
    and not a single element. Note: The ``etree`` parser supports limited ``XPath``
    expressions. For more complex ``XPath``, use ``lxml`` which requires
    installation.

namespaces : dict, optional
    The namespaces defined in XML document as dicts with key being
    namespace prefix and value the URI. There is no need to include all
    namespaces in XML, only the ones used in ``xpath`` expression.
    Note: if XML document uses default namespace denoted as
    `xmlns='<URI>'` without a prefix, you must assign any temporary
    namespace prefix such as 'doc' to the URI in order to parse
    underlying nodes and/or attributes. For example, ::

        namespaces = {{"doc": "https://example.com"}}

elems_only : bool, optional, default False
    Parse only the child elements at the specified ``xpath``. By default,
    all child elements and non-empty text nodes are returned.

attrs_only :  bool, optional, default False
    Parse only the attributes at the specified ``xpath``.
    By default, all attributes are returned.

names :  list-like, optional
    Column names for DataFrame of parsed XML data. Use this parameter to
    rename original element names and distinguish same named elements and
    attributes.

dtype : Type name or dict of column -> type, optional
    Data type for data or columns. E.g. {{'a': np.float64, 'b': np.int32,
    'c': 'Int64'}}
    Use `str` or `object` together with suitable `na_values` settings
    to preserve and not interpret dtype.
    If converters are specified, they will be applied INSTEAD
    of dtype conversion.

    .. versionadded:: 1.5.0

converters : dict, optional
    Dict of functions for converting values in certain columns. Keys can either
    be integers or column labels.

    .. versionadded:: 1.5.0

parse_dates : bool or list of int or names or list of lists or dict, default False
    Identifiers to parse index or columns to datetime. The behavior is as follows:

    * boolean. If True -> try parsing the index.
    * list of int or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3
      each as a separate date column.
    * list of lists. e.g.  If [[1, 3]] -> combine columns 1 and 3 and parse as
      a single date column.
    * dict, e.g. {{'foo' : [1, 3]}} -> parse columns 1, 3 as date and call
      result 'foo'

    .. versionadded:: 1.5.0

encoding : str, optional, default 'utf-8'
    Encoding of XML document.

parser : {{'lxml','etree'}}, default 'lxml'
    Parser module to use for retrieval of data. Only 'lxml' and
    'etree' are supported. With 'lxml' more complex ``XPath`` searches
    and ability to use XSLT stylesheet are supported.

stylesheet : str, path object or file-like object
    A URL, file-like object, or a raw string containing an XSLT script.
    This stylesheet should flatten complex, deeply nested XML documents
    for easier parsing. To use this feature you must have ``lxml`` module
    installed and specify 'lxml' as ``parser``. The ``xpath`` must
    reference nodes of transformed XML document generated after XSLT
    transformation and not the original XML document. Only XSLT 1.0
    scripts and not later versions is currently supported.

iterparse : dict, optional
    The nodes or attributes to retrieve in iterparsing of XML document
    as a dict with key being the name of repeating element and value being
    list of elements or attribute names that are descendants of the repeated
    element. Note: If this option is used, it will replace ``xpath`` parsing
    and unlike ``xpath``, descendants do not need to relate to each other but can
    exist any where in document under the repeating element. This memory-
    efficient method should be used for very large XML files (500MB, 1GB, or 5GB+).
    For example, ::

        iterparse = {{"row_element": ["child_elem", "attr", "grandchild_elem"]}}

    .. versionadded:: 1.5.0

{decompression_options}

    .. versionchanged:: 1.4.0 Zstandard support.

{storage_options}

dtype_backend : {{'numpy_nullable', 'pyarrow'}}, default 'numpy_nullable'
    Back-end data type applied to the resultant :class:`DataFrame`
    (still experimental). Behaviour is as follows:

    * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`
      (default).
    * ``"pyarrow"``: returns pyarrow-backed nullable :class:`ArrowDtype`
      DataFrame.

    .. versionadded:: 2.0

Returns
-------
df
    A DataFrame.

See Also
--------
read_json : Convert a JSON string to pandas object.
read_html : Read HTML tables into a list of DataFrame objects.

Notes
-----
This method is best designed to import shallow XML documents in
following format which is the ideal fit for the two-dimensions of a
``DataFrame`` (row by column). ::

        <root>
            <row>
              <column1>data</column1>
              <column2>data</column2>
              <column3>data</column3>
              ...
           </row>
           <row>
              ...
           </row>
           ...
        </root>

As a file format, XML documents can be designed any way including
layout of elements and attributes as long as it conforms to W3C
specifications. Therefore, this method is a convenience handler for
a specific flatter design and not all possible XML structures.

However, for more complex XML documents, ``stylesheet`` allows you to
temporarily redesign original document with XSLT (a special purpose
language) for a flatter version for migration to a DataFrame.

This function will *always* return a single :class:`DataFrame` or raise
exceptions due to issues with XML document, ``xpath``, or other
parameters.

See the :ref:`read_xml documentation in the IO section of the docs
<io.read_xml>` for more information in using this method to parse XML
files to DataFrames.

Examples
--------
>>> from io import StringIO
>>> xml = '''<?xml version='1.0' encoding='utf-8'?>
... <data xmlns="http://example.com">
...  <row>
...    <shape>square</shape>
...    <degrees>360</degrees>
...    <sides>4.0</sides>
...  </row>
...  <row>
...    <shape>circle</shape>
...    <degrees>360</degrees>
...    <sides/>
...  </row>
...  <row>
...    <shape>triangle</shape>
...    <degrees>180</degrees>
...    <sides>3.0</sides>
...  </row>
... </data>'''

>>> df = pd.read_xml(StringIO(xml))
>>> df
      shape  degrees  sides
0    square      360    4.0
1    circle      360    NaN
2  triangle      180    3.0

>>> xml = '''<?xml version='1.0' encoding='utf-8'?>
... <data>
...   <row shape="square" degrees="360" sides="4.0"/>
...   <row shape="circle" degrees="360"/>
...   <row shape="triangle" degrees="180" sides="3.0"/>
... </data>'''

>>> df = pd.read_xml(StringIO(xml), xpath=".//row")
>>> df
      shape  degrees  sides
0    square      360    4.0
1    circle      360    NaN
2  triangle      180    3.0

>>> xml = '''<?xml version='1.0' encoding='utf-8'?>
... <doc:data xmlns:doc="https://example.com">
...   <doc:row>
...     <doc:shape>square</doc:shape>
...     <doc:degrees>360</doc:degrees>
...     <doc:sides>4.0</doc:sides>
...   </doc:row>
...   <doc:row>
...     <doc:shape>circle</doc:shape>
...     <doc:degrees>360</doc:degrees>
...     <doc:sides/>
...   </doc:row>
...   <doc:row>
...     <doc:shape>triangle</doc:shape>
...     <doc:degrees>180</doc:degrees>
...     <doc:sides>3.0</doc:sides>
...   </doc:row>
... </doc:data>'''

>>> df = pd.read_xml(StringIO(xml),
...                  xpath="//doc:row",
...                  namespaces={{"doc": "https://example.com"}})
>>> df
      shape  degrees  sides
0    square      360    4.0
1    circle      360    NaN
2  triangle      180    3.0

>>> xml_data = '''
...         <data>
...            <row>
...               <index>0</index>
...               <a>1</a>
...               <b>2.5</b>
...               <c>True</c>
...               <d>a</d>
...               <e>2019-12-31 00:00:00</e>
...            </row>
...            <row>
...               <index>1</index>
...               <b>4.5</b>
...               <c>False</c>
...               <d>b</d>
...               <e>2019-12-31 00:00:00</e>
...            </row>
...         </data>
...         '''

>>> df = pd.read_xml(StringIO(xml_data),
...                  dtype_backend="numpy_nullable",
...                  parse_dates=["e"])
>>> df
   index     a    b      c  d          e
0      0     1  2.5   True  a 2019-12-31
1      1  <NA>  4.5  False  b 2019-12-31
r(   r-   r.   r/   r0   r1   r2   r3   r4   r5   r   r6   r7   r9   r&   r   r   )r   r   )r(   r-   r.   r/   r0   r1   r2   r3   r4   r5   r   r6   r7   r9   r&   r   s                   r;   read_xmlr   `  s    L	 & %  	
             (  $! r>   )
r   z6FilePath | bytes | ReadBuffer[bytes] | ReadBuffer[str]r5   r   r9   r   r&   r#   r   z1str | bytes | ReadBuffer[bytes] | ReadBuffer[str])r   zio.StringIO | io.BytesIO)r   r%   )"r(   r   r-   rq   r.   r   r/   r   r0   r   r1   r   r2   r   r3   r   r4   r   r5   r   r   r$   r6   r   r7   r   r9   r   r&   r#   r   DtypeBackend | lib.NoDefaultr   r%   )"r(   r   r-   rq   r.   r   r/   r   r0   r   r1   r   r2   r   r3   r   r4   r   r5   r   r   r$   r6   r   r7   r   r9   r   r&   zStorageOptions | Noner   r  r   r%   )Ar   
__future__r   r   osr   typingr   r   r   r   pandas._libsr   pandas.compat._optionalr	   pandas.errorsr
   r   pandas.util._decoratorsr   pandas.util._exceptionsr   pandas.util._validatorsr   pandas.core.dtypes.commonr   pandas.core.shared_docsr   pandas.io.commonr   r   r   r   r   r   r   pandas.io.parsersr   collections.abcr   r   r   r   r   pandas._typingr   r   r   r   r    r!   r"   r#   r$   pandasr%   r*   r   r   r   r   r   
no_defaultr   r   r   r>   r;   <module>r     s   # 	  
   > ( 4 7 2 0   )(-
 
 
 !  !23&'>?BRRf( f(	f(Rl" l"^B BJ*N** $* $	*
 7*Z$
N 36..!hBhh &h 	h
 h  h h %h &h h h Fh +h $h $h  0!h$ %hV  !23&'>?BRR (,"&!'+(,"HL-1&--125..%uBu u &	u
 u u  u u %u &u u u Fu +u  $!u" +#u$ 0%u& 'u	ur>   