As you may have noticed, Erik has recently overhauled (or rather
rewritten) xmlgrep. That's a fast utility for finding properties
in an XML file. It works with any XML file, not just our internal
<PropertyList> flavor.

In many cases a simple recursive grep isn't good enough. If you
do a simple search for "<name", because you want "view" names
listed, then you get this:

  $ grep '<name' $FG_ROOT/preferences.xml
      <name type="string">Helvetica.txf</name>
      <name>Cockpit View</name>
      [...]

The first one doesn't look like a "view" name at all. More like
a font name? You could let grep display a few lines before and
after the match so that you get some context. But that's a bit
messy and painful to use as input for further commands. xmlgrep
allows to adddress XML elements with their full path, e.g.

  /PropertyList/sim/view/name



So far the altruistic part. Actually, I just wanted to introduce
another, similar tool. ;-)  It doesn't want to compete with xmlgrep
and was never meant to. It's really a byproduct of something else
for which I needed it. It works only for <PropertyList>s and is
slower than xmlgrep. It doesn't search for any particular pattern,
but just lists them, so you will need to pipe the output into
e.g. grep:   http://members.aon.at/mfranz/lsprop  [4.8 kB]

lsprop lists all properties in the files given on the command line,
or, if none were specified, then of $FG_ROOT/preferences.xml and
$FG_ROOT/Aircraft/*/*-set.xml. It follows all "include"s and treats
the "omit-node" flag correctly (I hope :-).

Example:

  $ lsprop|grep --color "/systems/refuel/type"
  $FG_ROOT/Aircraft/ufo/ufo-set.xml:522: /systems/refuel/type = "boom"
  $FG_ROOT/Aircraft/ufo/ufo-set.xml:523: /systems/refuel/type[1] = "probe"
  $FG_ROOT/Aircraft/f16/f16-set.xml:158: /systems/refuel/type = "boom"
  $FG_ROOT/Aircraft/KC135/KC135-set.xml:169: /systems/refuel/type = "boom"
  $FG_ROOT/Aircraft/a4/a4f-set.xml:183: /systems/refuel/type = "probe"
  $FG_ROOT/Aircraft/A-10/A-10-set.xml:1034: /systems/refuel/type = "boom"
  $FG_ROOT/Aircraft/f-14b/f-14b-set.xml:549: /systems/refuel/type = "probe"
  $FG_ROOT/Aircraft/Lightning/lightning-set.xml:276: /systems/refuel/type = 
"probe"
  $FG_ROOT/Aircraft/A-6E/A-6E-set.xml:151: /sim/systems/refuel/type = "probe"

Use --help/-h for a few options. More options to come ...

m.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to