
    bMh                       d dl mZ d dlmZmZ d dlmZ d dlZd dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlZd dlZd d	lmZ d d
lmZmZ d dlmc mZ d dlZd dlmZmZm Z  d dl!m"Z# d dl$m%Z% d dl&m'Z'  eg dg ddej(        dgd          Z)dZ*dZ+ eddddddddddddddddddd d d d d ddddddddd d!d"d#dd$          Z,d% Z- ej.        d&d'g(          d)             Z/ ej.         ej0        d* ej1        d*          +          d,g(          d-             Z2d. Z3d/ Z4d0 Z5ej6        j7        ej6        j8        d1                         Z9d2 Z:d3 Z;d4 Z<d5 Z=d6 Z>d7 Z?d8 Z@ej6        A                    d9d:d;g          d<             ZBej6        A                    d9d:d;g          d=             ZCd> ZDej6        j7        ej6        j8        d?                         ZEej6        j7        ej6        j8        d@                         ZFdA ZGdB ZHdC ZIdD ZJdE ZKdF ZLdG ZMdH ZNdI ZOdJ ZPdK ZQej6        A                    dLd:dg          dM             ZRdN ZSdO ZTdP ZUdQ ZVdR ZWdS ZXdT ZYdU ZZdV Z[dW Z\dX Z]dY Z^dZ Z_d[ Z`d\ Zad] Zbd^ Zcd_ Zdd` Zeda Zf ejg        d*          db             Zhdc Zidd Zjde Zkdf Zldg Zmdh Zndi Zodj Zpdk Zqdl Zrdm Zsdn Ztdo Zuej6        A                    d9d:d;g          dp             Zvdq Zwdr Zxej6        j7        ej6        j8        ds                         Zydt Zzdu Z{dv Z|dw Z}dx Z~dy Zdz Zd{ Zd| Zd} Zd~ Zd Zd Zej6        j7        ej6        j8        d                         Zd Zd ZdS )    )annotations)BytesIOStringIO)	LZMAErrorN)	ReadError)	HTTPError)
ParseError)
BadZipFile)import_optional_dependency)EmptyDataErrorParserError)NA	DataFrameSeries)
get_handle)read_xmlsquarecircletriangleh  r            shapedegreessidesa[  <?xml version='1.0' encoding='utf-8'?>
<data xmlns="http://example.com">
  <row>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4</sides>
  </row>
  <row>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3</sides>
  </row>
</data>a  <?xml version='1.0' encoding='utf-8'?>
<doc:data xmlns:doc="http://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>ID_00001ID_00002ID_00003ID_00004ID_00005r         r   r   zBlue Line (Forest Park)zRed, Purple Linez#LineStyle01clampedToGroundz-87.77678526964958,41.8708863930319,0 -87.77826234150609,41.87097820122218,0 -87.78251583439344,41.87130129991005,0 -87.78418294588424,41.87145055520308,0 -87.7872369165933,41.8717239119163,0 -87.79160214925886,41.87210797280065,0a\  -87.65758750947528,41.96427269188822,0 -87.65802133507393,41.96581929055245,0 -87.65819033925305,41.96621846093642,0 -87.6583189819129,41.96650362897086,0 -87.65835858701473,41.96669002089185,0 -87.65838428411853,41.96688150295095,0 -87.65842208882658,41.96745896091846,0 -87.65846556843937,41.9683761425439,0 -87.65849296214573,41.96913893870342,0a  -87.65492939166126,41.95377494531437,0 -87.65557043199591,41.95376544118533,0 -87.65606302030132,41.95376391658746,0 -87.65623502146268,41.95377379126367,0 -87.65634748981634,41.95380103566435,0 -87.65646537904269,41.95387703994676,0 -87.65656532461145,41.95396622645799,0 -87.65664760856414,41.95404201996044,0 -87.65671750555913,41.95416647054043,0 -87.65673983607117,41.95429949810849,0 -87.65673866475777,41.95441024240925,0 -87.6567690255541,41.95490657227902,0 -87.65683672482363,41.95692259283837,0 -87.6568900886376,41.95861070983142,0 -87.65699865558875,41.96181418669004,0 -87.65756347177603,41.96397045777844,0 -87.65758750947528,41.96427269188822,0ah  -87.65362593118043,41.94742799535678,0 -87.65363554415794,41.94819886386848,0 -87.6536456393239,41.95059994675451,0 -87.65365831235026,41.95108288489359,0 -87.6536604873874,41.9519954657554,0 -87.65362592053201,41.95245597302328,0 -87.65367158496069,41.95311153649393,0 -87.65368468595476,41.9533202828916,0 -87.65369271253692,41.95343095587119,0 -87.65373335834569,41.95351536301472,0 -87.65378605844126,41.95358212680591,0 -87.65385067928185,41.95364452823767,0 -87.6539390793817,41.95370263886964,0 -87.6540786298351,41.95373403675265,0 -87.65430648647626,41.9537535411832,0 -87.65492939166126,41.95377494531437,0a   -87.65345391792157,41.94217681262115,0 -87.65342448305786,41.94237224420864,0 -87.65339745703922,41.94268217746244,0 -87.65337753982941,41.94288140770284,0 -87.65336256753105,41.94317369618263,0 -87.65338799707138,41.94357253961736,0 -87.65340240886648,41.94389158188269,0 -87.65341837392448,41.94406444407721,0 -87.65342275247338,41.94421065714904,0 -87.65347469646018,41.94434829382345,0 -87.65351486483024,41.94447699917548,0 -87.65353483605053,41.9453896864472,0 -87.65361975532807,41.94689193720703,0 -87.65362593118043,41.94742799535678,0idnamestyleUrlextrudealtitudeModecoordinatesc                     t          j        d           d} t          j        t          |           5  t          t                     d d d            d S # 1 swxY w Y   d S )NlxmlPassing 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.match)pytestimportorskiptmassert_produces_warningFutureWarningr   xml_default_nmspmsgs    \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/io/xml/test_xml.pytest_literal_xml_deprecationr>      s    
	:  
	#M	=	=	= # #!"""# # # # # # # # # # # # # # # # # #s   AAArbr)paramsc                    | j         S Nparamrequests    r=   moderH     
    =    r1   )marksetreec                    | j         S rC   rD   rF   s    r=   parserrN     rI   rJ   c                    t          j                    5 }t          |dd          5 }|                    |            d d d            n# 1 swxY w Y   t	          |fi |cd d d            S # 1 swxY w Y   d S )Nwutf-8encoding)r7   ensure_cleanopenwriter   )datakwargspathfs       r=   read_xml_iterparser[     s    			 (d$g... 	!GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	''''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s3   A-A	A-	A	A-A	A--A14A1c                   t          | d|          5 }t          j                    5 }t          |dd          5 }|                    |j                                                   d d d            n# 1 swxY w Y   t          |fi |cd d d            cd d d            S # 1 swxY w Y   	 d d d            d S # 1 swxY w Y   d S )Nr@   )compressionrP   rQ   rR   )r   r7   rT   rU   rV   handlereadr   )	comp_pathcompression_onlyrX   handlesrY   rZ   s         r=   read_xml_iterparse_comprc     s   	Is0@	A	A	A ,W_ 	,$dC'222 /a++--.../ / / / / / / / / / / / / / /D++F++	, 	, 	, 	, 	, 	, 	,, , , , , , , ,	, 	, 	, 	, 	, 	, 	, 	, 	,, , , , , , , , , , , , , , , , , ,sW   B<B#-A3'B#3A77B#:A7;B#
