For Juniper in configuration mode:
show | display xml
For Cisco IOS I've never made this, but you can try to use ODMSpec: http://www.cisco.com/en/US/docs/ios-xml/ios/xmlpi/command/xmlpi-cr-book.pdf http://www.cisco.com/en/US/docs/net_mgmt/enhanced_device_interface/2.2/developer/guide/progodm.html
I'm not sure, that it works with running-config.