Author |
Message
|
tresbain |
Posted: Tue Aug 25, 2009 2:33 pm Post subject: WMB 6.1 ProcessingInstruction added to XML -- strange! |
|
|
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 |
|
 |
fjb_saper |
Posted: Tue Aug 25, 2009 7:41 pm Post subject: Re: WMB 6.1 ProcessingInstruction added to XML -- strange! |
|
|
 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 |
|
 |
mqjeff |
Posted: Wed Aug 26, 2009 4:48 am Post subject: |
|
|
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 |
|
 |
tresbain |
Posted: Wed Aug 26, 2009 8:05 am Post subject: Alright -- here is what worked.... |
|
|
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 |
|
 |
mqjeff |
Posted: Wed Aug 26, 2009 8:10 am Post subject: Re: Alright -- here is what worked.... |
|
|
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 |
|
 |
tresbain |
Posted: Wed Aug 26, 2009 11:10 am Post subject: Yeah -- seems easy right? |
|
|
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 |
|
 |
mqjeff |
Posted: Wed Aug 26, 2009 11:19 am Post subject: |
|
|
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 |
|
 |
|