B<#B'	'B<*B'	+B<<C C c                H   t          j        d           t          | d          }t          | d          }t          | ddg di          }t          | ddg di          }t          j        ||           t          j        ||           t          j        ||           d S )Nr1   rN   rL   bookcategorytitleyearauthorpricerN   	iterparser5   r6   r   r7   assert_frame_equal)	xml_booksdf_file_lxmldf_file_etreedf_iter_lxmldf_iter_etrees        r=   test_parser_consistency_filerv     s    
If555LYw777MKKKL  L
 KKKL  M ,666,555,66666rJ   c                    |                     t                     t          t          t                    |           }t          t	          t                                                    | dg di          }t          j        ||           d S )Ncontentre   rowr   rm   )serve_contentr:   r   r   r   encoder7   rp   )rN   
httpserverdf_xpathdf_iters       r=   test_parser_consistency_urlr   3  s     %5666!1226BBBH ''))**7778  G (G,,,,,rJ   c                    t          | ||dk    rdnd           5 }t          ||          }d d d            n# 1 swxY w Y   t          g dg dg dg dg d	d
          }t          j        ||           d S Nr@   rQ   rR   re   cookingchildrenwebzEveryday ItalianzHarry PotterzLearning XMLzGiada De LaurentiiszJ K. RowlingzErik T. Ray  r   i  g      >@g=
ףp=@gC@rh   ri   rk   rj   rl   )rU   r   r   r7   rp   )rq   rN   rH   rZ   df_filedf_expecteds         r=   test_file_liker   B  s    	i43;;D	I	I	I -Q1V,,,- - - - - - - - - - - - - - - 666IIILLL&&&***	
 	
 K ';/////s   9= =c                ~   t          | ||dk    rdnd           5 }|                                }d d d            n# 1 swxY w Y   t          t          |t                    rt          |          nt          |          |          }t          g dg dg dg dg d	d
          }t          j	        ||           d S r   )
rU   r_   r   
isinstancebytesr   r   r   r7   rp   )rq   rN   rH   rZ   xml_objdf_ior   s          r=   test_file_ior   S  s%   	i43;;D	I	I	I Q&&((               '77	N			Xg=N=N  E
 666IIILLL&&&***	
 	
 K %-----   <A A c                   t          | ||dk    rdnd           5 }|                                }d d d            n# 1 swxY w Y   |dk    r"t          |                                          }n|dk    rt          |          }t	          ||          }t          g dg dg dg d	g d
d          }t          j        ||           d S Nr@   rQ   rR   r?   re   r   r   r   r   r   r   )rU   r_   r   decoder   r   r7   rp   rq   rN   rH   rZ   r   df_strr   s          r=    test_file_buffered_reader_stringr   i  s/   	i43;;D	I	I	I Q&&((               t||7>>++,,	7##gf---F666IIILLL&&&***	
 	
 K &+.....r   c                   t          | ||dk    rdnd           5 }t          |           |                                }d d d            n# 1 swxY w Y   |dk    r"t          |                                          }n|dk    rt          |          }t          ||          }t          g dg dg dg d	g d
d          }t          j        ||           d S r   )	rU   nextr_   r   r   r   r   r7   rp   r   s          r=   ,test_file_buffered_reader_no_xml_declarationr     s:   	i43;;D	I	I	I QQ&&((               t||7>>++,,	7##gf---F666IIILLL&&&***	
 	
 K &+.....s   $AAAc                    d}t          t          |          |           }t          ddddg          }t          j        ||           d S )N<   <中文標籤><row><c1>1</c1><c2>2</c2></row></中文標籤>re   r&   r'   )c1c2r   )indexr   r   r   r7   rp   )rN   txtr   r   s       r=   test_string_charsetr     sT    
HChsmmF333F1A..qc:::K&+.....rJ   c                    t          | |          }t          g dd                    ddg          d dgg dd          }t          j        ||           d S )	Nre   )uP   問  若箇是邪而言破邪 何者是正而道(Sorry, this is Big5 only)申正u;   問 既破有得申無得 亦應但破性執申假名以不uO   問 既破性申假 亦應但破有申無 若有無兩洗 亦應性假雙破耶 u<   答  邪既無量 正亦多途  大略為言不出二種 謂u;   有得與無得 有得是邪須破 無得是正須申
		故uL   答  不例  有無皆是性 所以須雙破 既分性假異 故有破不破)NuV   答 性執是有得 假名是無得  今破有得申無得 即是破性執申假名也N)u   問u   答a)r   r   joinr7   rp   )xml_doc_ch_utfrN   r   r   s       r=   test_file_charsetr     s    ~f555G   VX  ^	  !	
 	
 K2 ';/////rJ   c                    t          | d          5 }t          t          |                                          |           |j        rJ 	 d d d            d S # 1 swxY w Y   d S )Nr?   re   )rU   r   r   r_   closed)rq   rN   rZ   s      r=   test_file_handle_closer     s    	i		 !""622228                 s   :AA Avalr   rJ   c                h   t          j        d          }d                    ddg          }t          j        |j        |          5  t          | t                    rt          t          |           d           nt          t          |           d           d d d            d S # 1 swxY w Y   d S )N
lxml.etree|zDocument is emptyzNone \(line 0\)r3   r1   re   )
r5   r6   r   raisesXMLSyntaxErrorr   strr   r   r   )r   
lxml_etreer<   s      r=   test_empty_string_lxmlr     s    $\22J
((	
 C 
z0	<	<	< 2 2c3 	2Xc]]622222WS\\&1111	2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2s   AB''B+.B+c                   t          j        t          d          5  t          | t                    rt          t          |           d           nt          t          |           d           d d d            d S # 1 swxY w Y   d S )Nzno element foundr3   rL   re   )r5   r   r	   r   r   r   r   r   )r   s    r=   test_empty_string_etreer     s    	z);	<	<	< 3 3c3 	3Xc]]733333WS\\'2222	3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s   AA<<B B c                    d}t           j                            ddd          }t          j        t
          |          5  t          ||            d d d            d S # 1 swxY w Y   d S )Nr2   rW   htmlz	books.xmlr3   re   )osrY   r   r5   r   r9   r   )rN   r<   filenames      r=   test_wrong_file_pathr     s    	: 
 w||FFK88H	
 
 
 * * 	&))))	* * * * * * * * * * * * * * * * * *s   AA"%A"c                d   t          j        d           t          |d          5 }|                     |                                           t          | j        d          }d d d            n# 1 swxY w Y   t          g dg dg d	g d
