Python 从SQLServer解析XML文件

Python 从SQLServer解析XML文件,python,sql-server,xml,ms-access,xml-parsing,Python,Sql Server,Xml,Ms Access,Xml Parsing,我收到了一个“xml”文件,尽管它看起来不像xml。我知道它是从Microsoft Access或SQLServer导出的。该文件如下所示: >>> contents[:1000] '\xef\xbb\xbf<?xml version="1.0"?><Report xmlns="Ascent_x0_Metadata_x0020_Report_x0020__x002ted" xmlns:xsi="http://www.w3.org/2001/XMLSchema

我收到了一个“xml”文件,尽管它看起来不像xml。我知道它是从Microsoft Access或SQLServer导出的。该文件如下所示:

>>> contents[:1000]
'\xef\xbb\xbf<?xml version="1.0"?><Report xmlns="Ascent_x0_Metadata_x0020_Report_x0020__x002ted" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="Ascent_x0020_Me0_Repo29__x0020_updated http://reportserver?
%2fAsata+Report+(by+Title+Letter)+updated&amp;rs%3aFormat=XML&amp;rc%3aSchema=True" 
Name="Ascent Report (by Title Letter) updated">
    <table1>
        <Detail_Collection>
            <Detail ISOCountry="AR" TitleSort="A Very Brady Sequel" 
                ReleaseYear="1996" TitleKind="N/A" TitleType="N/A"...
>>内容[:1000]
'\xef\xbb\xbf

第一个十六进制字符是UTF-8字节顺序标记()

这仅仅意味着您收到的内容被编码为UTF-8,您应该通过设置用于读取内容的编码来将其视为UTF-8。就XML而言,文件的其余部分看起来还可以


Textmate可以使用UTF-8,但可能文件太大了。

\xef\xbb\xbf isï»。我不知道这是否有帮助,但仅此而已。在我看来,它确实像XML。只是在前几个字节中有一些垃圾?