somebody to help me about parsedxml?
"amine soulaymani" <[email protected]> Fri, 8 Aug 2003 11:39:28 -0000
| Newsgroups | gmane.comp.web.zope.parsed-xml |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============90053145367332244== Content-Type: multipart/alternative; boundary="----=_NextPart_000_000D_01C35DA1.B98ED7D0" This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C35DA1.B98ED7D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable somebody to help me? i'm working with parsedxml, and i have huge quantity of xml documents to = parse under zope, but: 1 - they contains some non-ascii caracters (=E9,=E8,=E0) 2 - I can"t modify the "site.py" file to change the default python = encoding. 3- I can't modify parsedxml source. I have to do all the ascii to unicode conversion in internal python = script, not even in external methods. example:=20 consider that xml, stored under zope as xmlfile: <?xml version=3D"1.0" encoding=3D"iso-8859-1"?><control> <utilisateur type=3D"facturation" qualite=3D"2"> <nom titre=3D"M">Bonn=E9</nom> <prenom>Jean</prenom> <telmobile>0645237379</telmobile> <email>[email protected]</email></utilisateur> <adresse type=3D"facturation"> <rue1>14 rue d'avant=E9</rue1>=20 <cpostal>75015</cpostal>=20 <ville>PARIS</ville> </adresse> <adresse type=3D"livraison"> <rue1>14 rue d'apr=E8s</rue1>=20 <cpostal>75015</cpostal>=20 <ville>PARIS</ville> </adresse> <infocommande> <montant devise=3D"EUR">88</montant>=20 <refid>Cmde-004</refid>=20 <siteid>112</siteid></infocommande></control> there is an accentued character at line 3. this python script raises exception: for items in container.xmlfile.documentElement.childNodes: print items return printed Error Type: UnicodeError Error Value: ASCII encoding error: ordinal not in range(128) how to proceed to print that without modify the parsedxml source nor the = site.py file? ------=_NextPart_000_000D_01C35DA1.B98ED7D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2> <DIV><FONT face=3DArial size=3D2>somebody to help me?</FONT></DIV> <DIV><FONT face=3DArial size=3D2>i'm working with parsedxml, and i have = huge=20 quantity of xml documents to parse under zope, but:</FONT></DIV> <DIV><FONT face=3DArial size=3D2>1 - they contains some non-ascii = caracters=20 (=E9,=E8,=E0)</FONT></DIV> <DIV><FONT face=3DArial size=3D2>2 - I can"t modify the = "site.py" file to=20 change the default python encoding.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>3- I can't modify parsedxml=20 source.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I have to do all the ascii to = unicode=20 conversion in internal python script, not even in external = methods.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>example: </FONT></DIV> <DIV>consider that xml, stored under zope as <EM>xmlfile</EM>:</DIV> <DIV> </DIV> <DIV><?xml version=3D"1.0"=20 encoding=3D"iso-8859-1"?><control><BR><utilisateur = type=3D"facturation"=20 qualite=3D"2"><BR><nom=20 titre=3D"M">Bonn=E9</nom><BR><prenom>Jean</prenom>=20 <telmobile>0645237379</telmobile><BR><email>albert@fia.= fr</email></utilisateur><BR><adresse=20 type=3D"facturation"><BR><rue1>14 rue d=92avant=E9</rue1> = <BR><cpostal>75015</cpostal> = <BR><ville>PARIS</ville>=20 </adresse><BR><adresse type=3D"livraison"><BR><rue1>14 = rue=20 d=92apr=E8s</rue1> <BR><cpostal>75015</cpostal>=20 <BR><ville>PARIS</ville>=20 </adresse><BR><infocommande><BR><montant=20 devise=3D"EUR">88</montant> = <BR><refid>Cmde-004</refid>=20 <BR><siteid>112</siteid></infocommande></control>= <BR></DIV> <DIV>there is an accentued character at line 3.</DIV> <DIV>this python script raises exception:</DIV> <DIV> </DIV> <DIV>for items in = container.xmlfile.documentElement.childNodes:<BR> =20 print items<BR>return = printed<BR><STRONG><STRONG></STRONG></STRONG></DIV> <DIV><STRONG><STRONG>Error Type: UnicodeError</STRONG><BR><STRONG>Error = Value:=20 ASCII encoding error: ordinal not in = range(128)</STRONG><BR></STRONG></DIV> <DIV>how to proceed to print that without modify the parsedxml source = nor the=20 site.py file?</DIV><BR></FONT></DIV></BODY></HTML> ------=_NextPart_000_000D_01C35DA1.B98ED7D0-- --===============90053145367332244== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Parsed-XML-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/parsed-xml-dev --===============90053145367332244==--