1
- import _base
2
- import new
1
+ from . import _base
3
2
import warnings
4
- from html5lib .constants import DataLossWarning
5
- import etree as etree_builders
6
- from html5lib import ihatexml
3
+ from . .constants import DataLossWarning
4
+ from . import etree as etree_builders
5
+ from .. import ihatexml
7
6
8
7
try :
9
8
import lxml .etree as etree
@@ -158,7 +157,7 @@ class Attributes(dict):
158
157
def __init__ (self , element , value = {}):
159
158
self ._element = element
160
159
dict .__init__ (self , value )
161
- for k , v in self .iteritems ():
160
+ for k , v in self .items ():
162
161
self ._element ._element .attrib [filter .coerceAttribute (k )] = v
163
162
164
163
def __setitem__ (self , key , value ):
@@ -263,7 +262,7 @@ def insertRoot(self, token):
263
262
"""Create the document root"""
264
263
#Because of the way libxml2 works, it doesn't seem to be possible to
265
264
#alter information like the doctype after the tree has been parsed.
266
- #Therefore we need to use the built-in parser to create our iniial
265
+ #Therefore we need to use the built-in parser to create our initial
267
266
#tree, after which we can add elements like normal
268
267
docStr = ""
269
268
if self .doctype and self .doctype .name :
@@ -278,7 +277,7 @@ def insertRoot(self, token):
278
277
try :
279
278
root = etree .fromstring (docStr )
280
279
except etree .XMLSyntaxError :
281
- print docStr
280
+ print ( docStr )
282
281
raise
283
282
284
283
#Append the initial comments:
0 commit comments