playMaker

Author Topic: Datamaker XML - Reference returns "--NULL--"  (Read 2960 times)

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Datamaker XML - Reference returns "--NULL--"
« on: November 22, 2016, 07:56:26 AM »
Hey all,

I'm posting this in Help as I assume I'm doing something wrong rather than it being a bug. I hope I'm right!

I'm using Datamaker and I'm trying to use references in an attempt to optimise my FSM.

I'm using an initial 'Xml Select Nodes' action to grab a reference to the XML proxy, and then I want to use the 'Memory Reference' for the subsequent operations. I'm also saving the xml as a string in this action to make it easier to debug.

So in a subsequent state, I use another 'Xml Select Nodes' to refine my search, and I am using the Memory Reference as the source. Unfortunately this seems to only return '--NULL--' in the preview, and triggers the Error event as it appears not to be able to find anything.

If I switch the input in this latter action to the string I'm saving in the first action, then it does find what I'm looking for. However, my understanding is that the faster option is to store it in memory, hence pursuing that approach.

I've attached two screenshots to illustrate. Can anyone help me out here?

[edit] I'm on Playmaker 1.8.2f7 and Datamaker 1.2 :)
« Last Edit: November 22, 2016, 08:10:47 AM by NateGallardo »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Datamaker XML - Reference returns "--NULL--"
« Reply #1 on: November 24, 2016, 02:19:35 AM »
Hi,

[EDIT] did a closer look at your question :)

It seem you ae not playing right? references are only populated properly when you play and actions are executed.

 If you are in play mode, do you get any logs saying the xpath was invalid or something?


 Bye,

 Jean
« Last Edit: November 24, 2016, 02:34:04 AM by jeanfabre »

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Datamaker XML - Reference returns "--NULL--"
« Reply #2 on: January 17, 2017, 10:44:13 AM »
Sorry for the extremely delayed response, I was out of the country and then moved house and on and on...

Yep this is definitely occurring in play mode :)

Yes, I do get the 'XML source is empty, or likely invalid' warning. I'm not sure why though, so I'm completely open to the possibility I'm doing something wrong!

I've attached two pictures illustrating the two key states.

In the first you can see I'm selecting all nodes with a particular Common and Type attribute. That's successfully saved as the XML Result, so I can see that that portion is working correctly. You can see I'm using Store Reference to store it as XMLRef_RarityType.

In the second, you can see I'm attempting to use the reference to access the nodes further, but it displays --NULL-- and triggers the Error event. And yep, I then get the Warning as mentioned.






jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Datamaker XML - Reference returns "--NULL--"
« Reply #3 on: January 19, 2017, 01:30:21 AM »
hi

 yes, if you get an error on an action supposed to save some xm in memory, theny this memory is null. This is to be expected.

 so the problem is likely in the xpath itself.

 can you give an extract of the xml and the xpath, and what you want to get with this xpath? then I'll test it here and give you the right xpath. I can see already by the start of your xpath this is needs to be optimize first and foremost.

 Bye,

 Jean

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Datamaker XML - Reference returns "--NULL--"
« Reply #4 on: January 23, 2017, 06:45:58 AM »
OK here's the XML file I'm using:
https://drive.google.com/file/d/0BzXgDZLN7B3KRHVRTEwyVDI2dDA/view?usp=sharing

This is the path I'm using:
/CardDatabase/Cards/Card[@Rarity="_0_" and @Type="_1_"]
With the variables:
_0_ = Variable: Rarity
_1_ = Variable: Type

So, an example would be:
/CardDatabase/Cards/Card[@Rarity="Common" and @Type="Weapon"]

That returns this XML Result string:

