Author |
Message
|
vickykarumbhu |
Posted: Mon Aug 10, 2015 6:31 am Post subject: Issue with Delete Field Statement with environment tree |
|
|
Newbie
Joined: 08 Jun 2015 Posts: 6
|
Code: |
<parent>
<child1>aaa</child1>
<child2>bbb</child2>
<child3>ccc</child3>
<child4>
<one>one</one>
</child4>
<child4>
<one>one</one>
</child4>
</parent> |
Hi I have saved the above response in Environment.Variables.Res = OutputRoot; I need to delete the child4 first occurance from the Environment Tree structure. I have tried this two statements
1) DELETE NEXTSIBLING OF Environment.Variables.Res.child3
2) DELETE FEILD OF Environment.Variables.Res.child3[1]
But the tree remains the same. Could you please guide me on this. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 10, 2015 6:50 am Post subject: Re: Issue with Delete Field Statement with environment tree |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
vickykarumbhu wrote: |
I have tried this two statements
1) DELETE NEXTSIBLING OF Environment.Variables.Res.child3
2) DELETE FEILD OF Environment.Variables.Res.child3[1]
|
I don't see anything called "Res" in that structure. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 10, 2015 6:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why are you trying to use child3 to access it's sibling child4?
both <some tree path>.child3 and <some tree path>.child3[1] address the first occurrence under <some tree path> of child3.
Also, you do not show the code where you have ensured that the XML data you have copied to the Environment tree will in fact remain XML data.
Vitor wrote: |
I don't see anything called "Res" in that structure. |
vickykarumbhu wrote: |
Environment.Variables.Res = OutputRoot; |
 |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 10, 2015 7:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Vitor wrote: |
I don't see anything called "Res" in that structure. |
vickykarumbhu wrote: |
Environment.Variables.Res = OutputRoot; |
 |
Still, it does explain why the code doesn't work. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 10, 2015 7:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
Still, it does explain why the code doesn't work. |
Depending on the contents of OutputRoot at the time of execution...
 |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 10, 2015 7:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Vitor wrote: |
Still, it does explain why the code doesn't work. |
Depending on the contents of OutputRoot at the time of execution...
 |
Exactly so sir; exactly. My eye is drawn both to the OP's description of the document and the on my desk...... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ganesh |
Posted: Mon Aug 10, 2015 9:01 am Post subject: Re: Issue with Delete Field Statement with environment tree |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
vickykarumbhu wrote: |
Environment.Variables.Res = OutputRoot; |
Assign a parser to your environment tree. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 10, 2015 9:33 am Post subject: Re: Issue with Delete Field Statement with environment tree |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ganesh wrote: |
vickykarumbhu wrote: |
Environment.Variables.Res = OutputRoot; |
Assign a parser to your environment tree. |
Solid advice, but uncertain that's going to help here _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ganesh |
Posted: Mon Aug 10, 2015 10:12 am Post subject: Re: Issue with Delete Field Statement with environment tree |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Vitor wrote: |
Solid advice, but uncertain that's going to help here |
True.
Quote: |
I need to delete the child4 first occurance |
Figure out the correct path to first occurrence of child4. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Aug 10, 2015 10:14 am Post subject: Re: Issue with Delete Field Statement with environment tree |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
vickykarumbhu wrote: |
Environment.Variables.Res = OutputRoot; |
So this means that at a minimum we should see something like (potentially)
Code: |
DELETE FIELD Environment.Variables.Res.XMLNSC.parent.child4[1] |
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
inMo |
Posted: Mon Aug 10, 2015 10:30 am Post subject: |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
I'm assuming you are assuming that the OP assumed it was not necessary to state that OutputRoot has been parsed by XMLNSC prior to assignment to Env. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Aug 10, 2015 10:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
inMo wrote: |
I'm assuming you are assuming that the OP assumed it was not necessary to state that OutputRoot has been parsed by XMLNSC prior to assignment to Env. |
That's not a bad assumption.
I think Vitor and I are wondering whether anything was assigned to OutputRoot before it was copied to the Environment tree. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 10, 2015 11:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
inMo wrote: |
I'm assuming you are assuming that the OP assumed it was not necessary to state that OutputRoot has been parsed by XMLNSC prior to assignment to Env. |
That's not a bad assumption.
I think Vitor and I are wondering whether anything was assigned to OutputRoot before it was copied to the Environment tree. |
Or if that parent tag got copied or not. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|