[linux] perl vraag: tree lezen.

Hugo van der Kooij hvdkooij op vanderkooij.org
Di Mrt 17 18:25:58 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Beetje OT. Maar zo storm loopt het nu ook weer niet.

Ik heb weer eens een perl uitdaging en het kwartje wil niet vallen.
Een beetje het probleem als programmeren geen dagelijkse bezigheid is.

De uitvoer van de volgende 2 regels:

my $tree = $parser->parsefile( $xmlfile );
print Dumper( $tree );

Geeft:

$VAR1 = [
          'xml',
          [
            {},
            0,
            '
            ',
            'island',
            [
              {},
              0,
              '
                ',
              'id',
              [
                {},
                0,
                '2922'
              ],
              0,
              '
                ',
              'name',
              [
                {},
                0,
                'Saryios'
              ],
              0,
              '
                ',
              'resource',
              [
                {},
                0,
                '2'
              ],
              0,
              '
                ',
              'wonder',
              [
                {},
                0,
                '2'
              ],
              0,
              '
                ',
              'coordinates',
              [
                {},
                0,
                '
                    ',
                'x',
                [
                  {},
                  0,
                  '18'
                ],
                0,
                '
                    ',
                'y',
                [
                  {},
                  0,
                  '67'
                ],
                0,
                '
                '
              ],
              0,
              '
            '
            ],
            0,
            '
            ',
            'source',
            [
              {},
              0,
              'IkaWorld at IkariamLibrary.com'
            ],
            0,
            '
        '
          ]
        ];

Maar nu wil ik dus gewoon eenvoudig wat variabelen vullen zoals:
id
name
X
Y
....

Kan iemand me weer op het goede pad zetten?

Hugo.

- --
hvdkooij op vanderkooij.org               http://hugo.vanderkooij.org/
PGP/GPG? Use: http://hugo.vanderkooij.org/0x58F19981.asc

	A: Yes.
	>Q: Are you sure?
	>>A: Because it reverses the logical flow of conversation.
	>>>Q: Why is top posting frowned upon?

Bored? Click on http://spamornot.org/ and rate those images.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkm/3SQACgkQBvzDRVjxmYFEtACdH4Aw4WWGBBFHxgrGLgKlstV9
dbQAn19twUlcDIdg0rf/MrN7wpgEcipb
=xqJ0
-----END PGP SIGNATURE-----



More information about the Linux mailing list