[Tool] Visual XML Editor : v1.0.7 (We-07-Jan-2015)

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

[Tool] Visual XML Editor : v1.0.7 (We-07-Jan-2015)

Post by Roger L.S. Griffiths » Sun, 21. Dec 14, 20:29

Hi Guys/Gals/Robots,

I have finally decided to start work on a generic XML editor designed primarily to help us mod X-Rebirth without having to get involved with the guts of XML syntax. The method of presentation is basically the same as the XML Editor I had built into Changeling (think Regedit and you get the idea).

I should have an initial offering ready by Christmas.

I am basing the work on the Changeling project that I started for X3:TC/X3:AP but never really got to complete properly due to lack of time to work on the delta logic.

This tool on the other hand should be a lot easier and quicker to implement due to Microsoft kindly having a nice XML DOM as part of C#.

My current developmental version can load in multiple files but will currently only show one file at a time. I hope to enable the display of multiple files and thus help with the comparison of them more easily.

Long term, I plan to implement:-
  • XML Difference file support.
  • XML Difference file generation.
  • XML Schema Support
If anyone knows of a similar tool already in existence that is free then please shout as it may stop me wasting time on developing this one. ;)

In the long run, I may create an optimised version tailored for X-Rebirth because as it stands opening 50MB XML save files seems to take a few seconds on my system and there may be some cheats or domain specific optimisations I can do (e.g. pre-parsing the generic XML into data structures).

See here for the Publish Folder on Google Drive.

See here for the project on Google Code (GIT Repository).

Download and Install Instructions
  1. Click on the link above
  2. Download all files/folders
  3. Run setup.exe
Last edited by Roger L.S. Griffiths on Wed, 7. Jan 15, 23:46, edited 11 times in total.
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13914
Joined: Sun, 20. Nov 05, 23:45
x4

Re: [Tool] Visual XML Editor [WiP]

Post by UniTrader » Sun, 21. Dec 14, 20:53

Roger L.S. Griffiths wrote:Long term, I plan to implement:-
  • XML Difference file support. <==
  • XML Difference file generation. <==
  • XML Schema Support
If anyone knows of a similar tool already in existence that is free then please shout as it may stop me wasting time on developing this one. ;)
used this xml_patch tool here for quite a while now on Linux: http://sourceforge.net/projects/xmlpatc ... rce=navbar (and have some versions compiled for Windows lying around, too but havent used them for a while since i dislike the Windows shell)

note: for diff file generation, which is also available there, some changes in the sel path may be necesary - it currently uses paths like these: sel="/*[4]/*[1]/*[2]" which may only apply to a certain Game Version and are possibly also altered by other mods
best would be imo to use the resulting file but set each sel path manually after generation and then check if its valid for that purpose since an automated process cannt determine what would make the most sense as identifier.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sun, 21. Dec 14, 22:39

Thanks for the info UniTrader, using GPL code from Linux may help - it depends on how it is written. If it is C/C++ based then it can probably be ported to C# easy enough (though it may not be straight forward).

If it is written in another language, then it may not be suitable for the usage I have in mind.
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Mon, 22. Dec 14, 02:37

First draft of the simple form of the tool is now available. You should be able to view and edit multiple XML files but you will need to manually backup any files BEFORE editing them with this revision.

This version supports:-
  1. Loading multiple XML files either via drag and drop from Windows Explorer or by opening them with-in the application.
  2. Viewing/Editing multiple XML files
  3. Saving as the selected files (with-in the main window) without backup
It is currently quite primitive but I will update the Google Drive folder with new releases as development progresses.
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Mon, 22. Dec 14, 19:12

Updated to v1.0.1, this release includes:-
  1. Support for creating new XML files
  2. Ensuring the labels are unique in the loaded XML file list
  3. Display of the label for the XML file instance in the Editors titles
  4. Editing of the labels in the loaded XML file list
  5. Save As and updating of the path as a consequence in the loaded XML file list
  6. Backup creating for Save operations
Addition of e-mail address in the about box for sending bug reports.

Minor Fix: Publish v1.0.1.2/v1.0.1.0 application resorts the file list after changing the label.

NOTE: Even the current limited editor is fully functional in terms of simple editing (XSL validation is next on the list after adding search functionality). It should rank better than Visual Studio Express (or even IntelliJ IDEA) for XML editing as there is no notional limit to the XML file size it will handle (large XML files such as game saves may result in slow loading, and editor display, times though)
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sat, 27. Dec 14, 14:10

Given there are some other people writing tools for X-Rebirth also using .NET v4.5, I am planning on adding plug-in support to the Visual XML Editor.

If there are any specific requests for the plug-in interface please post them here and I will see what I can do.

Short term, I plan to add support for plug-in single-document XML Viewers/Editors and the plug-ins will be available from the Tools menu (opening an instance for all selected files).
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sun, 28. Dec 14, 01:17

I have now opened a project for the management of this tool on Google code (please see OP for link).
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sun, 28. Dec 14, 02:23

Hi Roger L.S. Griffiths,

I tried it out, but I have to say, I like dealing with the code in a text editor better. Then again, I don't really deal with anything complicated yet, so I'll probably appreciate it more when (if?) I do.