g dd          }t          j	        ||           d S )Nr1   rQ   rR   rx   .//book[count(*)=4]xpathr   r   r   r   r   r   )
r5   r6   rU   r{   r_   r   urlr   r7   rp   )r}   xml_filerZ   df_urlr   s        r=   test_urlr     s!    	h	)	)	) GQ   222*.0EFFFG G G G G G G G G G G G G G G 666IIILLL&&&***	
 	
 K &+.....s   ?A11A58A5c                    |                     dd           t          j        t          d          5  t	          |j        d|            d d d            d S # 1 swxY w Y   d S )Nz	NOT FOUNDi  )codezHTTP Error 404: NOT FOUNDr3   r   r   rN   )r{   r5   r   r   r   r   )rN   r}   s     r=   test_wrong_urlr   	  s     [s333	y)D	F	F	F M M'<VLLLLM M M M M M M M M M M M M M M M M Ms   AAAc                    d}t          t          |          | d          }t          || dg did          }t          g dg dg d	dd
          }t	          j        ||           t	          j        ||           d S )Na  
      <data>
        <row sides=" 4 ">
          <shape>
              square
          </shape>
          <degrees>&#009;360&#009;</degrees>
        </row>
        <row sides=" 0 ">
          <shape>
              circle
          </shape>
          <degrees>&#009;360&#009;</degrees>
        </row>
        <row sides=" 3 ">
          <shape>
              triangle
          </shape>
          <degrees>&#009;180&#009;</degrees>
        </row>
      </data>string)rN   dtyperz   )r   r   r   )rN   rn   r   )z 4 z 0 z 3 )z 
              square
          z 
              circle
          z"
              triangle
          )	360	r   z	180	r   r   r   r[   r   r7   rp   rN   xmlr~   r   r   s        r=   test_whitespacer     s    C, fHEEEH 7778	  G ***  
 988	
 	
   K (K000';/////rJ   c                    t          j        d           t          j        t          d          5  t	          | dd           d d d            d S # 1 swxY w Y   d S )Nr1   xpath does not return any nodesr3   z	.//pythonr   r5   r6   r   
ValueErrorr   rq   s    r=   test_empty_xpath_lxmlr   H  s    
	z*K	M	M	M > >+f====> > > > > > > > > > > > > > > > > >   AAAc                    t          j        t          d          5  t          | dd           d d d            d S # 1 swxY w Y   d S )Nz/You have used an incorrect or unsupported XPathr3   	.//[book]rL   r   r5   r   SyntaxErrorr   r   s    r=   test_bad_xpath_etreer   N  s    	M
 
 
 ? ? 	+g>>>>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?   <A A c                    t          j        d          }t          j        |j        d          5  t	          | dd           d d d            d S # 1 swxY w Y   d S )Nr   zInvalid expressionr3   r   r1   r   r5   r6   r   XPathEvalErrorr   )rq   r   s     r=   test_bad_xpath_lxmlr   U  s    $\22J	z09M	O	O	O > >+f====> > > > > > > > > > > > > > > > > >r   c                ,   t          t          t                    dddi|           }t          t          | dg di          }t	          g dg d	d
t          d          dgd          }t          j        ||           t          j        ||           d S )N	.//ns:rownshttp://example.comr   
namespacesrN   rz   r   rm   r   r         @nan      @)r   r   r:   r[   r   floatr7   rp   rN   df_nmspr   r   s       r=   test_default_namespacer   _  s    !""./	  G !7778  G 555&5<<-	
 	
 K ';///';/////rJ   c                ,   t          t          t                    dddi|           }t          t          | dg di          }t	          g dg d	d
t          d          dgd          }t          j        ||           t          j        ||           d S )N
.//doc:rowdocr   r   rz   r   rm   r   r   r   r   r   )r   r   xml_prefix_nmspr[   r   r   r7   rp   r   s       r=   test_prefix_namespacer   y  s    !!/0	  G !5:W:W:W2X  G 555&5<<-	
 	
 K ';///';/////rJ   c                     t          j        d           t          t          t                    dddid          } t          t          t                    dddid          }t          j        | |           d S )	Nr1   r   r   r   r   r   r   rL   )r5   r6   r   r   r:   r7   rp   df_lxmldf_etrees     r=   "test_consistency_default_namespacer     s    
!""./	  G !""/0	  H '8,,,,,rJ   c                     t          j        d           t          t          t                    dddid          } t          t          t                    dddid          }t          j        | |           d S )Nr1   r   r   r   r   rL   )r5   r6   r   r   r   r7   rp   r   s     r=   !test_consistency_prefix_namespacer     s    
!!/0	  G !!/0	  H '8,,,,,rJ   c                    t          j        t          d          5  t          | d|           d d d            d S # 1 swxY w Y   d S )Nr   r3   z.//Placemarkr   r5   r   r   r   rq   rN   s     r=   *test_missing_prefix_with_default_namespacer    s    	z*K	M	M	M A A.@@@@A A A A A A A A A A A A A A A A A Ar   c                    t          j        t          d          5  t          | dd           d d d            d S # 1 swxY w Y   d S )Nz'you used an undeclared namespace prefixr3   .//kml:PlacemarkrL   r   r   )kml_cta_rail_liness    r=   $test_missing_prefix_definition_etreer    s    	{+T	V	V	V O O#+=gNNNNO O O O O O O O O O O O O O O O O Or   c                    t          j        d          }t          j        |j        d          5  t	          | dd           d d d            d S # 1 swxY w Y   d S )Nr   zUndefined namespace prefixr3   r  r1   r   r   )r  r   s     r=   #test_missing_prefix_definition_lxmlr	    s    $\22J	z09U	W	W	W N N#+=fMMMMN N N N N N N N N N N N N N N N N Nr   keyc                    t          j        d           t          j        t          d          5  t	          t          t                    d| did           d d d            d S # 1 swxY w Y   d S )Nr1   z0empty namespace prefix is not supported in XPathr3   r  http://www.opengis.net/kml/2.2r   )r5   r6   r   	TypeErrorr   r   r:   )r
  s    r=   test_none_namespace_prefixr    s    
	L
 
 
 
 
 	%&&$=>		
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   (A%%A),A)c                    t          | |          }t          | |dg di          }t          g dg dg dg dg d	d          }t          j        ||           t          j        ||           d S )
Nre   rf   r   rm   r   r   r   r   r   r   r   r7   rp   rq   rN   r   r   r   s        r=   test_file_elems_and_attrsr    s    y000GKKKL  G
 666IIILLL&&&***	
 	
 K ';///';/////rJ   c                    t          | d|          }t          | |ddgi          }t          dg di          }t          j        ||           t          j        ||           d S )NT)
attrs_onlyrN   rf   rh   rm   r   r  r  s        r=   test_file_only_attrsr    sv    yT&AAAGyFZL;QRRRGZ)G)G)GHIIK';///';/////rJ   c                    t          | d|          }t          | |dg di          }t          g dg dg dg d	d          }t          j        ||           t          j        ||           d S )
NT)
elems_onlyrN   rf   )ri   rk   rj   rl   rm   r   r   r   r   r  r  s        r=   test_file_only_elemsr    s    yT&AAAG???@  G
 IIILLL&&&***		
 	
 K ';///';/////rJ   c                    t          j        t          d          5  t          | dd|           d d d            d S # 1 swxY w Y   d S )Nz3Either element or attributes can be parsed not bothr3   T)r  r  rN   r  )r  rN   s     r=   test_elem_and_attrs_onlyr    s    	D
 
 
 V V 	#fUUUU	V V V V V V V V V V V V V V V V V Vs   =AAc                    d}t          j        t          d          5  t          t	          |          dd|            d d d            d S # 1 swxY w Y   d S )NaU  
      <data>
        <row>
          <shape sides="4">square</shape>
          <degrees>360</degrees>
        </row>
        <row>
          <shape sides="0">circle</shape>
          <degrees>360</degrees>
        </row>
        <row>
          <shape sides="3">triangle</shape>
          <degrees>180</degrees>
        </row>
      </data>-xpath does not return any nodes or attributesr3   ./rowT)r   r  rN   r5   r   r   r   r   rN   r   s     r=   test_empty_attrs_onlyr     s    C  
