Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on November 16, 2012, 05:29:24 AM

Title: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on November 16, 2012, 05:29:24 AM
[EDIT] NOW on the wiki: https://hutonggames.fogbugz.com/default.asp?W1133

[EDIT] Also available on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

Hi,

 Ok, I have an xml reader with a first action to select a node using Xpath! it's very very powerful!! Many features need to be added like being able to select multiple nodes, and output them into ArrayMaker for example, but for now this hilite the ease of use and power and is already very useful as is actually!

 basically it works like this:

1: create a DataMaker Xml Proxy and point to a text resource in your assets
2: then use the action "XPath Select Single Node" and point to that proxy to use xpath queries on that resource.

-- Xpath wildcard system
instead of letting you just input a string, I have created a simple wildcard format that allow you to define places in the xpath query that are flexible and points to FsmSTring variables.

in the sample provide, the xPath looks like
Code: [Select]
content[@type='%%0%%']
the action has defined one XPath variable for an FsmString, to %%0%% will be replaced by whatever is defined there

-- Result
The innerText is of course available, but I go much further then that
you can access any number of properties
-- attributes ( that is when you define a property starting with "@")
-- innerXml using again XPath, if your property starts with / then it will be processed as an XPath query locally on the selected node ( this is important to be aware of that, because I prepend a "." to make that path be really locale, else it will search from the document root, which is not what we want here)
-- direct child nodes innerText. simply reference the name and its inner Text will be returned

 Your first stop is to read this:
http://msdn.microsoft.com/en-us/library/ms256471.aspx (http://msdn.microsoft.com/en-us/library/ms256471.aspx)

If you need some of these XPath not yet supported, let me know, the play is to support XPath fully anyway.

 Have fun, Any questions and suggestions or trouble, don't hesitate.

 Jean
Title: Re: DataMaker Xml and xPath alpha version
Post by: kiriri on November 17, 2012, 06:20:03 AM
awesome, this is just perfect for a laguage system!
However, do you know a way to make editor classes work with this (with PlayMaker in general). It would be amazing to actually be able to create and move files at runtime.

Cheers,
kiriri
Title: Re: DataMaker Xml and xPath alpha version
Post by: Drunkenoodle on November 17, 2012, 12:59:45 PM
Just had a bit of a tinker with what you've come up with and, man, that is utterly awesome. Great job Jean!
Title: Re: DataMaker Xml and xPath alpha version
Post by: jeanfabre on July 31, 2013, 08:15:22 AM
Hi,

 I made some progress on this, you can now download a more stable and powerful version on the wiki:

https://hutonggames.fogbugz.com/default.asp?W1133

It's not compatible with previous alpha version tho, but it's for the best :) it's a lot more flexible and gives you raw power!

 Bye,

 Jean
Title: Re: DataMaker Xml and xPath alpha version
Post by: JennaReanne on November 21, 2013, 01:57:52 PM
First, let me just say that this is AMAZING.  This lets me store all sorts of information and grab it on the fly to generate my levels, I can't imagine how I would do that without this tool.  So a huge thank you!

I was wondering if this is still in development?  I'd love to be able to write to XML files as well.

Thanks Jean!
Title: Re: DataMaker Xml and xPath alpha version
Post by: jeanfabre on November 28, 2013, 02:59:51 AM
Hi,

 Yes, this is still in development, only very much down in the list of pending work :)

https://trello.com/c/tTJMLplH/26-xmlmaker-update

Please up vote this task so that it gets on top and processed quicker. Writing xml will be part of that update.


 bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on May 15, 2015, 05:40:16 AM
Hi,

 New version is up, and now features

- Unity 5 support,
- Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) downloadable
- proper version of ArrayMaker,
- Json support and convertion to xml ( RAW POWER!!!, any web rest api is accessible now)

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: nighty9 on June 18, 2015, 09:35:30 PM
Hi,

I don't get how can you get the Json file at first, before using the "Convert Json String To Xml Node" Action.

What does the "Json Source" should point to?

Thank you for the help, great job! :)

Nico
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on June 19, 2015, 09:06:17 AM
Hi,

 it can be any text, likely, it would come from a WWW action, or a text resource ( using "Load Resource" custom action.

this action is available on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181), here is the link below to the original thread.

http://hutonggames.com/playmakerforum/index.php?topic=3916.0

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: nighty9 on June 21, 2015, 03:34:11 AM
Hey,

Thank you! I never used WWW actions with Playmaker up to now, i can see in ecosystem actions like WWW POST; is this can be used to for example work with "Parse" using the REST Api? Then from there i get the Json file, then Resource Load, then finally the Json to XML conversion ? :)

