RE: [xml] Need a API that iterates through Attributes on a givne node
- From: "Jones, Mark A (Mark)" <jones lucent com>
- To: "'Mickautsch, Alfred'" <alfred mickautsch schuler-ag com>, "'xml gnome org'" <xml gnome org>
- Cc: "Jones, Mark A \(Mark\)" <jones lucent com>
- Subject: RE: [xml] Need a API that iterates through Attributes on a givne node
- Date: Thu, 28 Oct 2004 14:45:45 -0400
Alfred,
Below is an exerpt from my code that does exactly what I was expect.
Thanx for your help.
if ( xmlTextReaderMoveToFirstAttribute(reader) == 1 )
{
do {
tmpAttrib.name = (char *) xmlTextReaderName(reader);
tmpAttrib.value = (char *) xmlTextReaderValue(reader);
attribute.push_back(tmpAttrib);
tmpAttrib.name.erase();
tmpAttrib.value.erase();
} while ( xmlTextReaderMoveToNextAttribute(reader) == 1 );
}
M. Jones
-----Original Message-----
From: Mickautsch, Alfred [mailto:alfred mickautsch schuler-ag com]
Sent: Wednesday, October 27, 2004 9:57 AM
To: xml gnome org
Subject: AW: [xml] Need a API that iterates through Attributes on a
givne node
I think it is better to use
for(int rc = xmlTextReaderMoveToFirstAttribute(reader); rc !=
0;xmlTextReaderMoveToNextAttribute(reader))
in place of
xmlTextReaderMoveToFirstAttribute(reader);
while(xmlTextReaderRead(reader))
Servus -- Alfred
--
Alfred Mickautsch
schuler business solutions AG
Karl-Berner-Str. 4
D-72285 Pfalzgrafenweiler
tel: +49 (0)74 45 830-184
fax: +49 (0)74 45 830-349
e-mail: alfred mickautsch schuler-ag com
-----UrsprÃngliche Nachricht-----
Von: xml-bounces gnome org [mailto:xml-bounces gnome org]Im
Auftrag von
Mickautsch, Alfred
Gesendet: Mittwoch, 27. Oktober 2004 15:42
An: xml gnome org
Betreff: AW: [xml] Need a API that iterates through Attributes on a
givne node
you could try something like
xmlTextReaderMoveToFirstAttribute(reader);
while(xmlTextReaderRead(reader))
{
name = xmlTextReaderName(reader);
value = xmlTextReaderValue(reader);
}
xmlTextReaderMoveToElement(reader);
Servus -- Alfred
-----UrsprÃngliche Nachricht-----
Von: xml-bounces gnome org [mailto:xml-bounces gnome org]Im
Auftrag von
Jones, Mark A (Mark)
Gesendet: Mittwoch, 27. Oktober 2004 14:33
An: 'Danilo Segan'; Jones, Mark A (Mark)
Cc: 'xml gnome org'
Betreff: RE: [xml] Need a API that iterates through Attributes on a
givne node
All,
Thanx for your helpful suggestions. I will experiment later.
I still remain hopeful that a higher level API would emerge
such that one would not have to be concerned with the tree
implementation. Just like an API exists to provide the value
of an attribute for a given attribute number, I think one
should exist that gives the name and value for a given
attribute number. This makes for a cleaner interface between
the library and the application.
Why don't I write it? Firstly, it pays to make sure that it
does not already exists. Secondly, as with most of, time is
too precious and costly.
Again, thanx,
M. Jones
-----Original Message-----
From: Danilo Segan [mailto:dsegan gmx net]
Sent: Tuesday, October 26, 2004 2:38 PM
To: Jones, Mark A (Mark)
Cc: xml gnome org
Subject: Re: [xml] Need a API that iterates through Attributes on a
givne node
Today at 19:58, Danilo Åegan wrote:
At least that's how Python bindings and xmlNode.properties (or
.get_properties()) seem to work. So, I may be wrong, but even C
implementation of properties seems to indicate this is the case.
Actually, this implementation does the following:
if (cur->type == XML_ELEMENT_NODE)
res = cur->properties;
else
res = NULL;
So, this is probably what you're after.
Cheers,
Danilo
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]