[Python] I am facing this error "xml.parsers.expat.ExpatError: not well-formed (invalid...

Discussão em 'Python' iniciado por Stack, Fevereiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am facing this error xml.parsers.expat.ExpatError: syntax error: line 1, column 0 while parse data from url using minidom. Anyone can help me for this ?

    Here is my code:

    from xml.dom import minidom
    import urllib2
    url= 'http://www.awgp.org/about_us'
    openurl=urllib2.urlopen(url)
    doc=minidom.parse("about_us.xml")


    Error:

    Traceback (most recent call last):
    File "test3.py", line 11, in <module>
    doc=minidom.parse("about_us.xml")
    File "C:\Python27\lib\xml\dom\minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
    File "C:\Python27\lib\xml\dom\expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
    File "C:\Python27\lib\xml\dom\expatbuilder.py", line 211, in parseFile
    parser.Parse("", True)
    xml.parsers.expat.ExpatError: syntax error: line 1, column 0

    Continue reading...

Compartilhe esta Página