ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Rendering XML Namespace prefix

Post new topic  Reply to topic Goto page 1, 2  Next
 Rendering XML Namespace prefix « View previous topic :: View next topic » 
Author Message
pjs3r
PostPosted: Mon Apr 19, 2004 11:09 am    Post subject: Rendering XML Namespace prefix Reply with quote

Newbie

Joined: 19 Apr 2004
Posts: 4

Hi,
I've created a message definition that uses namespaces. All elements have their Namespace attributes set but when I write the message to an XML format, the XML tags do not have the namespace prefixes. How do I force WSIMB 5 (CSD 03) to write the namespace prefix for each element?

For example, currently I get this:

Code:
<interface xmlns:iface="interface/message/1.0.0.1">
<order>
<value>1000</value>
</order>
</interface>


But I want this:
Code:
<iface:interface xmlns:iface="interface/message/1.0.0.1">
<iface:order>
<iface:value>1000</iface:value>
</iface:order>
</iface:interface>


Thanks,

Pete
Back to top
View user's profile Send private message
TonyD
PostPosted: Mon Apr 19, 2004 3:25 pm    Post subject: Reply with quote

Knight

Joined: 15 May 2001
Posts: 540
Location: New Zealand

This piece of ESQL:
Code:
      DECLARE iface NAMESPACE 'interface/message/1.0.0.1';
      SET OutputRoot.XMLNS.iface:interface.(XML.NamespaceDecl)xmlns:iface =
      'interface/message/1.0.0.1';
      SET OutputRoot.XMLNS.iface:interface.iface:Order.iface:value = '1000';

:will create this output:
Code:

<iface:interface xmlns:iface="interface/message/1.0.0.1">
 <iface:Order>
  <iface:value>1000</iface:value>
 </iface:Order>
</iface:interface>
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Tue Apr 20, 2004 4:49 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

I think with the XMLNS parser, the namespace prefix will come out as NS1.

e.g.

<NS1:interface xmlns:NS1="interface/message/1.0.0.1">
...

The only way to get a specific prefix is to use MRM.
Back to top
View user's profile Send private message Send e-mail
funknor
PostPosted: Tue Apr 20, 2004 5:36 am    Post subject: NS1 is removed once namespace declared Reply with quote

Newbie

Joined: 07 Oct 2003
Posts: 6

Tony

Once the namespace is declared, you should not have any issues with NS1 or similar with the XMLNS parser. I used the XMLNS parser with this declaration

DECLARE iface NAMESPACE 'interface/message/1.0.0.1';

works
Back to top
View user's profile Send private message
TonyD
PostPosted: Tue Apr 20, 2004 6:33 pm    Post subject: Reply with quote

Knight

Joined: 15 May 2001
Posts: 540
Location: New Zealand

Hi Funknor,
The snippet I posted earlier as I indicated does not produce NS1: prefix. In fact the quoted output was taken from an actual message I created.
I have spent some time struggling to understand how to use the namespace support. We create a lot of messages that are going to JMS and .Net apps. So far, by importing a schema to a message set with namespace support enabled, and by setting the Runtime Parser to XMLNS, I am able to construct compliant messages, using Content Assist where possible. Content Assist includes the namespace prefix at each level. I don't know whether the namespace prefix will be automatically inserted at any stage .... As far as I know it will not.
Jonathan, can you describe how to use MRM to insert the prefix? I have had no success at all trying to use messages that include namespaces.
Back to top
View user's profile Send private message Send e-mail
TonyD
PostPosted: Wed Apr 21, 2004 11:19 pm    Post subject: Reply with quote

Knight

Joined: 15 May 2001
Posts: 540
Location: New Zealand

Further to last post I decided that I needed to sort this out for myself...almost got there except that <MRM> begin and end tags appeared as the result of coding:

Code:
SET OutputRoot.MRM.err:Error.err:Level = 'FATAL';

:as follows:
Quote:

<?xml version="1.0"?>
<MRM>
<err:ErrorList xmlns:err="http://xxx.com/scv/error-1/2004/01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xxx.com/scv/error-1/2004/01 c:\xxx\xml\20040415\">
<err:Error>
<err:Level>FATAL</err:Level>
.......
</err:Error>
</err:ErrorList>
</MRM>