Not sure if that's the right procedure, thank you for the help

Nicolas
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on June 22, 2015, 05:54:18 AM
Hi,

 Indeed! this is a typical use. Most rest api will return json, and accept json.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on June 22, 2015, 08:43:42 AM
hi, i noticed that the samples are not included in the package.
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on June 22, 2015, 08:44:24 AM
hi,
i think i understand how i have to set up an xml now, but not yet how to use DataMaker and Actions for it. i made my xml like this :

Code: [Select]
<?xml version="1.0" ?>
<Upgrades>
<Prefab>
<PrefabName>Uprgrade A</PrefabName>
<Price>50</Price>
<Unlocked>yes</Unlocked>
<Sold>no</Sold>
</Prefab>

<Prefab>
<PrefabName>Upgrade B</PrefabName>
<Price>100</Price>
<Unlocked>yes</Unlocked>
<Sold>no</Sold>
</Prefab>

<Prefab>
<PrefabName>Upgrade C</PrefabName>
<Price>20</Price>
<Unlocked>yes</Unlocked>
<Sold>no</Sold>

<Prefab>
<PrefabName>Upgrade D</PrefabName>
<Price>20</Price>
<Unlocked>yes</Unlocked>
<Sold>Yes</Sold>

<Prefab>
<PrefabName>Upgrade D</PrefabName>
<Price>20</Price>
<Unlocked>yes</Unlocked>
<Sold>Yes</Sold>

<Prefab>
<PrefabName>Upgrade F</PrefabName>
<Price>500</Price>
<Unlocked>yes</Unlocked>
<Sold>yes</Sold>

<Prefab>
<PrefabName>Upgrade E</PrefabName>
<Price>400</Price>
<Unlocked>yes</Unlocked>
<Sold>yes</Sold>

<Prefab>
<PrefabName>Upgrade X</PrefabName>
<Price>400</Price>
<Unlocked>no</Unlocked>
<Sold>yes</Sold>

<Prefab>
<PrefabName>Upgrade Z</PrefabName>
<Price>50</Price>
<Unlocked>no</Unlocked>
<Sold>yes</Sold>
</Prefab>

</Upgrades>

so 1st i would like to sort those in 2 groups (sold : yes/no) and by price but only those who are unlocked.
and what will happen if 2 or more objects have the same price?
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on June 24, 2015, 05:25:40 AM
Hi,

 Totally yes!

you can "Select Single Node" when you expect 1 and only 1 result, and use "Select Nodes" when you expect several, and you'll get a list of results you can iterate with getnext actions.

Check this xpath examples:

you have something like this: http://www.w3schools.com/xpath/xpath_examples.asp

Quote
/bookstore/book[price>35]/price

so you can make operations and filter the way you want indeed.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on June 25, 2015, 06:17:24 AM
hi, is there any sample?

on the wiki it says that there are 2 samples but i can't find them.

on the xml result the result i got is <result>
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on June 26, 2015, 02:44:23 AM
Hi,

 The samples will be back when 1.8 will be released, it's just that I started using the beta in datamaker Unity project and I can't revert now... sorry abotu that it wasn't planned that the 1.8 cycle would be so long.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on June 26, 2015, 10:55:16 AM
yes i understand. and i am using 1.8 also, that's why things where not working as it supposed to,

do you have a beta version for 1.8 that i can try/use?
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on June 28, 2015, 05:53:10 PM
Bump,

Sorry i don't really like to bumb :)

Can i find a beta in github for PM 1.8+?
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on June 28, 2015, 11:10:42 PM
Hi,

 Sorry about that. You'll need to bump, there are too much pending threads and your request would likely get buried in the stack if you don't bump :) so don't feel bad about it, this is necessary :)

 you can find the pacakage for the samples on github indeed. Not all are plugged properly tho:

https://github.com/jeanfabre/PlayMaker--DataMaker/tree/master/Packages

Bye,

 JEan
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on June 30, 2015, 08:40:38 AM
i can't seem to select Variables when using pm 1.8+
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on June 30, 2015, 12:34:45 PM
Hi,

 can you post ont he beta list, so we keep the forum aligned with the current public version? thanks :)

Meanwhile, I'll double check, but a screenshot would help understanding where you are. I am aware the xmlmaker custom actions interfaces are a bit tricky at time ( haven't found the problem, but it does behave odd sometimes for sure).

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: djaydino on November 04, 2015, 01:15:30 AM
Hi,
i have an issue with using more than one proxy on a single gameobject and made a quick video to show you :


