I really don't want to test whether or not I got the right xpath by running this game, so I set out to find the xml-patch lib, that way I can at least test that I'm patching the files properly, instead of wondering if that's one of the reasons why my code isnt working!
Oh that's a shame it requires Cygwin, I didn't know that.. You could grab the jar from that one and run it right away if youre using java 8. I couldn't figure out how to compile the source into an exe without using some third party app - I suppose you can run jars if you just have the JRE installed? https://jcenter.bintray.com/com/github/ ... -0.3.1.jar
Oh that's a shame it requires Cygwin, I didn't know that.. You could grab the jar from that one and run it right away if youre using java 8. I couldn't figure out how to compile the source into an exe without using some third party app - I suppose you can run jars if you just have the JRE installed? https://jcenter.bintray.com/com/github/ ... -0.3.1.jar
I'm not sure about this jar implementation it should have found a match in my example and it didn't ... might be broken
D:\tools\x4diff\bin>xml-patch FactionLogic.xml FactionLogicDiff.xml result.xml
Exception in thread "main" com.github.dnault.xmlpatch.PatchException: no matches for selector "//cue[@name='FindFactionHeadquarters']/actions/do_if[@exact='faction.argon']/find_cluster/@macro"
at com.github.dnault.xmlpatch.Patcher.selectNodes(Patcher.java:441)
at com.github.dnault.xmlpatch.Patcher.replace(Patcher.java:106)
at com.github.dnault.xmlpatch.Patcher.patch(Patcher.java:88)
at com.github.dnault.xmlpatch.Patcher.patch(Patcher.java:65)
at com.github.dnault.xmlpatch.CommandLineDriver.main(CommandLineDriver.java:62)
I think you just need the cygwin dll, which should be very small. If you run the installer and then dont select any packages it would be a fast download, maybe try that?
What might be the culprit is:
`bindNamespacePrefixes` - would need to step through the debugger to find out, but really - I'm not sure, it looks like a fun recursion function (selectNodes method)
EDIT: It's possibly a character encoding issue. Like it might be using something different (ISO-whatever something i see java use all the time) instead of UTF-8?
What might be the culprit is:
`bindNamespacePrefixes` - would need to step through the debugger to find out, but really - I'm not sure, it looks like a fun recursion function (selectNodes method)
EDIT: It's possibly a character encoding issue. Like it might be using something different (ISO-whatever something i see java use all the time) instead of UTF-8?
I've build the thing with gradle in IDEA. Haven't looked at the code yet but indeed it could be a char encoding issue. Cause the xpath works ingame. Now installing cygwin I can do just the dll in windows. But I need to know to which cygwin version you compiled. I can't just add any cygwin dll, or it won't work I fear.
What might be the culprit is:
`bindNamespacePrefixes` - would need to step through the debugger to find out, but really - I'm not sure, it looks like a fun recursion function (selectNodes method)
EDIT: It's possibly a character encoding issue. Like it might be using something different (ISO-whatever something i see java use all the time) instead of UTF-8?
I've build the thing with gradle in IDEA. Haven't looked at the code yet but indeed it could be a char encoding issue. Cause the xpath works ingame. Now installing cygwin I can do just the dll in windows. But I need to know to which cygwin version you compiled. I can't just add any cygwin dll, or it won't work I fear.
Ohh Ok, I just installed cygwin the day I posted this (i used cygwin to compile to windows, assumed it wouldn't be a dependency!)
Ok so looked at the dll files and it appears to be version 2.11.2
I fully installed the latest cygwin version but it's still not running . There is no log or debug, just application can't run ... ok ... Not sure how we can debug this any better
Thanks sob, I was trying to set it up so people didn't have to build it, but it looks like that is probably going to be the only way. So I went ahead and updated the initial post! Thanks!
Here's a simple online tool that I found: https://extendsclass.com/xpath-tester.html
Simply paste the XML code, and your XPath expression, it'll tell you the block that it finds.
E.g. I pasted the factionlogic_economy.xml, I typed in my XPath: "//cue[@name='Request_Commandeerable_Freighter']/actions/do_if[@value='$TestJob']/do_if[@value='$Ship.exists']/do_if[@value='$Miner']",
and it returned this correct block: