7 features of QXmlEdit for unusual situations

QXmlEdit's features make complex tasks quicker and easier than your everyday XML editor.
529 readers like this.
A introduction to creating documents in LaTeX

Opensource.com

QXmlEdit is an open source XML editor written using Qt libraries that has some unusual features that can help you in complex situations.

An ordinary XML editor can make it easier to write long XML documents in structured form instead of laying them down as text. (Did you ever do that?) Even so, sooner or later you will run into situations where a basic editor is not enough. For example, you may need to manipulate data with cardinalities you never thought possible, or deal with binary data, or compare two XML Schema Definitions (XSDs) at a semantic level. QXmlEdit, which runs on Linux, Windows, MacOS, and OS/2, has features that can help you in situations like those.

Let's jump in.

Journey into your data

Big data can produce huge XML files that are too large for some editors to open. QXmlEdit can show the data as a map where the horizontal extension is the nesting level of the elements, and different colors correspond to different dimensions of the XML, e.g., number of children, attributes, text size, or a cumulative sum. Spikes are highlighted using image processing tricks. A 3D view allows you to evaluate differences in values as peaks and valleys. It also generates a set of statistics about the distribution of elements and the links between them.

Map view of XML data

opensource.com

View of relationships between elements

opensource.com

Handle binaries and Base64

XML is an envelope to carry data, but binaries are not allowed unless they're transformed in text. Base64 is the most common transformation and is supported by the XSD standard. In QXmlEdit, Base64 data is an option for text or elements; you can insert a file from your file system into a text field or in attributes and, if the binary data is text or another XML fragment, you can also translate it from Base64, edit it, and reconvert it to Base64 in the editor. The search panel let you include Base64-coded text in the search domain. For heavier work, there's a panel to convert data to Base64 alongside the source.

Base64 panel

opensource.com

Study the history

The task of XML, especially that of the specialized XSD format, is to travel from program to program or between systems. (Traveling here means that XML is used to exchange data between programs, so XML data are sent and received.) When a file is modified often, such as when a development team is working together, QXmlEdit can use metadata in the shape of processing instructions, transparent to the usual data processing, to identify the current version.

Some of the data, such as the file's date, author, or revision number, can be updated automatically at each save, while other data can be edited using a panel.

Metadata editing panel

opensource.com

Make it pretty

XML is for humans, so its structure and grammar are such that you can write and read it in a text editor, but formatting and indenting it makes it easier to read and understand at a glance.

QXmlEdit provides options to format XML in the editor, then save and store the formatting settings inside the file. The attributes can be sorted alphabetically, displayed one per line, or grouped. For example, you can see the ordinal number of child elements and display a count of direct and indirect children of the branches.

When saving data, you can apply different settings or write the data in the same order you read it; presets help you choose the most common format styles. The settings can be saved in the XML file as processing instructions and reapplied on loading.

Formatting options

opensource.com

Configuring the display style in the task panel

opensource.com

Split documents into fragments

Fragment extraction is a way to manipulate XML documents that are too large to fit in memory or that otherwise must be split. You can extract fragments into new files, filter the content of the source XML, or extract attributes of target elements in a CSV file. When extracting fragments, you can create a structure of subfolders to avoid generating thousands of files in a single directory. Controls on the splitting conditions can be set by a fragment counter, attribute evaluation, etc. At the end of the operation, you can browse the extracted fragments in the editor. Using this feature, you can cut or isolate parts of data without a manual operation.

Extracting fragments

opensource.com

Mask your data

When you're testing, especially when doing regressions, the data should be as realistic as possible, but you can't use or share real production data with other developers looking to analyze and solve problems. QXmlEdit's Anonymize feature keeps the XML file's structure but masks any data you don't want to share publicly. You can create rules to mask certain parts of the data using the editor, then reapply the operation in batch on other files, even large ones. No original data, only the structure and the payload type, are retained, allowing the resulting file to be used for tests and analysis. Since QXmlEdit is open source, you also can review the code and implement new algorithms of your choice.

Anonymizing data

opensource.com

Compare XSD

XSD is very useful for exposing the format of data exchanged between systems. To identify what changed between the last version and the current one, you can use the XSD Diff feature. Each change is shown with a different color, and a summary table enables users to jump directly to a selected change. The resulting graphic can be exported in PDF or SVG format for inclusion in project documentation.

Diff of XSD

opensource.com

QXmlEdit offers a set of utilities to manage XML files and solve associated problems, from structure to encoding, that may not be new, but are definitely handy to have available directly in the editor.

For more in-depth information, including tutorials on these and other topics, visit the QXmlEdit website.

User profile image.
I am the founder and the maintainer of the QXmlEdit project. I work in the business customer communication management field and I had experiences in healthcare software sector, both management and devices firmware. I am a supporter of Free Software.

1 Comment

Very cool. I use Docbook or XML both at work and at home, so I look forward to taking a look at QXmlEdit. Thanks!

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.