On 8/29/2011 10:56, Michael McLoughlin wrote:
Would someone please explain the following syntax error that appears
when importing the etree module:

tree = etree.XML("<root></b>", parser)

"<root></b>" is invalid XML.  Tags must be balanced, so you have to have either matched opening & closing tags, or a standalone tag (<b/>).  You also don't need to manually instantiate a parser, unless you're setting some non-default options.   Something similar would be:

>>> from lxml import etree
>>> tree = etree.XML("<root><b/></root>")

I'd recommend reading up on the basics of XML, something like
http://www.w3schools.com/xml/default.asp

Jason