Com\’è dura la professione!

4 marzo 2016

Siblings, Parents and Other Relationships in XML with QXmlEdit

Filed under: Open Source,qxmledit,xml — lbell @ 21:06
Tags:

Navigate in a sea of siblings in an XML hierarchy can be problematic like the navigation in a true sea when the cardinality of the data is high. And yet, the XML can contain hand craft made test data to be validated or coming from an external source outside of our control.

Examine an element not conforming to a given XML Schema to understand the source of problems requires a lot of patience with complex data. QXmlEdit provides some tools to ease the task, customizing the data view and provides some facilities for the editing.

uno

Starting data

Visualization

Concentrating on some elements in a sequence, bookmarks are the first help to move quickly between different parts of data.

Each child element can show its index with respect to the parent using the menu “View>Show Child Index”.

The tree representation of the selection and all its siblings can be closed using the menu “View>Siblings>Close This and All Siblings”; the item “Close Siblings” of the same “View” menu can close all the siblings of the selection.

To reduce the visual clutter the siblings of the selection can be hidden.

The attributes can be sorted in alphabetical in the view order without modifying the position in the real data.

tre

Hiding siblings

Editing

The operations triggered in visualization can be made permanent with the commands of the menu XML.

In the “Siblings” menu there are commands to delete the siblings of an element, all the following, the previous ones, or simply all.

An element can be cloned, optionally adding an index using an attribute, to create quickly a feature that can differentiate a set of siblings.

With the hierarchy operations, the children of the selection can be moved or grouped, moving all the existing children to a new child.

Parents can be created or removed, isolating an element or promoting it to the previous level.

The sorting of attributes, available in the presentation layer, can be made permanent.

quattro

Siblings

In the End…

QXmlEdit can ease the task of manipulating complex XML files, while retaining the hierarchical structure of the data.

Get QXmlEdit at http://qxmledit.org, or go to the download folder at sourceforge.net.

6 dicembre 2015

Replicating XML Elements

Filed under: Open Source,QT,qxmledit,xml — lbell @ 18:06
Tags:

It is possible cloning or assigning unique indexes to elements in QXmlEdit 0.9.2 using two new menu items:
Tools > Fill Serie and Tools > Clone.

Applying an index is possible using Fill Serie. An attribute will be used on the siblings of the selected element. The value of the index can be a padded or unpadded number or alpha sequence giving birth to series like “AA”, “AB”, … or “A”, “B”, … and so on.
There are options to skip or replace existing values in the elements as well to merge the values. A non existing attribute can also be created.
The index can be applied recursively to the children of the selected element.

fill options

Cloning elements is a matter to select a sample element and apply the clone command. Only elements can be cloned unless they are the root of the XML. The cloning can be deep, that is applied recursively to the children too or only to the selected element.
An index can be applied in the process. QXmlEdit suggest you to use it if the option has not been selected.

clone options

The final result is shown in the next image.

 

cloning results

2 giugno 2015

QXmlEdit gets a New Home

Filed under: Uncategorized — lbell @ 20:03
Tags: , ,

Nowadays, everyone is always moving, not even Google is firm and stable and is closing Google Code project hosting, so QXmlEdit must have a new home.

