RE: [xml] python xmlReader remains in previous attribute
- From: "William M. Brack" <wbrack mmm com hk>
- To: xml gnome org, veillard redhat com
- Cc: Stéphane Bidoul <stephane bidoul softwareag com>
- Subject: RE: [xml] python xmlReader remains in previous attribute
- Date: Fri, 23 Jul 2004 01:21:47 +0800 (HKT)
Stéphane Bidoul said:
Hmm... now I'm a bit confused. I was just in the midst of
debugging
the problem (which is within the library itself, and not just a
python interface problem) when Stéphane's post arrived. I have
read
the data from the posted link (which describes how to use the
MoveToElement method), but I can't see from there why the Read
method should *not* return the proper node name. Could someone
elaborate whether Read should return the proper name, or not?
I did the test... and my memory proved wrong.
The following C# code does work with or without MoveToElement:
string s = "<test><e1 a1='a1' a2='a2'/><e2/></test>";
XmlTextReader reader = new XmlTextReader(new StringReader(s));
while(reader.Read())
{
Console.WriteLine(reader.Name);
if (reader.HasAttributes)
{
while(reader.MoveToNextAttribute())
{
Console.WriteLine(" {0}={1}", reader.Name, reader.Value);
}
//reader.MoveToElement();
}
}
So yes, after moving to the last attribute,
the next Read should move to the next node.
Sorry for the confusion.
-sbi
OK, thanks for the information and the additional test. I made a
small change to the code, and believe it should now be behaving
properly. The change is in CVS (xmlreader.c).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]