playMaker

Author Topic: How to remove an entire node in XML[SOLVED]  (Read 2776 times)

Matthew

  • Playmaker Newbie
  • *
  • Posts: 15
How to remove an entire node in XML[SOLVED]
« on: September 10, 2017, 09:58:57 PM »
Hi, is it possible to remove a whole node using the DataMaker XML actions?  I tried using "XML Node Remove All"  but this still leaves the bare node.   I need to be able to remove nodes since nodes can be created (as part of my level editor).   If I can't remove nodes my save file will get unnecessarily large over the course of level creating and deleting of levels. 

Thanks,
Matthew
« Last Edit: September 11, 2017, 04:04:04 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to remove an entire node in XML
« Reply #1 on: September 11, 2017, 04:03:54 AM »
Hi,

 good point, I added an action to let you do that, the RemoveAll is confusion but unfortunately named like that by the xml api, it indeed only remove the content of the node, not the node itself. So use XmlNodeDelete to do so now.

 Please updated DataMaker from the Ecosystem ( back up first, it has updates for ArrayMaker and Utils shipped in) and you have this new action.

 don't forget to use XmlProxyRefreshString action after if you are using a proxy component, then you'll see the deletion reflected for debugging purposes.

Bye,

 Jean

 Bye,

 Jean

Matthew

  • Playmaker Newbie
  • *
  • Posts: 15
Re: How to remove an entire node in XML[SOLVED]
« Reply #2 on: September 11, 2017, 08:28:25 AM »
Wow that was fast!  Thanks man! 

Matthew

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: How to remove an entire node in XML[SOLVED]
« Reply #3 on: January 09, 2018, 05:08:22 AM »
Hey Jean,

I'm using the Node Delete action, but I must be doing something wrong as it's not working for me.

I use the Select Nodes action to see if a node exists, and store a ref as XMLRef_ExistingNode.

Then I use the Node Delete action to attempt to delete the node if it exists, usign the same reference. But this just gives me an error every time, and doesn't delete the node.

Can you advise? Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to remove an entire node in XML[SOLVED]
« Reply #4 on: January 09, 2018, 05:40:02 AM »
Hi,

What error does it mentions in the Unity Log?

 once you selected the node you want to delete, use an action such as get node properties and check if the node is indeed what you expect for that reference.

 Bye,

 Jean

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: How to remove an entire node in XML[SOLVED]
« Reply #5 on: January 09, 2018, 06:29:27 AM »
Sorry I should have been clearer: I don't see any error messages in the console, the Node Delete action just triggers the Failure Event.

In my initial Select Nodes, I use the XML Result to confirm that it is finding the node, and then I store that reference to use in Node Delete.

I added a subsequent Select Nodes action in place of the Node Delete, set up as below. I use the In Memory option for Source Selection, and the Memory Reference as saved in the previous Select Nodes action. The xPath query is for the node that I would expect to be the root node in the result. This setup gives me the following warning, and does not return any data.

XMl source is empty, or likely invalid
UnityEngine.Debug:LogWarning(Object)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to remove an entire node in XML[SOLVED]
« Reply #6 on: January 10, 2018, 02:05:15 AM »
Hi,

 Can you show me the state where you actually query to get to the node you want to delete? It's one node right, not a nodeList?

Also, once you have found the node you want to delete insert a dummy state where you use GetXmlNodeProperties, reference that node and check the preview ( this is to check the content of that node reference and make sure we are playing with the right data to begin with), can you make a screenshot of that too?

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to remove an entire node in XML[SOLVED]
« Reply #7 on: January 10, 2018, 02:17:23 AM »
Hi,

 I mean something like this:



Bye,

 Jean

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: How to remove an entire node in XML[SOLVED]
« Reply #8 on: January 10, 2018, 08:57:20 AM »
Hi Jean,

I've solved it. My mistake was in using XML Select Nodes instead of XML Select Single Node!


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to remove an entire node in XML[SOLVED]
« Reply #9 on: January 11, 2018, 12:07:55 AM »
Hi,

 Good, yes, you can't delete a nodeList, you can only delete an individual node.

 Bye,

 Jean