using u5 v5.2.1f1 / PM 1.7.8.3 / lastest datamaker on EcoSystem
Title: Re: DataMaker Xml xPath and Json [MAI 2015]
Post by: jeanfabre on November 04, 2015, 04:22:47 AM
Hi,

 Thanks for spotting this. I fixed it and republished on the Ecosystem.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 04, 2015, 06:05:32 AM
Hi,
i found another issue when using breakpoints :

Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 16, 2015, 12:55:39 AM
Hi jean,
i found a mistake on the "XmlGetNextNodeListProperties" Action

in OnEnter the
Code: [Select]
nextItemIndex = index.Value;shoud be
Code: [Select]
nextItemIndex = 0;else the reset won't work.

I can not find the action on github else i would have changed it myself :)
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 16, 2015, 01:39:54 AM
Hi,
i still have some problems with that action :

Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on November 16, 2015, 05:08:35 AM
Hi,

Thanks for your debugging sessions! I'll have a look at all this and provide an update.


Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: rik on November 24, 2015, 02:24:54 AM
Hi jean how to parse a json file can you explain or procedure to follow i dont have idea about json so explanation and some introduction was great.
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on November 24, 2015, 02:59:02 AM
Hi,

 Can you make a specific thread on this, cause the topic deserves a post on its own, and I'll cover this in details.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 25, 2015, 12:42:23 AM
Hi Jean,

xml create Node does not seem to work, also on your sample (RssFeedEditor) does  not work

Also i am wondering what the difference is with xml insert node and create node?

i am almost done with the datamaker tutorial, only a few actions i need some help with...

How does the nodes Math Operator work? if you can make me a quick sample i can figure it out

What are the "Fsm Xml Properties Storage", "Fsm Xml Properties Type" and "Fsm Xml Source" for

and maybe a sample for Convert Json String To Xml Node.
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 25, 2015, 01:31:35 AM
Hi jean,
i think i found another bug :


don't forget to read my last post btw :)
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on November 25, 2015, 02:16:29 AM
Hi,

 Yes, I am just running behind big time, so I'll need to time to process everything.

 The examples are pending 1.8 release so that I clean them up, so don't rely too much on them right now, they will get a clean up pass.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 25, 2015, 12:38:07 PM
Hi,
Yes i have noticed that the examples needs to be cleaned up,
so i made my own samples for the tutorial videos.

But "Xml Create Node" seems not to work.

Can you let me know if you have updated.
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 26, 2015, 12:05:36 AM
Hi,
I found another problem in the action XmlInsert node.
insert after is inserting before.
line 79 of the code is this :
Code: [Select]
parentNode.InsertBefore(_node,refChild);
but should be this :

Code: [Select]
parentNode.InsertAfter(_node,refChild);
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 26, 2015, 11:36:43 PM
Hi jean,
i have updated the action "Xml Set Node Properties" so that you can also change the "inner text" from the node.

i think i found them on github so i can update the action and also thi XmlInsert node.

but i would like a permission first :)

and if this is the right path : PlayMaker--DataMaker--U4.3.4.SubModule-/Xml/Actions/

here is the code for the updated "Xml Set Node Properties" action :

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
// updated by : DjayDino
//
using UnityEngine;

using System.Xml;
using System.Xml.XPath;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("DataMaker Xml")]
[Tooltip("Sets node properties and attributes. Use an xml reference.")]
public class XmlSetNodeProperties : DataMakerXmlActions
{

[ActionSection("XML Node")]

public FsmString xmlReference;

public FsmString nodeInnerText;

[CompoundArray("Node Attributes", "Attribute", "Value")]
public FsmString[] attributes;

public FsmString[] attributesValues;

[ActionSection("Feedback")]
public FsmEvent errorEvent;

public override void Reset ()
{
xmlReference = null;

attributes = null;
attributesValues = null;
errorEvent = null;
nodeInnerText = new FsmString(){UseVariable=true};
}

public override void OnEnter ()
{

SetAttributes();


Finish ();
}


private void SetAttributes ()
{

XmlNode _node = DataMakerXmlUtils.XmlRetrieveNode(xmlReference.Value);

if (_node ==null)
{
Debug.LogWarning("XMl reference is empty, or likely invalid");

Fsm.Event (errorEvent);
return;
}

if (!nodeInnerText.IsNone)
{
_node.InnerText = nodeInnerText.Value;
}

int att_i = 0;
foreach (FsmString att in attributes) {
SetNodeProperty(_node,att.Value,attributesValues[att_i].Value);
att_i++;
}

// Debug.Log(_node.OwnerDocument.OuterXml);
Finish ();
}

}
}

