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 » WMB 6.1 ProcessingInstruction added to XML -- strange!

Post new topic  Reply to topic
 WMB 6.1 ProcessingInstruction added to XML -- strange! « View previous topic :: View next topic » 
Author Message
tresbain
PostPosted: Tue Aug 25, 2009 2:33 pm    Post subject: WMB 6.1 ProcessingInstruction added to XML -- strange! Reply with quote

Newbie

Joined: 25 Aug 2009
Posts: 3

There is some help in the forum for this, but I am missing something.

I do the following ESQL -->

SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
CREATE FIRSTCHILD OF OutputRoot.XMLNSC TYPE XMLNSC.XmlDeclaration;
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)StandAlone = 'yes';
SET OutputRoot.XMLNSC.(XMLNSC.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="test.xsl"';


This leaves a compute node and gets Propagated to a File output node -- When it becomes a file (xml file), it looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NS1:BKRPT xmlns:NS1="ht... OMITTED XML </NS1:BKRPT><?xml-stylesheet type="text/xsl" href="test.xsd"?>


I am sure there is some obscure documented explanation for why the stylesheet processing isntruction is at the end of the document but I don't want it that way. I have tried quite an array of things including telling the parser to put it as the next child of the xml declaration but that didn't work....

Any ideas?

Thanks,
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Aug 25, 2009 7:41 pm    Post subject: Re: WMB 6.1 ProcessingInstruction added to XML -- strange! Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

tresbain wrote:

I do the following ESQL -->

Code:
SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
CREATE FIRSTCHILD OF OutputRoot.XMLNSC TYPE XMLNSC.XmlDeclaration;
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)StandAlone = 'yes';
SET OutputRoot.XMLNSC.(XMLNSC.ProcessingInstruction)"xml-stylesheet" = 'type="text/xsl" href="test.xsl"';   



This leaves a compute node and gets Propagated to a File output node -- When it becomes a file (xml file), it looks like this:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NS1:BKRPT xmlns:NS1="ht... OMITTED XML </NS1:BKRPT><?xml-stylesheet type="text/xsl" href="test.xsd"?>



I am sure there is some obscure documented explanation for why the stylesheet processing isntruction is at the end of the document but I don't want it that way. I have tried quite an array of things including telling the parser to put it as the next child of the xml declaration but that didn't work....

Any ideas?

Thanks,

Not sure, maybe working as designed... What happens if you remove the '*' in your XmlDeclaration It seems at an odd place and as far as I remember points towards the last member... Not much if it is an attribute of the xml declaration... Could have some influence on the placement of the XmlProcessing clause though??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Aug 26, 2009 4:48 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It has always been true that the order of serialization of the message tree is dependant on the order of the ESQL statements that added the elements to the message tree.

You are a) updating an existing XMLNSC.XmlDeclaratoin, and b) Adding a New XMLNSC.ProcessingInstruction *after* you have fully populated your XMLNSC tree.
Back to top
View user's profile Send private message
tresbain
PostPosted: Wed Aug 26, 2009 8:05 am    Post subject: Alright -- here is what worked.... Reply with quote

Newbie

Joined: 25 Aug 2009
Posts: 3

Thanks for the ideas... you both got me thinking about all the different things I had tried. For some reason I could not get things to work in an orderly way (I got "unexpected xml at this point in the document" errors down stream)

I did get it to work in this seemingly silly way by stacking the xml pieces in from bottom to top. I imagine there was some ESQL technique that I am just not technically adept at but this did it.

CALL CopyMessageHeaders();
SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
CREATE FIRSTCHILD OF OutputRoot.XMLNSC TYPE XMLNSC.ProcessingInstruction NAME 'xml-stylesheet' VALUE 'type="text/xsl" href="test.xsl"';
CREATE FIRSTCHILD OF OutputRoot.XMLNSC TYPE XMLNSC.XmlDeclaration;
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';


Anyway -- thanks again -- your thoughts DID help.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 26, 2009 8:10 am    Post subject: Re: Alright -- here is what worked.... Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

When you "Set OutputRoot.XMLNSC = InputRoot.XMLNSC" you are populating a tree.

If you don't want to "stack them in reverse order" you can use NEXTSIBLING instead of FIRSTCHILD.

But the order of the children of OutputRoot.XMLNSC from 1 to N is going to be the order that they appear in the output bitstream.
Back to top
View user's profile Send private message
tresbain
PostPosted: Wed Aug 26, 2009 11:10 am    Post subject: Yeah -- seems easy right? Reply with quote

Newbie

Joined: 25 Aug 2009
Posts: 3

I tried this and the order gets messed up.

CALL CopyMessageHeaders();
CREATE FIRSTCHILD OF OutputRoot.XMLNSC TYPE XMLNSC.XmlDeclaration;
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
CREATE NEXTSIBLING OF OutputRoot.XMLNSC TYPE XMLNSC.ProcessingInstruction NAME 'xml-stylesheet' VALUE 'type="text/xsl" href="ebn.xsl"';
SET OutputRoot.XMLNSC.ns:BkActivity = InputRoot.XMLNSC.ns:BkActivity;

Next look at the message it is out of order and causes an error at the next parse.

(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 5907 (INTEGER)
(0x03000000:NameValue):Text = 'Invalid target for folder bitstream' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'xml-stylesheet' (CHARACTER)

I must not be smart enough to get the ESQL right.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 26, 2009 11:19 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't want to create a SIBLING of OutputRoot.XMLNSC.

You want to create the NEXTSIBLING of OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*, which is a CHILD of OutputRoot.XMLNSC.
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 » WMB 6.1 ProcessingInstruction added to XML -- strange!
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.