Re: [xml] C API question: reading attribute name?



Daniel Veillard wrote:
On Wed, May 11, 2005 at 12:50:57PM -0500, Jeremy Enos wrote:
  
Daniel Veillard wrote:
    
I think the solution is explained at
http://xmlsoft.planetmirror.com/xmlreader.html#Extracting1
You can either:
- loop with for all values of 0 .. AttributeCount() - 1
  and use MoveToAttributeNo(no) then use Name()/Prefix()/NamespaceUri()...
- or use MoveToNextAttribute()
  and similary use Name()/Prefix()/NamespaceUri()

the small Python example in that doc shows the second one.

I did not design this API, this is directly copied from C# xmlReader API.
      
[...]
  
However, I don't know a way to acquire a pointer to the first attribute 
property.
    

  You don't need to.
  Read my answer you have the solution you asked, just in front of you.

Daniel

  
Finally figured out what I was doing wrong...

I was trying to use:
name = xmlTextReaderName(reader);
value = xmlTextReaderGetAttribute(reader, name);

Apparently, those can't be used together?  If I got one to work, the other never did... as if I was in the wrong place on the stream or something.  I think I got off track with the xmlTextReaderGetAttribute function from the page:
http://xmlsoft.planetmirror.com/xmlreader.html#Extracting1

I eventually tried xmlTextReaderValue(reader) and all was well.
thx for the help-

    Jeremy




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