When the actions are updated i will release the first 3 parts of my datamaker tutorial.
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: djaydino on November 27, 2015, 11:31:06 AM
Hi,
i just noticed that i can't edit the xml actions
Quote
you must be on a branch to make or propose changes to this file
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on November 28, 2015, 05:46:40 AM
Hi,

 Let me have a look, I am pretty sure you can set the innertext of a node.

 as for contributing, I'll give you access, not a problem, this is very much welcomed indeed!!

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on December 01, 2015, 04:03:49 AM
Hi Jean,

xml create Node does not seem to work, also on your sample (RssFeedEditor) does  not work

Also i am wondering what the difference is with xml insert node and create node?

i am almost done with the datamaker tutorial, only a few actions i need some help with...

How does the nodes Math Operator work? if you can make me a quick sample i can figure it out

What are the "Fsm Xml Properties Storage", "Fsm Xml Properties Type" and "Fsm Xml Source" for

and maybe a sample for Convert Json String To Xml Node.

Hi,

 ok, so I looked at this, and I spotted the issue, and made an update, please redownload from the Ecosystem (http://j.mp/1Esn1mF).

-- setting the inner text of a node works, simply put "." for the xpath query.

-- insert node lets you specific where ( first child, last child, etc)
-- Create node simply append to the parent node

-- the FsmXmlPropertiesStorage etc etc are for internal usage to create complex actions interfaces and avoid duplication.

-- I have pushed the unity scene I am using the test json to xml conversion, it's on the Github rep (https://github.com/jeanfabre/PlayMaker--DataMaker/tree/master/Assets/PlayMaker%20DataMaker%20Samples/Json/JsonToXml).

-- nodes Math Operator is very easy, if you have a node with inner text 4, you can add 1 to it, without saving 4 into a fsmint, add it etc etc.

-- VEry important note, when you edit xm and you use an xml Proxy, use the action "XmlProxyRefreshStringVersion" after your editing so that in the Unity inspector the xml string of the proxy is refreshed, I fixed this in this latest version and is likely the reason why you get so confused, because them actions works, but it was not updating in proxies.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on December 01, 2015, 04:06:53 AM
Hi jean,
i have updated the action "Xml Set Node Properties" so that you can also change the "inner text" from the node.

When the actions are updated i will release the first 3 parts of my datamaker tutorial.

Hi,
 
not need to edit this action, it works as is. Simply put "." in the property, which refer to itself ( the innertext de facto).

 try this and let me know if that worked.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [NOVEMBER 2015]
Post by: jeanfabre on December 01, 2015, 04:11:08 AM
Hi,
I found another problem in the action XmlInsert node.
insert after is inserting before.
line 79 of the code is this :
Code: [Select]
parentNode.InsertBefore(_node,refChild);
but should be this :

Code: [Select]
parentNode.InsertAfter(_node,refChild);

Hi,

 Fixed in the latest version, thanks :)

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [DECEMBER 2015]
Post by: djaydino on December 05, 2015, 10:55:33 PM
Hi,
i will try to test the update next week and let you know if all works :)

Quote
"Xml Set Node Properties"

not need to edit this action, it works as is. Simply put "." in the property, which refer to itself ( the innertext de facto).

I did not know that was possible....
but i do think it is more clearer this way,
especially for beginners.
Title: Re: DataMaker Xml xPath and Json [DECEMBER 2015]
Post by: dudebxl on January 07, 2016, 09:08:29 AM
Hi,

I just downloaded a second ago DataMaker from ecosystem and I get this error: Assets/PlayMaker Utils/PropertyDrawers/PlayMakerFsmVariable/Editor/PlayMakerFsmVariablePropertyDrawer.cs(59,59): error CS0117: `HutongGames.PlayMaker.Ecosystem.Utils.PlayMakerInspectorUtils' does not contain a definition for `GetBaseProperty'

What is this? First time with datamaker so no sure what I am looking at..

UPDATE: I just reinstalled arraymaker from ecosystem and all is well..
Title: Re: DataMaker Xml xPath and Json [DECEMBER 2015]
Post by: jeanfabre on January 12, 2016, 11:17:06 PM
Hi,

 When you get this, it's likely that the PlayMaker utils of one package is older than the PlayMaker utils you have currently installed in your project.

so, thanks for reporting, because everytime I make an update of the PlayMaker utils, I need to repackage everything that depends on it pretty much...

Bye

Jean


Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on January 12, 2016, 11:19:30 PM
Hi,

 Just to ping this thread for everyone using datamaker, it's now updated and compatible with Unity 4.7.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: memetic arts on February 02, 2016, 03:12:43 PM
Hi -