One thing which would make it easier to use: could you please make it so that the output of the "Source" tab is more readable? Maybe have it recognize line terminators and spaces?

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sun, 28. Dec 14, 04:08

The source editor is a fallback mode really and only intended for use by advanced users (it is effectively note-pad) and is the pure textual output of the XML DOM.

If you really need to view it formatted then you can always copy and paste into a formatting textual XML editor.

The built-in editor source mode will never be formatted in the foreseeable future as that would require more time to do properly than I am willing to commit for such a task at this time.

My immediate focus at this point is to:-
  1. Add plug-in support for custom XML editors which should open up some possibilities (e.g. Game Save focused XML editors, Universe Editors, etc).
  2. Add Search/Replace features to the XML tree/property list interface.
Most textual formatting XML editors are limited by size of the source data IME (e.g. IntelliJ and VisualStudio 2012 will not handle large game save files properly) and I can understand why since real-time formatting and validation of free text form XML can be expensive in terms of CPU time and the cost notionally grows exponentially as the size of the file/XML fragment grows.

The power of the built-in editor is that you can (theoretically) have multiple (editable) views of the same document open at any given time. Long term, the intent is to allow drag and drop of XML tree fragments between XML editor windows.

Support for the usual editing functionality is planned as well (Cut/Copy/Paste) but from the graphical view only as the intent is to minimise the chances of human error (e.g. mismatched/missing opening/closing tags for instance).

I can understand why some may prefer to use a plain text editor with the functionality as it currently stands but things will improve (primarily the lack of Search/Replace and the absence of Cut/Copy/Paste). Technically only copy is not supported currently as drag and drop can be used to move XML fragments around the same file (Cut+Paste effectively). However, many text editors may struggle with some of the larger files. The text editing issues are side stepped by converting the text to an XML DOM format manipulating the DOM objects directly rather than having to parse text all the time.
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sun, 28. Dec 14, 06:35

Updated to v1.0.2, this release includes:-
  1. Provisional support for plug-ins (See uk.co.rlsg.apps.xml_editor.IPlugin) in DLL form
  2. Added initial support for copy drag-and-drop operations (inc. between different documents)
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sun, 28. Dec 14, 11:24

Fair enough. I'll try and play around with it more. Thanks!

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sun, 28. Dec 14, 17:38

Updated to v1.0.3, this release includes:-
  1. Formal support for plug-ins (See uk.co.rlsg.apps.xml_editor.PluginBase) in DLL form
  2. An example simple text editor plug-in under source control
In order to create a plug-in for Visual XML Editor you will need to do the following:-
  1. Download and install Visual XML Editor
  2. Create a .NET C# Class library project (or other language .NET equivalent)
  3. Add a reference to the Visual XML Editor executable to your project
  4. Derive from and implement the abstract class uk.co.rlsg.apps.xml_editor.PluginBase
The resulting DLL can be distributed as-is independent of Visual XML Editor.

To add a plug-in to Visual XML Editor you will need to do the following:-
  1. Download the relevant plug-in DLL(s) to the desired location
  2. Launch the Visual XML Editor
  3. Select the menu option Tools --> Plugins --> Manage...
  4. In the pop-up dialog, select the menu option Plugins --> Add...
  5. Locate and select the plug-in DLL(s)
  6. Observe that paths to the DLLs are added to the Plugin Manager list
  7. Close the dialog using the X at the top right of the window
  8. All plugins should automatically be unloaded and reloaded
When at least one document is selected in the main XML file list you can launch the relevant plug-in(s) from the Tools --> Plugins menu. All available plug-ins should be listed under the separator.
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Sun, 28. Dec 14, 22:16

Updated to v1.0.4, this release includes:-
  1. Fix for unhandled exceptions when editing XML source directly (will now turn the source editor background light red on validation error)
  2. General fixes for updating of the source view on tree operations
  3. Fixes for some relatively minor issues with the plug-in manager view
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Mon, 29. Dec 14, 01:13

Updated to v1.0.5, this release includes:-
  1. Simple depth first search for text in the built-in XML Editor
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

User avatar
Roger L.S. Griffiths
Posts: 9913
Joined: Fri, 12. Mar 04, 20:47
x4

Post by Roger L.S. Griffiths » Mon, 29. Dec 14, 14:57

Just a quick update with some further information on the search functionality for those that are interested and maybe have not tried it yet (and worked out what it is doing that is). :)

The search feature is pretty basic:-
  1. Search is always down (sub-tree/children) and forwards (next sibling/next parent's sibling/etc) so if you want to search the whole of an XML document you need to have the root node selected in the tree pane
  2. Search is always a textual substring case sensitive character sequence search (currently)
  3. Search will only find and select the relevant XML node in the tree, it will not highlight the matching text nor find other matches with-in the same node
  4. Search can be done on one or more of the following:-
    1. XML Node Name
    2. XML Attribute Name
    3. XML Attribute Value (un-encoded/un-escaped form)
    4. XML Text Node Contents (un-encoded/un-escaped form)
    5. XML Comment Node Contents (un-encoded/un-escaped form)
  5. Search failure will simply beep at the user.
If you think the search feature can be improved, please shout and we can discuss the possibilities in open forum.
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams

Post Reply

Return to “X Rebirth - Scripts and Modding”