Author |
Message
|
Broady |
Posted: Tue Oct 17, 2006 2:15 am Post subject: Outputting as a namespace using an MRM Message Set |
|
|
 Novice
Joined: 16 Apr 2004 Posts: 23 Location: Halifax, West Yorkshire, England
|
I am using WBIMB v5.
I have a requirement to produce an XML message that houses an HTML document in Base64 along with some namespace attribute.
I have managed to generate the HTML document using an MRM with a base64 definition using advice sought here before.
My problem now is is how to include the namespace entry.
I am struggling to understand how to generate this in spite of reading up on namespaces, having never worked with them before.
This is the expected output:-
<DOCUMENT Type="Type1" DocType="DocType1" Format="Format1">
PEhUTUw+ICAgIDxIR etc
xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="bin.base64"
</DOCUMENT>
I initially tried setting up a schema (again I am new to this) for importing as my Message but struggled getting it to have the namespace as above.
So I then set my Message Set to include namespaces; added my namespace alias nt into it and coded many attempts at ouputting it.
I have added nt as an attrribute under DOCUMENT wrongly or rightly.
I would normally summise that it has not recognised this as being output so it defaults to an element?
My latest attempt is..
SET OutputRoot.MRM.HXML.REQUEST.DOCUMENTS.DOCUMENT.(XML.NamespaceDecl)dt:dt = 'bin.base64';
which produces...
<dt:dt xmlns:dt="urn:schemas-microsoft-com:datatypes">bin.base64</dt:dt>
Firstly I do not want dt as an element and secondly the xmlns entry should reside only as a 'child' of the DOCUMENT element.
I know my language will be wrong as I do not comprehend the context of namespaces in this usage.
Can anyone tell me the best way to code for this; which may be showing me a sample schema that has it defined as I would want, or a piece of ESQL with appropriate Message Set/Message properties.
Thanks in anticipation of your considerations,
Alan _________________ Alan Broadbent |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 17, 2006 3:04 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Code: |
DECLARE myns NAMESPACE "urn:schemas-microsoft-com:datatypes";
SET OutputRoot.MRM.HXML.REQUEST.DOCUMENTS.myns:DOCUMENT = myblob; |
Now you set up the document as a blob. (xsd:hexbin).
DOCUMENT will be in namespace "urn:schemas-microsoft-com:datatypes".
This should give you a foundation to start with.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 17, 2006 3:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
My latest attempt is..
SET OutputRoot.MRM.HXML.REQUEST.DOCUMENTS.DOCUMENT.(XML.NamespaceDecl)dt:dt = 'bin.base64'; |
Completely wrong, I'm afraid. The MRM domain is completely different from the XML/XMLNS/XMLNSC domains. It does not use correlation names like 'XML.NamespaceDecl'.
You need to create a message tree in which the appropriate nodes are in namespace "urn:schemas-microsoft-com:datatypes". fjp_saper showed you how to do that. |
|
Back to top |
|
 |
Broady |
Posted: Tue Oct 17, 2006 3:49 am Post subject: Namespace and MRM output |
|
|
 Novice
Joined: 16 Apr 2004 Posts: 23 Location: Halifax, West Yorkshire, England
|
As I said I need some help in an example usage for this.
Am I to leave all my other properties as I have described (e.g. dt as an attribute under DOCUMENT in the Message Set) and then code as suggested?
Where does usage of a blob come into it?
I have defined attributes of the element DOCUMENT in the Message Set as they appear in my example layout below shows.
<DOCUMENT Type="Type1" DocType="DocType1" Format="Format1">
PEhUTUw+ICAgIDxIR etc
xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="bin.base64"
</DOCUMENT>
somehow I need the 'namespace attributes' xmlns:dt and dt:dt appearing as above.
I don't understand where I am to code the setting of the value of 'bin.base64', and have the output as above . _________________ Alan Broadbent |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 17, 2006 4:10 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
as I do not comprehend the context of namespaces in this usage. |
There is nothing strange or mysterious about this usage of namespaces. If you are not confident about schema namespaces, you should read some internet tutorials. If you are not sure about namespaces in message broker, you should read the docs. Until you are confident with the whole namespace thing, nothing that we say will make much sense. |
|
Back to top |
|
 |
Broady |
Posted: Tue Oct 17, 2006 6:17 am Post subject: |
|
|
 Novice
Joined: 16 Apr 2004 Posts: 23 Location: Halifax, West Yorkshire, England
|
I understand your comments but I am looking for a tactical solution that does what I require in this instance, hoping someone could give me a simple skeleton schema that has a namespace attribute within it that I can produce a Message Set from, and then some accompanying ESQL to pouplate that field, if that is the best way forward.
I have read a lot of literature about namespaces already, spending hours with various sources and experimenting with code and Message Set setups to get close to what i want.
Is it too much to ask now to explain what I need within the context of what I am trying to achieve?
The more I read up the more confused I get. These topics are large.
This is the very first requirement for this and may be the last, so I just want to get beyond it due to the amount of time I have already spent on it.
hopeful..
Alan _________________ Alan Broadbent |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 17, 2006 6:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - since you ask so nicely
Firstly, you are confused about namespace attributes. The xmlns attributes which appear in an instance document are never declared in the schema. xmlns attributes simply allow an instance document to define its own shorthand notation for the long namespace URIs which would otherwise make it unreadable. That's a good example of something you need to get clear.
Here's what I think you need to do:
- Build a message tree with the correct structure and contents. Make sure that the name and namespace of each node in the message tree matches your message definition.
- Do not include the xmlns attribute in your message definition. This is automatically inserted by the MRM domain when the message is output.
- For the same reason, do not include the xmlns attribute in your message tree. |
|
Back to top |
|
 |
|