Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¡¾ÇóÖú¡¿python xmlÎļþ¶ÁÈ¡ºÍת»»ÎÊÌâ

#½«GB2312¸ñʽתΪUTF-8¸ñʽ
    f = codecs.open('e:\TestResult.xml', "rb", "gb2312")
    text = f.read().encode("utf-8") 
    f.close
    f = open(options.TestResultFile, "wb") 
    f.write(text) 
    f.close() 

Ìáʾ  File "E:\TOOLS\ICP\ICP-23\cruisecontrol\userData\groups\group01\projects\R12ProductTest\script\pyt
hon_script\StaticResult.py", line 29, in main
    text = f.read().encode("utf-8") 
  File "C:\Python25\lib\codecs.py", line 606, in read
    return self.reader.read(size)
UnicodeDecodeError: 'gb2312' codec can't decode bytes in position 55-56: illegal multibyte sequence

ÊÇf.read()³öÁËÎÊÌ⣬ÒòΪ¡£encode("utf-8")  È¥µôÈÔÈ»ÊǸÃÏÖÏó¡£

²»ÖªµÀÎÒÕâÀï¶ÁÈ¡ÓкÎÎÊÌ⣿

ÕâÊdzÉÊìµÄ²úÆ·´úÂ룬ÒѾ­ÓбðÈËÔÚʹÓ᣶øÇÒÎÒʹÓÃËûÃÇͬÑùµÄÎļþÀ´²Ù×÷£¬ÒÔ¼°Í¬ÑùµÄpython°æ±¾£¨2.5£©Ò²ÊÇÕâÑùµÄÎÊÌ⣬ºÃÆæ¹Ö£¡


¶ÔÁË£¬ÍüÁË open

Python code:

def _openAnything(self, source):
try:
f = urllib.urlopen(source)
data = f.read()


Ïà¹ØÎÊ´ð£º

ÈçºÎÌá½»xmlÀàÐÍÊý¾Ý - .NET¼¼Êõ / ASP.NET

Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
  <a>aaa
  </a>
  <b>bbb
  </b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......

C# DataSetµ¼³öxml Åú´¦Àí(Ñ­»·)µÃÔõô´¦Àí

DataSetµ¼³öxml Åú´¦Àí(Ñ­»·)µÃÔõô´¦Àí
XMLÎļþ
<A>
      <B>
        <C>
        </C>
  &nb ......

Êý¾ÝÒÔxml¸ñʽ·µ»Ø - MS-SQL Server / Ó¦ÓÃʵÀý

´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽ
XML code:
<folder state="unchecked" label="È«²¿">
¡¡¡¡ <folder state="unchecked&qu ......

[vc] ÈçºÎ½«XML×Ö´®²åÈëµ½Ö¸¶¨µÄNode

²ÉÓÃDOM ½øÐнâÎöxml¡£ÒªÇó½«xml×Ö´®²åÈëÖ¸¶¨½Úµã×÷ΪÆä×Ó½Úµã
±ÈÈ磺 
Ô­xml 
<root>
</root>
Òª²åÈëµÄxml×Ö´®
<a>test</a> 
Ä¿µÄxml£º
<root>
<a> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