>
 
 
 O O 	#g$vNNNN	O O O O O O O O O O O O O O O O O O   !AAAc                    d}t          j        t          d          5  t          t	          |          dd|            d d d            d S # 1 swxY w Y   d S )Nz
      <data>
        <row sides="4" shape="square" degrees="360"/>
        <row sides="0" shape="circle" degrees="360"/>
        <row sides="3" shape="triangle" degrees="180"/>
      </data>r  r3   r  T)r   r  rN   r  r  s     r=   test_empty_elems_onlyr#  -  s    C 
>
 
 
 O O 	#g$vNNNN	O O O O O O O O O O O O O O O O O Or!  c                 V   t          j        d           d} t          t          |           d          }t          t          |           dd          }t	          | ddd	gi
          }t	          | dddd	gi          }t          j        ||           t          j        ||           d S )Nr1   a  <?xml version="1.0" encoding="UTF-8"?>
<TrainSchedule>
      <Stations>
         <station Name="Manhattan" coords="31,460,195,498"/>
         <station Name="Laraway Road" coords="63,409,194,455"/>
         <station Name="179th St (Orland Park)" coords="0,364,110,395"/>
         <station Name="153rd St (Orland Park)" coords="7,333,113,362"/>
         <station Name="143rd St (Orland Park)" coords="17,297,115,330"/>
         <station Name="Palos Park" coords="128,281,239,303"/>
         <station Name="Palos Heights" coords="148,257,283,279"/>
         <station Name="Worth" coords="170,230,248,255"/>
         <station Name="Chicago Ridge" coords="70,187,208,214"/>
         <station Name="Oak Lawn" coords="166,159,266,185"/>
         <station Name="Ashburn" coords="197,133,336,157"/>
         <station Name="Wrightwood" coords="219,106,340,133"/>
         <station Name="Chicago Union Sta" coords="220,0,360,43"/>
      </Stations>
</TrainSchedule>z
.//stationr   rL   r   stationNamecoordsrn   rm   )r5   r6   r   r   r[   r7   rp   )r   r   r   
df_iter_lx
df_iter_ets        r=   test_attribute_centric_xmlr+  <  s    
C( x}}L999G\'JJJH#CI?Q3RSSSJ#G	FH3E'F  J '8,,,*j11111rJ   c                    t          | g d|          }t          | |g ddg di          }t          g dg dg dg d	g d
d          }t          j        ||           t          j        ||           d S )N)Col1Col2Col3Col4Col5namesrN   rf   r   )rN   r3  rn   r   r   r   r   r   r  r  s        r=   test_names_option_outputr4  a  s    AAA&  G 666KKKL	  G 222HHHJJJ&&&)))	
 	
 K ';///';/////rJ   c                   d}t          t          |          d| g d          }t          || dg dig d          }t          dd	gd
dgddgd          }t	          j        ||           t	          j        ||           d S )Nz<shapes>
  <shape type="2D">
    <name>circle</name>
    <type>curved</type>
  </shape>
  <shape type="3D">
    <name>sphere</name>
    <type>curved</type>
  </shape>
</shapes>.//shape)type_dimr   	type_edger   rN   r3  r   )typer+   r:  rN   rn   r3  2D3Dr   spherecurvedr   r   s        r=   test_repeat_namesr@  z  s    
C 000	  H !4445000	  G t)"H-	
 	
 K (K000';/////rJ   c                    d}t          t          |          d| ddg          }t          || dddgiddg          }t          g d	g d
d          }t	          j        ||           t	          j        ||           d S )NaB  <shapes>
  <shape>
    <name>rectangle</name>
    <family>rectangle</family>
  </shape>
  <shape>
    <name>square</name>
    <family>rectangle</family>
  </shape>
  <shape>
    <name>ellipse</name>
    <family>ellipse</family>
  </shape>
  <shape>
    <name>circle</name>
    <family>ellipse</family>
  </shape>
</shapes>r6  r+   groupr9  r   familyr;  )	rectangler   ellipser   )rD  rD  rE  rE  )r+   rB  r   r   s        r=   test_repeat_values_new_namesrF    s    C& Zvw>O  H !VX./w	  G @@@EEE	
 	
 K (K000';/////rJ   c                   d}t          t          |          d| g d          }t          || dg dig d          }t          g dg d	g d
g dd          }t	          j        ||           t	          j        ||           d S )Na  <shapes>
  <shape>
    <value item="name">circle</value>
    <value item="family">ellipse</value>
    <value item="degrees">360</value>
    <value item="sides">0</value>
  </shape>
  <shape>
    <value item="name">triangle</value>
    <value item="family">polygon</value>
    <value item="degrees">180</value>
    <value item="sides">3</value>
  </shape>
  <shape>
    <value item="name">square</value>
    <value item="family">polygon</value>
    <value item="degrees">360</value>
    <value item="sides">4</value>
  </shape>
</shapes>r6  )r+   rC  r   r   r9  r   )valuerH  rH  rH  r;  )r   r   r   )rE  polygonrI  )r   r   r   )r   r   r   r   r   s        r=   test_repeat_elementsrJ    s    C* 444	  H !@@@A444	  G 444777&YY		
 	
 K (K000';/////rJ   c                    t          j        t          d          5  t          | g d|           d d d            d S # 1 swxY w Y   d S )Nznames does not match lengthr3   )r-  r.  r/  r2  r  r  s     r=   test_names_option_wrong_lengthrL    s    	z*G	I	I	I K K":":":6JJJJK K K K K K K K K K K K K K K K K K   >AAc                    t          j        t          d          5  t          | d|           d d d            d S # 1 swxY w Y   d S )Nzis not a valid type for namesr3   zCol1, Col2, Col3r2  r5   r   r  r   r  s     r=   test_names_option_wrong_typerP     s    	y)H	J	J	J E E"4VDDDDE E E E E E E E E E E E E E E E E Er   c                    t          j        t          d          5  t          | |           d d d            d S # 1 swxY w Y   d S )Nz'utf-8' codec can't decoder3   re   r5   r   UnicodeDecodeErrorr   xml_baby_namesrN   s     r=   test_wrong_encodingrV    s    	)2N	P	P	P 0 0////0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   ;??c                    t          j        t          d          5  t          | d|           d d d            d S # 1 swxY w Y   d S )NzLUTF-16 stream does not start with BOM|'utf-16(-le)?' codec can't decode byter3   zUTF-16rS   rN   )r5   r   UnicodeErrorr   rT  s     r=   test_utf16_encodingr[    s    	5
 
 
 C C 	(6BBBBC C C C C C C C C C C C C C C C C Cr   c                    t          j        t          d          5  t          | d|           d d d            d S # 1 swxY w Y   d S )Nzunknown encoding: UFT-8r3   zUFT-8rY  )r5   r   LookupErrorr   rT  s     r=   test_unknown_encodingr^    s    	{+D	F	F	F B B'&AAAAB B B B B B B B B B B B B B B B B Br   c                    t          j        t          d          5  t          | d|           d d d            d S # 1 swxY w Y   d S )Nz'ascii' codec can't decode byter3   asciirY  rR  rT  s     r=   test_ascii_encodingra    s    	)2S	U	U	U B B'&AAAAB B B B B B B B B B B B B B B B B Br   c                P   t          j        d           t          | dd          }t          | dd          }t          | dddg di          }t          | dddg di          }t          j        ||           t          j        ||           t          j        ||           d S )	Nr1   z
ISO-8859-1rN   rS   rL   z
iso-8859-1rz   )rankmalename
femalename)rN   rS   rn   ro   )rU  df_xpath_lxmldf_xpath_etreert   ru   s        r=   %test_parser_consistency_with_encodingri  "  s    
^F\RRRMnW|TTTN<<<=	  L <<<=	  M -888.-888,66666rJ   c                     t          j        d           d} t          j        t          d          5  t	          t          |           dd            d d d            d S # 1 swxY w Y   d S )Nr1   -<data>
  <row>
    <a>c</a>
  </row>
