Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- from xml.dom.minidom import parseString
- from javascriptcore import JSContext
- def modify_xml(xml_text, js_code):
- ctx = JSContext()
- window = ctx.evaluateScript('this')
- window.document = parseString(xml_text)
- ctx.evaluateScript(js_code)
- return window.document.toxml()
- def main():
- xml_text = open(sys.argv[1]).read()
- js_code = open(sys.argv[2]).read()
- print modify_xml(xml_text, js_code)
- if __name__=='__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement