XML programing help, xrebirth linux edition

I want to modify a mod called ‘improved engineer’. I know many programming languages and many years of experience in linux and mswin. I can’t make any sense of the syntax. I need a good guild to XML programming and with many examples, a free download.

Also, It would help if someone could break down parts of that code.

Personally I would not call XML a programming language. Like I would not call HTML a programming language.



The second link provided by Henk is an instructive example,
XML is is data stored in a way that is hierarchical, using “markup” which means that each data point is enclosed in tags.
The hierarchical nature has advantages over other “flat” text based data arrays like delimited text.
Because markup is text-based and easy to understand, it has become a favorite way for not only storing data but also transferring data between systems because tags are easy to parse, clearly allowing the data that remains to be converted into other formats and data types.

As such, data is static but can be consumed by a program for any purpose.

You have various XML variations that adhere to a schema, like JSON.
You can also use XML to store web page code, but that is not seen too much today because of its many uncomfortable restrictions with little additional benefit compared to HTML.


Thanks, that was very useful. ‘improved engineer’ here is some of that code. You can get this off ‘nexus mods - xrebirth’

content.xml authors info page
<?xml version=“1.0” encoding=“utf-8”?>
<content id=“ImprovedEngineer” name=“Improved Engineer” description="Complete rewrite of the engineer ai.
Include support for emergency repairs and repair using in flight drones, as well as engineer skills and morale.

See mod forum post on egosoft for more details" author=“Jey123456” version=“0.98” date=“2013-11-23”>
<text language=“44” name=“Improved Engineer” description="Complete rewrite of the engineer ai.
Include support for emergency repairs and repair using in flight drones, as well as engineer skills and morale.

See mod forum post on egosoft for more details" author=“Jey123456” version=“0.98” />

<interrupt_after_time time="(0+@$iterationSpeed) + 1s"/> ??

<set_value name="$EngineerWreckRestoreDelay" exact=“30”/> $EngineerWreckRestoreDelay=“30” (DEC) Right?

<set_value name="$overallRepairRate" exact=“45f” /> $overallRepairRate=“45.00” (FLOAT)

set_value name="$moralInc" exact="(1f+this.skill.morale)/5f"/> <!-- how much morale is added for every cycle where the engineer is not busy →
$moralInc= (1.00 + this.skill.morale) / 5.00" this->skill->morale

                    &lt;do_if value="not $accumulatedPerc?"&gt;                 if value nonzero?
                        &lt;set_value name="$lastEngineerWreckRestore" exact="player.age"/&gt;
                        &lt;set_value name="$lastEngineerRepair" exact="player.age"/&gt;
                        &lt;set_value name="$lastEngineerDrone" exact="player.age - $EngineerRepairRate"/&gt;
                        &lt;set_value name="$lastEngineerStatus" exact="player.age - $EngineerCheckStatus"/&gt;
                        &lt;set_value name="$lastEngineerMorale" exact="player.age"/&gt;
                        &lt;set_value name="$welderdronesScore" exact="0"/&gt;
                        &lt;set_value name="$welderdronesLaunched" exact="0"/&gt;
                        &lt;set_value name="$morallevel" exact="100f"/&gt; &lt;!-- A value from 125 to 25 that slowly increase when not busy, and decrease when busy, the rate at which it increase and decrease is affected by morale skill 125 mean 25% better at everything. 25 mean 1/4 as good at everything--&gt;
                        &lt;set_value name="$nextRepairTargetValue" exact="0"/&gt;
                        &lt;create_group groupname="$damagedelements" /&gt;
                        &lt;create_group groupname="$wreckedelements" /&gt;
                        &lt;set_value name="$lastEngineerMessage" exact="'Setting up'"/&gt;
                        &lt;set_value name="$lastEngineerDebugDelta" exact="''"/&gt;
                        &lt;set_value name="$lastEngineerDebug" exact="''"/&gt; &lt;!-- used to output all sort of debug info depending on what we want. Just set the value and uncomment the line that print it to the info panel --&gt;
                        &lt;set_value name="$lastEngineerMessageTime" exact="player.age - 30"/&gt;
                        &lt;set_value name="$accumulatedPerc" exact="0f"/&gt;

                &lt;do_if value="$welderdronesScore ge 1"&gt; &lt;!-- We have welding drones on board, so we can repair the hull a lot more --&gt;
                    &lt;set_value name="$EngineerRepairHullMaxPerc" exact="50"/&gt;

if $welderdronesScore >= 1 then

                &lt;do_if value="this.ship != null"&gt;
                    &lt;do_if value="(this.ship.exists) and (this.ship.isplayerowned)"&gt;
                        &lt;set_value name="$distanceToPlayerShip" exact="player.primaryship.distanceto.{this.ship}"/&gt;
                        &lt;set_value name="$withinDecentRange" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 60000m)" /&gt; &lt;!-- beyond 60km... we can slowdown our iteration rate a bit and it wouldnt really matter, average repair will be the same just not as smooth --&gt;
                        &lt;set_value name="$withinCommRange" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 1500m)" /&gt;
                        &lt;set_value name="$extremelyClose" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 150m)" /&gt;

if this->ship != null # valid ship?
if (this.ship.exists != 0) and (this.ship.isplayerowned != 0)">

<set_value name="$withinDecentRange" exact="($distanceToPlayerShip != null) and ($distanceToPlayerShip le 60000m)" />
Both values true.

I have no idea what you want to tell us, but as long as you do not post computer code parts between CODE tags, I am not even trying to read this.

Offering the link wasn’t really magic. Using Google to search for XML of course showed the Wikipedia one and the top one said “XML tutorial”. Something that everyone knowing many programming languages and having many years of experience in linux and mswin could easily have done.

Based on your experience with XML, am I interpreting the XML correctly? XML is more a general database storage system. It can be used as programming system by the program that uses reads. That’s correct?

Does it appear that i’m reading the code snips correctly? Based on your programming experience.

The XML you posted appears to be an example of what I described in my prior post, it’s possible to create a web page using xml in place of the more common html (or even sgml).

The first line declares the xml schema, but a declaration of the script engine to use is missing. It’s likely assumed that javascript will be used as default or is defined elsewhere, possibly globally.

The various elements in the xml include markup tags, many of which are common to most major markup languages.


As I said, i will not try to unravel your post without it being posted with proper usage of CODE tags.

Also, I have no experience with XML (I have btw with HTML), but I have (end-user) experience in using Google, thus I was able to find within seconds an article about what XML is (in Wikipedia) and a tutorial (as you asked for). One does not need any experience with cooking to be able to find cooking recipes on the internet.

In an object-oriented environment such as Cocoa, a common strategy for handling elements is to map them—at the higher nesting levels, at least—to objects. Root elements and other top-level elements are frequently equivalent to collections represented in Cocoa by NSDictionary and NSArray objects. Other elements might readily map to one or more of an application’s custom model objects. XML is extensible. It lets you define your own tags, the order in which they occur, and how they should be processed or displayed. Another way to think about extensibility is to consider that XML allows all of us to extend our notion of what a document is.

No, XML is nothing more or less than a (powerful) markup language – the ‘X’ means “Extended” – with everything that means in a markup sense . . .
Yes, W3C have defined the means to import things such as “schema” which then influence the behaviour of the markup at execution time; the details are in the W3C Recommendations. Things such as SOAP use XML for message formatting.

There’s an O’Reilly reference book for XML: “XML in a Nutshell”: ISBN: 978-0596007645.

An (Open Source) XML editor? Apart from ‘vim’ or ‘Emacs’, there’s “KXml Editor”, “Bluefish”, “Quanta”.A good XML editor however, costs money, real money: OxygenXML – (XMLSpy is “Redmond-only”).
“You pays your money and, you takes your choice!!!”

BTW, there’s a W3C News Feed for all the latest in that world: <https://www.w3.org/blog/news/feed>.