</data>
zencoding Noner3   rc  )r5   r6   r   r  r   r   )rW   s    r=   test_wrong_encoding_for_lxmlrl  9  s    
D 
y	8	8	8 ? ?$>>>>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s    AA#&A#c                     d} t          t          |           dd           }t          ddgi          }t          j        ||           d S )Nrk  rL   rc  r   cr   )rW   resultexpecteds      r=   test_none_encoding_etreerq  F  sQ    D htnnWtDDDF#u&&H&(+++++rJ   c                    t          j        t          d          5  t          |            d d d            d S # 1 swxY w Y   d S )Nz7lxml not found, please install or use the etree parser.r3   )r5   r   ImportErrorr   r   s    r=   test_default_parser_no_lxmlrt  V  s    	U
 
 
   	                 s   9= =c                    t          j        t          d          5  t          | d           d d d            d S # 1 swxY w Y   d S )Nz,Values for parser can only be lxml or etree.r3   bs4re   r  r   s    r=   test_wrong_parserrw  ^  s    	I
 
 
 * * 	5))))* * * * * * * * * * * * * * * * * *rW  c                    t          j        d           t          | dddi|          }t          | dg di          }t          j        t
          |           t          j        t
          |           d S )	Nr1   .//k:Placemarkkr  r   r   
stylesheet	Placemarkr)   r(  )r5   r6   r   r7   rp   df_kml)r  xsl_flatten_docdf_styler   s       r=   test_stylesheet_filer  h  s    
9:"	  H    	
  G &(+++&'*****rJ   c                    t          j        d           t          |||dk    rdnd           5 }t          | dddi|          }d d d            n# 1 swxY w Y   t	          j        t          |           d S 	Nr1   r@   rQ   rR   ry  rz  r  r{  )r5   r6   rU   r   r7   rp   r~  )r  r  rH   rZ   r  s        r=   test_stylesheet_file_liker    s    
	otgg$	O	O	O 
ST"=>	
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 &(+++++s   AAAc                   t          j        d           t          |||dk    rdnd           5 }|dk    r"t          |                                          }n!t          |                                          }d d d            n# 1 swxY w Y   t          | dddi|	          }t          j        t          |           d S )
Nr1   r@   rQ   rR   r?   ry  rz  r  r{  )
r5   r6   rU   r   r_   r   r   r7   rp   r~  r  r  rH   rZ   xsl_objr  s         r=   test_stylesheet_ior    s     
otgg$	O	O	O )ST4<<affhh''GGqvvxx((G	) ) ) ) ) ) ) ) ) ) ) ) ) ) ) 9:	  H &(+++++s   A
BB	B	c                   t          j        d           t          |||dk    rdnd           5 }|                                }d d d            n# 1 swxY w Y   t	          | dddi|          }t          j        t          |           d S r  )r5   r6   rU   r_   r   r7   rp   r~  r  s         r=   test_stylesheet_buffered_readerr    s    
	otgg$	O	O	O ST&&((               9:	  H &(+++++s   AAAc                     t          j        d           d} d}t          t          |                     }t          t          |           |          }t	          j        ||           d S )Nr1   r   u  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
 </xsl:template>

 <xsl:template match="中文標籤">
     <根>
       <xsl:apply-templates />
     </根>
 </xsl:template>

</xsl:stylesheet>r|  )r5   r6   r   r   r7   rp   )r   xsldf_origr  s       r=   test_style_charsetr    se    

HCC& x}}%%G#666H'8,,,,,rJ   c                    t          j        d          }t          j        |j        d          5  t	          | |           d d d            d S # 1 swxY w Y   d S )Nr   zdocument is not a stylesheetr3   r  r5   r6   r   XSLTParseErrorr   )r  rq   r   s      r=   test_not_stylesheetr    s    $\22J	!*H
 
 
 ; ; 	#	::::; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s   AAAc                    t          j        d          }d}t          j        |j        d          5  t	          | |           d d d            d S # 1 swxY w Y   d S )Nr   a  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:k="http://www.opengis.net/kml/2.2"/>
    <xsl:output method="xml" omit-xml-declaration="yes"
                cdata-section-elements="k:description" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>

    <xsl:template match="k:MultiGeometry|k:LineString">
        <xsl:apply-templates select='*'/>
    </xsl:template>

    <xsl:template match="k:description|k:Snippet|k:Style"/>
