Skip to content

Instantly share code, notes, and snippets.

@inancsevinc
Created October 1, 2012 06:23
Show Gist options
  • Save inancsevinc/3809800 to your computer and use it in GitHub Desktop.
Save inancsevinc/3809800 to your computer and use it in GitHub Desktop.
namespace-to-package mapper for non-standard namespaces in wsdl/xsd files, to be run before jax-rpc client generation
import os, re
searchDir= "C:/temp"
mydict = {} #empty dictionary, keys are namespace urls, values are mapped packages
for dirpath, dirnames, filenames in os.walk(searchDir): #walk thru directories recursively
for file in [ f for f in filenames if os.path.splitext(f)[1] in [".xsd",".wsdl"] ]:
with open(os.path.join(dirpath,file)) as current_file:
for line in current_file.readlines():
m = re.search(r'(http://)(isbank\.com([^\"])+)', line)
if(m): mydict[m.group(0)] = "com.isbank."+".".join(m.group(2).replace('/','.').split(".")[2:] )
for key,value in mydict.items():
print("<arg line=\"-N "+key+"="+value+"\" />")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment