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 » Xmldeclaration in ESQL

Post new topic  Reply to topic
 Xmldeclaration in ESQL « View previous topic :: View next topic » 
Author Message
elwis
PostPosted: Tue Jun 30, 2009 2:53 am    Post subject: Xmldeclaration in ESQL Reply with quote

Apprentice

Joined: 02 Apr 2008
Posts: 26
Location: Sweden

Hi all,

I think the heat has gotten to my brain, cause I've spent an hour without solving this one.

I'm in Broker5 trying to create an XML message. What I want is this:

Code:

<!DOCTYPE MYCAT SYSTEM "my_cat.dtd">
<MYCAT version="1.0">
....
</MYCAT>


I don't get that one no matter how I play with (XML.DocTypeDecl) and the (XML.Attribute). Am I getting a conflict with my DoctypeDecl and my Root tag when doing something like this?

Code:

SET OutputRoot.XML.(XML.DocTypeDecl)MYCAT = '';
SET OutputRoot.XML.(XML.DocTypeDecl).(XML.SystemId) = 'my_cat.dtd';
CREATE FIELD OutputRoot.XML.MYCAT;      
SET OutputRoot.XML.MYCAT.(XML.Attribute)Version = '1.0';


Regards from summerland
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jun 30, 2009 3:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

http://www.mqseries.net/phpBB2/viewtopic.php?t=27116&view=next&sid=b2abe02a1e5b6282abae602111279027

Found it by typing DocTypeDecl in the Search window ( having first selected 'MQSeries.net' rather than 'Web')
Back to top
View user's profile Send private message
elwis
PostPosted: Tue Jun 30, 2009 4:13 am    Post subject: Reply with quote

Apprentice

Joined: 02 Apr 2008
Posts: 26
Location: Sweden

You are a better searcher then I am I didn't find anything useful at all.

I've read about the (XML.Element) before but thought there were an easier way then adding this text to 386 lines of code. But if there isn't, this one will at least work
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Tue Jun 30, 2009 6:22 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

You don't need to add it to 386 lines.

Build up the root of your XML document and then create a reference to the root or whatever part of the document you want to build from.

We use references all the time for building XML documents. Makes it easy to handle changes in the structure of the document. If a high level tag changes or a new level is added we only have to change the reference to that portion. All the references based on that reference stay the same.

References are your friend in ESQL.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jun 30, 2009 7:05 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I've just realized what you meant. You only need to change one line, not 386 lines!

SET OutputRoot.XML.(XML.DocTypeDecl)MYCAT = '';
SET OutputRoot.XML.(XML.DocTypeDecl).(XML.SystemId) = 'my_cat.dtd';
CREATE FIELD OutputRoot.XML.MYCAT;
SET OutputRoot.XML.MYCAT.(XML.Attribute)Version = '1.0';

When the Compute node sees the second field reference to OutputRoot.XML.MYCAT it will assume that you are referring to the one which you created earlier. Instead of creating a new root element with name 'MYCAT' it will add the Version attribute to the DTD element.
That is why the XML writer was complaining about the missing root element.

When you specify OutputRoot.XML.(XML.Element)MYCAT, the path resolver cannot find any such element, and it creates a new one. Because that element has a suitable field type, it is a valid root for the output document - so no error.

btw, you should immediately change your code to use XMLNS. The XML domain is deprecated. Don't expect support from IBM if you continue to use it. ( I would advise XMLNSC, but you might need more DTD support than XMLNSC can provide ).
Back to top
View user's profile Send private message
elwis
PostPosted: Tue Jun 30, 2009 8:02 am    Post subject: Reply with quote

Apprentice

Joined: 02 Apr 2008
Posts: 26
Location: Sweden

Thanks for a very educating answer, I'll see if I can get a better solution then.

I'm using XML since the client wants the code to look like the old one, but perhaps I should be a little bit naughty here..
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jun 30, 2009 8:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

elwis wrote:
I'm using XML since the client wants the code to look like the old one, but perhaps I should be a little bit naughty here..


Make a sucking sound through your teeth, while shaking your head & saying "I don't know, unsupported domain, obviously you're the client but I couldn't endorse it as a descision and frankly it's a bit risky......"

If you let your voice tail off right they'll be begging you to use a newer domain.

This site has been using a combination of XML & XMLNS (because XMLNSC "isn't compatable" ) with no ill effects. I'm still working on the right sucking sound to get XMLSNC.

Or the right wrist action with the trout.....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
elwis
PostPosted: Tue Jun 30, 2009 8:54 am    Post subject: Reply with quote

Apprentice

Joined: 02 Apr 2008
Posts: 26
Location: Sweden

I still haven't seen any man fail with a trout...
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jun 30, 2009 8:57 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

elwis wrote:
I still haven't seen any man fail with a trout...


I need to pick my battles - this is a target rich environment & I'm wary of losing the "shock and awe" factor.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Xmldeclaration in ESQL
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.