</xsl:stylesheet>z(Extra content at the end of the documentr3   r  r5   r6   r   r   r   r  r   r  s      r=   test_incorrect_xsl_syntaxr    s    $\22JC( 
!*T
 
 
 5 5 	#44445 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5   AAAc                    t          j        d          }d}t          j        |j        d          5  t	          | |           d d d            d S # 1 swxY w Y   d S )Nr   a  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:k="http://www.opengis.net/kml/2.2">
    <xsl:output method="xml" omit-xml-declaration="yes"
                cdata-section-elements="k:description" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="node(*)|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>

    <xsl:template match="k:MultiGeometry|k:LineString">
        <xsl:apply-templates select='*'/>
    </xsl:template>

    <xsl:template match="k:description|k:Snippet|k:Style"/>
</xsl:stylesheet>zfailed to compiler3   r  r  r  s      r=   test_incorrect_xsl_evalr    s    $\22JC( 
z09L	N	N	N 5 5#44445 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5r  c                    t          j        d          }d}t          j        |j        d          5  t	          | |           d d d            d S # 1 swxY w Y   d S )Nr   ag  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes" />
    <xsl:strip-space elements="*"/>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:copy-of select="document('non_existent.xml')/*"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>zCannot resolve URIr3   r  )r5   r6   r   XSLTApplyErrorr   r  s      r=   test_incorrect_xsl_applyr    s    $\22J
C 
z09M	O	O	O 5 5#44445 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5r  c                    t          j        d          }|dz  }t          j        |j        d          5  t	          | |           d d d            d S # 1 swxY w Y   d S )Nr   zflatten.xslz!Start tag expected, '<' not foundr3   r  r  )r  xml_data_path	xml_etreer  s       r=   test_wrong_stylesheetr  &  s    #L11I
-
'C	 2
 
 
 5 5 	#4444	5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s   AAAc                \   t          j        d           t          |||dk    rdnd           5 }|dk    r"t          |                                          }n!t          |                                          }t          | |           |j        rJ 	 d d d            d S # 1 swxY w Y   d S )Nr1   r@   rQ   rR   r?   r  )r5   r6   rU   r   r_   r   r   r   )r  r  rH   rZ   r  s        r=   test_stylesheet_file_closer  2  s      
otgg$	O	O	O ST4<<affhh''GGqvvxx((G#88888                 s   A$B!!B%(B%c                    t          j        d           t          j        t          d          5  t	          | d|           d d d            d S # 1 swxY w Y   d S )Nr1   z*To use stylesheet, you need lxml installedr3   rL   )rN   r|  r   )r  r  s     r=   test_stylesheet_with_etreer  C  s    
	G
 
 
 Q Q 	#GPPPPQ Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Qr   c                    t          j        d           d}t          j                            ddd          }t          j        t          |          5  t          ||            d d d            d S # 1 swxY w Y   d S )Nr1   r2   rW   r   zcta_rail_lines.kmlr3   r  )r5   r6   r   rY   r   r   r9   r   )r   r<   kmls      r=   test_empty_stylesheetr  K  s    
	: 
 ',,vu&:
;
;C	}C	0	0	0 & &%%%%& & & & & & & & & & & & & & & & & &s   A22A69A6c           	        t          | ||dk    rdnd           5 }|dk    r]|dk    rWt          j        t          d          5  t	          ||dg di	           d d d            n# 1 swxY w Y   	 d d d            d S t	          ||dg di	          }	 d d d            n# 1 swxY w Y   t          g d
g dg dg dg dd          }t          j        ||           d S Nr@   rQ   rR   r1   z.reading file objects must return bytes objectsr3   rf   rg   rm   r   r   r   r   r   r   )rU   r5   r   r  r   r   r7   rp   )rq   rN   rH   rZ   df_fileliker   s         r=   test_file_like_iterparser  Z  s   	i43;;D	I	I	I Q3;;6V++"R   	 	 ! P P P   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	         #!#S#S#ST  KK              ( 666IIILLL&&&***	
 	
 K +{33333s;   (B"A&B"&A*	*B"-A*	.B"?B""B&)B&c           
     n   |dk    rt           nt          }t          | ||dk    rdnd           5 } ||                                          5 }|dk    rh|dk    rbt	          j        t          d          5  t          ||dg di	           d d d            n# 1 swxY w Y   	 d d d            d d d            d S t          ||dg di	          }	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          g d
g dg dg dg dd          }t          j
        ||           d S r  )r   r   rU   r_   r5   r   r  r   r   r7   rp   )rq   rN   rH   funcIOrZ   b	df_fileior   s           r=   test_file_io_iterparser  |  s   XX'F	 CKKT
 
 
  
VAFFHH 	s{{v//]&V   	 	 %"$T$T$T#   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	       & %! P P P  			 	 	 	 	 	 	 	 	 	 	 	 	 	 	              6 666IIILLL&&&***	
 	
 K )[11111se   C6(C5BCBCB C$C6<CC6C#	#C6&C#	'C66C:=C:c           	     F   t          |d          5 }|                    |                                           t          j        t
          d          5  t          |j        | dg di           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )	NrQ   rR   rx   )iterparse is designed for large XML filesr3   rz   r   r   r   daterm   )rU   r{   r_   r5   r   r   r   r   )rN   r}   r   rZ   s       r=   test_url_path_errorr    s9    
h	)	)	) 	Q   222] K
 
 
 	 	  "G"G"GH   	 	 	 	 	 	 	 	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s6   ABA>2B>B	BB	BBBc           	     0   t          j        d          5 }t                              || |           t	          j        t          d          5  t          || dg di|           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )	Nzgeom_xml.zipr   rN   r]   r  r3   rz   r  rN   rn   r]   )r7   rT   geom_dfto_xmlr5   r   r   r   )rN   ra   rY   s      r=   test_compression_errorr    s2   	.	1	1	1 TtF8HIII] K
 
 
 	 	  "G"G"GH,	   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	                 s5   9BA3'B3A7	7B:A7	;BBBc                    t          j        t          d          5  t          | |g d           d d d            d S # 1 swxY w Y   d S )Nz&list is not a valid type for iterparser3   rg   rm   rO  r  s     r=   test_wrong_dict_typer    s    	y(P	Q	Q	Q 
 
FFF	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rM  c                    t          j        t          d          5  t          | |ddi           d d d            d S # 1 swxY w Y   d S )Nz8<class 'str'> is not a valid type for value in iterparser3   rf   rh   rm   rO  r  s     r=   test_wrong_dict_valuer    s    	S
 
 
 K K 	6fj5IJJJJK K K K K K K K K K K K K K K K K KrM  c           
     z   d}t          j        d          5 }t          |dd          5 }|                    |           d d d            n# 1 swxY w Y   t	          j        t          d          5  t          || d	gd
g di           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Na  <?xml version='1.0' encoding='utf-8'?>
  <row>
    <shape>square</shape>
    <degrees>00360</degrees>
    <sides>4.0</sides>
    <date>2020-01-01</date>
   </row>
  <row>
    <shape>circle</shape>
    <degrees>00360</degrees>
    <sides/>
    <date>2021-01-01</date>
  </row>
  <row>
    <shape>triangle</shape>
    <degrees>00180</degrees>
    <sides>3.0</sides>
    <date>2022-01-01</date>
  </row>
zbad.xmlr  rP   rQ   rR   zDExtra content at the end of the document|junk after document elementr3   r  rz   r  )rN   parse_datesrn   )r7   rT   rU   rV   r5   r   r   r   )rN   bad_xmlrY   rZ   s       r=   test_bad_xmlr    s   G* 
)	,	,	, $g... 	!GGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ].
 
 
 	 	 #H "G"G"GH	   	 	 	 	 	 	 	 	 	 	 	 	 	 	 		                 sX   B0AB0A	B0A	B03BB0B	B0B	 B00B47B4c                    d}t          t          |          d|           }t          || dddgi          }t          dd	gd
dgd          }t	          j        ||           t	          j        ||           d S )Na-  <!-- comment before root -->
<shapes>
  <!-- comment within root -->
  <shape>
    <name>circle</name>
    <type>2D</type>
  </shape>
  <shape>
    <name>sphere</name>
    <type>3D</type>
    <!-- comment within child -->
  </shape>
  <!-- comment within root -->
