Author |
Message
|
saini |
Posted: Tue Sep 20, 2005 2:38 pm Post subject: Having trouble with Positional Fields within XML... |
|
|
Novice
Joined: 28 Feb 2002 Posts: 24
|
I have an interesting problem! I have a requirement to generate the following XML in a compute node.
<Test>
<F1>test1</F1>
<F2>test2</F2>
<F1>test3</F1>
<F2>test4</F2>
</Test>
No matter what I try I get the following XML:
<Test>
<F1>test1</F1>
<F1>test3</F1>
<F2>test2</F2>
<F2>test4</F2>
</Test>
I know both the above XML's are the same (non positional), however, Is there a way to force the parser to produce the 1st output.
I am using MB 5 with CSD5 on windows 2000 server. Is there even a way to override default behaviour?
Thanks for any help.
Best Regards,
NS |
|
Back to top |
|
 |
elvis_gn |
Posted: Tue Sep 20, 2005 7:46 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
R u using a message set ??
Can you show us your code ?? |
|
Back to top |
|
 |
saini |
Posted: Wed Sep 21, 2005 3:28 am Post subject: |
|
|
Novice
Joined: 28 Feb 2002 Posts: 24
|
I have tried:
SET OutputRoot.XML.Test.F1 = 'test1';
SET OutputRoot.XML.Test.F2 = 'test2';
SET OutputRoot.XML.Test.F1[2] = 'test3';
SET OutputRoot.XML.Test.F2[2] = 'test4';
I also tried:
SET OutputRoot.XML.Test.F1 = 'test1';
CREATE NEXTSIBLING OF OutputRoot.XML.Test.F1 TYPE NameValue NAME 'F2' Value 'test2';
SET OutputRoot.XML.Test.F1[2] = 'test3';
CREATE NEXTSIBLING OF OutputRoot.XML.Test.F1[2] TYPE NameValue NAME 'F2' Value 'test4'; |
|
Back to top |
|
 |
mgk |
Posted: Wed Sep 21, 2005 3:40 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
why not do this [not tested]:
Code: |
CREATE FIELD OutputRoot.XML.Test ;
DECLARE myRef REFERENCE TO OutputRoot.XML.Test ;
CREATE LASTCHILD OF myRef TYPE NameValue NAME 'F1' Value 'test1';
CREATE LASTCHILD OF myRef TYPE NameValue NAME 'F2' Value 'test2';
CREATE LASTCHILD OF myRef TYPE NameValue NAME 'F1' Value 'test3';
CREATE LASTCHILD OF myRef TYPE NameValue NAME 'F2' Value 'test4'; |
This will create the elements in the order specified
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Sep 21, 2005 4:16 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Shouldn't this itself work
SET OutputRoot.XML.Test.F1[1] = 'test1';
SET OutputRoot.XML.Test.F1[2] = 'test3';
SET OutputRoot.XML.Test.F2[1] = 'test2';
SET OutputRoot.XML.Test.F2[2] = 'test4';
Saini, from ur first snippet of code I would like to say that "the order you want the output in, is the order in which to code the fields"
Regards. |
|
Back to top |
|
 |
javaforvivek |
Posted: Wed Sep 21, 2005 4:19 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
I have given the answer elsewhere :
http://www.mqseries.net/phpBB2/viewtopic.php?t=23916 _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
saini |
Posted: Wed Sep 21, 2005 4:27 am Post subject: |
|
|
Novice
Joined: 28 Feb 2002 Posts: 24
|
The following worked:
CREATE FIELD OutputRoot.XML.Test;
DECLARE myREF REFERENCE TO OutputRoot.XML.Test;
CREATE LASTCHILD OF myREF TYPE Name NAME 'F1';
CREATE LASTCHILD OF myREF TYPE Name NAME 'F2';
CREATE LASTCHILD OF myREF TYPE Name NAME 'F1';
CREATE LASTCHILD OF myREF TYPE Name NAME 'F2';
SET myREF.F1 = 'test1';
SET myREF.F2 = 'test2';
SET myREF.F1[2] = 'test3';
SET myREF.F2[2] = 'test4';
Thanks to MGK for the suggestion! |
|
Back to top |
|
 |
|