I just reinstalled the JSON files in DataMaker (via EcoSystem) in order to retest against Case 1387.  It now looks like the FSM that the script I was using to load AssetBundles is no longer functioning - my HashTables are getting created and populated, but the objects all read "None" (they're supposed to be textures).

Since I have a backup of the version just before the DataMaker/JSON update, I loaded that back up, and it works fine.  So there is no doubt that the connection to the server and XML file is working properly.

Before I go down the troubleshooting rabbit hole, is there some obvious setting that I might be missing?

Thanks very much!
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on February 03, 2016, 04:22:46 AM
Hi,

What are the datamaker and arraymaker versions that works?

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: memetic arts on February 03, 2016, 08:10:09 AM
ArrayMaker: 1.1.0.5.f

DataMaker: 1.0.5.0.f

There is also an ArrayMaker folder within the DataMaker folder, but that does not include version info; I'm assuming that compiles as an add-on to the larger ArrayMaker install?

Also, FYI, I just sent you an e-mail re: Case 1387, in response to yours. Seems like there might be some other issues re: iOS deployement.
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: WilsonC on February 14, 2016, 03:21:21 AM
Hi,

I have the following error message while importing the DataMaker v1.0.6 on Unity 5.3.2 (32bit) with PlayMaker 1.8.0f41 and PUN+ 1.66 on Windows7 SP1 x64

"Assets/Photon Unity Networking/Editor/PhotonNetwork/AccountService.cs(181,45): error CS0433: The imported type `Newtonsoft.Json.JsonConvert' is defined multiple times"

The same error is also repeated while installing DataMaker first and then PUN+. Please take a look with this issue.

Thank you very much!

Regards,

Wilson
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: dudebxl on March 23, 2016, 12:10:11 PM
Quick question. Is it normal that when you have this in

"Text": {
  "current": [
    I like playmaker,
    I do not like playmaker
  ],
  "type": "txt"
}

The result after xml conversion (from json) and node extraction is this: I like playmakerI do not like playmaker

and not this:  I like playmaker, I do not like playmaker

The comma is missing.. is this normal?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on March 23, 2016, 11:38:59 PM
Hi,

 your json is not valid, you need to put doublequotes around your entries.

Quote
{
   "Text": {
      "current": [
         "I like playmaker",
         "I do not like playmaker"
      ],
      "type": "txt"
   }
}

Always double check with a online json validator (http://jsonlint.com/) when you have trouble.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: dudebxl on March 24, 2016, 05:41:26 AM
Hi,

Yeah that is very true:)

Actually it is a section of the twitter api Json results. I changed it to make it easier to understand the problem, but yeah it is geoJSON.. anyway i found a way around it in datamaker (you have to run an extra node then eliminate the data from the string by splitting it)

... but it make senses why it would not work. Anyway many thanks for the clarification  :)
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on March 24, 2016, 11:15:10 PM
Hi,

 That's odd that this wrong json formatting comes from twitter. I imagine most browser adjust their formatting rules to comply with messy formats ( like they do for messy html and css...)

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: dudebxl on March 25, 2016, 08:34:20 AM
Twitter coordinates:

So others have a reference if they also have this problem - You have to use a geojson extractor.

from twitter api website - It is a section of the json result of GET and it is geoJSON (http://geojson.org/) format and not Json - link (look at coordinates section): https://dev.twitter.com/overview/api/tweets

Twitter api example:
"coordinates":
{
    "coordinates":
    [
        -75.14310264,
        40.05701649
    ],
    "type":"Point"
}
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: rik on March 31, 2016, 09:47:15 AM
HI
i have a problem with json parsing
{"app42":{"response":{"success":true,"timer":{"currentTime":"2016-03-31T15:35:04.685Z"}}}}


above was the json file i am tring to parse but i get error

<app42>
  <response>
    <success>true</success>
    <timer>
      <currentTime>2016-03-31T15:35:04.685Z</currentTime>
    </timer>
  </response>
</app42>

so i try to parse with xml after converting that to xml but for some reason when i use get node properties to get current time i get result like true2016-03-31T15:35:04.685Z

can some one explain how to get it right Thanks
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on March 31, 2016, 11:12:40 PM
Hi,

 What is the xpath you are using to get to that node? it's likely that access "response" instead of directly "currentTime".

what error do you get when parsing the json?


Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: rik on April 01, 2016, 12:30:46 AM
Hi thanks for quick reply
i did not get any error. but it always send found variable event but it dont store any thing in the variable when i use json


but in xml i did not use xpath i use  get node properties because i was little confused on xml path.

and i dont find any samples for the xpath
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on April 04, 2016, 11:41:57 PM
Hi,

you are using "Convert Json to Xml Node" action right? I just tested and it worked, it outputed the json into a dataMaker xmk proxy fine.

(http://i.imgur.com/vcHAtRg.png)

then, you use XML Get Node Properties, and in the "property" you put

Code: [Select]
//response/timer/currentTime
and you'll get the content of just that node:

(http://i.imgur.com/iLxSVgu.png)

Have a go at this and let me know how it goes.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: rik on April 05, 2016, 11:21:22 AM
later i have managed to get the details but why it did not manage to get property details from the json itself ?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on April 05, 2016, 12:14:11 PM
Hi,

 I did, straight on, maybe you did not provide the json properly? what's your technic to get the string to parse as a json?

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: marv on May 14, 2016, 02:59:32 AM
Heya, I am getting this error, when trying to use a string variable as a source for datamaker xml actions:

(the same with a GameObject variable with proxy reference)

==================================================

ArgumentException: Object type HutongGames.PlayMaker.FsmString cannot be converted to target type: HutongGames.PlayMaker.FsmEvent
Parameter name: val
System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:133)
System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/FieldInfo.cs:150)
HutongGames.PlayMakerEditor.ActionEditor.DoVariableSelection (System.Object userdata) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:2779)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected) (at C:/buildslave/unity/build/artifacts/generated/common/editor/GenericMenuBindings.gen.cs:122)