</shapes>
<!-- comment after root -->r6  r   r   r+   r:  rm   r   r>  r<  r=  r+   r:  r   r   s        r=   test_commentr    s    C" ZGGGH Fw0@&A  G x(4L	
 	
 K (K000';/////rJ   c                    d}t          t          |          d|           }t          || dddgi          }t          dd	gd
dgd          }t	          j        ||           t	          j        ||           d S )Na8  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE non-profits [
    <!ELEMENT shapes (shape*) >
    <!ELEMENT shape ( name, type )>
    <!ELEMENT name (#PCDATA)>
]>
<shapes>
  <shape>
    <name>circle</name>
    <type>2D</type>
  </shape>
  <shape>
    <name>sphere</name>
    <type>3D</type>
  </shape>
</shapes>r6  r   r   r+   r:  rm   r   r>  r<  r=  r  r   r   s        r=   test_dtdr         C$ ZGGGH Fw0@&A  G x(4L	
 	
 K (K000';/////rJ   c                    d}t          t          |          d|           }t          || dddgi          }t          dd	gd
dgd          }t	          j        ||           t	          j        ||           d S )Nam  <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<?display table-view?>
<?sort alpha-ascending?>
<?textinfo whitespace is allowed ?>
<?elementnames <shape>, <name>, <type> ?>
<shapes>
  <shape>
    <name>circle</name>
    <type>2D</type>
  </shape>
  <shape>
    <name>sphere</name>
    <type>3D</type>
  </shape>
</shapes>r6  r   r   r+   r:  rm   r   r>  r<  r=  r  r   r   s        r=   test_processing_instructionr  D  r  rJ   c                    t          j        t          d          5  t          | |dg di           d d d            d S # 1 swxY w Y   d S )Nz+No result from selected items in iterparse.r3   nodeattr1elem1elem2elem3rm   )r5   r   r   r   r  s     r=   test_no_resultr  h  s    	H
 
 
 
 
 	CCCD	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   A  AAc                    t          j        t          d          5  t          | |dg di           d d d            d S # 1 swxY w Y   d S )NzNo columns to parse from filer3   rf   r  rm   )r5   r   r   r   r  s     r=   test_empty_datar  s  s    	~-L	M	M	M 
 
CCCD	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
r  c            	         t          j        d           d} d}t          t          |           dddg|          }t	          dd	d
dddddddddd          }t          j        ||           d S )Nr1   a  <?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>
  <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
  </cd>
  <cd>
    <title>Greatest Hits</title>
    <artist>Dolly Parton</artist>
    <country>USA</country>
    <company>RCA</company>
    <price>9.90</price>
    <year>1982</year>
  </cd>
  <cd>
    <title>Still got the blues</title>
    <artist>Gary Moore</artist>
    <country>UK</country>
    <company>Virgin records</company>
    <price>10.20</price>
    <year>1990</year>
  </cd>
  <cd>
    <title>Eros</title>
    <artist>Eros Ramazzotti</artist>
    <country>EU</country>
    <company>BMG</company>
    <price>9.90</price>
    <year>1997</year>
  </cd>
  <cd>
    <title>One night only</title>
    <artist>Bee Gees</artist>
    <country>UK</country>
    <company>Polydor</company>
    <price>10.90</price>
    <year>1998</year>
  </cd>
  <cd>
    <title>Sylvias Mother</title>
    <artist>Dr.Hook</artist>
    <country>UK</country>
    <company>CBS</company>
    <price>8.10</price>
    <year>1973</year>
  </cd>
  <cd>
    <title>Maggie May</title>
    <artist>Rod Stewart</artist>
    <country>UK</country>
    <company>Pickwick</company>
    <price>8.50</price>
    <year>1990</year>
  </cd>
  <cd>
    <title>Romanza</title>
    <artist>Andrea Bocelli</artist>
    <country>EU</country>
    <company>Polydor</company>
    <price>10.80</price>
    <year>1996</year>
  </cd>
  <cd>
    <title>When a man loves a woman</title>
    <artist>Percy Sledge</artist>
    <country>USA</country>
    <company>Atlantic</company>
    <price>8.70</price>
    <year>1987</year>
  </cd>
  <cd>
    <title>Black angel</title>
    <artist>Savage Rose</artist>
    <country>EU</country>
    <company>Mega</company>
    <price>10.90</price>
    <year>1995</year>
  </cd>
  <cd>
    <title>1999 Grammy Nominees</title>
    <artist>Many</artist>
    <country>USA</country>
    <company>Grammy</company>
    <price>10.20</price>
    <year>1999</year>
  </cd>
  <cd>
    <title>For the good times</title>
    <artist>Kenny Rogers</artist>
    <country>UK</country>
    <company>Mucik Master</company>
    <price>8.70</price>
    <year>1995</year>
  </cd>
  <cd>
    <title>Big Willie style</title>
    <artist>Will Smith</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>9.90</price>
    <year>1997</year>
  </cd>
  <cd>
    <title>Tupelo Honey</title>
    <artist>Van Morrison</artist>
    <country>UK</country>
    <company>Polydor</company>
    <price>8.20</price>
    <year>1971</year>
  </cd>
  <cd>
    <title>Soulsville</title>
    <artist>Jorn Hoel</artist>
    <country>Norway</country>
    <company>WEA</company>
    <price>7.90</price>
    <year>1996</year>
  </cd>
  <cd>
    <title>The very best of</title>
    <artist>Cat Stevens</artist>
    <country>UK</country>
    <company>Island</company>
    <price>8.90</price>
    <year>1990</year>
  </cd>
  <cd>
    <title>Stop</title>
    <artist>Sam Brown</artist>
    <country>UK</country>
    <company>A and M</company>
    <price>8.90</price>
    <year>1988</year>
  </cd>
  <cd>
    <title>Bridge of Spies</title>
    <artist>T`Pau</artist>
    <country>UK</country>
    <company>Siren</company>
    <price>7.90</price>
    <year>1987</year>
  </cd>
  <cd>
    <title>Private Dancer</title>
    <artist>Tina Turner</artist>
    <country>UK</country>
    <company>Capitol</company>
    <price>8.90</price>
    <year>1983</year>
  </cd>
  <cd>
    <title>Midt om natten</title>
    <artist>Kim Larsen</artist>
    <country>EU</country>
    <company>Medley</company>
    <price>7.80</price>
    <year>1983</year>
  </cd>
  <cd>
    <title>Pavarotti Gala Concert</title>
    <artist>Luciano Pavarotti</artist>
    <country>UK</country>
    <company>DECCA</company>
    <price>9.90</price>
    <year>1991</year>
  </cd>
  <cd>
    <title>The dock of the bay</title>
    <artist>Otis Redding</artist>
    <country>USA</country>
    <COMPANY>Stax Records</COMPANY>
    <PRICE>7.90</PRICE>
    <YEAR>1968</YEAR>
  </cd>
  <cd>
    <title>Picture book</title>
    <artist>Simply Red</artist>
    <country>EU</country>
    <company>Elektra</company>
    <price>7.20</price>
    <year>1985</year>
  </cd>
  <cd>
    <title>Red</title>
    <artist>The Communards</artist>
    <country>UK</country>
    <company>London</company>
    <price>7.80</price>
    <year>1987</year>
  </cd>
  <cd>
    <title>Unchain my heart</title>
    <artist>Joe Cocker</artist>
    <country>USA</country>
    <company>EMI</company>
    <price>8.20</price>
    <year>1987</year>
  </cd>
</catalog>
a7  <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
  <h2>My CD Collection</h2>
  <table border="1">
    <tr bgcolor="#9acd32">
      <th style="text-align:left">Title</th>
      <th style="text-align:left">Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
  </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
z.//tr[td and position() <= 6]ri   artist)r   r3  r|  zEmpire BurlesquezHide your heartzGreatest HitszStill got the bluesErosr%   z	Bob DylanzBonnie TylerzDolly Partonz
Gary MoorezEros Ramazzotti)ri   r  )r5   r6   r   r   r   r7   rp   )r   r  df_xslr   s       r=   test_online_stylesheetr  |  s    
TCjC2 -!	  F  &$"(  !!$ 	
 	
 K& +v.....rJ   c           	     T   t          j                    5 }t                              |d| |           t	          || |          }t          ||| dg di|          }d d d            n# 1 swxY w Y   t          j        |t                     t          j        |t                     d S )NF)r   rN   r]   r  rz   r   r  )r7   rT   r  r  r   rc   rp   )rN   ra   r`   r~   r   s        r=   test_compression_readr    s    			 