I was unable to get rid of these tags, so ran the Video sample, only to find that it produces the same tags:

Quote:

<?xml version="1.0"?>
<MRM>
<Customer xmlns:addr="http://www.ibm.com/AddressDetails" xmlns:brw="http://www.ibm.com/BorrowedDetails" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name LastName="Bloggs">
<Title>Mr</Title>
....
</Customer>
</MRM>
[/quote]
Anyone know if this is a bug?...... I made no changes to the Video sample.
Back to top
View user's profile Send private message Send e-mail
pjs3r
PostPosted: Fri Apr 23, 2004 7:37 am    Post subject: Reply with quote

Newbie

Joined: 19 Apr 2004
Posts: 4

Tony,
Try setting the Root Tag Name field under your message definition's physical properites page to empty string.

1) Open the message definition
2) Expand Messages and select your message
3) Select the properties tab at the bottom.
4) Select the physical format under Properites Hierarchy
5) Root Tag Name is about half way down.

-Pete
Back to top
View user's profile Send private message
TonyD
PostPosted: Fri Apr 23, 2004 4:56 pm    Post subject: Reply with quote

Knight

Joined: 15 May 2001
Posts: 540
Location: New Zealand

Already tried that:
Quote:

<?xml version="1.0"?>
<>
<err:ErrorList xmlns:err="http://xxx.com/scv/error-1/2004/01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<err:Error>
<err:System>Huon</err:System>
<err:Level>INFO</err:Level>
<err:Module>Adapter</err:Module>
<err:Code>VR998</err:Code>
<err:Message>Invalid Name</err:Message>
<err:TimeStamp>2004-04-24T10:53:10-10:00</err:TimeStamp>
</err:Error>
</err:ErrorList>
</>

:before trying the Video sample. In any case, it seems to me that the Video sample should not generate incorrect output?!
Back to top
View user's profile Send private message Send e-mail
TonyD
PostPosted: Mon Apr 26, 2004 5:23 pm    Post subject: Reply with quote

Knight

Joined: 15 May 2001
Posts: 540
Location: New Zealand

My apologies!...you were right...when I thought I had erased 'MRM' I had replace it with ' ' (Space) rather than '' (Null)! All OK now.
Back to top
View user's profile Send private message Send e-mail
Blobtastic
PostPosted: Wed Jul 28, 2004 3:23 am    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2003
Posts: 34
Location: uk

Hi,

Reading through this, people have refered to the XMLNS parser. Is this the same as the XML domain?

Any help appreciated!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jul 28, 2004 4:47 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Blobtastic wrote:
Hi,

Reading through this, people have refered to the XMLNS parser. Is this the same as the XML domain?

Any help appreciated!


Not exactly...

it's a separate domain for XML Name Spaces. It provides support for schema handling and validation with XML data.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Blobtastic
PostPosted: Wed Jul 28, 2004 4:59 am    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2003
Posts: 34
Location: uk

Thanks Jeff.

Can you tell me where I cam find some information on it, so that I can find out what it will give me? The manuals I'm looking at only seem to refer to an XML domain. If I scan for xmlns it refers to the attribute, not the domain, and if I type in a DECLARE statement for a NAMESPACE in my e-SQL, I get a syntax error.

Is this something new in version 5? I am on 2.1
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Jul 28, 2004 5:28 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

The XMLNS domain was introduced (along with DECLARE ... NAMESPACE.... and many other ESQL changes) in V5.


Cheers,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
shanson
PostPosted: Thu Jul 29, 2004 9:23 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

Let's be quite clear what XMLNS provides. It is virtually the same as XML domain except that it is namespace aware. So it will create both name and namespace information in the message tree when it parses XML instance documents that use namespaces.

It does not provide the ability to perform runtime validation of XML instance documents against an XML Schema.

From V5 onwards the XML domain is effectively deprecated, and you are recommended to switch to XMLNS domain.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jul 29, 2004 1:19 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

shanson wrote:
It does not provide the ability to perform runtime validation of XML instance documents against an XML Schema.



_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Rendering XML Namespace prefix
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.