===================================================

I am using Unity 5.3.4f1 with Playmaker 1.8.0f43. I have created a completely new project and tried an older version of unity, but the problem persists. This has me kind of in a bind since I need a few FSMs on prefab gameobjects to get data from xmls. A fix for this or if anyone can come up with a good workaround for this and let me know would be much, much appreciated.

cheers
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on May 24, 2016, 11:11:22 PM
Hi,

 I think there is simply a mix up of issues with Action setup, likely not passing the right type of Fsm variable for what xml is getting.

Could you isolate the problem and share it with me so that I can reproduce here? I'll tell you how to set it up properly then.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: JellyHair on July 04, 2016, 07:25:08 AM
I've just come across this same problem today.

Marv did you find a work around?

Jean: Just to be clear I've attached a screenshot of the problem I'm having.

Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on July 05, 2016, 12:17:20 AM
Hi,

 Yes, I am on the case, thanks for the report.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: marv on July 12, 2016, 02:06:14 AM
Hey, yea sorry... I kind of forgot about this so I didn't reply.^^

@JellyHair: The main problem this caused me was that I wasn't able to have FSMs on objects created from prefabs read out xml proxies on other objects/xml data stored in global variables. So I added separate xml proxies to the prefab objects and had them populate them on generation. Not the smoothest way to do it I guess, but it works.

This is due to the "Xml Save in Proxy" action still working fine with variables. So you can store the xml data (I have my .xmls in the streamingassets folder to enable modding) in global variables and then use those to fill xml proxies in runtime.

I have no programming background so a lot of this is trial and error for me.^^
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: ermak on November 14, 2016, 03:07:26 AM
Hi, I have 3 questions.

1. I am with Unity 5.3.5, Playmaker 1.8.3, ArrayMaker 1.1.5 Build 2.
Is it everything compatible with Data Maker 1.0.6?
https://hutonggames.fogbugz.com/default.asp?W1133
Any errors, problems with actions?

2. Currently I using ArrayMaker components (HashTable, ArrayList) for data base with prefilled values (string, integers, gameObjects, sprites, audio).
If I change my data base to XML files, for example: items.xml located in Assets root folder in the project. In the final build (for Windows) where will be this XML file? Maybe my game can be hacked if someone find this file and change the xml values?
Also I am not sure where ArrayMaker store the values too... in the final build. Maybe no matter what will be: ArrayMaker or Data Maker, these values can be found?

3. Can I use XML file for Prefabs gameObjects, Sprites, Audio clips? And how I can find these things by name after this? I mean from Assets folders, not Scene Hierarchy objects.
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on November 14, 2016, 11:06:52 PM
Hi,

1: DataMaker is already at version 1.2, you should update to the latest ( always back up first).

2: the xml if stored in the asset root can be either in Resources which will be plainly and easily exposed, or in the binary of the app, which is less easy to get but nonetheless accessible if you know how to do it. So yes, values ( not just arrayMaker and DataMaker, but ALL values) can be found and tweaked for cheating or else.

encryption and obfuscation are ways to increase security up to a certain level... Your advantage over pur c# is that the hacking the logic will be a lot harder since PlayMaker is a framework that will make it a lot harder to change the logic of things, but data, yes it can be found and edited, etc etc.


