Page 1 of 1

XPathEdit - Mass value changes in xml

Posted: Mon May 05, 2014 12:56 pm
by HorridoJoho
Hello, i wrote this little tool to do mass value changes to xmls.

You open an xml document:
1.GIF
You type in a XPath expression and click on "Select Batch Nodes" which selects elements or attributes:
2.GIF
You type in a new value for the selected nodes and click "Set New Value" to update the nodes:
3.GIF
Warning:
Saved documents have XML attributes undefined sorted, i can't change this.

Limitations:
The tool will only allow element and attribute nodes to be selected. XPath expression like /list/npc/race/text() would not select anything.
This is because i have not the knowledge yet about xml and all it's nodes a DOM tree represents and how to represent all the nodes in a tree.


Java 8 is required for this application to run.
On windows it should suffice to start the XPathEdit.jar file. If that does not work try the XPathEdit.bat file.
If that does not work also, edit the XPathEdit.bat file and set the JSE_8_PATH to the Java 8 installation bin path(with trailing slash).
Eg.: "C:\Program Files\Java\jre8\bin\" -> SET JSE_8_PATH=C:\Program Files\Java\jre8\bin\

Re: XPathEdit - Mass value changes in xml

Posted: Mon May 05, 2014 1:11 pm
by jurchiks
Looks pretty good for a generic solution. Maybe find out if the other people working on a similar tool are planning to make it project-specific, and if so, continue working on this one as a generic tool.
Throw in a quick help for xpath with some basic tips and it's great.

Re: XPathEdit - Mass value changes in xml

Posted: Mon May 05, 2014 4:27 pm
by Hyrelius
This looks nice - as long as you know XPath.

What I'd be interested to know is: does it support several files at once? (e.g. all skill*.xml files etc.)

Also: perhaps it'd be a nice idea to attempt an implementation of XQuery Update?

Anyway: great work - I'll certainly check it out.

Re: XPathEdit - Mass value changes in xml

Posted: Tue May 06, 2014 6:26 pm
by HorridoJoho
I updated the tool with localisation. Default language is english and german is buildin as localisation.
I also added generic message boxes for errors and confirmation of saving and value setting.
The full source code is included in the JAR file.
XQuery
I'm not sure if for such a tool XQuery is usefull. It raises the learning curve a little and is more complex.
XPath is extremly easy and with a tree in the GUI you have an overview of the nodes you select before you change them.

Re: XPathEdit - Mass value changes in xml

Posted: Tue May 06, 2014 6:34 pm
by jurchiks
It may raise the learning curve, but it doesn't mean that the feature would not be appreciated for those who know or can learn how to use it. After all, it would be an optional feature.
Localization definitely shouldn't be a focus at the moment.

Re: XPathEdit - Mass value changes in xml

Posted: Wed May 07, 2014 12:03 pm
by Hyrelius
Actually, jurchiks, you are in no position to decide what the dev - here @FBIAgent - should focus on. If the stuff is on github or something, you may fork and add things you want, but don't command others. I'm just suggesting, yet staying friendly. And so should you.

Btw. @FBIAgent: is it possible to uhm.. work this magic the application is capable of on several files at once? Like.. say I want to change some property on all skills, which have a certain different property set to some certain value.. would I be able to locate all skills with "someProperty=someValue" and change another property within that to some other value across all the #####-#####.xml files? If not - this would certainly be a great feature.

Also I agree, that XQuery doesnt have all that many new features. But if you were to support XQuery Update and perhaps XQuery itself, we could use similar statements to what BaseX (XML-database) offers (which is where I see the future of our tons of XML files anyway).

Re: XPathEdit - Mass value changes in xml

Posted: Wed May 07, 2014 5:07 pm
by jurchiks
Jesus Christ, I said "SHOULD NOT" not "MUST NOT". I am not deciding for him, I'm stating my opinion.
Why would you even raise that as an argument? We have enough of those here.