Author |
Message
|
KIT_INC |
Posted: Tue Apr 10, 2012 6:13 am Post subject: Any quick way to add namespace? |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Because of merging, we were given a large number of mqsi 21 esqls from another location. We do not have to migrate them to WMB 7 which is our environment. However we like to reuse some of them. Since we started with WMB6, we already use namespace and XMLNSC. We do not have any experience with this. We know that we have to add namespace declaration and name space prefix to the ESQL code in general. Is using an editor to do a massive serach and replace the only way to do it ?
For example FIND OutputRoot.XML.A.B.C REPLACE InputRoot.XMLNSC.ns:A.ns:B.ns:C where ns is the name space prefix.
Any experience you can share will be greatly appreciated. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 10, 2012 6:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I might tend to use a find/replace thingy, like grep or perl or sed or etc, rather than using manual changes in a full featured editor.
But you're still going to have to load the ESQL files into a 7.0 toolkit project and validate them. 2.1 esql has a number of subtle differences that are going to require manual intervention. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Apr 10, 2012 6:53 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
When dealing with namespaces, we have found that local declarations are more convenient rather than global declarations, especially when multiple developers are working in the same area. Therefore, as you are migrating your files, move your namespace decls into the module and out of the global scope. I'm sure others may have differing opinions on this advice. We also standardized the naming convention so that the same XML tag equates to the same namespace tag in all locations.
For future, we want a neat little utility that imports a set of namespaces in all esql files. IMHO. Thanks Vitor. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Apr 10, 2012 6:56 am Post subject: Re: Any quick way to add namespace? |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Search and replace (probably "within files") is fine in my view...
Just to put up an alternative:
You can do that with a texteditor, e.g. notepad++ (or ultraedit) or ...
For XML: Use XMLSpy or oXygen, since I have the impression that they can handle large (and probably also a lot of) (XML-)files better (than a plain texteditor)... but, o.k. you want to convert your ESQLs.
BTW: It is called XMLNSC, but you do not need to use namespaces with the XMLNSC parser! _________________ Just use REFERENCEs |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 10, 2012 7:12 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
For future, we want a neat little utility that imports a set of namespaces in all esql files. IMHO. Thanks Vitor. |
You should be able to alter your source management systems so that it runs a script when an .esql file is checked out.
which will work like magic until it
 |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Apr 10, 2012 7:17 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mqjeff wrote: |
lancelotlinc wrote: |
For future, we want a neat little utility that imports a set of namespaces in all esql files. IMHO. Thanks Vitor. |
You should be able to alter your source management systems so that it runs a script when an .esql file is checked out. |
I suppose we can use this as a work around until WMB v9. ESQL <import> like the Java <import> would be ideal. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 10, 2012 7:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
ESQL <import> like the Java <import> would be ideal. |
You can currently have a common "imported" esql that contains namespace definitions.
Not exactly the same as an import, but another workaround until WMBv9. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 10, 2012 12:01 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 10, 2012 9:13 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And think also about another alternative:
Write a utility function that will assign the given namespace to each of the children... Start at the top. Find where the namespace changes and reassign the changed one going down... Use REFERENCES.
Make it recursive.
Build once reuse multiple times. Quick way of solving your problem with minimal code changes (thinking of a default namespace here).
You could also insert an added benefit by checking the type and transforming certain XML types to XMLNSC types...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|