Code: [Select]
<result>
<Card CardID="0129d62e-fb82-4282-ba00-0a976230de52" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="e253c06d-8c71-4ba3-82d5-94c94da2634c" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="e9edfd77-8b40-4b82-9de5-435ce0dfe7b5" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="974c3fc8-fa79-406a-a4a0-dbf391aca82e" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="cfdaa2a2-5bae-4a77-99f1-a142ad039cad" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="ceca9bd4-f040-4f86-8894-323555bb6366" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="f4af795e-a261-4615-ad18-149e555e6429" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="947bb61b-5714-4de7-8ca1-689ba3d1fd42" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="7b943a6c-a755-42c6-97bb-c7e32745d319" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="d5f48172-99b0-41f3-ad93-3bf3a74ca1bf" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="bf54053b-87ba-4d8b-92b3-77bf161b4efa" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="c784a59f-97eb-4351-80a7-8d436f20b67f" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="c71a809b-7dcf-4f81-b804-e6ca0ef2eb74" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="73b615bc-55d3-402d-bbc7-16e42742469c" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="5e8d3f88-2dcf-42c0-8148-41de64f10715" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="3b248263-dc7a-4aff-a4d9-c9d3fd7285a4" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="68bfd580-380a-43b8-a0d1-7f56501afe60" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="03c0df0f-a510-4c33-a40e-d100a6a3c729" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="f697ebc7-8c33-4208-a33f-ef0421f99600" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="23989d54-cfe8-4d8c-b945-280430a47fcc" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="c5633190-0233-4c00-a63f-cd58e5a4ebe3" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="ec061fea-1371-415a-a414-70e87a0d1132" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="e556cefa-4351-4d13-9459-4be22b36e9fe" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="864dc96c-d78f-4955-8726-624b5daf3795" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="d4bb0c30-a88d-4cb2-929a-cf1a26d1925e" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="821dbeac-d90c-455e-bccd-26ed4fe8a94c" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="2d2cac2c-d8e1-4889-b047-6a10bbbf7721" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="0b1bb083-d3f0-4da6-934c-6b8781c34359" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="aaa577cd-0abb-4f59-ac7b-d9ee6f22d635" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="a53ff9ca-5008-4577-9527-cbdf206b508a" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="0e62246b-d35f-4981-b05e-91c540bf5bda" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="a33ab544-8390-487a-b5a1-7494ecef959a" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="ec373c61-d372-4162-8228-f04dd022c779" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="37aa08ee-d525-42aa-856c-d8126a1deb00" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="f4c81dfe-9ebb-4b0b-b7c1-5b6158de37bb" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="e7ca55cd-0c60-4a9d-bfc3-b14467544012" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="428c0aac-6258-4b32-8c97-06c2404576ce" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="9eded45b-6b50-475f-97eb-4c3043978968" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="7feee996-a3d2-448f-ab32-58d985d6e42a" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card>
<Card CardID="69532282-8a48-408d-ad5d-b93c9dbfaad4" Name="" Class="" Rarity="Common" MaxCollectible="2" NoCollected="0" RarityValue="70" Type="Weapon">Card</Card></result>


That returns the nodes I'd expect, which I can save to an XML Result string variable and access in a later action, but storing it as an XML Reference and accessing that doesn't seem to work for me, as you can see in the attached images
« Last Edit: January 23, 2017, 06:51:17 AM by NateGallardo »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Datamaker XML - Reference returns "--NULL--"
« Reply #5 on: January 24, 2017, 01:32:57 AM »
Hi,

 I see, an xmlNodeList is a special type, it contains a list of nodes but as such isn't a regular XmlNode is not something you can use in the action XmlSelectNode.

 when you store an XmlNodeList in memoryReference it's for it to be used then with XmlGetNextNodeListProperties action.

 else, you need to refine your original xpath directly.

can you explain what xpath you would like to use on that xmlNodeList result you got?

when you request the string result of the XmNodeList, I put a "result" root node around the string, so that it becomes a valide xml document, but in memory the nodelist isn't a valid xml document, it's simply a "Collection" of nodes from your xpath query, and really is only supposed to be then iterated with, it's not a PlayMaker or DataMaker restriction, but a c# xml design

Bye,

 Jean