Advertisement
Guest User

Untitled

a guest
Jul 13th, 2011
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys
  3. from xml.dom.minidom import parseString
  4. from javascriptcore import JSContext
  5.  
  6. def modify_xml(xml_text, js_code):
  7. ctx = JSContext()
  8. window = ctx.evaluateScript('this')
  9. window.document = parseString(xml_text)
  10. ctx.evaluateScript(js_code)
  11. return window.document.toxml()
  12.  
  13. def main():
  14. xml_text = open(sys.argv[1]).read()
  15. js_code = open(sys.argv[2]).read()
  16. print modify_xml(xml_text, js_code)
  17.  
  18. if __name__=='__main__':
  19. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement