Re: [xml] Get the atribute name



Jonas schrieb:

How to get the value of *type*?   <foo type="aa">bar</foo>

Using .tag is got 'foo', and with .text is got 'bar'. But I don't know
how to get the name of atributes.

Python? Are you using LibXML2 at all? Here's a self-contained example of
how it works in Perl:

use strict;
use warnings;
use XML::LibXML;
my $parser = XML::LibXML->new;
my $doc = $parser->parse_string( '<Urmel bla="3"/>');
print $doc->documentElement->getAttribute('bla'), "\n";

If that doesn't help, I suggest you post an equally self-contained
example of your code and a statement as to what you want to achieve.

Michael Ludwig



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