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 » XML - setting a wildcard attribute from an extension

Post new topic  Reply to topic
 XML - setting a wildcard attribute from an extension « View previous topic :: View next topic » 
Author Message
dyson
PostPosted: Wed Apr 24, 2013 5:42 pm    Post subject: XML - setting a wildcard attribute from an extension Reply with quote

Apprentice

Joined: 04 Apr 2011
Posts: 45

e.g. The Total element has a wildcard attribute which I'm trying to set.

Code:

SET TRANSACTION.*:Total=5.99;
SET TRANSACTION.*:Total.(XMLNSC.Attribute)*:Element.*:TotalType='Grand';


The above passed thru the validation node successfully but the XML generated doesn't include the attribute i.e. the output is: <Total>5.99</Total>.
I was thinking it would be:
<Total Element.TotalType="Grand">5.99</Total>

Not sure if it's the code or how the TotalType attribute was defined in the xsd?
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Wed Apr 24, 2013 9:34 pm    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Problem is in your code. Study ESQL field referencing and search from web if XML attributes can have namespaces.

--
Marko
Back to top
View user's profile Send private message Visit poster's website
Esa
PostPosted: Wed Apr 24, 2013 10:45 pm    Post subject: Re: XML - setting a wildcard attribute from an extension Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

dyson wrote:

SET TRANSACTION.*:Total.(XMLNSC.Attribute)*:Element.*:TotalType='Grand';[/code]



If the attribute name has special characters like '.', it should be enclosed with quotes, like
Code:
SET TRANSACTION.(XMLNSC.Attribute)"Element.TotalType" = 'Grand';


An attribute with a namespace may be a little challenging, maybe something like TRANSACTION.(XMLNSC.Attirbute)*:"Element.Type" could work.

But your code is for an attribute that has two namespaces, one of them in the middle of the attribute name. That is not valid XML.
As if you had an element like this:

Code:
<ns1:TRANSACTION ns1:Element.ns1:Type='Grand'/>
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Apr 25, 2013 2:05 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Esa is correct. Looks like a simple typo in your field reference.

A couple of points to clarify:
- setting a namespace on an attribute is the same as setting it on an element. Not sure why one would be harder than the other.
- this is nothing to do with wildcards. It's a simple ESQL coding error.
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Thu Apr 25, 2013 2:38 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Yes kimbert, you are right. I was remembering and didn't check the exact clause
Quote:
It is only logical that namespaces are mostly about elements and that attributes don’t need to be in a namespace.


XML attributes and namespace are quite a well described here

--
Marko
Back to top
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Thu Apr 25, 2013 2:49 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Yes, I can see how that article could confuse people.

The XML specification does allow attributes to have namespaces, and there are very good reasons for that. Imagine that your XML schema defines an attribute called 'type'. There is a commonly used attribute called 'type' in the xsi namespace. Without namespaces on attributes, it would be impossible to distinguish between xsi:type="myns:mySimpleType" and dogs:type="labrador".
Back to top
View user's profile Send private message
dyson
PostPosted: Thu Apr 25, 2013 8:10 am    Post subject: Reply with quote

Apprentice

Joined: 04 Apr 2011
Posts: 45

Perfect, thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML - setting a wildcard attribute from an extension
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.