DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA : XML Stripper  (Read 9,924 times)

mino.ganzerli

  • Participant
  • Joined in 2010
  • *
  • Posts: 1
IDEA : XML Stripper
« on: October 18, 2011, 07:41 PM »
Hy all!
I've been using some of your utility (Shortcut Creator, OpeningHours, Screenshot Captor, to tell you some) and in the last months I'm searching for a way to manipulate, hem, strip, the XML tag from some XML files.
I'm a inSSIDer user ( http://www.metageek.net/products/inssider/ ) and I would like to save in XML bacause has a lot of info, more than saving in CSV, but to manage, organize and list wlan I'm using Libre Office.
The passage that I always do is :

open a text editor
search for ant XML marker and replace with "tab"
import the text in Libre Office Calc
start to organize the list
export the list to XML

If I have a tool that strip all the unwanted XML marker and give me the old plain text ready to import in Calc I will be really happy!
My final goal is to have a list of all the wlan in my city, divided per blocks, per streets, per channel and so on, but without the XML stripper it's a long and boring "search and replace hell"...
Maybe someone can help me?

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: IDEA : XML Stripper
« Reply #1 on: October 18, 2011, 07:59 PM »
Usually, anyone requiring special XML formatting I direct to the Apache FOP project, but you'll find FOP is quite a tank to swat a fly with :D
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,217
Re: IDEA : XML Stripper
« Reply #2 on: October 18, 2011, 08:13 PM »
A quick Google search turns up a few SED and PERL scripts that might work, at least partially?

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: IDEA : XML Stripper
« Reply #3 on: October 18, 2011, 08:28 PM »
SED or PERL are good choices for this case, I guess, the file-layout is rather static.
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA : XML Stripper
« Reply #4 on: October 18, 2011, 08:36 PM »
Why not use one of the dedicated XML editors out there instead of all this converting from XML and then converting back to XML?

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,217
Re: IDEA : XML Stripper
« Reply #5 on: October 18, 2011, 08:36 PM »
There's even:

Quote
XMLgawk

http://home.vrweb.de/~juergen.kahrs/gawk/XML/

XMLgawk is an experimental extension of the GNU Awk interpreter. It includes a small XML parsing library which is built upon the Expat XML parser. The parsing library is a very thin layer on top of Expat (implementing a pull-interface) and can also be used without GNU Awk to read XML data files. Both, XMLgawk and its XML puller library only require an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a 'make' program.

XMLgawk provides the following functionality:

   * AWK's way of reading data line by line is supplemented by reading XML files node by node.
[...]
Someone has compiled binaries for Windows, though it looks like you might need Cygwin or something else as well.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: IDEA : XML Stripper
« Reply #6 on: October 18, 2011, 08:39 PM »
If you have to knock something together yourself you might try AutoIt3 using _StringBetween() function. This line I used with an xml subtitle file to get the start time:

Code
$lines = _StringBetween($chapterTimes[$x], "<ChapterTimeStart>", "</ChapterTimeStart>")

You could have a 2 dimensional array with start and end tags you are looking for if you only need to find a few tags. If it's wide-reaching then you may need to use RegEx patterns.  But to catch simple start and end tags _StringBetween should be good enough. It's easy to use.

If it finds the delimiters it returns an array of the strings between them.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: IDEA : XML Stripper
« Reply #7 on: October 18, 2011, 08:44 PM »
Looks like this XmlGawk mod was compiled with MinGW as stand-alone Windows binary:

http://www.wim-blit.nl/xmlgawk/XMLgawk%20for%20Windows.html

Original address: https://www.donationcoder.com/forum/index.php?topic=28401.0