Author |
Message
|
kytem |
Posted: Sun Dec 06, 2009 5:54 pm Post subject: Accessing the XML Field Type |
|
|
Newbie
Joined: 06 Dec 2009 Posts: 7
|
Hi,
I have a situation where we have a number of XML messages coming into the broker. Whilst each message is different they all have a number of fields that are common in each message.
They are complex field types.
What I would like to do is to be able to scan through each message and identify the occurances of the complex types. Ideally I'd like to create a single sub flow that can scan the message(s) and perform specific actions based upon the occurances of the complex types it finds in each message.
I have scanned thru forums (like this one) and I have not yet found a way to do this in the Broker.
Is it possible? If so, how?
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Sun Dec 06, 2009 6:09 pm Post subject: Re: Accessing the XML Field Type |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kytem wrote: |
Is it possible? If so, how? |
It's certainly possible to reference common fields in the body of a message irrespective of the parent fields. Equally it's possible to identify a message based on the name / type of the parent fields.
Not sure if that's what you're looking for, but this technique is described in the WMB InfoCentre. Start here, then look up references. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kytem |
Posted: Sun Dec 06, 2009 8:15 pm Post subject: |
|
|
Newbie
Joined: 06 Dec 2009 Posts: 7
|
Ideally I want to avoid being dependent upon searching for the "base elements" (if I can...)
The situation I've got is I have a Complex type def'n of DocAttach, which contains two fields FileName and FileReference.
In the example below we PisFile and UploadFile are defined with the complex type of DocAttach.
What I would like to do is scan the message when it arrives into the Broker and identify the occurence(s) of complex type DocAttach.
<Msg1>
...
...
<PisFile>
<FileName>
<FileURL>
</PisFile>
</Msg1>
<Msg2>
...
...
<UploadFile>
<FileName>
<FileURL>
</UploadFile>
</Msg2> |
|
Back to top |
|
 |
Vitor |
Posted: Sun Dec 06, 2009 8:21 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kytem wrote: |
Ideally I want to avoid being dependent upon searching for the "base elements" (if I can...) |
You can. It's the very definition of anonymous references.
kytem wrote: |
What I would like to do is scan the message when it arrives into the Broker and identify the occurence(s) of complex type DocAttach. |
Perfectly doable. You'll have to produce some ESQL to do it; WMB doesn't have a "IF InputBody CONTAINS <XML type>" function but it's fairly straightforward if you're doing what I think you're doing. It's not that complex even if you're not.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 07, 2009 2:28 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
What I would like to do is scan the message when it arrives into the Broker and identify the occurence(s) of complex type DocAttach |
Not possible - the message tree does not contain the name of ( or any other properties of ) the simple types/complex types in the original schemas.
You can't do it using an XSLTransform node either - XPath 1.0 does not provide access to the schema types. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 07, 2009 7:57 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
Not possible - the message tree does not contain the name of ( or any other properties of ) the simple types/complex types in the original schemas. |
Really? I am enlightened!
I suppose, on reflection, FIELDTYPE returns the message tree type rather than the underlying type. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Dec 08, 2009 2:06 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I suppose, on reflection, FIELDTYPE returns the message tree type rather than the underlying type. |
Correct. FIELDTYPE consists of two parts. The top 8 bits identify the generic type of the element. Generic types are Name / Value / NameValue.
The lower 24 bits are the parser-specific field type. These are used differently by each parser. XML parsers use these bits to identify which XML construct the element represents. These bits get cleared automatically when an element is copied into the tree owned by a different parser.
From v61 FP04, the parser-specific field type is decoded by the Trace node and displayed along with the other info about the element. That's where the (PCDataField) and (NamespaceDecl) strings come from. |
|
Back to top |
|
 |
|