iU6?O 	 	
 	
 	
 IfBRSSS);;;<(
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 (G,,,'7+++++s   A	A))A-0A-c                6   |}|}||k    rt          j        | d|            t          dft          dft          dft          dfd}t          dd	          }||j        d
f|d<   t          dd	          }|t          df|d<   ||         \  }}	t          j	                    5 }
t                              |
| |           t          j        ||	          5  t          |
| |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nz == zInvalid data streamzNot a gzipped filezFile is not a zip filez%file could not be opened successfully)bz2gzipziptar	zstandardignore)errorszUnknown frame descriptorzstdlzmaz%Input format not supported by decoderxzr  r3   )r5   skipOSErrorr
   r   r   	ZstdErrorr   r7   rT   r  r  r   r   )rN   r]   ra   actual_compressionattempted_compressionr  r  r  	error_cls	error_strrY   s              r=   test_wrong_compressionr    s   $,222)FF/DFFGGG ././45BC	 F &k(CCCD.*DEv%fX>>>D!#JKt!"78Iy			 MdtF8JKKK]9I666 	M 	MT&6KLLLL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	MM M M M M M M M M M M M M M M M M Ms6   #4DC6*D6C:	:D=C:	>DDDc                    t          j        t          d          5  t          j                    5 }t          || d           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )NzUnrecognized compression typer3   7zr  )r5   r   r   r7   rT   r   )rN   rY   s     r=   test_unsuported_compressionr    s    	z)H	I	I	I < <_ 	<$T&d;;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<< < < < < < < < < < < < < < < < < <s4   A'AA'A	A'A	A''A+.A+c                    t          j        d           t          j        d           d| j         d}t          |d|          }t          |d|          }t	          j        ||           d S )Ns3fsr1   zs3://z
/books.xml)rN   storage_optionsrL   )r5   r6   r+   r   r7   rp   )s3_public_bucket_with_datas3sos3r   r   s        r=   test_s3_parser_consistencyr    s{     
	<+0	<	<	<Br&$???G7DAAAH'8,,,,,rJ   c                  	 d}t          j        d|          5  t          t          |          | |          }d d d            n# 1 swxY w Y   |dk    r;t	          j        d          	t          j        	                                          }nt          j        |          }t          t          ddg|          t          dd	gd
          t          ddgd          t          dd g|          t          d	t          gd
          t          dt          gd          t          t          t          gd
          t          ddgd          t          dt          gd          d	          |dk    r_t	          j        d          	ddlm t          	fdj        D                        	                    d d g                    d<   t!          j        |d           d S )Na;  <?xml version='1.0' encoding='utf-8'?>
<data xmlns="http://example.com">
<row>
  <a>x</a>
  <b>1</b>
  <c>4.0</c>
  <d>x</d>
  <e>2</e>
  <f>4.0</f>
  <g></g>
  <h>True</h>
  <i>False</i>
</row>
<row>
  <a>y</a>
  <b>2</b>
  <c>5.0</c>
  <d></d>
  <e></e>
  <f></f>
  <g></g>
  <h>False</h>
  <i></i>
</row>
</data>zmode.string_storage)rN   dtype_backendpyarrowxyr   r&   r'   Int64r   g      @Float64TFboolean)	r   r  rn  derZ   ghir   )ArrowExtensionArrayc           	     ^    i | ])}|                      |         d                     *S )T)from_pandas)array).0colr
  rp  pas     r=   
<dictcomp>z1test_read_xml_nullable_dtypes.<locals>.<dictcomp>  sK        (((3-T)R)RSS  rJ   r  )check_column_type)pdoption_contextr   r   r5   r6   
ArrowDtyper   StringDtyper   r   r   pandas.arraysr
  columnsr  r7   rp   )
rN   string_storager  using_infer_stringrW   ro  string_dtyper
  rp  r  s
          @@@r=   test_read_xml_nullable_dtypesr    sk   D4 
	0.	A	A V V(4..}UUUV V V V V V V V V V V V V V V 	!! ++}RYY[[11~n55c
,777Ag...c
)444d<888Bw///b	333R000uY7779555
	
 
	
 H 	!! ++555555     #+  
 
 ,+BHHdD\,B,BCC &(eDDDDDDs    AAAc                     d} t          j        t          |           5  t          dd           d d d            d S # 1 swxY w Y   d S )NzPdtype_backend numpy is invalid, only 'numpy_nullable' and 'pyarrow' are allowed.r3   testnumpy)r  r  r;   s    r=   test_invalid_dtype_backendr     s    	!  
z	-	-	- 0 0w////0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s   =AA)
__future__r   ior   r   r  r   r   tarfiler   urllib.errorr   xml.etree.ElementTreer	   zipfiler
   r  npr5   pandas.compat._optionalr   pandas.errorsr   r   pandas.util._test_decoratorsutil_test_decoratorstdpandasr  r   r   r   pandas._testing_testingr7   pandas.io.commonr   pandas.io.xmlr   r   r  r:   r   r~  r>   fixturerH   rE   
skip_if_norN   r[   rc   rv   marknetwork
single_cpur   r   r   r   r   r   r   r   parametrizer   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r	  r  r  r  r  r  r   r#  r+  r4  r@  rF  rJ  rL  rP  rV  r[  r^  ra  ri  rl  rq  skip_if_installedrt  rw  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r    rJ   r=   <module>r;     s	   " " " " " "              				       " " " " " " , , , , , ,            > > > > > >        * ) ) ) ) ) ) ) )             
       ' ' ' ' ' ' " " " " " "l )111"??RVQ   (* 
 
 
 )!!!!
 
 
 
 Q1q11     
 
999&9$9uI
 I
=h hj
 j
Z
# 
# 
# c{###  $# V=2=3H3HIII7STTT  UT( ( (, , ,7 7 7* 
- 
-  
-0 0 0". . .,/ / /0/ / /2/ / /0 0 0>   S	**2 2 +*2" S	**3 3 +*3* * * / /  /& M M  M.0 .0 .0h> > >? ? ?> > >0 0 040 0 0.- - -&- - -,A A A
O O O
N N N T
++

 

 ,+

 0 0 0*0 0 00 0 0(V V VO O O0O O O2 2 2J0 0 02#0 #0 #0L'0 '0 '0T.0 .0 .0bK K K
E E E0 0 0
C C CB B B
B B B
7 7 7.
? 
? 
?
, 
, 
,  f  * * *+ + +6
, 
, 
,, , ,,, , ,- - -:; ; ;5 5 5:5 5 565 5 5&	5 	5 	5  "Q Q Q S	**
& 
& +*
&4 4 4D'2 '2 '2T 
 
  
  
 
 
K K K& & &R 0  0  0F!0 !0 !0H!0 !0 !0H
 
 

 
 
J/ J/ J/`, , ,(M M M8< < < 	- 	-  	-CE CE CEL0 0 0 0 0rJ   