Author |
Message
|
Vitor |
Posted: Fri Jul 30, 2010 5:13 am Post subject: Obtaining references as strings |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMB 6.1.0.5
A flow reads an XML document from a queue and processes it in the traditional manner, transforming it and passing it forward. An existing downstream application has a similar XML document that doesn't pass through WMB but as part of their processing they need to know what parts of the document we've processed. Rather than taking our processed XML like any sane application they want XPath references to the relevant sections.
So what I need to do is take a REFERENCE variable that points to InputRoot.XMLNSC.Something.Somewhere.ThisBit.WillBeChanged and get a CHARACTER varable "InputRoot.XMLNSC.Something.Somewhere.ThisBit.WillBeChanged". After that some substringing and replacing gets me where I need to be but what's the best way to get a reference in string form? Is there a way? Do I (glup) need a JCN?
I accept what I actually need is a really big trout and 5 minutes with the downstream application people but that's a work in progress.
Suggestions welcomed, especially suggestions that include the phrase "just use the ... ESQL function you idiot". _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jul 30, 2010 5:18 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I think you need to recursively walk up PARENT using FIELDNAME and FIELDNAMESPACE. I don't think you can otherwise cast a reference to a meaningful string value... ?
I've not played with it though.  |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jul 30, 2010 5:24 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
:I think you need to recursively walk up PARENT using FIELDNAME and FIELDNAMESPACE. I don't think you can otherwise cast a reference to a meaningful string value... ? |
I was afraid you'd say that. Though more afraid you'd suggest a JCN  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jul 30, 2010 6:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
mqjeff wrote: |
:I think you need to recursively walk up PARENT using FIELDNAME and FIELDNAMESPACE. I don't think you can otherwise cast a reference to a meaningful string value... ? |
I was afraid you'd say that. Though more afraid you'd suggest a JCN  |
Oh, I was tempted.
But there isn't a specific reason I can think of that requires a JCN here - OTOMH there isn't a method that produces an XPath expression from an MbElement object.
You could review the specs on MbElement yourself..  |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jul 30, 2010 7:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
You could review the specs on MbElement yourself..  |
I could. It's not likely.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jul 30, 2010 10:36 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
XPaths use prefixes, not namespace URIs. PRefix->URI mappings must be provided separately. So...does the XML document use namespaces, or will it ever do so in the future? If so, your message flow will need one of two things:
- knowledge of the namespace prefixes used by the downstream app
or
- the ability to allocate a namespace prefix for each element in the XPath, and the ability to communicate those prefix->URI mappings to the downstream app.
I'm guessing that the answer is 'no', but you might be able to use this question as a 'trout'. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jul 30, 2010 10:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
At the moment we are namespace free. A cynical, twisted person might claim that's because it a concept outside the grasp of those involved but what are the odds of a cynical, twisted person posting here?
Grrr.....  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 30, 2010 1:33 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mqjeff wrote: |
I think you need to recursively walk up PARENT using FIELDNAME and FIELDNAMESPACE. I don't think you can otherwise cast a reference to a meaningful string value... ?
I've not played with it though.  |
Walk up the tree like Jeff said and append the character variable to whatever you found at each step... At the end the character variable will give you the reference... It is a little bit ugly but why would they just reference something and not have it copied? Are their documents so huge? And how do they reference the particular instance of the document that the reference is pointing to?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Fri Jul 30, 2010 2:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fjb_saper wrote: |
why would they just reference something and not have it copied? |
That's a good & relevant question.
fjb_saper wrote: |
Are their documents so huge? |
Average at 24Mb a document.
fjb_saper wrote: |
And how do they reference the particular instance of the document that the reference is pointing to?  |
Another very relevant question.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|