3: yes, if they are stored in resources, you can find them by name and load them when needed. else you will need to either hold a reference to them directly, deduce them from logic or have them listed in arrays or hashtables.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: 600 on November 29, 2016, 02:09:20 AM
Hi,
I am getting an error when selecting a property as string variable, it will stay as None. It works with plain text written in, not with variable.
Please advise.

Unity 5.4.3p1 + Playmaker 1.8.3

Code: [Select]
ArgumentException: Object type HutongGames.PlayMaker.FsmString cannot be converted to target type: HutongGames.PlayMaker.FsmInt
Parameter name: val
System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:148)
System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/FieldInfo.cs:150)
HutongGames.PlayMakerEditor.ActionEditor.DoVariableSelection (System.Object userdata) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/ActionEditor.cs:2893)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, Int32 selected) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/GenericMenuBindings.gen.cs:122)
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: JOY on December 13, 2016, 11:07:33 AM
Hi. I cannot find Convert JSON to XML Node action. Is there any change recently?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on December 13, 2016, 11:50:42 PM
Hi,

 good point, I forgot to finish this off.

Basically, json is available as a separate package, because it's using a dll that is also used by other assets.

(http://i.imgur.com/01wGw7U.png)

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: JOY on December 13, 2016, 11:55:36 PM
Hi,

 good point, I forgot to finish this off.

Basically, json is available as a separate package, because it's using a dll that is also used by other assets.

(http://i.imgur.com/01wGw7U.png)

Bye,

 Jean

Thank you Jean.
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: gozda on December 29, 2016, 07:09:00 AM
It is possible to load/save xml data outside the unity? also creating new .xml file?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: gozda on December 29, 2016, 04:11:24 PM
Answer is Yes.

Thanks :)

on unity 5.4.3 are bugs with datamaker, like sometimes i cant choose variable, or when i can, script see do nothing with that. Sometimes when i drag action(any from datamaker) to state where is 2-3 other actions, some fields just gone from dragged action, when i copy it and paste to empty state they are visible. And i found more stuff like that :)
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: nallez on December 30, 2016, 01:02:21 AM
I have an issue with the datamaker.

The "Conver Json String to Xml Node" isn't working properly.

It gives me an error "After Parsing a value an unexpected character was encountered"

I have a JSON String which I'm using:
{"root": [{"money":"2105","cars":"","power":"1","weight":"1","grip":"1","wins":"0","losses":"0","experience":"0"}] }

The node cannot parse arrays?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: gozda on December 30, 2016, 07:07:12 AM
Xml Create Node not working:/
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: gozda on January 03, 2017, 01:13:52 AM
Can someone check whats wrong with "Xml Create Node" action?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on January 09, 2017, 12:55:44 AM
I have an issue with the datamaker.

The "Conver Json String to Xml Node" isn't working properly.

It gives me an error "After Parsing a value an unexpected character was encountered"

I have a JSON String which I'm using:
{"root": [{"money":"2105","cars":"","power":"1","weight":"1","grip":"1","wins":"0","losses":"0","experience":"0"}] }

The node cannot parse arrays?

It works here:

