Re: [xml] libxml2 performance



On Mon, 2004-12-06 at 19:00, Nix N. Nix wrote:

I know that. Unfortunately, I don't have any data in XML format.

Here's a carreer hint: learn a scripting language or three.

The smallest useful example:

That example is fairly easy to convert into XML. In almost no time
I hacked together the following Perl script (and I normally don't
program in Perl). You can use this to create your test data.

#!/usr/bin/perl
print "<root>\n";
while (<>) {
    if (s!^\s*\[\#(\S*)\]\n!\1!) {
        # Matches [#label]
        s!:!_!;
        print "</$_>\n";
    } elsif (s!^\s*\[(\S*)\]\n!\1!) {
        # Matches [label]
        s!:!_!;
        print "<$_>\n";
    } elsif (s!^\s*(\S*)\s*=\s*(\S*)\n!<\1>\2</\1>!) {
        # Matches key=value
        print "<$1>$2</$1>\n";
    }
}
print "</root>\n";





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]