Author |
Message
|
sammy_910 |
Posted: Mon Apr 16, 2012 5:00 am Post subject: Creating XML with two root elements |
|
|
Apprentice
Joined: 16 Dec 2010 Posts: 33
|
Hi,
Currently I am trying to create an XML having two root elements using compute node in WMB.I tried using MRM domain but havent been successful so far.
Could anyone help me with how to approach this problem?Would java code be a possible solution?
Regards, |
|
Back to top |
|
 |
Esa |
Posted: Mon Apr 16, 2012 5:04 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Have you tried creating two OutputRoots? That should work. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 16, 2012 5:07 am Post subject: Re: Creating XML with two root elements |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sammy_910 wrote: |
Currently I am trying to create an XML having two root elements |
Given that a well-formed XML document has a single root element (the clue is in the name) why are you trying to do this? Given that all XML parsers which conform to the W3C standard will refuse to parse it?
If you're trying to create 2 XML documents in a single step inside WMB that's a different and much more achieveable objective. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 16, 2012 5:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Esa wrote: |
Have you tried creating two OutputRoots? That should work. |
It will work. The OP will then post back about 30 seconds later along the lines of "I created 2 XML documents with 2 OutputRoot but when I try to output it WMB throws an error about multiple root elements". _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Esa |
Posted: Mon Apr 16, 2012 5:28 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Vitor wrote: |
It will work. The OP will then post back about 30 seconds later along the lines of "I created 2 XML documents with 2 OutputRoot but when I try to output it WMB throws an error about multiple root elements". |
Dear Vitor, you happen to be wrong here. Just a couple of weeks ago I got slapped with a trout by mgk when I claimed the same thing.
I tested this. You get a message with 2 root elements and it is put in the output queue with no problems. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Apr 16, 2012 5:29 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Currently I am trying to create an XML having two root elements |
There is no such thing. If it has two root tags then it is not well-formed XML. Why do you want to do this?
Quote: |
Have you tried creating two OutputRoots? That should work. |
It might work, but I'm not going along with this until I hear a good reason why it is necessary. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 16, 2012 5:37 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Esa wrote: |
Dear Vitor, you happen to be wrong here. Just a couple of weeks ago I got slapped with a trout by mgk when I claimed the same thing. |
Post the link. It might work with BLOB or (maybe) MRM but not XMLNSC.
Esa wrote: |
I tested this. You get a message with 2 root elements and it is put in the output queue with no problems. |
And the XML writer didn't blink, but placed a message in the queue which had a payload of an XML document with 2 roots? An XML document which is not well formed? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Apr 16, 2012 5:52 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
And the XML writer didn't blink, but placed a message in the queue which had a payload of an XML document with 2 roots? An XML document which is not well formed? |
Each OutputRoot.XMLNSC will own its own instance of the XMLNSC parser. So each instance of XMLNSC is writing a single-rooted XML document. The effect of writing the entire output tree is to write a double-rooted XML document using two different XMLNSC parsers. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 16, 2012 5:53 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
Esa wrote: |
Dear Vitor, you happen to be wrong here. Just a couple of weeks ago I got slapped with a trout by mgk when I claimed the same thing. |
Post the link. It might work with BLOB or (maybe) MRM but not XMLNSC |
I support Esa's contention that a logical message tree that has two separate instances of OutputRoot.XMLNSC will be output by any of the Output nodes.
note that this is entirely different than one instance of OutputRoot.XMLNSC with TWO root elements under XMLNSC.
I.e
Code: |
OutputRoot
XMLNSC
Root1
XMLNSC
Root2 |
Will "work", whereas
Code: |
OutputRoot
XMLNSC
Root1
Root2 |
Will not. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 16, 2012 5:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
Quote: |
And the XML writer didn't blink, but placed a message in the queue which had a payload of an XML document with 2 roots? An XML document which is not well formed? |
Each OutputRoot.XMLNSC will own its own instance of the XMLNSC parser. So each instance of XMLNSC is writing a single-rooted XML document. The effect of writing the entire output tree is to write a double-rooted XML document using two different XMLNSC parsers. |
So it does. The things you learn.
Still not sure why you'd want to though, or what use the output is. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sammy_910 |
Posted: Mon Apr 16, 2012 6:08 am Post subject: |
|
|
Apprentice
Joined: 16 Dec 2010 Posts: 33
|
The requirement is at the Target end...
We are migrating parts of existing code from age old ICS to WMB.ICS does this currently using some java code.But I tried this in WMB to no avail.
Regards, |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Apr 16, 2012 6:16 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
sammy_910 wrote: |
But I tried this in WMB to no avail. |
How?
You've been told how to do it so it 'works'.
The target system is still broken. |
|
Back to top |
|
 |
sammy_910 |
Posted: Mon Apr 16, 2012 7:07 am Post subject: |
|
|
Apprentice
Joined: 16 Dec 2010 Posts: 33
|
Tried using the MRM message domain and as suggested before by trying to create two OutputRoots. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Apr 16, 2012 7:11 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Tried using the MRM message domain and as suggested before by trying to create two OutputRoots. |
So you are using the MRM domain to output an XML message?
Any particular reason why you are not using XMLNSC? |
|
Back to top |
|
 |
sammy_910 |
Posted: Mon Apr 16, 2012 7:14 am Post subject: |
|
|
Apprentice
Joined: 16 Dec 2010 Posts: 33
|
Quote: |
Any particular reason why you are not using XMLNSC? |
Because XMLNSC gives a parsing error of an invalid XML document |
|
Back to top |
|
 |
|