我正在使用jQuery
<textarea name="" id="upEditor" cols="30" rows="10"></textarea>
var editor = CodeMirror.fromTextArea($('#upEditor'), {
stylesheet:'monokai.css'
});
我不知道为什么它不起作用,在控制台中,它说:
Uncaught TypeError: Object [object Object] has no method 'getAttribute'
请帮忙-thanks
答案 0 :(得分:3)
可能是由dom延迟init引起的。并且还应添加[0]
$(document).ready(function() {
var editor = CodeMirror.fromTextArea($('#upEditor')[0], {
stylesheet:'monokai.css'
});
});
答案 1 :(得分:0)
您应该将PmtInf
更改为def parse_xml(file, output_path):
parser = ET.XMLParser(encoding='utf-8', recover=True)
dom = ET.parse(file, parser=parser)
xslt = ET.fromstring(TEMPLATE_XSLT) # TEMPLATE_XSLT contains the transformation
transform = ET.XSLT(xslt)
new_dom = transform(dom)
with open(output_path, 'wb') as xml_file:
xml_file.write(new_dom)
。这应该可以立即解决您的问题