(http://i.imgur.com/jHIgseE.png)

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: jeanfabre on January 09, 2017, 01:04:25 AM
Can someone check whats wrong with "Xml Create Node" action?

oups, good catch, it's fixed now, please redownload from the Ecosystem.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2016]
Post by: gozda on January 09, 2017, 02:08:52 AM
Thank you
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on January 29, 2018, 02:02:34 AM
Hi,

 New update with few fixes for capricious Action editor and new actions:

- "XmlNodeRemoveAttribute"
- "XmlCloneNode"
- "XmlParentNode"

also, there is a new scripting symbol defined DATAMAKER which allows developers to better provide support for DataMaker and check that it's installed to avoid unity errors and act nicely.

More updates will come soon as I finish the meFace sample.

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: Hayato on February 27, 2018, 05:36:10 AM
Hello , I got a problem with "XmlGetNextNodeListProperties" .

I just download DataMaker from ecosystem and using playmaker 1.8.9 and unity 2017.3.0f3.

When I use "XmlSelectNodes" to Query and setup Store Reference then use "XmlGetNextNodeListProperties" to get properties in nodes , it works as well at the 1st time .
Then I change the xPath Query words and do 2nd query again , I can see the Xml Result in "XmlSelectNodes" have changed as what I do , but "XmlGetNextNodeListProperties" still give back the properties as 1st Query , even I chang Store Reference everytime I make query.

By the way , after install DataMaker , I got a lot of "good" message on unity console window when mouse around playmaker editor in editor time and playing time , is that any way totrun off it ?

(https://i.imgur.com/2tfD8xB.png)
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: Hayato on February 27, 2018, 08:10:46 AM
Okay finally I find out the reason why , there are 2 things need to do.
1.MUST setup the reset bool variable in "XmlGetNextNodeListProperties" action , and set true evertime before take a new reference.
2.Open "XmlGetNextNodeListProperties" script and hide line 117:
Code: [Select]
index.Value = nextItemIndex;
to fix the index bug.
Hope there will be a update that need not to setup reset veriable and set true everytime .

Although I still don't know how to trun off the mass "good" message in console please help me to stop it .
Thank you.

(https://i.imgur.com/r0UVRus.png)
Hello , I got a problem with "XmlGetNextNodeListProperties" .

I just download DataMaker from ecosystem and using playmaker 1.8.9 and unity 2017.3.0f3.

When I use "XmlSelectNodes" to Query and setup Store Reference then use "XmlGetNextNodeListProperties" to get properties in nodes , it works as well at the 1st time .
Then I change the xPath Query words and do 2nd query again , I can see the Xml Result in "XmlSelectNodes" have changed as what I do , but "XmlGetNextNodeListProperties" still give back the properties as 1st Query , even I chang Store Reference everytime I make query.

By the way , after install DataMaker , I got a lot of "good" message on unity console window when mouse around playmaker editor in editor time and playing time , is that any way totrun off it ?
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on February 28, 2018, 12:40:52 AM
Hi,

 oups :) let me remove the spam log, it was when I wanted to debug it.

 to remove it right now, simply double click on the log entry and comment that line ( put // in front)

the trye reset must be done by you. I can not do this automatically. So have a state prior the state where you run this action, and set a bool variable to true, and reference that bool variable in the reset property of that action.

This flag is menat to be used only if you are shunting the action so that is starts again at index 0 when it will be entered the next time.

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on February 28, 2018, 04:32:06 AM
Hi,

 new version is out on the ecosystem :)

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: Hayato on March 06, 2018, 11:11:04 PM
Hello Jean,

Thank you for removing logs from console .
But in the new version "XmlGetNextListProperties" still go wrong after the 2nd run.

Line 117
Code: [Select]
index.Value = nextItemIndex;When DoGetNextNode() it just set Index to the last "nextItemIndex" value get at the end of 1st run.
It make 2nd run start with the wrong index.

Please check about it , thanks !


Hi,

 new version is out on the ecosystem :)

 Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on March 08, 2018, 05:23:50 AM
Hi,

Ok, yes, I see. you need to create a variable index that you put in the action, and set that 0 in the same state as you reset, otherwise it starts at the index of this property. And the bug in this action is if index property is not set.

so for now do the step above, while I finish up some pending work, I want to update soon with the Reference browser as well as some new Utils features.

Thanks for pointing that out :)

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: Hayato on March 08, 2018, 06:23:54 AM
Hi,

OK I know if I setup a variable index and always set it to 0 before the state will make fine after 2nd run , but if I hide Line 117 it will work well even I setup a index or not (also the index can be set to any int will works as well when hind line 117).
That's because you have use "nextItemIndex" to deal with DoGetNextNode() loops , maybe it's not necessary to save back nextItemIndex value to "index" in line 177 , and that will make this action more easy to use .:)

DataMaker is a super powerful tool , but it's some what hard to learn without hints , if you can give a hint in the action tell the RESET is MUST HAVE , that will help a lot .
Thank you for taking time with my questions !




Hi,

Ok, yes, I see. you need to create a variable index that you put in the action, and set that 0 in the same state as you reset, otherwise it starts at the index of this property. And the bug in this action is if index property is not set.

so for now do the step above, while I finish up some pending work, I want to update soon with the Reference browser as well as some new Utils features.

Thanks for pointing that out :)

Bye,

 Jean
Title: Re: DataMaker Xml xPath and Json [JANUARY 2018]
Post by: jeanfabre on March 13, 2018, 11:41:12 PM
Hi,

 Yes, It's always tricky to find the right balance between a simple action and a feature rich action.

What I would suggest is that you duplicate this action and rename it and modify it to your liking.

 I actually highly recommend this, as all this work is really a base for you to expand, and really is one approach to development, that is mine, but not necessarily adapted to everyone, and so feel free to just duplicate and modify them.

The reset is not a must have, it's only needed if you are going to reuse this state over and over. But also, as I write, maybe the action is buggy in another place that is when the action has finished looping, maybe I should reset it as well. I'll double check.


Bye,

 Jean