The code will be kindly hosted by GitHub (https://github.com/lbellonda/qxmledit), binary downloads by SourceForge as usual (https://sourceforge.net/projects/qxmledit/), but the project at last will have a brand new home: http://qxmledit.org.

The move is almost done, but like in all the moves something is still inside a packaging box.

The new QXmlEdit home: http://qxmledit.org

5 aprile 2013

Springs and forces in QXmlEdit 0.8.5

Filed under: Open Source,QT,qxmledit,xml — lbell @ 20:45
Tags: , ,

A force directed layout graph (http://en.wikipedia.org/wiki/Force-directed_graph_drawing) is is well suited for hierarchical structures or directed graph, perfect to visualize the relationships existent between the elements of a XML structure.

QXmlEdit 0.8.5 lets you view the content of the current data or another file of your choice creating a graphic scene of the current screen dimensions, inserts the graphical representation of the elements in random positions inside it. The nodes migrate into an equilibrium configuration automatically under the application of a force similar to the binding of the electric particles, to reach an optimal distribution in the general case. A damping factor is applied to avoid a long stabilization time of the configuration.

The panel can be reached with one of these methods depending on the data to show:

  • The current file open in the editor

Edit a file and select the menu item “Relations” from the “View” menu.

  • A file on the file system

Choose the “Relations…” item from the”Tools” menu and use the browse button to load a file or drop in a file.

  • The map panel

From the Tools menu, choose the View Map item, before loading any file, check the the “Analyze relations” option; after loading the file, operate the “View Relations…” button.

When the panel is open it is possible to

  • View the structure

The panel shows the relations between elements. Each circle represent an XML element. The lines show a relationship between element types. To evenly distribute the elements on the view area, each element is repelling the others, the nodes are connected by simulated springs.

strcture

  • Move the items

The elements can be dragged with the mouse causing the movement of the other elements until reaching a new equilibrium point. Zoom controls can modify the view.

Each time the “Reset” button is pressed, a new initial casual combination is generated and the elements move themselves to reach a new equilibrium point.

img_06

  • Isolate a single element

Checking the “Center Selected” option, hides all the elements that are not diretcly connected with the selected one. By clicking on one node, you can filter the display of nodes showing only the data related to the selected element.

img_08

The data can be shown also in tabluar format

Each element on the rows show its absolute and relative count and the references made to any other element.

img_09

The settings can be tuned.

 The intensity of the replusive force can be changed using the “Force” slider. The effective distance that the force can act can be set using the “Radius” slider. The lenght of the lines connecting elements can be regulated using the “Spring” slider.

31 agosto 2012

Visual comparison between XML Schema files in QXmlEdit

Filed under: Open Source,QT,qxmledit,xml,xsd — lbell @ 21:31
Tags: , , ,

Visualizing a comparison between files is first of all a semantic operation. The comparison of source code of programs usually is done at level of source lines, and the level of concepts, classes and methods in this case, is entirely left to the user. There is no doubt that any line of source code is important, but while in the programming world the abstraction level is always raising, using protocols, interfaces and as last resource, languages better suited for the job, the comparison of variations of different versions is always done at character level.

The comparison of XML files is similar to a source code comparison, given that the information carried by a file are not related to the XML syntax, but to the meaning associated with the particular XML structure.

XML Schema files can be compared at XML elements level, the analogue of the source code comparison, but understanding the difference of the information carried by of the different XSD files is not easy.

The future 8.3 QXmlEdit, now on development trunk, follows another approach, transforming the data into concepts, element, types, and so on, then comparing the concepts. Given that the XML Schema follows a strictly hierarchical model, the reference and the target schema are scanned in parallel for inner contents. Where an element in the reference schema has an equivalent on the target schema, is compared for equality on the basis of the element type and name. If the two values are equals, the element are posed in correlation and any other difference ends in modified items. The comparison continue recursively.

The schema is then presented, using colors that show at a glance only the reference schema, highlighting the changes, showing the information in their context. The key is shift the focus from the comparison as operation, to the variation of the information in the schema context.

Image

22 dicembre 2010

Explore a XML file structure with QXmlEdit

Filed under: Open Source,QT,qxmledit,xml — lbell @ 22:08
Tags: , ,

One of QXmlEdit peculiar characteristics is the possibility to change the quantity and the type of informations shown on a XML file to examine it from various prospectives.

If the XML file is very large and complex it happens to focus on some details missing the big picture. Let us take for example a Qt user interface file, we can face the following situation:


 

it is very difficult, at least for me, to follow the widgets’s structure or differentiate between them. As a first help we can activate a display style that can list in the space reserved to element tag name, the value of one or more attributes that can characterize the element itself. The predefined style provided with QXmlEdit installer displays near to the element tag, the value of ‘name’, ‘id’ or ‘build’ attributes, if any. The styles can be created and installed by the end users; they can be applied using the ‘paint can’ icon button at the bottom right of the data tree.


The style makes the visualization more intuitive and the data structure stand out very quickly.

 

To solve the problem of seeing the element text together with his tag, we can activate the compact view visualization as shown in the following screenshot. The text, if present and if no attributes exist, appears in the column reserved to the attributes with a different color.


 

We can have an overview of the XML file while maintaining the desired level of detail.


Blog su WordPress.com.