RE: [xml] python xmlReader remains in previous attribute

Stéphane Bidoul said:
Hmm... now I'm a bit confused.  I was just in the midst of
the problem (which is within the library itself, and not just a
python interface problem) when Stéphane's post arrived.  I have
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));
              if (reader.HasAttributes)
                              Console.WriteLine(" {0}={1}", reader.Name, reader.Value);

So yes, after moving to the last attribute,
the next Read should move to the next node.
Sorry for the confusion.


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]